/* ============================================================
   Timely — Authenticated App Design System
   Warm Calm: tonal surfaces, type-led numbers, restrained motion
   ============================================================ */

:root {
  /* ---- Mac "island" palette (ported 1:1 from timelymac) -----------------
     islandBrand / islandInk / islandSurface / islandCanvas are the exact
     constants from SidebarViews.swift (lines 261-267). Everything on the
     dashboard + rail is built from these; never pure black. ------------- */
  --island-brand:    #8D6E63;   /* wordmark, active pills, accents */
  --island-ink:      #3A2C1A;   /* warm brown text */
  --island-surface:  #FCF8F1;   /* lifted cream card / island + clock hero */
  --island-canvas:   #F5F1E8;   /* page canvas behind the island (Mac constant) */
  /* Content cards are white so they lift off the cream canvas, matching the
     Mac/mobile card treatment. The clock hero deliberately stays
     --island-surface: its controls sit on top of the card, and white would
     erase the boundary they need. */
  --island-card:     #FFFFFF;
  --island-nav-text: #6B5B4A;   /* inactive nav label */
  --island-nav-icon: #9A8A78;   /* inactive nav icon */

  /* Clock-state accents (SidebarViews.clockStatusColor + HomePageViews) */
  --clock-idle:  #D8564E;   /* red @ 70% */
  --clock-break: #F5BA54;   /* rgb(245,186,84) */
  --clock-work:  #66CC80;   /* rgb(102,204,128) */
  --clock-work-ink: #3F9160; /* readable green for text on cream */
  --clock-label-brown: #99664D; /* rgb(0.6,0.4,0.3) — Mac's idle dial label */

  --island-hairline: rgba(141, 110, 99, 0.09);
  --island-radius: 26px;
  /* One soft shadow, reused. Deliberately cheap — no stacked layers. */
  --island-shadow: 0 6px 18px rgba(141, 110, 99, 0.13);
  /* spring(response .44, damping .72) approximated */
  --ease-jelly: cubic-bezier(0.34, 1.3, 0.64, 1);

  /* Surfaces — a warm tonal stack, no borders required */
  --paper:      var(--island-canvas);   /* page background */
  --surface:    #FFFEFB;   /* primary card */
  --surface-2:  #F1EADD;   /* tonal block (stats, inputs) */
  --surface-3:  #E8DFD0;   /* subtle press / divider */
  --hairline:   rgba(28, 25, 23, 0.06);

  /* Ink */
  --ink:        #1C1917;
  --ink-2:      #2F2A26;
  --ink-3:      #4A433D;
  --muted:      #8B7355;
  --muted-2:    #A89A82;

  /* Brand accent — used sparingly */
  --accent:     #8B4513;
  --accent-ink: #FAF7F2;

  /* Espresso — the inverted hero surface */
  --espresso:   #211D1A;
  --espresso-2: #2C2622;
  --cream:      #FAF7F2;

  /* State */
  --green:      #2E9461;
  --green-soft: #DCEBE0;
  --amber:      #C77E1C;
  --amber-soft: #F4E6CC;
  --red:        #B8392E;
  --red-soft:   #F4DCD8;

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-pill: 999px;

  /* Easing */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-io:     cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 72px;
  --content-max: 960px;
}

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

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: "cv11", "ss01", "ss03";
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button { font: inherit; color: inherit; }

::selection { background: var(--surface-3); color: var(--ink); }

/* ============================================================
   Layout shell
   ============================================================ */

.app {
  display: flex;
  min-height: 100vh;
}

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2.25rem 2.5rem 3.5rem;
  max-width: calc(var(--content-max) + var(--sidebar-w));
  transition: margin-left 340ms var(--ease-jelly);
}

.sidebar.collapsed ~ .main {
  margin-left: var(--sidebar-w-collapsed);
}

/* Center the content column once sidebar is fixed */
.main-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ============================================================
   Sidebar — the floating "island" rail (ported from the Mac app)
   Injected by js/sidebar.js. A lifted cream card on the canvas:
   one solid fill, one soft shadow, no border, no glass.
   ============================================================ */

.sidebar {
  position: fixed;
  top: 16px;
  left: 16px;
  width: calc(var(--sidebar-w) - 32px);   /* 208px — Mac island is 210 */
  height: calc(100vh - 32px);
  background: var(--island-surface);
  border-radius: var(--island-radius);
  box-shadow: var(--island-shadow);
  display: flex;
  flex-direction: column;
  padding: 16px 0 12px;
  overflow: hidden;
  /* island ⇄ circle morph: one jelly spring drives both axes */
  transition: width 340ms var(--ease-jelly), height 340ms var(--ease-jelly),
              border-radius 340ms var(--ease-jelly);
  z-index: 50;
}

/* The inner column keeps the island's expanded width so nothing reflows
   while the card shrinks into the circle — it just clips away. */
.sidebar > * { width: calc(var(--sidebar-w) - 32px); flex-shrink: 0; }

.sidebar.collapsed {
  width: 48px;
  height: 48px;
  border-radius: 24px;
}

/* Content dissolves on a quick, non-bouncy ease (Mac: sidebarFade 0.19s) */
.sidebar-header,
.sidebar-status,
.nav,
.user-section {
  transition: opacity 190ms ease-in-out;
}
.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-status,
.sidebar.collapsed .nav,
.sidebar.collapsed .user-section {
  opacity: 0;
  pointer-events: none;
}

/* --- App header: logo + wordmark + collapse ------------------------- */

.sidebar-header {
  padding: 0 14px 14px;
  display: flex;
  align-items: center;
}

/* In-drawer close button — only shown in the mobile drawer. */
.sidebar-close {
  display: none;
  margin-left: auto;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(141, 110, 99, 0.10);
  color: var(--island-ink);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 150ms ease-in-out, transform 120ms var(--ease-out);
}
.sidebar-close:hover { background: rgba(141, 110, 99, 0.18); }
.sidebar-close:active { transform: scale(0.92); }
.sidebar-close svg { width: 1.25rem; height: 1.25rem; }

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--island-brand);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.logo img {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  object-fit: contain;
}

.logo-text { transition: opacity 190ms ease-in-out; }

/* --- Clock status line ----------------------------------------------
   Mirrors the Mac island's quiet indicator. There is no JS wiring for
   this on the web, so it reads the dashboard clock card's own state
   classes through :has(). Pages without a clock card don't show it. */

