/* ==========================================================================
   FINI — Warm charcoal editorial, amber accent
   Dark default (:root), light override ([data-theme="light"])
   Base: 1rem = 16px. Body 1rem, interactive 0.875rem min, labels 0.75rem.
   ========================================================================== */

/* ---------- CSS Variables: Dark (default) ---------- */

:root {
  color-scheme: dark;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --bg: #1a1917;
  --surface: #242320;
  --surface-raised: #2c2b27;
  --surface-inset: #1e1d1a;
  --border: #3a3832;
  --border-light: #2e2d29;
  --border-focus: #4a4840;
  --text: #e8e4da;
  --text-secondary: #b5b0a3;
  --text-muted: #8a8577;
  --text-dim: #5c584f;
  --amber: #d4a44a;
  --amber-dim: rgba(212, 164, 74, 0.12);
  --amber-border: rgba(212, 164, 74, 0.25);
  --amber-glow: rgba(212, 164, 74, 0.06);
  --green: #6b9e6b;
  --green-dim: rgba(107, 158, 107, 0.12);
  --green-border: rgba(107, 158, 107, 0.18);
  --red: #c45c4a;
  --red-dim: rgba(196, 92, 74, 0.12);
  --radius: 0.375rem;
  --radius-lg: 0.625rem;
  --wknd-overlay: rgba(0, 0, 0, 0.15);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%235c584f'/%3E%3C/svg%3E");
  --transition-ui: color 0.12s, background-color 0.12s, border-color 0.12s, opacity 0.12s, transform 0.12s, box-shadow 0.12s;

  /* Invoice sheet tokens — cream paper, warm ink, holds its identity in both themes */
  --paper: #f6efdf;
  --paper-edge: #ebe2cc;
  --paper-ink: #2a2620;
  --paper-ink-secondary: #6b6453;
  --paper-ink-muted: #928a78;
  --paper-ink-dim: #b4ac98;
  --paper-rule: #d9d0b8;
  --paper-rule-soft: #e4dcc6;
  --paper-amber: #a57c2e;
  --paper-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ---------- CSS Variables: Light override ---------- */

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-raised: #faf9f6;
  --surface-inset: #eeece7;
  --border: #d8d4ca;
  --border-light: #e5e2da;
  --border-focus: #c0bbb0;
  --text: #2c2a25;
  --text-secondary: #4a4740;
  --text-muted: #7a756a;
  --text-dim: #a09b8f;
  --amber: #ff9900;
  --amber-dim: rgba(255, 153, 0, 0.1);
  --amber-border: rgba(255, 153, 0, 0.3);
  --amber-glow: rgba(255, 153, 0, 0.05);
  --green: #1e7e3a;
  --green-dim: rgba(30, 126, 58, 0.08);
  --green-border: rgba(30, 126, 58, 0.15);
  --red: #b82e2e;
  --red-dim: rgba(184, 46, 46, 0.08);
  --wknd-overlay: rgba(0, 0, 0, 0.03);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23a09b8f'/%3E%3C/svg%3E");

  /* Invoice sheet tokens — same paper, softer shadow against the pale app background */
  --paper: #fbf6ea;
  --paper-edge: #ede3c9;
  --paper-ink: #2a2620;
  --paper-ink-secondary: #5a5243;
  --paper-ink-muted: #8a8170;
  --paper-ink-dim: #b0a790;
  --paper-rule: #d4c9ad;
  --paper-rule-soft: #e4dcc4;
  --paper-amber: #a57c2e;
  --paper-shadow: 0 12px 32px rgba(42, 38, 32, 0.1), 0 2px 4px rgba(42, 38, 32, 0.06);
}

/* ---------- Reset & Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

main {
  max-width: 1400px;
  margin: 0 auto;
}

a {
  color: var(--amber);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a, button, [role="button"], [tabindex]:not([tabindex="-1"]) {
  border-radius: var(--radius);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Card base ---------- */

.summary-row,
.grid-wrap,
.auth-card,
.landing-grid-preview,
.panel,
.form-card,
.day-add-form,
.cal-wrap,
.invite-section,
.members-list,
.form-fieldset,
.approval-card,
.uninvoiced-preview,
.stat-summary,
.chart-wrap,
.chart-bars,
.util-card,
.db-week,
.db-today,
.db-card,
.entity-stats {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ---------- APP NAV ---------- */

.app-nav {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 1.5rem;
}

.app-nav-left {
  flex-shrink: 0;
}

.app-logo {
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.app-logo:hover { text-decoration: none; }

.app-logo:focus-visible {
  outline-offset: 0.25rem;
}

.app-logo span {
  color: var(--amber);
}

.app-nav-links {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  position: relative;
  transition: color 0.12s;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  color: var(--amber);
  font-weight: 600;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -0.875rem;
  left: 0.75rem;
  right: 0.75rem;
  height: 2px;
  background: var(--amber);
  border-radius: 1px;
}

.nav-link-accent {
  color: var(--amber);
  font-weight: 600;
}

/* Mobile hamburger */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-muted);
  line-height: 0;
}

.nav-toggle:hover { color: var(--text); }

.nav-toggle svg { display: block; }

@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .app-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .app-nav-links.open { display: flex; }

  .nav-link {
    padding: 0.625rem 1.75rem;
    font-size: 0.875rem;
  }

  .nav-link.active::after {
    display: none;
  }

  /* Mobile active-nav uses the same text color + underline-equivalent state
     signal as desktop — bg amber was redundant with the text highlight. */

  .app-nav { position: relative; }
}

.app-nav-right {
  margin-left: auto;
  flex-shrink: 0;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--amber);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-size: 0.5625rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.app-avatar:hover { text-decoration: none; opacity: 0.85; }

/* Avatar dropdown menu */

.avatar-menu {
  position: relative;
}

.avatar-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 13rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 200;
  overflow: hidden;
}

.avatar-menu.open .avatar-dropdown {
  display: block;
}

.avatar-dropdown-header {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.avatar-dropdown-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* A display name with its email available on hover (title). The dotted
   underline signals there's more to reveal; the email is how a viewer
   confirms a spoofable, non-unique display name. */
.user-label {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  text-decoration-color: var(--border);
}

.avatar-dropdown-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* Current org name under the email in the avatar menu -- shown for everyone,
   so single-org users still get the context without any nav chrome. */
.avatar-dropdown-org {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.avatar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 0;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}

.avatar-dropdown-item:hover {
  background: var(--hover);
  text-decoration: none;
  color: var(--text);
}

.avatar-dropdown-item:focus-visible {
  outline-offset: -0.125rem;
}

.avatar-dropdown-item svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.avatar-dropdown-logout {
  color: var(--danger, #e55);
}

.avatar-dropdown-logout svg {
  color: var(--danger, #e55);
}

.avatar-dropdown-divider {
  height: 1px;
  background: var(--border);
}

/* Theme toggle */

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  transition: var(--transition-ui);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.icon-moon { display: none; }

[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }



@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- TIMER STRIP (content-area, between toolbar and summary) ---------- */

.timer-strip {
  padding: 0.55rem 0.85rem;
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  animation: timerSlideIn 0.25s ease both;
}

@keyframes timerSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.timer-strip .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s ease infinite;
  flex-shrink: 0;
}

.timer-strip .t-project {
  font-weight: 600;
  color: var(--green);
}

.timer-strip .t-task {
  color: var(--text-muted);
}

.timer-strip .t-elapsed {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.timer-strip .t-stop {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--green);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

.timer-strip .t-stop:hover {
  filter: brightness(1.15);
}

.timer-strip .t-stop.t-go {
  background: var(--green);
}

.timer-strip .t-discard {
  font-family: var(--font);
  font-size: 1.125rem;
  font-weight: 600;
  background: none;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.timer-strip .t-discard:hover {
  color: var(--red);
}

/* Timer strip: start state (collapsed initially, expands on click) */

.timer-strip-start {
  background: var(--surface);
  border-color: var(--border);
  cursor: default;
}

.timer-strip-start .timer-start-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.timer-strip-start .timer-start-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1px solid var(--green-border);
  background: var(--green-dim);
  color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.timer-strip-start .timer-start-play:hover {
  background: var(--green);
  color: var(--bg);
  border-color: var(--green);
  transform: scale(1.08);
}

.timer-strip-start .timer-start-label {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.timer-strip-start .timer-start-fields {
  display: none;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.timer-strip-start.expanded .timer-start-fields {
  display: flex;
}

.timer-strip-start.expanded .timer-start-label {
  display: none;
}

/* Group B base defined in shared block; only timer-strip-specific layout here. */
.timer-strip-start .timer-start-fields select {
  flex: 1;
  min-width: 0;
}

/* Timer strip: locked state (current week submitted/approved) */

.timer-strip-locked {
  background: var(--surface);
  border-color: var(--border);
  cursor: default;
}

.timer-strip-locked .timer-locked-note {
  color: var(--text-muted);
}

/* ---------- TIMER ROW (live entry in grid/day) ---------- */

.timer-row {
  background: var(--green-dim);
  border-left: 3px solid var(--green);
}

.timer-row td {
  border-bottom: 1px solid var(--green-border);
}

.timer-row-project {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--green);
  font-size: 0.8125rem;
}

.timer-row-project .dot,
.day-entry-timer .dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s ease infinite;
  display: inline-block;
  flex-shrink: 0;
}

.timer-row-task {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.timer-row-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--green);
  font-size: 0.8125rem;
}

.time-input-placeholder {
  display: block;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

/* Hide the real input when timer overlay is active */
.time-input.timer-hidden {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.timer-cell-overlay {
  display: block;
  text-align: center;
}

/* Timer row: flex the project cell so dot sits beside the select */
.timer-row .c-proj {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.timer-row .c-proj .proj-select {
  flex: 1;
  min-width: 0;
}

.timer-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s ease infinite;
  flex-shrink: 0;
}

/* Make the c-day cell relative so overlay positions correctly */
.timer-row .c-day {
  position: relative;
}

/* Day view timer entry */

.day-entry-timer {
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
}

.day-entry-timer .day-entry-project {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--green);
}

.day-entry-timer .day-entry-time {
  color: var(--green);
  font-weight: 700;
}

/* ---------- Filter Links (lightweight inline filter) ---------- */

.filter-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: 0.75rem;
}

.filter-link {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.12s;
  position: relative;
}

.filter-link:hover {
  color: var(--text);
}

.filter-link.active {
  color: var(--amber);
  font-weight: 600;
}

.filter-link + .filter-link::before {
  content: "·";
  color: var(--text-muted);
  font-weight: 400;
  position: absolute;
  left: -0.5rem;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.filter-link:focus-visible {
  outline-offset: 0.25rem;
}

/* ---------- PAGE HEADER ---------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  padding: 0.6rem 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Bar dividers (page-level): inset to the 1.75rem content gutter so they
   align with in-content dividers (.audit-info border-top, panel borders).
   Bar element itself stays edge-to-edge; only the line is constrained.
   Responsive insets track the gutter at the same breakpoints. */
.page-header,
.week-toolbar,
.tt-toolbar,
.filter-bar { position: relative; }

.page-header::after,
.week-toolbar::after,
.tt-toolbar::after,
.filter-bar::after {
  content: "";
  position: absolute;
  left: 1.75rem;
  right: 1.75rem;
  bottom: 0;
  height: 1px;
  background: var(--border-light);
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.page-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ---------- WEEK TOOLBAR ---------- */

.week-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.view-tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-tab {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text-dim);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: var(--transition-ui);
  text-decoration: none;
}

.view-tab + .view-tab {
  border-left: 1px solid var(--border);
}

.view-tab:hover {
  color: var(--text-muted);
  text-decoration: none;
}

.view-tab:focus-visible {
  outline-offset: -0.125rem;
}

.view-tab.active {
  background: var(--surface-raised);
  color: var(--amber);
}

.week-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.week-nav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.875rem;
  transition: var(--transition-ui);
  text-decoration: none;
  text-align: center;
  line-height: 1.75rem;
}

.week-nav-btn:hover {
  color: var(--text);
  border-color: var(--amber-border);
  text-decoration: none;
}

.week-label {
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 10rem;
  text-align: center;
}

.today-btn {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius);
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: var(--transition-ui);
  white-space: nowrap;
  text-decoration: none;
}

.today-btn:hover {
  color: var(--text-muted);
  border-color: var(--text-dim);
  text-decoration: none;
}

/* ---------- SUMMARY ROW ---------- */

.summary-row {
  display: flex;
  overflow: hidden;
  animation: fadeIn 0.3s ease both;
  animation-delay: 0.05s;
}

.s-card {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.25rem;
  background: var(--surface);
  padding: 1rem 1.25rem;
  min-width: 0;
}

.s-card + .s-card {
  border-left: 1px solid var(--border);
}

.s-card .s-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
}

.s-card .s-value {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.s-card .s-value.amber { color: var(--amber); }
.s-card .s-value.green { color: var(--green); }
.s-card .s-value.red { color: var(--red); }

.s-card .bar {
  height: 0.125rem;
  background: var(--border-light);
  border-radius: 0.0625rem;
  margin-top: 0.35rem;
  overflow: hidden;
}

.s-card .bar .fill {
  height: 100%;
  background: var(--amber);
  border-radius: 0.0625rem;
  transition: width 0.4s ease;
}

.s-card .bar .fill.over {
  background: var(--red);
}

/* Timesheet/Team/Approvals compact stats — label on top, left-aligned */
.summary-row .s-card {
  flex-direction: column;
  align-items: flex-start;
  padding: 0.7rem 1rem;
  gap: 0.05rem;
}
.summary-row .s-value { font-size: 1.25rem; }

/* Reports/Index B large stats */
.stat-summary .s-value { font-size: 2rem; }
.stat-summary .s-card { gap: 0.3rem; }

.s-card-hero { flex: 1.5; background: var(--surface-raised); }
.s-card-hero .s-value { color: var(--text); }

.s-value-inline {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0;
}

/* Project detail stats */
.entity-stats .s-card.budget-ok .s-value { color: var(--green); }
.entity-stats .s-card.budget-warn .s-value { color: var(--amber); }
.entity-stats .s-card.budget-over .s-value { color: var(--red); }

/* ---------- TIMESHEET GRID ---------- */

.grid-wrap {
  overflow: hidden;
  animation: fadeIn 0.3s ease both;
  animation-delay: 0.1s;
}

.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 56.25rem;
  border-collapse: collapse;
}

thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0.6rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}