.sidebar-status {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 15px 16px;
  font-size: 11px;
  font-weight: 500;
}

.sidebar-status-dot {
  position: relative;
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--clock-idle);
}

/* Pulse ring — transform + opacity only, and only while working. */
.sidebar-status-dot::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: inherit;
  opacity: 0;
}

.sidebar-status-text { color: rgba(58, 44, 26, 0.5); }
.sidebar-status-text[data-state="working"],
.sidebar-status-text[data-state="break"] { display: none; }

@supports selector(:has(*)) {
  .app:has(.clock-card) .sidebar-status { display: flex; }

  /* Working */
  .app:has(.clock-card.clocked-in) .sidebar-status-dot { background: var(--clock-work); }
  .app:has(.clock-card.clocked-in) .sidebar-status-dot::after {
    animation: island-dot-pulse 1.5s ease-in-out infinite;
  }
  .app:has(.clock-card.clocked-in) .sidebar-status-text[data-state="out"] { display: none; }
  .app:has(.clock-card.clocked-in) .sidebar-status-text[data-state="working"] {
    display: inline;
    color: var(--clock-work-ink);
  }

  /* On break — same accent, no pulse */
  .app:has(.clock-card.on-break) .sidebar-status-dot { background: var(--clock-break); }
  .app:has(.clock-card.on-break) .sidebar-status-dot::after { animation: none; }
  .app:has(.clock-card.on-break) .sidebar-status-text[data-state="out"],
  .app:has(.clock-card.on-break) .sidebar-status-text[data-state="working"] { display: none; }
  .app:has(.clock-card.on-break) .sidebar-status-text[data-state="break"] {
    display: inline;
    color: #B77E1F;
  }
}

@keyframes island-dot-pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* --- Section labels + nav rows --------------------------------------- */

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding: 0 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(141, 110, 99, 0.55);
  padding: 0 10px 8px;
}
.nav-section-label + .nav-section-label { padding-top: 0; }

/* The NAV array's `{ divider: true }` entry renders the "More" label. */
.nav-divider {
  padding-top: 18px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--island-nav-text);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: background-color 150ms ease-in-out, color 150ms ease-in-out,
              transform 140ms var(--ease-out);
  white-space: nowrap;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--island-nav-icon);
  transition: color 150ms ease-in-out;
}

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { background: rgba(141, 110, 99, 0.08); }
  .nav-item:hover svg { color: var(--island-brand); }
}
.nav-item:active { transform: scale(0.97); transition-duration: 100ms; }

/* Active = filled brown pill with a soft brown lift (NavigationMenuItem) */
.nav-item.active {
  background: var(--island-brand);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(141, 110, 99, 0.28);
}
.nav-item.active svg,
.nav-item.active:hover svg { color: #FFFFFF; }
.nav-item.active:hover { background: var(--island-brand); }

/* Warm focus ring instead of the browser's blue one. */
.nav-item:focus-visible,
.user-section:focus-visible,
.sidebar-collapse-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(141, 110, 99, 0.35);
}

.nav-item-label { transition: opacity 190ms ease-in-out; }

/* --- Bottom profile block -------------------------------------------- */

.sidebar-footer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 8px 0;
}
/* Soft divider above the profile block, inset like the Mac island's. */
.sidebar-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: var(--island-hairline);
}
.sidebar.collapsed .sidebar-footer::before { display: none; }

.user-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background-color 150ms ease-in-out, transform 140ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .user-section:hover { background: rgba(141, 110, 99, 0.10); }
}
.user-section:active { transform: scale(0.97); }

.user-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #E4D6CF;              /* islandBrand @ 16% over the cream */
  color: var(--island-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  overflow: hidden;
}

.user-info {
  flex: 1;
  min-width: 0;
  transition: opacity 190ms ease-in-out;
}
.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--island-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-email {
  font-size: 10.5px;
  color: rgba(58, 44, 26, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-section-gear {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: rgba(58, 44, 26, 0.4);
  transition: color 150ms ease-in-out;
}
.user-section:hover .user-section-gear { color: var(--island-brand); }

/* --- Collapse control ------------------------------------------------
   Expanded: a quiet row under the profile. Collapsed: it *is* the island
   — the card has shrunk to a 48px circle and this fills it. */

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  padding: 8px 12px;
  border-radius: 10px;
  color: rgba(58, 44, 26, 0.45);
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: background-color 150ms ease-in-out, color 150ms ease-in-out, transform 140ms var(--ease-out);
}
.sidebar-collapse-btn:hover { background: rgba(141, 110, 99, 0.08); color: var(--island-brand); }
.sidebar-collapse-btn:active { transform: scale(0.97); }

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 340ms var(--ease-jelly);
}
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

.sidebar-collapse-btn span { transition: opacity 190ms ease-in-out; }

.sidebar.collapsed .sidebar-footer {
  position: absolute;
  inset: 0;
  width: 48px;
  padding: 0;
  margin: 0;
}
/* Absolute so the (faded-out) profile row above it can't push the control
   out of the 48px circle. */
.sidebar.collapsed .sidebar-collapse-btn {
  position: absolute;
  inset: 0;
  width: 48px;
  height: 48px;
  justify-content: center;
  padding: 0;
  gap: 0;
  color: var(--island-brand);
  border-radius: 24px;
}
.sidebar.collapsed .sidebar-collapse-btn svg { width: 18px; height: 18px; }
.sidebar.collapsed .sidebar-collapse-btn span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ============================================================
   Page header
   ============================================================ */

/* Mac: dashboardGreetingSection — 24pt bold warm-brown greeting over a
   14pt medium date line. */
.page-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--island-ink);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: rgba(58, 44, 26, 0.45);
}

/* ============================================================
   Surfaces & utilities
   ============================================================ */

.surface {
  background: var(--surface);
  border-radius: var(--r-lg);
}

.tonal {
  background: var(--surface-2);
  border-radius: var(--r-lg);
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.75rem 0 0.75rem;
}

/* Mac: the "Today" section header — 20pt semibold in the warm brown.
   Scoped to .section-header so the account drawer's small caps title
   (.section-block .section-title) is untouched. */
.section-header .section-title {
  font-size: 20px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--clock-label-brown);
}

.section-link {
  font-size: 0.8125rem;
  color: rgba(58, 44, 26, 0.5);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: color 160ms var(--ease-out);
}
/* Animate the trailing arrow alone — text stays put, arrow walks. */
.section-link::after {
  content: " →";
  display: inline-block;
  margin-left: 0.125rem;
  transition: transform 240ms var(--ease-out);
}
.section-link:hover { color: var(--island-brand); }
.section-link:hover::after { transform: translateX(3px); }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--r-pill);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  border: none;
  cursor: pointer;
  transition:
    background 220ms var(--ease-out),
    color 220ms var(--ease-out),
    transform 220ms var(--ease-out),
    box-shadow 260ms var(--ease-out),
    opacity 220ms var(--ease-out);
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { cursor: not-allowed; }

/* Hover lift + gentle grow — only on real pointer devices */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1.5px) scale(1.02); }
}

/* Press: depress + shrink. Faster than the hover-rise so it feels weighted. */
.btn:active {
  transform: translateY(1px) scale(0.97);
  transition: transform 110ms var(--ease-out), background 120ms var(--ease-out), box-shadow 110ms var(--ease-out);
}

/* Keyboard focus — warm ring, never the browser default */
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.28);
}


/* Loading pulse — scoped to the clock-card so it outranks the entrance
   animation that lives on the same buttons. */
.clock-card .btn:disabled,
.clock-card .btn[disabled] {
  animation: btn-loading 1.4s ease-in-out infinite;
}

@keyframes btn-loading {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.9; }
}

.btn svg { width: 1rem; height: 1rem; }

.btn-primary {
  background: var(--espresso);
  color: var(--cream);
}
.btn-primary:hover { background: #161311; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--ink);
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--ink-3);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* ============================================================
   Clock card — the Mac home "dial" stage
   A lifted cream island (#FCF8F1) on the canvas: solid fill, one soft
   shadow, no glass. The colour lives in the dial, not the card.
   ============================================================ */

.clock-card {
  position: relative;
  background: var(--island-surface);
  color: var(--island-ink);
  border-radius: var(--island-radius);
  box-shadow: var(--island-shadow);
  padding: 22px 28px 30px;
  overflow: hidden;
  text-align: center;
}

/* Clock-out flourish: a flat warm-red wash that fades in on opacity only. */
.clock-card-red-overlay {
  position: absolute;
  inset: 0;
  background: #F7E4E1;
  opacity: 0;
  border-radius: inherit;
  transition: opacity 320ms var(--ease-out);
  pointer-events: none;
  z-index: 0;
}
.clock-card-red-overlay.active { opacity: 1; }
.clock-card > *:not(.clock-card-red-overlay) { position: relative; z-index: 1; }

/* --- Status line ------------------------------------------------------ */

.clock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  min-height: 20px;
}

.clock-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  position: relative;
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--clock-idle);
  transition: background-color 240ms var(--ease-out);
}

/* Pulse ring — transform + opacity only, and only while actually working. */
.status-dot::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: inherit;
  opacity: 0;
}
.clock-card.clocked-in .status-dot::after {
  animation: island-dot-pulse 1.5s ease-in-out infinite;
}

.clock-card.clocked-in .status-dot { background: var(--clock-work); }
.clock-card.on-break   .status-dot { background: var(--clock-break); }
.clock-card.clocking-out .status-dot { background: var(--clock-idle); }