thead th.col-project {
  text-align: left;
  padding-left: 0.85rem;
  width: 28%;
  min-width: 13rem;
}

thead th.col-task {
  text-align: left;
  width: 16%;
  min-width: 8.125rem;
}

thead th.col-day { width: 5.5rem; }

thead th.col-day .d-name { display: block; }

thead th.col-day .d-date {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-top: 0.0625rem;
  letter-spacing: 0.03em;
}

thead th.col-day.today { color: var(--amber); }
thead th.col-day.today .d-date { color: var(--amber); opacity: 0.65; }
thead th.col-day.wknd { opacity: 0.5; }
thead th.col-total { width: 4.5rem; color: var(--text-muted); }
thead th.col-act { width: 2.5rem; }

tbody tr { transition: background 0.1s; animation: fadeIn 0.2s ease both; }
tbody tr:nth-child(1) { animation-delay: 0.12s; }
tbody tr:nth-child(2) { animation-delay: 0.15s; }
tbody tr:nth-child(3) { animation-delay: 0.18s; }
tbody tr:nth-child(4) { animation-delay: 0.21s; }
tbody tr:nth-child(5) { animation-delay: 0.24s; }
tbody tr:nth-child(6) { animation-delay: 0.27s; }

tbody tr:not(:last-child) { border-bottom: 1px solid var(--border-light); }
tbody tr:hover { background: var(--amber-glow); }
tbody td { padding: 0.45rem 0.5rem; font-size: 1rem; vertical-align: middle; }

td.c-proj { padding-left: 0.85rem; }

.proj-select {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0.3rem 1.4rem 0.3rem 0;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 0 center;
  width: 100%;
}

.proj-select:hover { border-bottom-color: var(--border-focus); }
.proj-select:focus { border-bottom-color: var(--amber); }
.proj-select option { background: var(--surface-raised); color: var(--text); }

.task-select {
  font-family: var(--font);
  font-size: 0.875rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0.25rem 1.4rem 0.25rem 0;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 0 center;
  width: 100%;
}

.task-select:hover { border-bottom-color: var(--border-focus); }
.task-select:focus { border-bottom-color: var(--amber); }
.task-select option { background: var(--surface-raised); color: var(--text); }

td.c-day { text-align: center; padding: 0.45rem 0.2rem; }
td.c-day.wknd { background: var(--wknd-overlay); }
td.c-day.today { position: relative; }

td.c-day.today::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0.125rem;
  background: var(--amber);
}

.time-input {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  width: 3.25rem;
  text-align: center;
  background: var(--surface-inset);
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 0.25rem;
  padding: 0.4rem 0.15rem;
  outline: none;
  transition: var(--transition-ui);
}

.time-input::placeholder { color: var(--text-dim); opacity: 0.4; }
.time-input:hover { border-color: var(--border-focus); }

.time-input:focus {
  border-color: var(--amber);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 0 0 0.125rem var(--amber-dim);
}

.time-input.filled { color: var(--text); font-weight: 600; }
.time-input.invalid { border-color: var(--red); box-shadow: 0 0 0 0.125rem var(--red-dim); }

td.c-total {
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  color: var(--amber);
}

td.c-total.zero { color: var(--text-dim); font-weight: 500; }
td.c-total.over { color: var(--red); }

td.c-act { text-align: center; }

.del-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 0.25rem;
  line-height: 1;
  opacity: 0;
  transition: var(--transition-ui);
}

tr:hover .del-btn { opacity: 1; }
.del-btn:hover { color: var(--red); background: var(--red-dim); }

tfoot td {
  padding: 0.55rem 0.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
  font-size: 1rem;
}

tfoot td.f-label {
  padding-left: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

tfoot td.f-day {
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

tfoot td.f-day.over { color: var(--red); }
tfoot td.f-day.wknd { background: var(--wknd-overlay); }
tfoot td.f-day.today { color: var(--amber); }

tfoot td.f-grand {
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 1.0625rem;
  color: var(--amber);
}

.add-area {
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--border-light);
}

.add-btn {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  padding: 0.45rem;
  cursor: pointer;
  transition: var(--transition-ui);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  justify-content: center;
}

.add-btn:hover {
  border-color: var(--amber-border);
  color: var(--amber);
  background: var(--amber-dim);
}

.add-btn .plus { font-size: 1rem; line-height: 1; }

/* ---------- BUTTONS ---------- */

.btn {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: var(--transition-ui);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn:focus-visible {
  outline: 0.125rem solid var(--amber);
  outline-offset: 0.125rem;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--amber);
  color: var(--bg);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0.125rem 0.75rem var(--amber-dim);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-ghost-danger {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--red);
}

.btn-ghost-danger:hover {
  border-color: var(--red);
  background: var(--red-dim);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.btn-danger-subtle {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid transparent;
}

.btn-danger-subtle:hover {
  border-color: var(--red);
}

.btn-block { width: 100%; }

.btn-lg {
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
}

/* ---------- FORMS ---------- */

/* Inside .form-row (a flex row), form-groups grow equally by default.
   Mark narrow exceptions with .form-group-narrow (color picker, date input). */
.form-row > .form-group {
  flex: 1;
}

.form-row > .form-group-narrow {
  flex: 0 1 auto;
}

/* Form-rows that end in an inline .btn (add-rate, add-phase, add-task)
   pair the input against a button; shrink the inputs to .btn's height
   so the trio reads proportionally. Standalone form-rows (e.g. the
   main Edit page's two-column grid) are unaffected — they have no
   direct .btn child, so :has() doesn't match. */
.form-row:has(> .btn:not(.btn-sm)) > .form-group > .form-control {
  font-size: 0.875rem;
  padding: 0.4rem 0.7rem;
}

/* Same height-alignment for the -sm pairing used inside .panel-drawer:
   .form-control-sm is ~29.5px, .btn-sm is ~26px. Trim input padding so
   the input's top aligns with the button's top. */
.form-row:has(> .btn-sm) > .form-control-sm {
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}

.form-control {
  font-family: var(--font);
  font-size: 1rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--surface-inset);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: var(--transition-ui);
}

.form-control::placeholder {
  color: var(--text-dim);
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.form-control {
  appearance: none;
  cursor: pointer;
  padding-right: 1.8rem;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

select.form-control option {
  background: var(--surface-raised);
  color: var(--text);
}

select.form-control:hover {
  border-color: var(--border-focus);
}

.form-control-color {
  width: 3rem;
  height: 2.25rem;
  padding: 0.15rem;
  cursor: pointer;
}

.form-check-group {
  display: flex;
  align-items: center;
}

.form-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.form-check-input {
  accent-color: var(--amber);
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.form-check-input:disabled {
  cursor: not-allowed;
}

.form-check-input:focus-visible {
  outline: 0.125rem solid var(--amber);
  outline-offset: 0.125rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.form-actions-spacer {
  flex: 1;
}

.form-danger-zone {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

.form-hint {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.text-danger {
  color: var(--red);
  font-size: 0.8125rem;
}

.validation-summary {
  /* No vertical margin — .form-card flex gap handles spacing. */
}

.validation-summary-errors {
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.validation-summary-errors ul {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
}

.validation-summary-errors li {
  font-size: 0.8125rem;
  color: var(--red);
  line-height: 1.5;
}

.field-validation-error {
  display: block;
  font-size: 0.75rem;
  color: var(--red);
  margin-top: 0.25rem;
}

.field-validation-valid {
  display: none;
}

.input-validation-error {
  border-color: var(--red) !important;
}

/* ---------- AUTH PAGES ---------- */

.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 4rem);
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  padding: 2rem;
  animation: fadeIn 0.35s ease both;
}

.auth-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--amber);
  font-weight: 500;
}

.auth-divider {
  margin: 0 0.4rem;
  color: var(--text-dim);
}

/* ---------- MANAGE PAGES ---------- */

.manage-page {
  display: flex;
  max-width: 52rem;
  margin: 2rem auto;
  padding: 0 1.75rem;
  gap: 2rem;
}

.manage-sidebar {
  width: 12rem;
  flex-shrink: 0;
}

.manage-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.manage-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.manage-nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius);
  transition: var(--transition-ui);
}

.manage-nav-link:hover {
  color: var(--text);
  background: var(--surface-raised);
  text-decoration: none;
}

.manage-nav-link.active {
  color: var(--text);
  background: var(--surface-raised);
}

.manage-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* page-level rhythm, matches .entity-page */
}

.manage-form {
  max-width: 28rem;
}


.reminder-member-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 28rem;
}

.reminder-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: var(--surface);
}

.reminder-member-email {
  font-size: 0.875rem;
  color: var(--text);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.alert-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(196, 92, 74, 0.25);
}

/* ---------- LANDING PAGE ---------- */

.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 4rem);
  padding: 3rem 1.75rem;
  gap: 4rem;
  flex-wrap: wrap;
}

.landing-content {
  max-width: 28rem;
  animation: fadeIn 0.4s ease both;
}

.landing-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid var(--amber-border);
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  margin-bottom: 1.25rem;
}

.landing-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.landing-subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.landing-actions {
  display: flex;
  gap: 0.75rem;
}

.landing-visual {
  animation: fadeIn 0.5s ease both;
  animation-delay: 0.15s;
}

.landing-grid-preview {
  width: 28rem;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.preview-dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s ease infinite;
}

.preview-days,
.preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(7, minmax(0, 1.75rem)) auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
}

.preview-days {
  padding-top: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.preview-day-label {
  text-align: left;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-day {
  text-align: center;
}

.preview-day.today {
  color: var(--amber);
}

.preview-day.weekend {
  color: var(--text-dim);
  opacity: 0.55;
}

.preview-day-total {
  text-align: right;
  min-width: 2.5rem;
}

.preview-row {
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
}

.preview-row:last-child { border-bottom: none; }

.preview-project {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.preview-project-swatch {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--pc, var(--amber));
  flex-shrink: 0;
}

.preview-project-label {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.preview-hours {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-secondary);
}

.preview-hours.filled { color: var(--text); font-weight: 600; }
.preview-hours.dim { color: var(--text-dim); opacity: 0.3; }
.preview-hours.dim::after { content: "\2014"; }

.preview-total {
  text-align: right;
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
}

.preview-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
}

.preview-footer-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.preview-footer-value {
  font-weight: 800;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

/* ---------- PROJECTS ---------- */

.badge-archived {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--red-dim);
  color: var(--red);
  padding: 0.05rem 0.4rem;
  border-radius: 0.25rem;
  margin-left: 0.35rem;
}

/* Panel — canonical section container for tables/lists.
   No margin; positioning (horizontal + vertical) comes from parent .entity-page. */
.panel {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.4s ease;
}

/* Uniform vertical rhythm inside page content wrappers.
   The wrapper's padding-top provides the space above the first child;
   the owl selector provides the same gap between every pair of siblings.
   Content components inside (panel, stat-summary, etc.) MUST NOT set
   their own vertical margins — this rule owns all vertical spacing. */
.entity-page > * + * {
  margin-top: 1.5rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Panel-title that is itself a 2-view toggle. Reads as `Active / Inactive`
   with the active view styled as the regular title and the other dimmed.
   Inline buttons keep keyboard + a11y semantics without breaking the
   typographic look. */
.panel-title-toggle {
  display: inline-flex;
  align-items: baseline;
  margin: 0;
}

.panel-title-link {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s;
}

.panel-title-link:hover:not(.active) {
  color: var(--text-secondary);
}

.panel-title-link.active {
  color: var(--text);
}

.panel-title-link:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}

.panel-title-sep {
  color: var(--text-muted);
  font-weight: 400;
  margin: 0 0.5em;
}

/* panel-title used standalone (outside a .panel-head row): owns its own
   bottom spacing above the following content. */
.panel-title-standalone {
  margin-bottom: 0.75rem;
}

.panel-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Left-side cluster inside .panel-head — title + badges + count rendered as one unit. */
.panel-head-group {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  min-width: 0;
}

/* Right-side meta strip inside .panel-head. */
.panel-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.panel-meta-item { font-variant-numeric: tabular-nums; }
.panel-meta-sep { color: var(--text-dim); opacity: 0.6; }

/* Inline budget bar inside .panel-head (per-phase panels). */
.panel-budget {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 12rem;
  flex-shrink: 0;
}
.panel-budget .budget-bar-track {
  flex: 1;
  min-width: 6rem;
}

/* Padded content region inside a .panel for content that isn't a table
   (e.g. an add-item form below the table, an empty-state block).
   Border-top separates this from the preceding table/head. */
.panel-body {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-light);
}