.status-text {
  font-size: 12px;
  font-weight: 500;
  color: rgba(58, 44, 26, 0.5);
  transition: color 240ms var(--ease-out);
}
.clock-card.clocked-in .status-text { color: var(--clock-work-ink); }
.clock-card.on-break   .status-text { color: #B77E1F; }

.clock-time-info {
  font-size: 12px;
  font-weight: 500;
  color: rgba(58, 44, 26, 0.42);
}
.clock-time-info span {
  color: var(--island-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- The dial + break bubble ------------------------------------------ */

.clock-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.25rem;
}

/* Big 148px circle — Mac's clockButton. White idle base with a warm
   hairline; the state colour is a flat fill, not a gradient. */
.clock-card .btn.clock-dial {
  flex-direction: column;
  gap: 2px;
  width: 148px;
  height: 148px;
  padding: 0;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid rgba(58, 44, 26, 0.06);
  color: var(--clock-label-brown);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 6px 16px rgba(58, 44, 26, 0.09);
  transition: background-color 300ms var(--ease-out), color 300ms var(--ease-out),
              border-color 300ms var(--ease-out), transform 220ms var(--ease-out);
}
.clock-card .btn.clock-dial svg { width: 22px; height: 22px; }
.clock-card .btn.clock-dial span { white-space: nowrap; }

/* On break the clock-out dial becomes "Resume Shift" (mobile's flow: resume
   first, clock out second). Only the glyph and the slightly smaller label are
   state-driven here — the click target and text come from the page module. */
.clock-card .btn.clock-dial .dial-icon-play { display: none; }
.clock-card.on-break .btn.clock-dial .dial-icon-stop { display: none; }
.clock-card.on-break .btn.clock-dial .dial-icon-play { display: block; }
.clock-card.on-break .btn.clock-dial { font-size: 16px; }

@media (hover: hover) and (pointer: fine) {
  .clock-card .btn.clock-dial:hover { transform: scale(1.03); }
}
.clock-card .btn.clock-dial:active { transform: scale(0.97); transition-duration: 110ms; }

/* Working — green bloom (rgb 102,204,128) */
.clock-card.clocked-in .btn.clock-dial {
  background: var(--clock-work);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(102, 204, 128, 0.35);
}
/* On break — amber */
.clock-card.on-break .btn.clock-dial {
  background: var(--clock-break);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(245, 186, 84, 0.35);
}
/* Clocking out — warm red */
.clock-card.clocking-out .btn.clock-dial {
  background: var(--clock-idle);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(216, 86, 78, 0.32);
}

/* Mac's white progress ring. There is no progress value on the web, so it
   reads as a slow breathing ring — transform + opacity only. */
.clock-card.clocked-in .btn.clock-dial::after,
.clock-card.on-break .btn.clock-dial::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;                 /* centres without needing transform */
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 7px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.clock-card.clocked-in .btn.clock-dial::after {
  animation: dial-ring 1.6s ease-in-out infinite alternate;
}

@keyframes dial-ring {
  from { transform: scale(1);    opacity: 0.5; }
  to   { transform: scale(1.08); opacity: 0.85; }
}

/* Break bubble — the mobile app's pause control: a 40px white circle with an
   orange glyph and an orange-tinted lift, sitting under the dial. Icon only, no
   label (iOS DashboardView.breakButton, DeviceSize.breakButtonDiameter = 40).
   Starts breaks only; the page module hides it while one is running, because
   resuming happens on the dial. */
.clock-card .btn.clock-break {
  width: 40px;
  height: 40px;
  padding: 0;
  gap: 0;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #FFFFFF;
  border: none;
  color: var(--clock-break);
  box-shadow: 0 2px 6px rgba(245, 186, 84, 0.30);
  transition: background-color 220ms var(--ease-out), color 220ms var(--ease-out),
              transform 220ms var(--ease-out);
}
.clock-card .btn.clock-break .break-icon { width: 16px; height: 16px; }

@media (hover: hover) and (pointer: fine) {
  .clock-card .btn.clock-break:hover { transform: translateY(-1px); background: #FFF8EC; }
}
.clock-card .btn.clock-break:active { transform: scale(0.97); transition-duration: 110ms; }

/* Label kept in the DOM for assistive tech — it is the icon-only bubble's
   only text. The bubble is always "Take Break": ending one happens on the
   dial, which has a visible label of its own. */
.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;
}

/* --- Timer + label ---------------------------------------------------- */

.clock-center { text-align: center; }

.clock-timer {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 0.375rem;
  color: var(--island-ink);
}

.clock-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: rgba(58, 44, 26, 0.45);
  transition: color 300ms var(--ease-out);
}
.clock-card.clocked-in .clock-label { color: var(--clock-work-ink); }
.clock-card.on-break   .clock-label { color: #B77E1F; }
.clock-card.clocking-out .clock-label { color: #B54B44; }

/* --- State transition choreography ----------------------------------
   The page module toggles `display: none/flex` on the buttons. A CSS
   animation fires when an element enters layout, which is a free hook to
   choreograph the swap without touching the JS. Transform/opacity only.
   --------------------------------------------------------------------- */

@keyframes btn-emerge {
  0%   { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes timer-rise {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.clock-card:not(.clocked-in):not(.on-break):not(.clocking-out) .btn-primary {
  animation: btn-emerge 320ms var(--ease-jelly) both;
}
.clock-card.clocked-in   .btn-clock-out,
.clock-card.on-break     .btn-clock-out,
.clock-card.clocking-out .btn-clock-out {
  animation: btn-emerge 340ms var(--ease-jelly) both;
}
/* Only `clocked-in` — the bubble is hidden on break, so this also plays the
   re-entry when a break ends and the pause control comes back. */
.clock-card.clocked-in .btn-break {
  animation: btn-emerge 320ms var(--ease-jelly) 90ms both;
}

.clock-card.clocked-in   .clock-timer,
.clock-card.on-break     .clock-timer,
.clock-card.clocking-out .clock-timer {
  animation: timer-rise 340ms var(--ease-out) both;
}

/* ============================================================
   Today stat row — Mac's two-card "Today" section, in cream
   ============================================================ */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 0;
}

.stat {
  background: var(--island-card);
  border-radius: 20px;
  box-shadow: var(--island-shadow);
  padding: 16px 18px;
  transition: transform 240ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .stat:hover { transform: translateY(-2px); }
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(58, 44, 26, 0.5);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--island-ink);
  font-variant-numeric: tabular-nums;
}

.stat-value.green { color: var(--clock-work-ink); }

/* ============================================================
   Week chart
   ============================================================ */

.chart-card {
  background: var(--island-card);
  border-radius: 20px;
  box-shadow: var(--island-shadow);
  padding: 20px 20px 18px;
}

.chart {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 150px;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
}

.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* The track gives the bar a definite height to size its inline `height: n%`
   against — as a flex-column child the bar alone resolved to zero. */
.chart-bar-track {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
}

/* Scoped to the track: the analytics page reuses the bare `.chart-bar` class
   inside a different wrapper, and an unscoped `position: absolute` here escaped
   onto it and anchored its bars over the week labels. */
.chart-bar-track .chart-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 28px;
  background: #DCC8BA;
  border-radius: 6px;
  transform-origin: bottom;
  transform: scaleY(0.02);
  animation: bar-grow 600ms var(--ease-out) forwards;
  transition: background-color 180ms ease-in-out;
}
.chart-bar-track .chart-bar.today { background: var(--island-brand); }

@media (hover: hover) and (pointer: fine) {
  .chart-bar-group:hover .chart-bar { background: #C7AE9E; }
  .chart-bar-group:hover .chart-bar.today { background: #7C5F55; }
  .chart-bar-group:hover .chart-day { color: var(--island-ink); }
}

.chart-bar-group:nth-child(1) .chart-bar { animation-delay: 40ms; }
.chart-bar-group:nth-child(2) .chart-bar { animation-delay: 80ms; }
.chart-bar-group:nth-child(3) .chart-bar { animation-delay: 120ms; }
.chart-bar-group:nth-child(4) .chart-bar { animation-delay: 160ms; }
.chart-bar-group:nth-child(5) .chart-bar { animation-delay: 200ms; }
.chart-bar-group:nth-child(6) .chart-bar { animation-delay: 240ms; }
.chart-bar-group:nth-child(7) .chart-bar { animation-delay: 280ms; }

@keyframes bar-grow {
  from { transform: scaleY(0.02); }
  to   { transform: scaleY(1); }
}

.chart-day {
  font-size: 11px;
  color: rgba(58, 44, 26, 0.45);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 180ms ease-in-out;
}
.chart-day.today { color: var(--island-brand); font-weight: 600; }

.chart-summary {
  display: flex;
  justify-content: space-between;
  padding-top: 1rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--island-hairline);
}

.chart-summary-item { text-align: left; }
.chart-summary-item + .chart-summary-item { text-align: center; }
.chart-summary-item:last-child { text-align: right; }

.chart-summary-value {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--island-ink);
  font-variant-numeric: tabular-nums;
}
.chart-summary-label {
  font-size: 11px;
  color: rgba(58, 44, 26, 0.45);
  font-weight: 500;
  margin-top: 2px;
}

/* ============================================================
   Profile panel (right drawer)
   ============================================================ */

.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms var(--ease-out), visibility 220ms var(--ease-out);
  z-index: 100;
}
.profile-overlay.active { opacity: 1; visibility: visible; }

.profile-panel {
  position: fixed;
  top: 0; right: 0;
  width: 100%;
  max-width: 380px;
  height: 100vh;
  background: var(--paper);
  transform: translateX(100%);
  transition: transform 320ms var(--ease-drawer);
  z-index: 101;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.profile-panel.active { transform: translateX(0); }

/* Wider for the full account experience */
.profile-panel.account-drawer { max-width: 420px; }

/* Scrollable body section so the header + close stay pinned */
.account-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.account-drawer-body .section-block { margin-bottom: 0; }
.account-drawer-body .account-profile-card { margin-bottom: 0; padding: 1.5rem 1.25rem; }
.account-drawer-body .account-profile-avatar {
  width: 4rem; height: 4rem; min-width: 4rem;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}
.account-drawer-body .btn-signout { margin-top: 0.25rem; }
.account-drawer-body .profile-footer {
  padding: 0.5rem 0 0;
  text-align: center;
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
}
.profile-panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.profile-panel-close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-3);
  transition: background 160ms var(--ease-out), transform 140ms var(--ease-out);
}
.profile-panel-close:hover { background: var(--surface-3); }
.profile-panel-close:active { transform: scale(0.94); }
.profile-panel-close svg { width: 1.125rem; height: 1.125rem; }

.profile-user {
  padding: 0.75rem 1.5rem 2rem;
  text-align: center;
}

.profile-user-avatar {
  width: 4.5rem;
  height: 4.5rem;
  min-width: 4.5rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--ink-3));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
  overflow: hidden;
}

.profile-user-name {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 0.125rem;
}

.profile-user-email {
  font-size: 0.8125rem;
  color: var(--muted);
}

.profile-section {
  padding: 0 1.5rem 1.25rem;
}

.profile-section-list {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 0.25rem 1rem;
}

.profile-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0.25rem 0.5rem;
}

.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 0;
}
.profile-item + .profile-item { border-top: 1px solid var(--hairline); }

.profile-item-label {
  font-size: 0.9375rem;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.profile-item-value {
  font-size: 0.9375rem;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.profile-signout {
  margin: 0.5rem 1.5rem;
  padding: 0.875rem 1rem;
  background: var(--red-soft);
  color: var(--red);
  border: none;
  border-radius: var(--r-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms var(--ease-out), transform 140ms var(--ease-out);
}
.profile-signout:hover { background: #EFCDC7; }
.profile-signout:active { transform: scale(0.98); }

.profile-footer {
  padding: 1rem 1.5rem 1.5rem;
  text-align: center;
  margin-top: auto;
}
.profile-footer-text {
  font-size: 0.6875rem;
  color: var(--muted-2);
}
.profile-footer-text a {
  color: var(--muted);
  text-decoration: none;
}
.profile-footer-text a:hover { text-decoration: underline; }

/* ============================================================
   Loading / data states
   ============================================================ */

.data-loading { opacity: 0.5; transition: opacity 180ms var(--ease-out); }
.data-loaded  { opacity: 1; }

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 4px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) {
  /* Tablet: behave like desktop — the collapse/expand button drives the
     sidebar through the global .collapsed rules, and the content margin
     follows via `.sidebar.collapsed ~ .main`.

     Previously the rail was hard-locked on plain `.sidebar` at this width,
     which overrode the width and left the expand button doing nothing. */
  .main { padding: 2rem 1.75rem 3rem; }
}

@media (max-width: 768px) {
  /* On phones the island becomes a slide-in drawer over the page.
     translateX keeps it on the GPU; only `transform` animates (no layout). */
  .sidebar,
  .sidebar.collapsed {
    top: 0;
    left: 0;
    width: min(308px, 84vw);
    height: 100vh;
    padding: 1rem 0 1rem;
    border-radius: 0 24px 24px 0;
    transform: translateX(-100%);
    transition: transform 300ms var(--ease-drawer);
    box-shadow: 0 10px 40px rgba(58, 44, 26, 0.22);
    z-index: 60;
    will-change: transform;
  }
  .sidebar.open,
  .sidebar.collapsed.open { transform: translateX(0); }
  .sidebar > * { width: 100%; }

  /* Inside the drawer always show full content — neutralise the desktop
     collapsed (island → circle) state. */
  .sidebar .logo-text,
  .sidebar .nav-item-label,
  .sidebar .user-info,
  .sidebar.collapsed .logo-text,
  .sidebar.collapsed .nav-item-label,
  .sidebar.collapsed .user-info {
    opacity: 1; width: auto; overflow: visible; pointer-events: auto;
  }
  .sidebar.collapsed .sidebar-header,
  .sidebar.collapsed .sidebar-status,
  .sidebar.collapsed .nav,
  .sidebar.collapsed .user-section {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar.collapsed .sidebar-footer {
    position: relative;
    width: 100%;
    padding: 11px 8px 0;
    margin: 0;
  }
  .sidebar.collapsed .sidebar-footer::before { display: block; }
  .sidebar .nav-item,
  .sidebar .user-section,
  .sidebar.collapsed .nav-item,
  .sidebar.collapsed .user-section {
    justify-content: flex-start;
    padding: 0.75rem 0.875rem;
    gap: 0.875rem;
  }
  /* The collapse button is meaningless in the full-width drawer. */
  .sidebar-collapse-btn,
  .sidebar.collapsed .sidebar-collapse-btn { display: none; }
  /* Show the in-drawer close button. */
  .sidebar-close { display: flex; }
  .sidebar-header { padding: 0 0.875rem 1rem; }
  .sidebar-status { padding: 0 1rem 1rem; }
  /* Hide the floating hamburger while the drawer is open. */
  body.sidebar-open .sidebar-toggle { opacity: 0; pointer-events: none; }

  .main { margin-left: 0; padding: 4rem 1rem 3rem; }
  .clock-card { padding: 1.25rem 1.25rem 1.75rem; }
  .clock-timer { font-size: 2.75rem; }
  .stats { grid-template-columns: 1fr; }
  .chart { gap: 0.375rem; }
}

/* ============================================================
   Mobile drawer chrome — hamburger + backdrop (injected by sidebar.js)
   ============================================================ */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem; left: 0.75rem;
  z-index: 70;
  width: 2.625rem; height: 2.625rem;
  align-items: center;
  justify-content: center;
  background: var(--island-surface);
  color: var(--island-brand);
  border: none;
  border-radius: 14px;
  box-shadow: var(--island-shadow);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 200ms var(--ease-out), background-color 150ms ease-in-out, transform 120ms var(--ease-out);
}
.sidebar-toggle:hover { background: #FFFDF8; }
.sidebar-toggle:active { transform: scale(0.94); }
.sidebar-toggle svg { width: 1.375rem; height: 1.375rem; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.42);
  z-index: 55;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms var(--ease-drawer), visibility 300ms var(--ease-drawer);
}
.sidebar-backdrop.active { opacity: 1; visibility: visible; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 120ms !important;
  }
  /* Must out-specify `.chart-bar-track .chart-bar`, which sets the pre-animation
     scaleY(0.02); a bare `.chart-bar` here would lose the cascade. */
  .chart-bar,
  .chart-bar-track .chart-bar { transform: scaleY(1); }
  /* Kill the looping pulses outright rather than running them at 0.01ms. */
  .status-dot::after,
  .sidebar-status-dot::after,
  .clock-card .btn.clock-dial::after {
    animation: none !important;
  }
}

/* ============================================================
   Shifts page
   ============================================================ */

#skeleton-container {
  opacity: 1;
  transition: opacity 220ms var(--ease-out);
}
#skeleton-container.hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  inset: 0;
}