/* First .panel-body after the head (no table between) doesn't need the divider. */
.panel-head + .panel-body {
  border-top: 0;
}

/* Collapsible meta region below .panel-head. Toggled via .panel--open on
   the enclosing .panel (applied by the shared.js data-toggle-class handler).
   Binary show/hide, matching the .view-pane[hidden] convention. */
.panel-drawer {
  display: none;
}
.panel--open .panel-drawer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

/* Compact inline forms inside the drawer: tight label/input/button gap and
   center alignment (label is shorter than input/button). Overrides the
   default .form-row (1rem gap, flex-end) in this context only. */
.panel-drawer .form-row {
  gap: 0.25rem;
  align-items: center;
}

/* Square icon button for the drawer toggle in .panel-head. Gets an amber
   active state when the drawer is open so the state is visible. */
.panel-drawer-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.panel-drawer-toggle:hover {
  background: var(--surface-inset);
  border-color: var(--border);
  color: var(--text);
}
.panel--open .panel-drawer-toggle {
  background: var(--amber-dim);
  border-color: var(--amber-border);
  color: var(--amber);
}

/* Tables inside panels and card-wrappers containing tables */
.panel table,
.inv-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.panel thead th,
.inv-card thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
  transition: color 0.15s;
}

.panel tbody tr,
.inv-card tbody tr {
  position: relative; /* bounds .row-link::after stretch */
  transition: background 0.15s, transform 0.1s;
}

.panel tbody tr:not(:last-child),
.inv-card tbody tr:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.panel tbody tr:nth-child(even) {
  background: var(--surface-inset);
}

.panel tbody tr:hover,
.inv-card tbody tr:hover {
  background: var(--amber-glow);
}

/* Row-link: real <a> in the primary cell whose ::after stretches across the
   whole row. Provides middle-click / cmd-click / right-click / screen-reader
   link affordance that JS-based navigation (the old tr[data-href] pattern)
   couldn't. */
.row-link { color: inherit; }
.row-link:hover { text-decoration: none; }
.row-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* Layering: interactive content in other cells (action buttons, inline
   forms, nested links) must sit above .row-link::after so clicks hit them
   instead of the row-wide stretch. */
.panel tbody tr form,
.panel tbody tr > td > a:not(.row-link),
.panel tbody tr > td > button {
  position: relative;
  z-index: 1;
}

.panel tbody tr.archived td {
  opacity: 0.5;
}

.panel tbody tr.archived:hover td {
  opacity: 0.7;
}

.panel td,
.inv-card td {
  padding: 0.6rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  vertical-align: middle;
  white-space: nowrap;
}

/* Sortable column headers */
.panel .sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.panel .sortable:hover,
.panel .sortable:focus-visible {
  color: var(--text-muted);
}

.panel .sortable:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}

.panel .sortable.active {
  color: var(--amber);
}

.panel .sort-arrow {
  font-size: 0.5625rem;
  opacity: 0.4;
  margin-left: 0.2rem;
  transition: opacity 0.15s;
}

.panel .sortable.active .sort-arrow {
  opacity: 1;
  color: var(--amber);
}

/* Role-based column classes */
.col-name {
  width: 100%;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

td.col-name .name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 100%;
}

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.col-name .name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-detail {
  white-space: nowrap;
  color: var(--text-secondary);
}

.col-num {
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.col-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

.col-date.overdue {
  color: var(--red);
  font-weight: 600;
}

.col-hours {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.col-notes {
  color: var(--text-dim);
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-icon {
  width: 2rem;
  text-align: center;
}

.col-action {
  width: 2.5rem;
  text-align: center;
}

.col-budget { width: 10rem; }

.cell-dim {
  color: var(--text-dim);
}

/* Archive button (used in .col-action cells) */
.archive-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  line-height: 1;
  opacity: 0.55;
  transition: var(--transition-ui);
  display: inline-flex;
  align-items: center;
}

tr:hover .archive-btn { opacity: 1; }
.archive-btn:hover { color: var(--amber); background: var(--amber-dim); }
tr.archived .archive-btn { opacity: 0.6; }
tr.archived:hover .archive-btn { opacity: 1; }
tr.archived .archive-btn:hover { color: var(--green); background: var(--green-dim); }

/* GAP-6: per-task phase select sits inline in .col-action with the
   archive/delete buttons. Sized small and dim by default to avoid
   pulling visual weight from the task name; row-hover lifts opacity
   like the archive button does. */
.task-move-select {
  width: auto;
  min-width: 0;
  max-width: 9rem;
  font-size: 0.75rem;
  padding: 0.15rem 0.35rem;
  height: auto;
  opacity: 0.65;
  vertical-align: middle;
  transition: var(--transition-ui);
}

tr:hover .task-move-select { opacity: 1; }

.entity-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.entity-badge-billable {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green-border);
}

.entity-search {
  font-family: var(--font);
  font-size: 0.8125rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.65rem;
  outline: none;
  transition: var(--transition-ui);
  width: 10rem;
}

.entity-search:hover {
  border-color: var(--border-focus);
}

.entity-search::placeholder {
  color: var(--text-dim);
}

.form-page {
  max-width: 32rem;
  margin: 1.5rem auto;
  padding: 0 1.75rem;
}

.form-card {
  padding: 1.5rem;
}

/* Stack containers — single-source vertical spacing via flex gap.
   Children carry no vertical margin; gap owns rhythm. Covers form-stack
   wrappers (form-card, manage-form, auth-card form, form-fieldset, form-col). */
.form-card,
.manage-form,
.auth-card form,
.form-fieldset,
.form-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---------- BUDGET ---------- */

/* .col-budget width defined in panel block. */

.budget-cell { display: flex; flex-direction: column; gap: 0.2rem; }

.budget-bar-track {
  height: 0.25rem;
  background: var(--surface-inset);
  border-radius: 0.125rem;
  overflow: hidden;
}

.budget-bar-lg { height: 0.375rem; }

.budget-bar-fill {
  height: 100%;
  border-radius: 0.125rem;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.budget-ok .budget-bar-fill { background: var(--green); }
.budget-warn .budget-bar-fill { background: var(--amber); }
.budget-over .budget-bar-fill { background: var(--red); }

.budget-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.budget-ok .budget-label { color: var(--text-muted); }
.budget-warn .budget-label { color: var(--amber); }
.budget-over .budget-label { color: var(--red); }

/* Right-side accent token in .panel-meta (e.g. "27:30 remaining"). */
.panel-meta-accent {
  color: var(--text-secondary);
  font-weight: 600;
}
.budget-warn .panel-meta-accent { color: var(--amber); }
.budget-over .panel-meta-accent { color: var(--red); }

/* Chart container — Chart.js canvas inside a .panel on Projects/Show.
   Shared by the Trajectory line chart, the Velocity bar chart, and the
   Tasks horizontal bar chart. Fixed height so the canvas has a stable
   render target; responsive breakpoint below shortens for mobile. */
.chart-body {
  position: relative;
  height: 240px;
  padding: 1rem 1.25rem 0.75rem;
}

/* Heatmap — GitHub-style contribution graph: 7 days × 52 weeks (Patterns
   panel toggle). Empty days render as faint baseline cells; activity scales
   1–4 in opacity. Left-aligned in the panel body; cells flex slightly so
   the grid widens to fit. */
.heatmap {
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 1.25rem repeat(52, minmax(0.75rem, 1fr));
  grid-auto-rows: minmax(0.75rem, 0.9375rem);
  gap: 0.1875rem;
  align-content: start;
  min-width: max-content;
}

.heatmap-day-label {
  font-size: 0.625rem;
  color: var(--text-dim);
  text-align: right;
  padding-right: 0.25rem;
  align-self: center;
  font-variant-numeric: tabular-nums;
}

.heatmap-cell {
  border-radius: 2px;
  background: var(--surface-inset);
  transition: var(--transition-ui);
}

.heatmap-cell:hover {
  transform: scale(1.18);
}

/* Intensity 0 inherits .heatmap-cell's default surface-inset — no override needed. */
.heatmap-intensity-1 { background: rgba(212, 164, 74, 0.22); }
.heatmap-intensity-2 { background: rgba(212, 164, 74, 0.45); }
.heatmap-intensity-3 { background: rgba(212, 164, 74, 0.72); }
.heatmap-intensity-4 { background: var(--amber); }

@media (max-width: 768px) {
  .chart-body {
    height: 200px;
    padding: 0.75rem 0.875rem;
  }
  .heatmap {
    padding: 1rem 0.75rem;
  }
  .heatmap-grid {
    grid-template-columns: 1rem repeat(52, 0.75rem);
    grid-auto-rows: 0.75rem;
  }
}

.trajectory-legend {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.5rem 1.25rem 0.875rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.trajectory-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
}

.trajectory-legend-swatch {
  width: 1.25rem;
  height: 0;
  border-top-style: solid;
  border-top-width: 2px;
  display: inline-block;
}

.trajectory-swatch-actual {
  border-top-color: var(--amber);
  border-top-style: solid;
}

.budget-over .trajectory-swatch-actual {
  border-top-color: var(--red);
}

.trajectory-swatch-projected {
  border-top-color: var(--amber);
  border-top-style: dashed;
  border-top-width: 1.5px;
}

.trajectory-swatch-budget {
  border-top-color: var(--text-dim);
  border-top-style: dashed;
}

/* Budgets report — portfolio view at /Reports/Budgets. Uses the shared Reports
   shell (page-header + stat-summary + .panel table). The page-specific bit is the
   inline Progress cell (pct / bar / hours on one row) and the column that holds it. */

.col-progress {
  width: 18rem;
  min-width: 14rem;
}

.bh-progress {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: center;
  gap: 0.625rem;
}

.bh-progress-pct {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: -0.01em;
}

.bh-progress.budget-ok .bh-progress-pct { color: var(--green); }
.bh-progress.budget-warn .bh-progress-pct { color: var(--amber); }
.bh-progress.budget-over .bh-progress-pct { color: var(--red); }

.bh-progress-bar { min-width: 0; }

.bh-progress-hours {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bh-of {
  color: var(--text-dim);
  margin: 0 0.1rem;
}

.bh-burn {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.bh-forecast {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.bh-forecast-over {
  color: var(--red);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- EXPENSES ---------- */

.form-hint-link {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--amber);
  text-decoration: none;
  margin-left: 0.5rem;
}

.form-hint-link:hover {
  text-decoration: underline;
}

/* Phase list — vertical stack of per-phase .panel sections on Projects/Edit.
   Gap matches the .entity-page owl-selector spacing (1.5rem) so phases on
   Edit read the same as phases on Show. */
#phase-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.member-inactive {
  opacity: 0.5;
}

/* ---------- DAY VIEW ---------- */

.day-entries {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: fadeIn 0.3s ease both;
  animation-delay: 0.1s;
}

.day-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition-ui);
}

.day-entry:hover {
  border-color: var(--amber-border);
  background: var(--amber-glow);
}

.day-entry-color {
  width: 0.25rem;
  height: 2.25rem;
  border-radius: 0.125rem;
  flex-shrink: 0;
}

.day-entry-info {
  flex: 1;
  min-width: 0;
}

.day-entry-project {
  font-weight: 600;
  font-size: 0.9375rem;
}

.day-entry-task {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.day-entry-notes {
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  font-style: italic;
}

/* Transparency cue: when a teammate (typically a Manager via the Approvals
   editor) was the last to update an entry, the Member sees a small badge in
   their own Day view. The UpdatedBy data is captured for free by IAuditable;
   this surface just renders it. */
.day-entry-edited {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.1rem 0.4rem;
  background: var(--amber-dim);
  color: var(--amber);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius);
  white-space: nowrap;
}

.day-entry-time {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--amber);
  flex-shrink: 0;
}

.day-entry-actions {
  flex-shrink: 0;
}

.day-entry .del-btn.visible {
  opacity: 0.4;
}

.day-entry:hover .del-btn.visible {
  opacity: 1;
}

/* Compact empty: centered icon + one hint line, no heading. For empties
   inside a populated region where a full empty-state would be too heavy. */
.empty-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
  font-size: 0.875rem;
  text-align: center;
}

.empty-hint svg {
  opacity: 0.4;
  stroke: var(--text-muted);
}

/* Dashed-box variant -- timesheet day uses it to signal "add an entry here". */
.empty-hint-boxed {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-hint-title {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.empty-hint-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.empty-hint-secondary {
  margin-top: 0.25rem;
  color: var(--text-muted);
}

.day-add-form {
  padding: 1rem;
}

.day-form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.day-form-row:last-child {
  margin-bottom: 0;
}

.day-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.day-form-project { flex: 2; min-width: 10rem; }
.day-form-task { flex: 2; min-width: 8rem; }

.day-form select.form-control {
  background-color: var(--surface);
}
.day-form-hours { flex: 0 0 5rem; }
.day-form-notes { flex: 1; min-width: 12rem; }

.day-form-submit {
  flex: 0 0 auto;
}

.day-form-submit .btn {
  padding: 0.55rem 0.9rem;
  font-size: 1rem;
}

.inline-form {
  display: inline;
}

/* ---------- RECEIPT ---------- */

.receipt-preview {
  margin-bottom: 0.5rem;
}

.receipt-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--amber);
  font-size: 0.875rem;
  text-decoration: none;
}

.receipt-link:hover {
  text-decoration: underline;
}

.receipt-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.receipt-actions .form-control {
  flex: 1;
}

.receipt-actions .form-hint {
  margin-top: 0;
  white-space: nowrap;
}

.receipt-indicator {
  display: inline-flex;
  color: var(--text-muted);
  vertical-align: middle;
}

.receipt-indicator svg {
  width: 14px;
  height: 14px;
}

/* ---------- CALENDAR VIEW ---------- */

.cal-wrap {
  overflow: hidden;
  animation: fadeIn 0.3s ease both;
  animation-delay: 0.1s;
}

.cal-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr) 3.5rem;
  border-bottom: 1px solid var(--border);
}

.cal-header-cell {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0.55rem 0.5rem;
  text-align: center;
}

.cal-header-wk {
  opacity: 0.5;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr) 3.5rem;
}

/* Day cells */
.cal-cell {
  aspect-ratio: 1.35;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.4rem 0.5rem;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s;
  cursor: pointer;
  position: relative;
}

.cal-cell:hover {
  background: var(--amber-glow);
  text-decoration: none;
}

.cal-cell.outside {
  color: var(--text-dim);
  opacity: 0.55;
}

.cal-cell.future {
  opacity: 0.5;
}

.cal-cell.wknd {
  background: var(--wknd-overlay);
}

.cal-cell.today {
  background: var(--amber-dim);
}

.cal-cell.today .cal-day {
  background: var(--amber);
  color: var(--bg);
  font-weight: 700;
}


/* Day number — top-left, compact badge */
.cal-day {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-muted);
  min-width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* Hours — prominent, glowing value, true-centered */
.cal-hours {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--amber);
  line-height: 1;
}

/* Week total column */
.cal-wk-total {
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  text-decoration: none;
  transition: background 0.12s;
  cursor: pointer;
}

.cal-wk-total:hover {
  background: var(--amber-glow);
  text-decoration: none;
}

.cal-wk-hrs {
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* ---------- TEAM TIMESHEET (ledger_v1 style) ---------- */

.tt-toolbar {
  padding: 0.6rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---------- TOOLBAR / FILTER CONTROLS (Group B) ----------
   Small variant used on Timesheet, Team, Reports, Timer Strip.
   Shared base defined once here; class-specific quirks (e.g. .filter-date
   padding, .timer-strip-start flex) are overridden in their feature
   sections. Focus indicator: universal outer outline only. */

.tt-toolbar select,
.tt-toolbar input,
.filter-select,
.filter-date,
.filter-input,
.timer-strip-start .timer-start-fields select {
  font-family: var(--font);
  font-size: 0.8125rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  outline: none;
  transition: var(--transition-ui);
  appearance: none;
}

.tt-toolbar select,
.filter-select,
.timer-strip-start .timer-start-fields select {
  padding-right: 1.8rem;
  cursor: pointer;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.tt-toolbar select option,
.filter-select option,
.timer-strip-start .timer-start-fields select option {
  background: var(--surface-raised);
  color: var(--text);
}

.tt-toolbar select:hover,
.tt-toolbar input:hover,
.filter-select:hover,
.filter-date:hover,
.filter-input:hover,
.timer-strip-start .timer-start-fields select:hover {
  border-color: var(--border-focus);
}

.filter-input:focus {
  border-color: var(--border-focus);
}

.tt-toolbar input::placeholder {
  color: var(--text-dim);
}

.tt-spacer {
  flex: 1;
}

.tt-sort-btn {
  font-family: var(--font);
  font-size: 0.8125rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  transition: var(--transition-ui);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.tt-sort-btn:hover {
  color: var(--text);
  border-color: var(--border-focus);
}

.tt-sort-btn.active {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-dim);
}

.tt-arrow {
  font-size: 0.625rem;
  opacity: 0.6;
}

.tt-table-wrap {
  animation-delay: 0.12s;
}

.tt-table {
  width: 100%;
  min-width: 53rem;
  border-collapse: collapse;
}

.tt-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}

.tt-col-employee {
  min-width: 12.5rem;
}

.tt-col-day {
  text-align: center !important;
  width: 4.5rem;
}

.tt-col-total {
  text-align: center !important;
  color: var(--amber) !important;
  width: 5rem;
}

.tt-sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.tt-sortable:hover {
  color: var(--text-muted);
}

.tt-sortable.active {
  color: var(--amber);
}

.tt-sortable.active .sort-arrow {
  opacity: 1;
  color: var(--amber);
}

.tt-sortable .sort-arrow {
  margin-left: 0.2rem;
}

.tt-table tbody tr {
  transition: background 0.1s;
}

.tt-table tbody tr:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.tt-table tbody tr:hover {
  background: var(--amber-glow);
}

.tt-table tbody td {
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  vertical-align: middle;
}

.tt-employee-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 12.5rem;
}

.tt-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--bg);
}

.tt-employee-name {
  font-weight: 600;
  white-space: nowrap;
}

.tt-employee-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.tt-project-cell {
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.tt-project-dot {
  display: inline-block;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.tt-time-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-dim);
  width: 4.5rem;
}

.tt-time-cell.has-time {
  color: var(--text);
  font-weight: 600;
}

.tt-time-cell.weekend {
  background: var(--wknd-overlay);
}

.tt-total-cell {
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--amber);
  width: 5rem;
}

.tt-total-cell.over {
  color: var(--red);
}

/* ---------- TEAM MEMBERS ---------- */

.invite-section {
  padding: 1.25rem;
  animation: fadeIn 0.3s ease both;
}

.invite-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.invite-form .form-control {
  flex: 1;
}

.invite-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.pending-invites-section {
  /* Vertical spacing owned by .manage-content flex gap. */
}

.pending-invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border-light);
}

.pending-invite-row:last-child {
  border-bottom: none;
}

.pending-invite-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.pending-invite-email {
  font-size: 0.875rem;
  color: var(--text);
}

.pending-invite-expires {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.invite-error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.invite-error-card {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.invite-error-icon {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.invite-error-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.invite-error-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.members-section {
  animation: fadeIn 0.3s ease both;
  animation-delay: 0.08s;
}

.members-list {
  overflow: hidden;
}

.member-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.member-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--amber-dim);
  border: 1px solid var(--amber-border);
  display: grid;
  place-items: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--amber);
  flex-shrink: 0;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  transition: background 0.1s;
}

.member-row:not(:last-child) {
  border-bottom: 1px solid var(--border-light);
}

.member-row:hover {
  background: var(--amber-glow);
}

.member-you {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.8125rem;
}

.member-joined {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.member-role-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.role-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
}