#actual-content {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out);
}
#actual-content.loaded { opacity: 1; transform: translateY(0); }

.summary-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.summary-item + .summary-item {
  border-left: 1px solid var(--hairline);
  padding-left: 1.5rem;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.summary-value.green { color: var(--green); }

.summary-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* --- Filter bar (tabs + date dropdown) ------------------------------ */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0 1rem;
}

.filter-tabs {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}

.filter-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 220ms var(--ease-out), color 220ms var(--ease-out), transform 140ms var(--ease-out);
  letter-spacing: -0.005em;
}
.filter-tab:hover { color: var(--ink); }
.filter-tab:active { transform: scale(0.97); transition-duration: 90ms; }
.filter-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Date dropdown */
.date-dropdown { position: relative; }

.date-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  border-radius: var(--r-pill);
  border: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 220ms var(--ease-out), transform 140ms var(--ease-out), box-shadow 220ms var(--ease-out);
  box-shadow: 0 0 0 1px var(--hairline) inset;
}
.date-filter-btn:hover { background: #FFFFFF; box-shadow: 0 0 0 1px rgba(28, 25, 23, 0.12) inset; }
.date-filter-btn:active { transform: scale(0.98); transition-duration: 90ms; }
.date-filter-btn svg {
  width: 0.9375rem;
  height: 0.9375rem;
  opacity: 0.7;
}

.date-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 240px;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 0.375rem;
  box-shadow: 0 12px 32px rgba(28, 25, 23, 0.12), 0 0 0 1px var(--hairline);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96) translateY(-4px);
  transform-origin: top right;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 200ms var(--ease-out);
  z-index: 60;
}
.date-dropdown.open .date-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

.date-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out);
}
.date-dropdown-item:hover { background: var(--surface-2); color: var(--ink); }
.date-dropdown-item svg { width: 0.9375rem; height: 0.9375rem; opacity: 0.6; flex-shrink: 0; }

.date-dropdown-divider { height: 1px; background: var(--hairline); margin: 0.375rem 0.25rem; }

.custom-date-range { padding: 0.5rem 0.625rem; }
.custom-date-range-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.custom-date-inputs { display: flex; gap: 0.375rem; margin-bottom: 0.5rem; }
.custom-date-input {
  flex: 1;
  min-width: 0;
  padding: 0.4375rem 0.5rem;
  background: var(--surface-2);
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--ink);
  transition: background 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.custom-date-input:focus {
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.22);
}
.custom-date-apply {
  width: 100%;
  padding: 0.5rem;
  background: var(--espresso);
  color: var(--cream);
  border: none;
  border-radius: var(--r-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms var(--ease-out), transform 140ms var(--ease-out);
}
.custom-date-apply:hover { background: #161311; }
.custom-date-apply:active { transform: scale(0.98); transition-duration: 90ms; }

/* Filter summary chip */
.filter-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem 0.5rem 0.875rem;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  color: var(--ink-3);
  margin-bottom: 1rem;
}
.filter-summary-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border: none;
  background: transparent;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out);
}
.filter-summary-clear:hover { background: var(--surface-3); color: var(--ink); }
.filter-summary-clear svg { width: 0.8125rem; height: 0.8125rem; }

/* --- Shifts list ----------------------------------------------------- */

.shifts-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.shift-date-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shift-date-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-left: 0.25rem;
}

.shift-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: transform 220ms var(--ease-out), background 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
  position: relative;
}
@media (hover: hover) and (pointer: fine) {
  .shift-card:hover {
    transform: translateY(-1px);
    background: #FFFFFF;
    box-shadow: 0 6px 20px rgba(28, 25, 23, 0.06);
  }
}
.shift-card:active { transform: translateY(0) scale(0.995); transition-duration: 110ms; }

.shift-icon {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.shift-icon svg { width: 1.125rem; height: 1.125rem; }
.shift-icon.corrupt { background: var(--red-soft); color: var(--red); }

.shift-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.shift-time {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
}
.shift-meta { font-size: 0.8125rem; color: var(--muted); }

.shift-stats {
  display: flex;
  gap: 1.5rem;
  flex-shrink: 0;
}
.shift-stat { text-align: right; }
.shift-stat-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.shift-stat-value.green { color: var(--green); }
.shift-stat-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.125rem;
}

/* Active shift — green accent on the leading edge */
.shift-card-active {
  background: linear-gradient(90deg, rgba(46, 148, 97, 0.06), var(--surface) 30%);
  box-shadow: inset 3px 0 0 var(--green);
}
.shift-card-active .shift-icon { background: var(--green-soft); color: var(--green); }
.shift-card-active::after {
  content: 'Active';
  position: absolute;
  top: 0.625rem;
  right: 1.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  background: var(--green-soft);
  padding: 0.125rem 0.5rem;
  border-radius: var(--r-pill);
}