.role-owner {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.role-admin {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.role-member {
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.role-manager {
  background: rgba(110, 168, 217, 0.12);
  color: #6ea8d9;
  border: 1px solid rgba(110, 168, 217, 0.25);
}

/* Generic follow-on section divider for multi-section settings pages
   (Reminders, MemberDetail). Single source of rhythm for "another section
   begins here" within .manage-content. */
.manage-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ---------- PROJECT ASSIGNMENT LIST ---------- */

/* The one bespoke component on the MemberDetail page: a filterable checkbox
   list with a per-row "manages" sub-toggle. No existing equivalent in
   the codebase, so it gets its own block; constrained to manage-form's
   28rem so it lines up with the surrounding form rhythm. */
.project-assign-list {
  display: flex;
  flex-direction: column;
  max-width: 28rem;
  max-height: 22rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.project-assign-row {
  display: grid;
  grid-template-columns: 1.25rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.project-assign-row:last-child {
  border-bottom: none;
}

.project-assign-row.archived .project-assign-name {
  color: var(--text-muted);
  font-style: italic;
}

.project-assign-name {
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.project-assign-name .client {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.project-assign-manages {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  cursor: pointer;
}

.project-assign-row[data-assigned="false"] .project-assign-manages {
  opacity: 0.45;
}

.btn-text {
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius);
  transition: var(--transition-ui);
}

.btn-text:hover {
  color: var(--amber);
  background: var(--amber-dim);
}

.btn-text.danger:hover {
  color: var(--red);
  background: var(--red-dim);
}

/* ---------- RATE MANAGEMENT ---------- */

.form-fieldset {
  padding: 1rem 1.25rem;
}

.form-fieldset legend {
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0 0.25rem;
}

.member-card {
  border-bottom: 1px solid var(--border-light);
}

.member-card:last-child {
  border-bottom: none;
}

.member-card .member-row {
  border-bottom: none;
}

.member-rates-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0 1rem 0.75rem;
  padding-left: calc(1rem + 2rem + 0.75rem); /* match avatar offset */
}

.rate-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.rate-field .form-label {
  font-size: 0.75rem;
  margin-bottom: 0;
}

.form-control-sm {
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
  width: 7rem;
}

/* ---------- PROFITABILITY ---------- */

.profit-revenue { color: var(--amber); }
.profit-cost { color: var(--text-muted); }
.profit-positive { color: var(--green); }
.profit-negative { color: var(--red); }

.profit-bar-fill {
  background: var(--green);
}

.profit-bar-cost {
  background: var(--red);
  opacity: 0.5;
}

.profit-bar-value {
  min-width: 8rem;
}

/* ---------- EMPTY STATE ---------- */

.empty-state {
  text-align: center;
  padding: 5rem 1.5rem 4rem;
  color: var(--text-muted);
  animation: fadeIn 0.4s ease both;
}

.empty-icon {
  margin-bottom: 1.25rem;
  color: var(--text-dim);
  opacity: 0.7;
}

.empty-icon svg {
  stroke: var(--amber);
  opacity: 0.7;
}

.empty-state h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
  max-width: 24rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.empty-state-compact {
  padding: 3.5rem 1rem;
}

.empty-state-compact .empty-icon svg {
  opacity: 0.5;
}

/* ---------- CONTENT PAGE ---------- */

.content-page {
  max-width: 40rem;
  margin: 2rem auto;
  padding: 0 1.75rem;
}

.mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace; }

/* ---------- SCROLLBAR ---------- */

.grid-scroll::-webkit-scrollbar { height: 0.25rem; }
.grid-scroll::-webkit-scrollbar-track { background: var(--surface); }
.grid-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0.125rem; }

/* ---------- ANIMATIONS ---------- */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(0.25rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- HTMX SWAP TRANSITIONS ---------- */

.htmx-swapping {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.htmx-settling {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.htmx-added {
  animation: fadeIn 0.25s ease both;
}

*:focus-visible {
  outline: 0.125rem solid var(--amber);
  outline-offset: 0.125rem;
}

.time-input:focus-visible {
  outline: none;
}

/* ---------- TOAST ---------- */

.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amber);
  color: #1a1917;
  border-radius: var(--radius);
  padding: 0.5rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: toastIn 0.25s ease, toastOut 0.4s ease 2.5s forwards;
  pointer-events: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-0.5rem); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.toast-error {
  background: var(--red);
  color: #fff;
}

/* ---------- HTMX LOADING ---------- */

.htmx-request .week-nav-btn,
.htmx-request .today-btn,
.htmx-request .filter-select {
  opacity: 0.5;
  pointer-events: none;
}

.htmx-request.week-nav-btn,
.htmx-request.today-btn {
  opacity: 0.5;
  pointer-events: none;
}

[hx-get].htmx-request,
[hx-post].htmx-request {
  position: relative;
  opacity: 0.6;
  pointer-events: none;
}

#timesheet-content.htmx-request,
#team-content.htmx-request,
#approval-content.htmx-request {
  opacity: 0.4;
  transition: opacity 0.15s;
  pointer-events: none;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 768px) {
  .app-nav { padding-left: 1.25rem; padding-right: 1.25rem; }
  .page-header, .week-toolbar, .tt-toolbar, .filter-bar { padding-left: 1.25rem; padding-right: 1.25rem; }
  .page-header::after,
  .week-toolbar::after,
  .tt-toolbar::after,
  .filter-bar::after { left: 1.25rem; right: 1.25rem; }
  .entity-page { padding-left: 1.25rem; padding-right: 1.25rem; }
  .summary-row { flex-wrap: wrap; }
  .summary-row .s-card { min-width: calc(50% - 1px); }
  .manage-page { flex-direction: column; }
  .manage-sidebar { width: 100%; }
  .manage-nav { flex-direction: row; flex-wrap: wrap; gap: 0.25rem; }
  .landing { flex-direction: column; text-align: center; gap: 2rem; }
  .landing-actions { justify-content: center; }
  .landing-grid-preview { width: 100%; max-width: 22rem; }
  .landing-grid-preview .preview-days,
  .landing-grid-preview .preview-row {
    grid-template-columns: minmax(0, 1fr) repeat(7, minmax(0, 1.45rem)) auto;
    gap: 0.25rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .landing-grid-preview .preview-header,
  .landing-grid-preview .preview-footer {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .landing-grid-preview .preview-total,
  .landing-grid-preview .preview-day-total { min-width: 2.25rem; }
  .day-form-row { flex-direction: column; }
  .day-form-hours { flex: 1; }
  .cal-cell { aspect-ratio: 1; }
  .cal-grid { grid-template-columns: repeat(7, 1fr) 2.5rem; }
  .cal-header { grid-template-columns: repeat(7, 1fr) 2.5rem; }
  .cal-hours { font-size: 0.85rem; }
  .cal-wk-hrs { font-size: 0.7rem; }
  .panel table { min-width: 28rem; }
  .entity-search { width: 8rem; }
  /* Collapse the org switcher to its icon in the crowded mobile nav cluster;
     the current org name still lives in the avatar dropdown header. */
  .org-switcher-name { display: none; }
  .org-switcher-btn { padding: 0.3rem 0.4rem; }
}

@media (max-width: 480px) {
  .app-nav { padding: 0.75rem 1rem; gap: 0.75rem; }
  .app-logo { font-size: 0.8125rem; }
  .nav-link { font-size: 0.75rem; padding: 0 0.45rem; }
  .timer-strip { font-size: 0.8125rem; }
  .timer-strip-start .timer-start-fields { flex-wrap: wrap; }
  .page-header { padding: 0.5rem 1rem; }
  .page-header::after,
  .week-toolbar::after,
  .tt-toolbar::after,
  .filter-bar::after { left: 1rem; right: 1rem; }
  .week-toolbar { padding: 0.5rem 1rem; flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .week-center { justify-content: center; }
  .view-tabs { align-self: center; }
  .entity-page { padding-left: 1rem; padding-right: 1rem; }
  .summary-row .s-value { font-size: 1.05rem; }
  .tt-toolbar { padding: 0.5rem 1rem; gap: 0.4rem; }
  .tt-toolbar select, .tt-toolbar input { font-size: 0.75rem; padding: 0.35rem 0.55rem; }
  .tt-sort-btn { font-size: 0.75rem; padding: 0.35rem 0.55rem; }
  .time-input { width: 2.6rem; font-size: 0.875rem; padding: 0.32rem 0.1rem; }
  .landing-title { font-size: 1.75rem; }
  .landing-subtitle { font-size: 0.9375rem; }
  .date-presets { justify-content: center; flex-wrap: wrap; }
  .filter-bar { padding: 0.5rem 1rem; }
  .panel table { min-width: 24rem; }
  .entity-search { width: 7rem; font-size: 0.75rem; padding: 0.3rem 0.5rem; }
  .page-header { flex-wrap: wrap; }
  /* UX-7: Reports nav has 5 tabs that overflow at 375px (iPhone-SE). The
     view-tabs scroll internally (below), but that only works if this flex
     wrapper can shrink -- min-width:0 overrides the default min-width:auto so
     it doesn't balloon to the tabs' content width and push the page wide. */
  .page-header-left { flex-wrap: wrap; gap: 0.4rem; min-width: 0; }
  .view-tabs { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .view-tab { padding: 0.4rem 0.6rem; font-size: 0.8125rem; }
}

/* ==========================================================================
   REPORTS
   ========================================================================== */

.date-presets {
  display: flex;
  gap: 0.25rem;
}

.date-preset {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: var(--transition-ui);
  cursor: pointer;
  white-space: nowrap;
}

.date-preset:hover {
  color: var(--text-muted);
  border-color: var(--border);
}

.date-preset.active {
  color: var(--amber);
  border-color: var(--amber-border);
  background: var(--amber-dim);
}

.rpt-saved-menu {
  position: relative;
  align-self: center;
}

.rpt-saved-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: var(--transition-ui);
}

.rpt-saved-btn:hover {
  color: var(--text);
  border-color: var(--border-focus);
  background: var(--surface-raised);
}

.rpt-saved-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 50;
  padding: 0.35rem 0;
}

.rpt-saved-empty {
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.rpt-saved-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 0.25rem 0;
}

.rpt-saved-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}

.rpt-saved-option:hover {
  background: var(--hover);
}

.rpt-saved-item {
  display: flex;
  align-items: center;
}

.rpt-saved-link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.rpt-saved-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.rpt-saved-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.rpt-saved-delete {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  margin-right: 0.5rem;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.rpt-saved-delete:hover {
  color: var(--danger);
  background: var(--hover);
}

/* Save dialog */
.rpt-save-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  padding: 1.5rem;
  min-width: 320px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  margin: auto;
}

.rpt-save-dialog::backdrop {
  background: rgba(0,0,0,0.5);
}

.rpt-save-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.rpt-save-field {
  margin-bottom: 0.75rem;
}

.rpt-save-field .filter-select,
.rpt-save-field input {
  width: 100%;
  box-sizing: border-box;
}

.rpt-save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.rpt-save-cancel {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8125rem;
}

.rpt-save-cancel:hover {
  background: var(--hover);
}

.rpt-save-submit {
  padding: 0.45rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--amber);
  color: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8125rem;
}

.rpt-save-submit:hover {
  filter: brightness(1.1);
}

/* ---------- Report Filters ---------- */

.filter-bar {
  padding: 0.5rem 1.75rem;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-end;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid var(--amber-border);
  padding: 0.4rem 0.5rem;
  border-radius: 1rem;
  white-space: nowrap;
}

.filter-count-clear {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--amber);
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.filter-count-clear:hover {
  opacity: 1;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.filter-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

/* .filter-select styling provided by shared Group B block. */

/* .filter-date uses shared Group B base; overrides for date-input specifics. */
.filter-date {
  padding: 0.4rem 0.3rem 0.4rem 0.7rem;
  cursor: text;
}
.filter-date::-webkit-calendar-picker-indicator {
  opacity: 0.35;
}

.filter-spacer { flex: 1; }

.export-menu {
  position: relative;
  align-self: center;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: var(--transition-ui);
}

.export-btn:hover {
  color: var(--text);
  border-color: var(--border-focus);
  background: var(--surface-raised);
}

.export-caret {
  opacity: 0.5;
}

.export-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 7rem;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

.export-dropdown[hidden] { display: none; }

.export-option {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s;
}

.export-option:hover {
  background: var(--amber-glow);
}

.export-option:last-child { border-radius: 0 0 var(--radius) var(--radius); }

.export-columns {
  padding: 0.5rem 0.75rem 0.25rem;
}

.export-columns-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.export-col-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text);
  padding: 0.15rem 0;
  cursor: pointer;
}

.export-col-check input[type="checkbox"] {
  accent-color: var(--amber);
  width: 14px;
  height: 14px;
}

.export-col-check input[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.export-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 0.35rem 0;
}

/* ---------- Date Label ---------- */

.filter-date-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.filter-date-days {
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-left: 0.5rem;
}

/* ---------- Summary Stats ---------- */

.stat-summary {
  display: flex;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}




/* ---------- Chart ---------- */

.chart-wrap {
  padding: 1rem;
  animation: fadeIn 0.4s ease;
}

/* ---------- Bar Chart (CSS) ---------- */

.chart-bars {
  overflow: hidden;
  animation: fadeIn 0.35s ease;
}


.chart-bars-total {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-light);
  animation: fadeIn 0.3s ease both;
  transition: background 0.1s;
}

.chart-bar-row:last-child { border-bottom: none; }
.chart-bar-row:hover { background: var(--amber-glow); }

.chart-bar-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 10rem;
  flex-shrink: 0;
}

.chart-bar-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-bar-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.chart-bar-track {
  flex: 1;
  height: 1.25rem;
  background: var(--surface-inset);
  border-radius: 0.125rem;
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  height: 100%;
  background: var(--amber-dim);
  border-radius: 0.125rem;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.chart-bar-billable {
  height: 100%;
  background: var(--amber);
  opacity: 0.6;
  border-radius: 0.125rem;
}

.chart-bar-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 4rem;
  flex-shrink: 0;
}

.chart-bar-hours {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.chart-bar-pct {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Drill-down */
.chart-bar-group { border-bottom: 1px solid var(--border-light); }
.chart-bar-group:last-child { border-bottom: none; }
.chart-bar-group .chart-bar-row { border-bottom: none; }

.chart-bar-expandable { cursor: pointer; }
.chart-bar-expandable:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }

.chart-bar-chevron {
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.chart-bar-expandable[aria-expanded="true"] .chart-bar-chevron {
  transform: rotate(90deg);
}

.chart-bar-subs[hidden] { display: none; }
.chart-bar-subs {
  animation: fadeIn 0.2s ease;
}

.chart-bar-sub-row {
  padding-left: 2.25rem;
  background: var(--surface-inset);
}
.chart-bar-sub-row .chart-bar-name { font-weight: 400; opacity: 0.75; }
.chart-bar-sub-row .chart-bar-hours { font-weight: 500; opacity: 0.75; }
.chart-bar-sub-row .chart-bar-fill { background: rgba(212, 164, 74, 0.25); }
.chart-bar-sub-row:last-child { border-bottom: none; }

/* Detail-table-specific formatting moved into .panel + role-based col-* classes. */

.content-empty {
  padding: 3rem 1.75rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9375rem;
}

/* ---------- Utilization ---------- */

.util-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.75rem;
}

.util-card {
  padding: 1rem;
  animation: fadeIn 0.3s ease both;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.util-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.util-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.util-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--bg);
  flex-shrink: 0;
}

.util-green .util-avatar { background: var(--green); }
.util-amber .util-avatar { background: var(--amber); }
.util-red .util-avatar { background: var(--red); }

.util-info { flex: 1; min-width: 0; }

.util-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.util-role {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.util-pct {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.util-green .util-pct { color: var(--green); }
.util-amber .util-pct { color: var(--amber); }
.util-red .util-pct { color: var(--red); }

.util-bar-track {
  height: 0.375rem;
  background: var(--surface-inset);
  border-radius: 0.25rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
  display: flex;
}

.util-bar-fill {
  height: 100%;
  border-radius: 0.25rem;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.util-green .util-bar-fill { background: var(--green); }
.util-amber .util-bar-fill { background: var(--amber); }
.util-red .util-bar-fill { background: var(--red); }

.util-bar-over {
  height: 100%;
  background: var(--red);
  opacity: 0.5;
  border-radius: 0 0.25rem 0.25rem 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.util-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.util-hours {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.util-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.util-green .util-status { color: var(--green); }
.util-amber .util-status { color: var(--amber); }
.util-red .util-status { color: var(--red); }

.util-sparkline {
  display: flex;
  gap: 0.25rem;
  height: 2.5rem;
  align-items: flex-end;
}

.util-spark-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  height: 100%;
  justify-content: flex-end;
}

.util-spark-day.wknd { opacity: 0.5; }

.util-spark-bar {
  width: 100%;
  border-radius: 0.125rem 0.125rem 0 0;
  min-height: 0;
  transition: height 0.4s ease;
}

.util-green .util-spark-bar { background: var(--green); opacity: 0.5; }
.util-amber .util-spark-bar { background: var(--amber); opacity: 0.5; }
.util-red .util-spark-bar { background: var(--red); opacity: 0.5; }

.util-spark-label {
  font-size: 0.5625rem;
  color: var(--text-dim);
  font-weight: 600;
}

/* ---------- Activity Feed ---------- */

.filter-summary {
  font-size: 0.8125rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.act-day {
  margin-bottom: 0.5rem;
}

.act-day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 0 0.4rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.25rem;
}

.act-day-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.act-day-total {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.act-day-entries {
  display: flex;
  flex-direction: column;
}

.act-entry {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
  animation: fadeIn 0.3s ease both;
  transition: background 0.1s;
}

.act-entry:last-child { border-bottom: none; }
.act-entry:hover { background: var(--amber-glow); border-radius: var(--radius); }

.act-entry-color {
  width: 3px;
  height: 2rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.act-entry-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.act-entry-body {
  flex: 1;
  min-width: 0;
}

.act-entry-top {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.act-entry-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.act-entry-project {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.act-entry-task {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.act-entry-notes {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.act-entry-hours {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 3rem;
  text-align: right;
}

/* ---------- Approval Banner (on timesheet views) ---------- */

.approval-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.approval-banner.status-submitted {
  border-color: var(--amber-border);
  background: var(--amber-dim);
}

.approval-banner.status-approved {
  border-color: var(--green-border);
  background: var(--green-dim);
}

.approval-banner.status-rejected {
  border-color: rgba(196, 92, 74, 0.25);
  background: var(--red-dim);
}

.approval-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.approval-banner-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ---------- Status Badges ---------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.status-badge.status-draft {
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.status-badge.status-submitted,
.status-badge.status-atrisk {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.status-badge.status-approved,
.status-badge.status-paid,
.status-badge.status-ontrack {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.status-badge.status-rejected,
.status-badge.status-overbudget {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(196, 92, 74, 0.25);
}

.status-badge.status-sent {
  background: rgba(74, 144, 196, 0.12);
  color: #5a9ec4;
  border: 1px solid rgba(74, 144, 196, 0.25);
}

.status-badge.status-voided {
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-decoration: line-through;
}

.form-static {
  display: block;
  padding: 0.4rem 0;
  color: var(--text);
}

.inv-details-readonly {
  opacity: 0.85;
}

/* ---------- Approval Queue (admin view) ---------- */

.approval-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.approval-card {
  padding: 1rem 1.25rem;
}

/* Inside the section panel the submissions read as divided blocks, not
   nested bordered cards; the panel itself owns the boundary. */
.panel > .approval-cards {
  margin-top: 0;
  gap: 0;
}

.panel .approval-card {
  background: none;
  border: none;
  border-radius: 0;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.panel .approval-card:last-child {
  border-bottom: none;
}

.panel > .approval-reviewed-list {
  margin-top: 0;
  padding: 0.5rem 1rem;
}

.approval-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.approval-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.approval-user-info {
  min-width: 0;
}

.approval-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.approval-user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.approval-card-stats {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.approval-stat strong {
  color: var(--text);
  font-weight: 600;
}

/* Day bar chart in approval card */

.approval-day-bars {
  display: flex;
  gap: 0.25rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}

.approval-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.approval-bar.wknd {
  opacity: 0.5;
}

.approval-bar-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.approval-bar-track {
  width: 100%;
  height: 2.5rem;
  background: var(--surface-inset);
  border-radius: 2px;
  position: relative;
  display: flex;
  align-items: flex-end;
}

.approval-bar-fill {
  width: 100%;
  background: var(--amber);
  border-radius: 2px 2px 0 0;
  opacity: 0.65;
  min-height: 0;
  transition: height 0.3s ease;
}

.approval-bar-value {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.approval-submitted-at {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.approval-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.approval-card-actions .inline-form {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.approval-notes-input {
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text);
  width: 10rem;
}

.approval-notes-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.btn-approve {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-approve:hover { opacity: 0.85; }

.btn-reject {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(196, 92, 74, 0.3);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-reject:hover { opacity: 0.85; background: var(--red-dim); }

.approval-self-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Editable entries on a submission card -- only rendered when the viewer has
   CanEditOthersTime. <details> handles expand/collapse with no JS. */

.approval-edit-details {
  margin: 0.5rem 0 0.75rem;
  border-top: 1px dashed var(--border-light);
  padding-top: 0.5rem;
}

.approval-edit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  user-select: none;
  list-style: none;
}

.approval-edit-toggle::-webkit-details-marker { display: none; }

.approval-edit-toggle:hover {
  color: var(--text);
}

.approval-edit-toggle-icon {
  display: inline-flex;
  color: var(--text-dim);
}

.approval-edit-toggle-count {
  color: var(--text-dim);
  font-weight: 500;
}

.approval-edit-details[open] .approval-edit-toggle-icon {
  color: var(--amber);
}

.approval-edit-form {
  margin-top: 0.75rem;
}

.approval-edit-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.approval-edit-row {
  display: grid;
  grid-template-columns: minmax(11rem, 1.4fr) 5rem minmax(8rem, 1.5fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0.6rem;
  background: var(--surface-inset);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.8125rem;
}

.approval-edit-row.is-invoiced {
  opacity: 0.7;
}

.approval-edit-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.approval-edit-date {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.approval-edit-project {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-edit-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.approval-edit-task {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-edit-minutes,
.approval-edit-notes {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--text);
  font-family: var(--font);
  width: 100%;
  min-width: 0;
}

.approval-edit-minutes {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.approval-edit-minutes:focus,
.approval-edit-notes:focus {
  outline: none;
  border-color: var(--border-focus);
}

.approval-edit-minutes[readonly],
.approval-edit-notes[readonly] {
  background: var(--amber-dim);
  border-color: transparent;
  cursor: not-allowed;
  color: var(--text-muted);
}

.approval-edit-locked {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--amber);
  padding: 0.2rem 0.45rem;
  background: var(--amber-dim);
  border-radius: var(--radius);
  white-space: nowrap;
}

/* Per-row delete affordance: matches the Day-view's del-btn.visible pattern --
   quietly visible at rest (0.4 opacity), full brightness on row hover. The
   hover-only reveal used in the timesheet grid is wrong here: Managers
   coming to fix one number on someone else's sheet shouldn't have to
   discover the action by accident. */
.approval-edit-row .del-btn.visible {
  opacity: 0.4;
}

.approval-edit-row:hover .del-btn.visible,
.approval-edit-row:focus-within .del-btn.visible {
  opacity: 1;
}

.approval-edit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.approval-edit-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Add-entry inline form: single-row, one entry per submission. Project, task,
   day-select, minutes, notes, submit. Honest about being a one-at-a-time tool;
   adding entries across multiple project/task combos means re-submitting. */

.approval-add-form {
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-light);
}

.approval-add-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1.2fr) minmax(6rem, 1fr) minmax(7rem, auto) 5rem minmax(7rem, 1.2fr) auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8125rem;
}

.approval-add-project,
.approval-add-task,
.approval-add-date,
.approval-add-minutes,
.approval-add-notes {
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--text);
  font-family: var(--font);
  min-width: 0;
  width: 100%;
}

.approval-add-minutes {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.approval-add-project:focus,
.approval-add-task:focus,
.approval-add-date:focus,
.approval-add-minutes:focus,
.approval-add-notes:focus {
  outline: none;
  border-color: var(--border-focus);
}

@@media (max-width: 720px) {
  .approval-add-row {
    grid-template-columns: 1fr;
  }
}

/* Unsubmitted (submit-on-behalf) panel */

.unsubmitted-intro {
  margin: 0;
  padding: 0.75rem 1rem 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.unsubmitted-list {
  display: flex;
  flex-direction: column;
  margin-top: 0.5rem;
}

.unsubmitted-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(12rem, 1.5fr) minmax(10rem, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.unsubmitted-row:last-of-type { border-bottom: none; }

.unsubmitted-row-head {
  padding: 0.4rem 1rem;
  background: var(--surface-inset);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.unsubmitted-row-head .unsubmitted-col-name,
.unsubmitted-row-head .unsubmitted-col-meta {
  font-weight: 700;
}

.unsubmitted-select,
.unsubmitted-select-all {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.unsubmitted-select input,
.unsubmitted-select-all input {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--amber);
}

.unsubmitted-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.unsubmitted-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.unsubmitted-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unsubmitted-user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unsubmitted-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.unsubmitted-meta strong {
  color: var(--text);
  font-weight: 600;
}

.unsubmitted-single {
  display: inline-flex;
}

.unsubmitted-bulk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface-inset);
  border-top: 1px solid var(--border-light);
}

.unsubmitted-bulk-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
}

@@media (max-width: 720px) {
  .approval-edit-row {
    grid-template-columns: 1fr;
  }
  .unsubmitted-row {
    grid-template-columns: 2rem 1fr auto;
  }
  .unsubmitted-row .unsubmitted-meta { grid-column: 2 / -1; }
}

/* Reviewed list */

.approval-reviewed-list {
  margin-top: 0.5rem;
}

.approval-reviewed-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.8125rem;
}

.approval-reviewed-row:last-child { border-bottom: none; }

.approval-reviewed-name {
  font-weight: 600;
  color: var(--text);
  min-width: 8rem;
}

.approval-reviewed-by {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.approval-reviewed-at {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.approval-reviewed-notes {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-style: italic;
  max-width: 20rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Locked state styling */

.time-input[readonly] {
  opacity: 0.6;
  pointer-events: none;
}

/* Edited-by-other cue on Week grid: a subtle amber dot in the top-right of
   any cell whose entries were last updated by someone other than the entry
   owner. Hover/title (on the td) carries the editor's display name. The Day
   view shows the explicit "Edited by X" badge per entry. The pseudo-element
   sits on the td -- inputs are replaced elements and can't carry ::after. */
.c-day.edited-by-other {
  position: relative;
}

.c-day.edited-by-other::after {
  content: "";
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--amber);
  pointer-events: none;
  z-index: 1;
}

/* Invoiced cell: locked because its minutes are billed on a sent invoice.
   Distinct from whole-week lock -- tinted, and keeps pointer events so the
   "Invoiced -- locked" title tooltip is discoverable on hover. */
.time-input.invoiced {
  pointer-events: auto;
  cursor: not-allowed;
  opacity: 0.75;
  background: var(--amber-dim);
  border-color: transparent;
}

.time-input.invoiced:hover,
.time-input.invoiced:focus {
  border-color: transparent;
  box-shadow: none;
}

select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- INVOICES ---------- */

.invoice-col-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.invoice-col-qty,
.invoice-col-rate {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 6rem;
}

.invoice-line-table {
  margin-bottom: 0;
}

.invoice-total-row {
  background: var(--surface-raised);
}

.invoice-total-row td {
  border-top: 2px solid var(--border);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.invoice-total-label {
  text-align: right;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.invoice-total-value {
  font-weight: 700;
  font-size: 1rem;
  color: var(--amber);
}

.invoice-li-desc {
  font-weight: 500;
}

.invoice-li-type {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* ──────────────────────────────────────────────────────────────────────
   Invoice Show: The Ledger Sheet
   A warm cream document floats on the dark/light app desk. Editorial
   serif letterhead, small-caps meta labels, tabular-number figures,
   diagonal status watermark. Prints as-is; QuestPDF mirrors server-side.
   ────────────────────────────────────────────────────────────────────── */

.invoice-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0 1rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.invoice-toolbar-left,
.invoice-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.invoice-toolbar-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  padding-left: 0.5rem;
  padding-right: 0.75rem;
}

.invoice-toolbar-due {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border-light);
  border-radius: 999px;
}

.invoice-toolbar-due-over {
  color: var(--red);
  border-color: rgba(196, 92, 74, 0.35);
  background: var(--red-dim);
}

.invoice-shell {
  max-width: 52rem;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.sheet {
  position: relative;
  background: var(--paper);
  color: var(--paper-ink);
  border: 1px solid var(--paper-edge);
  border-left: 3px solid var(--paper-amber);
  border-radius: 2px;
  box-shadow: var(--paper-shadow);
  padding: 3.5rem 3.25rem 2.75rem;
  overflow: hidden;
  /* Bound mix-blend-mode children (see .sheet-logo) to blend against the
     cream paper, not the stacking contexts created by .sheet > * below. */
  isolation: isolate;
  animation: sheet-rise 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheet-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet-watermark { animation: none; }
  .sheet-watermark { opacity: 1; }
}

.sheet::before {
  /* subtle paper grain — radial noise at very low opacity.
     z-index: -1 keeps it below content in .sheet's isolated stacking context
     without forcing z-index: 1 on every child (which would create nested
     stacking contexts and break the logo's mix-blend-mode). */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(42, 38, 32, 0.025) 1px, transparent 1px),
    radial-gradient(rgba(42, 38, 32, 0.015) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
  opacity: 0.6;
  z-index: -1;
}

/* ── Watermark (PAID/VOIDED/OVERDUE) ── */
.sheet-watermark {
  position: absolute;
  top: 38%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 7rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  transform: rotate(-14deg);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  z-index: -1;
  animation: watermark-fade 420ms 240ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.sheet--paid .sheet-watermark {
  color: rgba(46, 115, 58, 0.14);
}

.sheet--voided .sheet-watermark {
  color: rgba(42, 38, 32, 0.13);
}

.sheet--overdue .sheet-watermark {
  color: rgba(196, 92, 74, 0.16);
}

@keyframes watermark-fade {
  from { opacity: 0; transform: rotate(-14deg) scale(1.02); }
  to   { opacity: 1; transform: rotate(-14deg) scale(1); }
}

/* ── Letterhead ── */
.sheet-letterhead {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--paper-rule);
}

.sheet-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sheet-logo {
  /* Respect the logo's natural aspect ratio — no square frame.
     Height caps keep tall logos in check; width cap keeps wide wordmarks
     from crowding the invoice-mark block on the right.
     mix-blend-mode: darken erases white backgrounds at render time by
     taking the darker of the logo pixel and the cream paper — so both
     transparent PNGs and white-bg PNGs render cleanly against the paper.
     Caveat: logos whose artwork is lighter than cream will be clipped.
     Dark-bg PNGs are not supported (see Branding hint). */
  max-height: 3.5rem;
  max-width: 12rem;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  mix-blend-mode: darken;
}

.sheet-monogram {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--paper-amber);
  color: var(--paper-amber);
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}

.sheet-org {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.125rem;
}

.sheet-org h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--paper-ink);
  letter-spacing: -0.01em;
}

.sheet-org address {
  font-style: normal;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--paper-ink-secondary);
  white-space: pre-line;
}

.sheet-taxid {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--paper-ink-muted);
  text-transform: uppercase;
}

.sheet-invoice-mark {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.sheet-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--paper-ink-muted);
  font-weight: 600;
}

.sheet-number {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--paper-ink);
  letter-spacing: 0.02em;
}

.sheet-dates {
  margin: 0.5rem 0 0;
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.15rem 1rem;
  text-align: right;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.sheet-dates dt {
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--paper-ink-muted);
  justify-self: start;
}

.sheet-dates dd {
  margin: 0;
  color: var(--paper-ink);
}

/* ── Meta strip ── */
.sheet-meta-strip {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.5rem;
  padding: 1rem 0 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--paper-rule);
}

.sheet-meta-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.sheet-meta-cell-right {
  align-items: flex-end;
  text-align: right;
}

.sheet-meta-cell strong {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--paper-ink);
}

.sheet-meta-cell address {
  font-style: normal;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--paper-ink-secondary);
  white-space: pre-line;
}

.sheet-meta-sub {
  font-size: 0.8125rem;
  color: var(--paper-ink-secondary);
}

.sheet-client-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--paper-rule);
}

.sheet-client-link:hover {
  color: var(--paper-amber);
  border-bottom-color: var(--paper-amber);
}

.sheet-meta-sub a {
  color: var(--paper-amber);
  text-decoration: none;
}

.sheet-meta-sub a:hover {
  text-decoration: underline;
}

.sheet-meta-total {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--paper-ink);
}

/* ── Line items table on the sheet ── */
.sheet-lines {
  margin-bottom: 1.75rem;
}

.sheet-lines-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  color: var(--paper-ink);
  margin: 0;
}

.sheet-lines-table thead th {
  background: transparent;
  border-bottom: 1px solid var(--paper-ink);
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-ink-secondary);
  text-align: left;
}

.sheet-lines-table tbody tr.sheet-line-row > td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--paper-rule-soft);
  font-size: 0.875rem;
  background: transparent;
  color: var(--paper-ink);
}

.sheet-lines-table tbody tr.sheet-line-row > td:first-child {
  padding-left: 0;
  position: relative;
}

.sheet-lines-table tbody tr.sheet-line-row > td:last-child {
  padding-right: 0;
}

.sheet-lines-table tbody tr.sheet-line-row-hoverable {
  transition: background-color 0.15s ease;
}

.sheet-lines-table tbody tr.sheet-line-row-hoverable:hover {
  background-color: rgba(165, 124, 46, 0.06);
}

.sheet-lines-table .invoice-li-desc {
  font-weight: 500;
  color: var(--paper-ink);
}

/* Rescope the .invoice-li-type badge inside the sheet to use paper palette */
.sheet-lines-table .invoice-li-type {
  color: var(--paper-ink-muted);
  background: rgba(165, 124, 46, 0.08);
  border: 1px solid var(--paper-rule);
}

.sheet-lines-table .invoice-col-qty,
.sheet-lines-table .invoice-col-rate,
.sheet-lines-table .invoice-col-amount {
  text-align: right;
}

/* ── Source-entry hover card (right-gutter reveal on Time rows) ── */
.source-hover {
  position: absolute;
  top: 50%;
  left: calc(100% + 1.25rem);
  transform: translate(-8px, -50%);
  min-width: 16rem;
  max-width: 20rem;
  background: var(--paper);
  border: 1px solid var(--paper-rule);
  border-left: 2px solid var(--paper-amber);
  border-radius: 3px;
  box-shadow: 0 10px 30px rgba(42, 38, 32, 0.18);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--paper-ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 5;
}

.sheet-line-row-hoverable:hover .source-hover {
  opacity: 1;
  transform: translate(0, -50%);
}

.source-hover-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-ink-muted);
  margin-bottom: 0.5rem;
}

.source-hover ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.source-hover li {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  gap: 0.5rem;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}

.source-hover time {
  color: var(--paper-ink-muted);
  font-size: 0.75rem;
}

.source-hover-amount {
  color: var(--paper-ink);
}

/* Hide hover card on narrow viewports — <details> disclosure takes over */
@media (max-width: 56rem) {
  .source-hover { display: none; }
}

/* Source-disclosure <details> row inside the sheet — restyle for paper.
   Parent td sets the default ink; summary/time/note bump down to muted. */
.sheet-source-row td {
  background: rgba(212, 164, 74, 0.04);
  padding: 0;
  color: var(--paper-ink-secondary);
}

.sheet-source-row .invoice-source-details { padding: 0.25rem 0 0.5rem; }

.sheet-source-row .invoice-source-details summary {
  color: var(--paper-ink-muted);
  font-size: 0.75rem;
}

.sheet-source-row .invoice-source-list time,
.sheet-source-row .invoice-source-note { color: var(--paper-ink-muted); }

/* Hide <details> disclosure rows on wide viewports where hover card wins */
@media (min-width: 56rem) {
  .sheet-source-row { display: none; }
}

/* ── Totals block (right-weighted) ── */
.sheet-totals {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 2rem;
}

.sheet-totals-list {
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.sheet-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.2rem 0;
  color: var(--paper-ink-secondary);
  font-size: 0.875rem;
}

.sheet-totals-row dt {
  letter-spacing: 0.02em;
}

.sheet-totals-row dd {
  margin: 0;
}

.sheet-totals-grand {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1.5px solid var(--paper-ink);
  font-size: 1.125rem;
  color: var(--paper-ink);
}

.sheet-totals-grand dt {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8125rem;
}

.sheet-totals-grand dd {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--paper-amber);
  letter-spacing: 0.01em;
}

/* ── Footer (notes + payment) ── */
.sheet-footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 2rem;
  padding: 1.5rem 0 0.5rem;
  border-top: 1px solid var(--paper-rule);
}