/* Corrupt shift */
.shift-card-corrupt {
  background: var(--red-soft);
  box-shadow: inset 3px 0 0 var(--red);
}
.shift-actions-corrupt { flex-shrink: 0; }
.delete-corrupt-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.75rem;
  background: rgba(184, 57, 46, 0.12);
  color: var(--red);
  border: none;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms var(--ease-out), transform 140ms var(--ease-out);
}
.delete-corrupt-btn:hover { background: rgba(184, 57, 46, 0.2); }
.delete-corrupt-btn:active { transform: scale(0.97); transition-duration: 90ms; }
.delete-corrupt-btn svg { width: 0.875rem; height: 0.875rem; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}
.empty-state svg {
  width: 2.5rem;
  height: 2.5rem;
  opacity: 0.45;
  margin: 0 auto 1rem;
  display: block;
}
.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.375rem;
  letter-spacing: -0.005em;
}
.empty-state p { font-size: 0.875rem; color: var(--muted); max-width: 28ch; margin: 0 auto; }

/* Skeleton (shifts page) */
.skeleton-summary {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.skeleton-summary > div { display: flex; flex-direction: column; gap: 0.5rem; }
.skeleton-summary .skeleton { height: 1.5rem; width: 70%; }
.skeleton-summary .skeleton.label { height: 0.625rem; width: 50%; }
.skeleton-shift {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--r-lg);
  margin-top: 0.5rem;
}
.skeleton-shift .skeleton.icon { width: 2.5rem; height: 2.5rem; border-radius: var(--r-md); }
.skeleton-shift .skeleton.line { height: 0.875rem; flex: 1; max-width: 60%; }
.skeleton-shift .skeleton.val { height: 1rem; width: 4rem; }

/* ============================================================
   Analytics page
   ============================================================ */

.period-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.period-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border-radius: var(--r-pill);
  padding: 4px;
}

.period-nav-btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 180ms var(--ease-out), transform 140ms var(--ease-out);
}
.period-nav-btn:hover { background: var(--surface-2); }
.period-nav-btn:active { transform: scale(0.92); transition-duration: 100ms; }
.period-nav-btn svg { width: 1rem; height: 1rem; }

.period-range-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  min-width: 10ch;
  text-align: center;
}

.period-tabs {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.period-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 220ms var(--ease-out), color 220ms var(--ease-out), transform 140ms var(--ease-out);
}
.period-tab:hover { color: var(--ink); }
.period-tab:active { transform: scale(0.97); transition-duration: 90ms; }
.period-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.period-today-btn {
  padding: 0.5rem 0.875rem;
  border-radius: var(--r-pill);
  border: none;
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--hairline) inset;
  transition: background 200ms var(--ease-out), transform 140ms var(--ease-out);
}
.period-today-btn:hover { background: #FFFFFF; }
.period-today-btn:active { transform: scale(0.97); transition-duration: 90ms; }
.period-today-btn.hidden { display: none; }

/* --- Earnings hero — espresso surface with the big number ---------- */

.earnings-hero {
  background: var(--espresso);
  color: var(--cream);
  border-radius: var(--r-xl);
  padding: 2.25rem 2.25rem 2rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.earnings-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(250, 247, 242, 0.55);
  margin-bottom: 0.75rem;
}

.earnings-amount {
  font-size: clamp(2.75rem, 7vw, 4rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.625rem;
}

.earnings-change {
  font-size: 0.8125rem;
  color: rgba(250, 247, 242, 0.6);
}
.earnings-change span {
  color: var(--green-soft);
  font-weight: 600;
  margin-right: 0.25rem;
}

/* --- Stats grid ----------------------------------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.375rem;
  transition: transform 240ms var(--ease-out), background 220ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .stat-card:hover { transform: translateY(-1px); background: #FFFFFF; }
}
.stat-card-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.625rem;
}
.stat-card-value {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.375rem;
}

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

.chart-section {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.chart-legend { font-size: 0.6875rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  height: 180px;
}

.chart-bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  height: 100%;
  cursor: pointer;
  position: relative;
}
.chart-bar-container {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.chart-bar-wrapper .chart-bar {
  width: 100%;
  max-width: 44px;
  background: var(--espresso);
  border-radius: 6px;
  transform-origin: bottom;
  animation: bar-grow 700ms var(--ease-out) both;
  transition: filter 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.chart-bar.earnings { background: var(--espresso); }
.chart-bar.hours { background: var(--accent); opacity: 0.55; }

.chart-bar-wrapper:nth-child(1) .chart-bar { animation-delay: 60ms; }
.chart-bar-wrapper:nth-child(2) .chart-bar { animation-delay: 120ms; }
.chart-bar-wrapper:nth-child(3) .chart-bar { animation-delay: 180ms; }
.chart-bar-wrapper:nth-child(4) .chart-bar { animation-delay: 240ms; }
.chart-bar-wrapper:nth-child(5) .chart-bar { animation-delay: 300ms; }
.chart-bar-wrapper:nth-child(6) .chart-bar { animation-delay: 360ms; }
.chart-bar-wrapper:nth-child(7) .chart-bar { animation-delay: 420ms; }

@media (hover: hover) and (pointer: fine) {
  .chart-bar-wrapper:hover .chart-bar { filter: brightness(1.18); transform: scaleY(1.02); }
  .chart-bar-wrapper:hover .chart-bar-label { color: var(--ink); }
}

/* Hover tooltip from data-value */
.chart-bar-wrapper[data-value]::after {
  content: attr(data-value);
  position: absolute;
  top: -2rem;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--espresso);
  color: var(--cream);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0.25rem 0.5rem;
  border-radius: var(--r-sm);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 180ms var(--ease-out), transform 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .chart-bar-wrapper:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.chart-bar-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  transition: color 180ms var(--ease-out);
}

/* --- Breakdown ------------------------------------------------------ */

.breakdown-section {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 0.5rem 1.5rem;
}
.breakdown-header { padding: 1rem 0 0.5rem; }
.breakdown-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.breakdown-list { display: flex; flex-direction: column; }
.breakdown-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--hairline);
}
.breakdown-item:first-child { border-top: none; }