.sheet-footer-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sheet-footer-block p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--paper-ink-secondary);
  white-space: pre-line;
}

.sheet-payment-link {
  color: var(--paper-amber);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.sheet-payment-link:hover {
  text-decoration: underline;
}

/* ── Branding settings (logo preview) ── */
.branding-logo-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface-raised);
  margin-bottom: 0.5rem;
}

.branding-logo-preview img {
  max-width: 4rem;
  max-height: 4rem;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.branding-logo-remove {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ── Narrow-viewport fallbacks ── */
@media (max-width: 48rem) {
  .sheet {
    padding: 2rem 1.5rem 1.75rem;
  }

  .sheet-letterhead,
  .sheet-meta-strip {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .sheet-invoice-mark {
    text-align: left;
    align-items: flex-start;
  }

  .sheet-dates {
    text-align: left;
    grid-template-columns: auto 1fr;
  }

  .sheet-meta-cell-right {
    align-items: flex-start;
    text-align: left;
  }

  .sheet-watermark {
    font-size: 4rem;
  }
}

/* ── Invoice Edit Card ── */
.inv-card {
  margin: 0.75rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.inv-details {
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.inv-details-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0 1.25rem;
  align-items: start;
}

.inv-details-fields .form-group {
  margin-bottom: 0.75rem;
}

.inv-notes-group {
  grid-column: 1 / -1;
}

.inv-details-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding-top: 0.25rem;
}

/* Line items section inside card */
.inv-lines table {
  margin-bottom: 0;
}

/* Align numeric th headings with their td values */
.invoice-line-table thead th.invoice-col-qty,
.invoice-line-table thead th.invoice-col-rate,
.invoice-line-table thead th.invoice-col-amount {
  text-align: right;
}

/* ── Invoice Show: per-line-item source disclosure ── */
.invoice-source-row td {
  background: var(--surface-raised, transparent);
  padding: 0;
  border-top: none;
}

.invoice-source-details {
  padding: 0.25rem 1rem 0.5rem;
}

.invoice-source-details > summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.25rem 0;
  user-select: none;
}

.invoice-source-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0 0 0 1rem;
  font-size: 0.8125rem;
}

.invoice-source-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.25rem 0;
  color: var(--text);
}

.invoice-source-list time {
  color: var(--text-dim);
  min-width: 4rem;
}

.invoice-source-note {
  color: var(--text-dim);
  font-style: italic;
}

/* ── Add Line Item Panel ── */
.inv-add-panel {
  margin: 1.25rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.inv-add-panel-head {
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.inv-add-panel-body {
  padding: 1rem 1.5rem;
}

.inv-add-fields {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.inv-add-fields .form-group {
  margin-bottom: 0;
}

.inv-add-desc {
  flex: 2;
  min-width: 12rem;
}

.inv-add-num {
  flex: 0 0 7rem;
}

.inv-add-submit {
  flex: 0 0 auto;
  padding-bottom: 1px; /* align with inputs */
}

/* ── Fixed Fee Billing rows ── */
.inv-fee-list {
  padding: 0.5rem 1.5rem 1rem;
}

.inv-fee-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

.inv-fee-row:last-child {
  border-bottom: none;
}

.inv-fee-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 12rem;
}

.inv-fee-project {
  font-weight: 600;
}

.inv-fee-context {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.inv-fee-action {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.inv-fee-action .form-control {
  width: 9rem;
}

/* Status badge inside page-title */
.page-title .status-badge {
  margin-left: 0.75rem;
  vertical-align: middle;
}

@media (max-width: 640px) {
  .inv-details-fields {
    grid-template-columns: 1fr;
  }
  .inv-add-fields {
    flex-direction: column;
  }
  .inv-add-num {
    flex: 1 1 auto;
  }
}

.uninvoiced-preview {
  background: var(--surface-inset);
  padding: 1.25rem;
}

/* The htmx placeholder div uses id="uninvoiced-preview" (class is on the
   injected inner wrapper).  When empty it would still occupy a flex slot
   and add gap on both sides; hide it until content arrives. */
#uninvoiced-preview:empty {
  display: none;
}

.uninvoiced-preview-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.uninvoiced-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.uninvoiced-stat-value {
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.uninvoiced-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.uninvoiced-total .uninvoiced-stat-value {
  color: var(--amber);
}

.uninvoiced-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.uninvoiced-empty p {
  margin: 0;
}

/* ---------- DASHBOARD ---------- */

/* Dashboard uses the canonical .entity-page wrapper — no page-specific
   chrome beyond the widgets below. */

/* ── Week Strip ── */

.db-week {
  padding: 1.25rem 1.5rem;
}

.db-week-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.db-week-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
}

.db-week-total {
  font-variant-numeric: tabular-nums;
  font-size: 1.125rem;
}

.db-week-total strong {
  color: var(--amber);
}

.db-week-target {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.db-week-bar {
  height: 0.375rem;
  background: var(--surface-inset);
  border-radius: 0.25rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.db-week-bar-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 0.25rem;
  transition: width 0.4s ease;
}

.db-week-bar-full {
  background: var(--green);
}

.db-week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.375rem;
}

.db-day {
  text-align: center;
  padding: 0.5rem 0.25rem;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.db-day-label {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.db-day-hours {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.db-day-today {
  background: var(--amber-dim);
  border: 1px solid var(--amber-border);
}

.db-day-today .db-day-label {
  color: var(--amber);
}

.db-day-today .db-day-hours {
  color: var(--text);
}

.db-day-gap .db-day-hours {
  color: var(--red);
  opacity: 0.7;
}

.db-day-weekend {
  opacity: 0.5;
}

.db-reviewer-notes {
  margin-top: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--red-dim);
  border: 1px solid rgba(196, 92, 74, 0.25);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.db-reviewer-notes strong {
  color: var(--red);
}

/* ── Today Card ── */

.db-today {
  padding: 1.25rem 1.5rem;
}

.db-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.db-timer-active {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.db-timer-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

.db-timer-project {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.db-timer-task {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.db-timer-elapsed {
  margin-left: auto;
  font-weight: 700;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--green);
}

.db-today-list {
  list-style: none;
}

.db-today-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  position: relative;
}

.db-today-item + .db-today-item {
  border-top: 1px solid var(--border-light);
}

.db-project-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.db-project-name {
  font-size: 0.875rem;
  color: var(--text);
}

.db-project-hours {
  margin-left: auto;
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.db-today-total {
  display: flex;
  justify-content: space-between;
  padding-top: 0.5rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.db-today-total strong {
  font-variant-numeric: tabular-nums;
}

/* ── Admin Cards ── */

.db-admin {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.db-card {
  padding: 1.25rem 1.5rem;
}

.db-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.db-card-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
}

.db-card-link {
  font-size: 0.75rem;
  color: var(--amber);
}

/* UX-1: empty-state Getting Started card on /dashboard. Editorial tone
   (proper headline, not uppercase smallcaps) — overrides .db-card-title
   only when it sits inside a Getting Started card. */
.db-getting-started {
  padding: 1.5rem 1.75rem;
}

.db-getting-started .db-card-title {
  font-size: 1.0625rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  font-weight: 600;
}

.db-getting-started-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.db-getting-started-item {
  border-top: 1px solid var(--border-soft, var(--border));
  padding-top: 0.75rem;
}

.db-getting-started-item:first-child {
  border-top: none;
  padding-top: 0;
}

.db-getting-started-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
}

.db-getting-started-link strong {
  color: var(--amber);
  font-size: 0.9375rem;
}

.db-getting-started-hint {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* Dashboard "set up approvals" nudge -- borrows the Getting Started
   editorial tone (non-uppercase title) and adds a corner dismiss. */
.db-setup-hint {
  position: relative;
  padding: 1.5rem 1.75rem;
}

.db-setup-hint .db-card-title {
  font-size: 1.0625rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  font-weight: 600;
}

.db-setup-hint-body {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.db-setup-hint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.db-setup-hint-dismiss {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.db-setup-hint-dismiss:hover {
  background: var(--surface);
  color: var(--text);
}

.db-card-stat {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

.db-card-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.db-card-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Approval list */

.db-approval-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.db-approval-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.db-approval-item .member-avatar {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.625rem;
}

.db-approval-name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.db-approval-more {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Budget alerts */

.db-budget-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.db-budget-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.db-budget-warn .db-budget-dot {
  background: var(--amber);
}

.db-budget-over .db-budget-dot {
  background: var(--red);
}

.db-budget-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.db-budget-name {
  font-size: 0.8125rem;
  color: var(--text);
}

.db-budget-pct {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.db-budget-warn .db-budget-pct {
  color: var(--amber);
}

.db-budget-over .db-budget-pct {
  color: var(--red);
}

.db-budget-bar {
  height: 0.25rem;
  background: var(--surface-inset);
  border-radius: 0.125rem;
  overflow: hidden;
}

.db-budget-bar-fill {
  height: 100%;
  border-radius: 0.125rem;
}

.db-budget-warn .db-budget-bar-fill {
  background: var(--amber);
}

.db-budget-over .db-budget-bar-fill {
  background: var(--red);
}

/* Invoice summary */

.db-invoice-stats {
  display: flex;
  gap: 1.5rem;
}

.db-invoice-stat {
  display: flex;
  flex-direction: column;
}

.db-invoice-stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.db-invoice-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Team snapshot */

.db-team-stats {
  display: flex;
  gap: 1.5rem;
}

.db-team-stat {
  display: flex;
  flex-direction: column;
}

.db-team-stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.db-team-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.db-team-stat-warn .db-team-stat-value {
  color: var(--red);
}

/* Per-member capacity bars (reuse .db-budget-* markup). Unlike budget alerts
   — which are always >=80% and so always amber/red — team members can sit
   under threshold, so the fill needs a default (healthy) color. */
.db-team-members {
  margin-top: 1rem;
}

.db-team-members .member-avatar {
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.5625rem;
}

.db-team-members .db-budget-item + .db-budget-item {
  margin-top: 0.625rem;
}

.db-team-members .db-budget-bar-fill {
  background: var(--green);
}

.db-team-members-more {
  margin-top: 0.625rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Billable / non-billable caption under the week progress bar. */
.db-week-billable {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Overdue invoices: a past-due subset of Outstanding, flagged red. */
.db-invoice-stat-overdue .db-invoice-stat-value {
  color: var(--red);
}

/* Four money stats can exceed one row on a narrow admin card. */
.db-invoice-stats {
  flex-wrap: wrap;
  row-gap: 0.75rem;
}

/* Trend chart sits in a .db-card, which already pads; trim the chart-body's
   own horizontal padding so the canvas aligns with the card content. */
.db-trend .chart-body {
  height: 200px;
  padding: 0.5rem 0 0;
}

/* ── Dashboard Responsive ── */

@media (max-width: 640px) {
  .db-week-days {
    gap: 0.125rem;
  }

  .db-day-label {
    font-size: 0.625rem;
  }

  .db-day-hours {
    font-size: 0.8125rem;
  }
}

/* ---------- PROJECT DETAIL ---------- */

.entity-page {
  padding: 1.5rem 1.75rem 3rem;
  animation: fadeIn 0.3s ease;
}

.entity-identity {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}


/* Project color dot (inline with title) */
.entity-color-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: baseline;
  position: relative;
  top: -0.05em;
}

.entity-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Audit metadata strip rendered at the bottom of entity detail pages.
   Key/value grid with a hairline top rule: micro-caps labels on the left,
   "<timestamp> · <user>" on the right. */
.audit-info {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1.25rem;
  row-gap: 0.1875rem;
  margin-top: 1.5rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.audit-info dt {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  align-self: center;
}

.audit-info dd {
  margin: 0;
  line-height: 1.4;
}

.audit-info .audit-sep {
  color: var(--text-dim);
  margin: 0 0.125rem;
}

.entity-client {
  color: var(--text-muted);
}

.entity-sep {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.entity-type {
  font-weight: 600;
  font-size: 0.875rem;
}

.entity-type-hourly { color: var(--text); }
.entity-type-fixedfee { color: var(--blue, #6ea8d9); }
.entity-type-nonbillable { color: var(--text-dim); }

.entity-rate {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Stats strip */
.entity-stats {
  display: flex;
  overflow: hidden;
  margin-bottom: 1.25rem;
}


/* Section heading */
.section-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  /* No margin — spacing owned by the surrounding flex-gap container. */
}

/* Archived phase panel — dim the whole card. */
.panel-archived { opacity: 0.6; }

.entity-empty {
  color: var(--text-dim);
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

/* Horizontal inset only when inside a bare panel; padded cards (dashboard)
   align it to their own gutter without the extra indent. */
.panel .entity-empty {
  padding-inline: 1rem;
}

.entity-empty a {
  color: var(--amber);
}

/* Two-column form grid. Used on Projects/Edit for parallel General/Billing columns. */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 1.5rem;
}

/* .form-col inherits flex-column-gap from the shared form-stack rule above. */

/* (Manage sections moved to Phase List panel styles above) */

/* ── Project Detail Responsive ── */

@media (max-width: 768px) {
  .entity-page {
    padding: 1.25rem 1rem 2rem;
  }

  .entity-stats {
    flex-wrap: wrap;
  }

  .entity-stats .s-card {
    min-width: 45%;
    flex: 1 1 45%;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ========== PRINT ========== */

@media print {
  nav,
  .timer-strip,
  .week-toolbar .view-tabs,
  .week-nav-btn,
  .today-btn,
  .page-header-right a,
  .invoice-toolbar,
  .btn,
  button,
  .toast,
  .filter-bar,
  footer {
    display: none !important;
  }

  /* Invoice sheet prints as-is — no chrome, no shadow, fill the page */
  .invoice-shell {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  .invoice-shell > .audit-info,
  .invoice-shell > div:last-child {
    display: none !important;
  }

  .sheet {
    box-shadow: none !important;
    border: none !important;
    border-left: 3px solid var(--paper-amber) !important;
    border-radius: 0 !important;
    padding: 1.5cm 1.75cm !important;
    background: #fff !important;
    color: #000 !important;
    page-break-inside: auto;
    animation: none !important;
  }

  .sheet::before {
    display: none !important; /* no grain in print */
  }

  .sheet-watermark {
    animation: none !important;
    opacity: 1 !important;
  }

  .source-hover {
    display: none !important;
  }

  /* Show the <details> disclosure on print even on wide viewports */
  .sheet-source-row {
    display: table-row !important;
  }

  .sheet-source-row .invoice-source-details > summary {
    display: none; /* summary is redundant when content is always shown */
  }

  .sheet-source-row .invoice-source-details[open] .invoice-source-list,
  .sheet-source-row .invoice-source-details .invoice-source-list {
    display: block;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
  }

  main {
    padding: 0;
    margin: 0;
    max-width: 100%;
  }

  .week-label {
    font-size: 14pt;
    font-weight: 600;
    color: #000;
  }

  .s-card {
    border: 1px solid #ccc;
    background: #f9f9f9;
    color: #000;
  }

  .s-label {
    color: #555;
  }

  .s-value {
    color: #000;
  }

  table {
    border: 1px solid #ccc;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ==========================================================================
   DATE RANGE PICKER
   ========================================================================== */

.range-root {
  position: relative;
  display: inline-block;
}

.range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-ui);
}

.range-trigger:hover {
  border-color: var(--border-focus);
  background: var(--surface-raised);
}

.range-trigger[aria-expanded="true"] {
  border-color: var(--amber-border);
  color: var(--amber);
  background: var(--amber-dim);
}

.range-trigger-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.range-trigger[aria-expanded="true"] .range-trigger-icon { color: var(--amber); }

.range-trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.range-trigger-caret {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.12s;
}

.range-trigger[aria-expanded="true"] .range-trigger-caret {
  color: var(--amber);
  transform: rotate(180deg);
}

.range-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: flex;
  align-items: stretch;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 0;
  animation: rangePopoverIn 0.12s ease;
}

/* The .range-popover { display: flex } rule above defeats the browser
   default [hidden] { display: none }; restore it with matching specificity
   so toggling the hidden attribute actually toggles visibility. */
.range-popover[hidden] {
  display: none;
}

[data-theme="light"] .range-popover {
  box-shadow: 0 8px 24px rgba(42, 38, 32, 0.12);
}

@keyframes rangePopoverIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.range-quick-picks {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.5rem;
  border-right: 1px solid var(--border-light);
  min-width: 9.5rem;
}

.range-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 0.6rem 0.35rem 0.6rem;
}

.range-quick-pick {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.6rem;
  font-family: var(--font);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-ui);
}

.range-quick-pick:hover {
  color: var(--text);
  background: var(--surface);
}

.range-quick-pick--active {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: var(--amber-border);
}

.range-cal {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  min-width: 16rem;
}

.range-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.range-cal-prev,
.range-cal-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-ui);
}

.range-cal-prev:hover,
.range-cal-next:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.range-cal-month {
  flex: 1;
  text-align: center;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.range-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 2rem);
  gap: 2px;
}

.range-cal-dow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.range-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s, border-color 0.1s;
}

.range-day:hover {
  background: var(--surface);
  color: var(--text);
}

.range-day--other-month {
  color: var(--text-dim);
}

.range-day--today {
  border-color: var(--amber-border);
}

.range-day--in-range {
  background: var(--amber-dim);
  color: var(--amber);
  border-radius: 0;
}

.range-day--endpoint {
  background: var(--amber);
  color: var(--bg);
  border-color: var(--amber);
}

.range-day--endpoint:hover {
  background: var(--amber);
  color: var(--bg);
  filter: brightness(1.05);
}

.range-day:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
  position: relative;
  z-index: 1;
}

.range-cal-summary {
  margin-top: 0.6rem;
  padding: 0.4rem 0.1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  padding-top: 0.6rem;
  text-align: center;
  letter-spacing: 0.01em;
}

.range-cal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.range-cancel,
.range-apply {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-ui);
  border: 1px solid var(--border);
}

.range-cancel {
  color: var(--text-secondary);
  background: transparent;
}

.range-cancel:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-focus);
}

.range-apply {
  color: var(--bg);
  background: var(--amber);
  border-color: var(--amber);
}

.range-apply:hover {
  filter: brightness(1.08);
}

@media (max-width: 30rem) {
  .range-popover {
    flex-direction: column;
    right: auto;
    left: 0;
    width: min(20rem, calc(100vw - 1.5rem));
  }

  .range-quick-picks {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    min-width: 0;
  }

  .range-section-label {
    flex-basis: 100%;
    padding: 0 0.4rem 0.25rem;
  }

  .range-quick-pick {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Org switcher -- sits in the right-hand user cluster, just left of the theme
   toggle, and is only rendered for multi-org users. Reuses the generic
   data-dropdown-toggle behaviour (shared.js). */
.org-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.org-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 10rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: var(--transition-ui);
}

.org-switcher-btn:hover {
  color: var(--text);
  border-color: var(--border-focus);
  background: var(--surface-raised);
}

.org-switcher-btn svg { flex-shrink: 0; }

.org-switcher-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-switcher-caret { opacity: 0.5; }

.org-switcher-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  min-width: 12rem;
  max-width: 18rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  padding: 0.25rem 0;
  animation: fadeIn 0.15s ease;
}

.org-switcher-dropdown[hidden] { display: none; }

.org-switcher-heading {
  padding: 0.4rem 0.75rem 0.3rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.org-switcher-form { margin: 0; }

.org-switcher-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}

.org-switcher-option:hover { background: var(--hover); }

.org-switcher-option:focus-visible { outline-offset: -0.125rem; }

.org-switcher-option-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-switcher-option.is-current { font-weight: 600; }

.org-switcher-check {
  flex-shrink: 0;
  color: var(--accent, var(--text));
}