.breakdown-icon {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.breakdown-icon svg { width: 1rem; height: 1rem; }

.breakdown-details { flex: 1; min-width: 0; }
.breakdown-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.breakdown-meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.125rem; }

.breakdown-value {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}
.breakdown-value.green { color: var(--green); }
.breakdown-value.red   { color: var(--red); }

/* --- Animation utility classes used inline in analytics ------------ */

.animate-fade-in-up {
  opacity: 0;
  transform: translateY(8px);
  animation: fade-in-up 480ms var(--ease-out) forwards;
}
.animate-fade-in-up.delay-1 { animation-delay: 40ms; }
.animate-fade-in-up.delay-2 { animation-delay: 100ms; }
.animate-fade-in-up.delay-3 { animation-delay: 160ms; }
.animate-fade-in-up.delay-4 { animation-delay: 220ms; }
.animate-fade-in-up.delay-5 { animation-delay: 280ms; }

@keyframes fade-in-up {
  to { opacity: 1; transform: translateY(0); }
}

/* --- Page-level responsive tweaks for shifts + analytics ----------- */

@media (max-width: 768px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .summary-item + .summary-item { border-left: none; padding-left: 0; }
  .summary-item:nth-child(odd) { padding-right: 0.5rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .date-dropdown-menu { left: 0; right: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .chart-bars { height: 140px; }
  .shift-card { padding: 0.875rem 1rem; gap: 0.75rem; }
  .shift-stats { gap: 1rem; }
  .shift-card-active::after { display: none; }
}

/* ============================================================
   Account page
   ============================================================ */

/* Hidden node that satisfies #userAvatar/#userInitial lookups
   without rendering a duplicate header avatar. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

#loadingState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 1rem;
}

#loadingState .spinner {
  width: 2rem;
  height: 2rem;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loadingState .loading-text {
  font-size: 0.8125rem;
  color: var(--muted);
}

#accountContent {
  opacity: 0;
  transform: translateY(6px);
  animation: fade-in-up 360ms var(--ease-out) 80ms forwards;
}

/* --- Profile card ---------------------------------------------------- */

.account-profile-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 2.25rem 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.account-profile-avatar {
  width: 5rem;
  height: 5rem;
  min-width: 5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--ink-3));
  color: var(--cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.875rem;
  font-weight: 600;
  margin: 0 auto 1rem;
  overflow: hidden;
}
.account-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.account-profile-name {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.25rem;
}
.account-profile-email {
  font-size: 0.875rem;
  color: var(--muted);
}

/* --- Settings list --------------------------------------------------- */

.section-block {
  margin-bottom: 1.5rem;
}

.section-block .section-title {
  display: block;
  margin: 0 0.25rem 0.5rem;
}

.list-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  transition: background 180ms var(--ease-out);
}
.list-item + .list-item { border-top: 1px solid var(--hairline); }

.list-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.list-item-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.list-item-value {
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.edit-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.75rem;
  background: var(--surface-2);
  border: none;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 200ms var(--ease-out), transform 140ms var(--ease-out), color 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .edit-chip:hover { background: var(--surface-3); color: var(--ink); }
}
.edit-chip:active { transform: scale(0.96); transition-duration: 90ms; }
.edit-chip svg { width: 0.8125rem; height: 0.8125rem; opacity: 0.7; }

/* --- Job profile rows (rendered by account-app.js) ------------------ */

.job-profile {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
}
.job-profile + .job-profile { border-top: 1px solid var(--hairline); }

.job-profile-icon {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.job-profile-icon svg { width: 1rem; height: 1rem; }
.job-profile-info { flex: 1; min-width: 0; }
.job-profile-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.job-profile-details {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.125rem;
}

/* --- Sign out -------------------------------------------------------- */

.btn-signout {
  display: block;
  width: 100%;
  padding: 0.875rem 1rem;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  color: var(--red);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 200ms var(--ease-out), border-color 200ms var(--ease-out), transform 140ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .btn-signout:hover { background: var(--red-soft); border-color: transparent; }
}
.btn-signout:active { transform: scale(0.985); transition-duration: 100ms; }

/* --- Edit modal ------------------------------------------------------ */

#editModalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms var(--ease-out), visibility 220ms var(--ease-out);
  z-index: 110;
}
#editModalOverlay.active { opacity: 1; visibility: visible; }

#editModal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: calc(100% - 2rem);
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--r-xl);
  z-index: 111;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.94);
  transform-origin: center;
  transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out), visibility 240ms var(--ease-out);
  box-shadow: 0 20px 60px rgba(28, 25, 23, 0.22);
  overflow: hidden;
}
#editModal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.edit-modal-header {
  padding: 1.25rem 1.5rem 0.75rem;
}
.edit-modal-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.edit-modal-body { padding: 0.5rem 1.5rem 1.25rem; }

.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--hairline);
}

.edit-modal-btn {
  padding: 0.625rem 1.125rem;
  border-radius: var(--r-pill);
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms var(--ease-out), transform 140ms var(--ease-out);
}
.edit-modal-btn:active { transform: scale(0.97); transition-duration: 90ms; }
.edit-modal-btn.cancel {
  background: var(--surface-2);
  color: var(--ink-3);
}
.edit-modal-btn.cancel:hover { background: var(--surface-3); }
.edit-modal-btn.save {
  background: var(--espresso);
  color: var(--cream);
}
.edit-modal-btn.save:hover { background: #161311; }
.edit-modal-btn:disabled { cursor: not-allowed; opacity: 0.6; }

/* Form fields used by account-app's modal innerHTML */
.edit-field { display: flex; flex-direction: column; gap: 0.5rem; }
.edit-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.edit-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 0.625rem 0.875rem;
  transition: background 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.edit-input-wrapper:focus-within {
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.28);
}
.edit-input-prefix,
.edit-input-suffix {
  font-size: 0.9375rem;
  color: var(--muted);
  font-weight: 500;
}
.edit-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.edit-input:focus { outline: none; }

.edit-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: none;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238B7355'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 1rem;
  padding-right: 2rem;
  transition: background-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.edit-select:focus {
  outline: none;
  background-color: var(--surface);
  box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.28);
}

.edit-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
  line-height: 1.5;
}
