/* =========================================================
   ExpressLink Couriers · Time Tracker
   Design tokens first, then base, layout, components, screens.
   Brand: deep teal on cool neutrals (light + dark pairs).
   ========================================================= */
:root {
  /* colour: brand tokens (unchanged) */
  --bg: #f4f6f7;
  --card: #ffffff;
  --ink: #14202b;
  --muted: #5d6b78;
  --line: #dde3e8;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f3f1;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn-soft: #fff4d6;

  /* colour: derived from the brand tokens */
  --surface-2: #eef1f3;                 /* quiet fill: inputs-at-rest, day chips, segmented track */
  --accent-press: #0b5f58;              /* pressed / hover on filled teal */
  --accent-line: #b9dfdb;               /* teal hairline */
  --ring: rgba(15, 118, 110, .28);      /* focus halo */
  --warn-ink: #7a4f00;
  --hairline: rgba(20, 32, 43, .08);
  --glass: rgba(255, 255, 255, .78);    /* translucent bars */

  /* spacing: 4px scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 48px;

  /* radius: concentric (outer = inner + padding) */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --radius: 16px;

  /* elevation */
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 2px 8px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-3: 0 18px 48px rgba(16, 24, 40, .22), 0 2px 8px rgba(16, 24, 40, .08);
  --shadow: var(--shadow-1);

  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --t-fast: 120ms; --t-med: 200ms; --t-slow: 320ms;

  /* type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --fs-title-l: clamp(1.75rem, 1.4rem + 1.6vw, 2.125rem);
  --fs-title: 1.3rem;
  --fs-head: 1.0625rem;
  --fs-body: 1rem;
  --fs-sub: .9rem;
  --fs-cap: .75rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1418;
    --card: #17202a;
    --ink: #e8eef3;
    --muted: #93a2b0;
    --line: #2a3744;
    --accent: #2dd4bf;
    --accent-ink: #052e2b;
    --accent-soft: #123a37;
    --danger: #ff8f84;
    --danger-soft: #3a1b18;
    --warn-soft: #3a3010;

    --surface-2: #1e2a35;
    --accent-press: #5eead4;
    --accent-line: #1f5a55;
    --ring: rgba(45, 212, 191, .35);
    --warn-ink: #f5c86a;
    --hairline: rgba(255, 255, 255, .08);
    --glass: rgba(23, 32, 42, .72);
    --shadow-1: 0 0 0 rgba(0, 0, 0, 0);
    --shadow-2: 0 1px 0 rgba(255, 255, 255, .03) inset;
    --shadow-3: 0 18px 48px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs-body)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 var(--s-3); letter-spacing: -.01em; }
h1 { font-size: var(--fs-title-l); font-weight: 700; letter-spacing: -.022em; }
h2 { font-size: var(--fs-title); font-weight: 650; }
h3 { font-size: var(--fs-head); font-weight: 650; }
a { color: var(--accent); text-underline-offset: 2px; }
.muted { color: var(--muted); }
.small-text { font-size: var(--fs-sub); }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.overline { font-size: var(--fs-cap); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s-1); }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
#main.enter > * { animation: rise var(--t-slow) var(--ease) both; }
#main.enter > *:nth-child(2) { animation-delay: 30ms; }
#main.enter > *:nth-child(3) { animation-delay: 60ms; }
#main.enter > *:nth-child(n+4) { animation-delay: 90ms; }

/* ---------- layout ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: var(--s-5) var(--s-4) 112px; }
@media (min-width: 721px) { .wrap { padding-top: var(--s-7); padding-bottom: 72px; } }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s-5);
  padding: 10px var(--s-4); padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--glass); border-bottom: 1px solid var(--hairline);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .topbar { background: var(--card); } }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand-logo, .brand-logo img { display: block; height: 30px; width: auto; }
.brand-app {
  padding-left: 12px; border-left: 1px solid var(--line); line-height: 22px;
  font-size: .78rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
@media (max-width: 1100px) { .brand-app { display: none; } }
#nav { display: flex; gap: 2px; flex: 1; }
#nav a {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: .95rem; white-space: nowrap; transition: background var(--t-fast), color var(--t-fast);
}
#nav a svg { display: none; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#nav a:hover { background: var(--surface-2); color: var(--ink); }
#nav a.active { background: var(--accent-soft); color: var(--accent); }

.who { position: relative; display: flex; align-items: center; margin-left: auto; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .8rem; letter-spacing: .02em; user-select: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.who-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px; border-radius: 999px; cursor: pointer; color: var(--ink); font: inherit; min-height: 44px; }
.who-btn:hover .avatar { box-shadow: 0 0 0 3px var(--accent-soft); }
.who-btn #whoName { font-size: .9rem; font-weight: 600; padding-right: 6px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: var(--s-2);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  animation: pop var(--t-med) var(--ease); transform-origin: top right;
}
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; border-bottom: 1px solid var(--hairline); margin-bottom: 6px; }
.menu-head b { display: block; line-height: 1.2; }
.menu-head span { font-size: .8rem; color: var(--muted); }
.menu .btn { width: 100%; justify-content: flex-start; }

@media (max-width: 960px) { #nav a { padding: 8px 11px; } .who-btn #whoName { display: none; } }

/* phones: translucent tab bar à la iOS */
@media (max-width: 720px) {
  /* a backdrop-filter on the top bar would trap the fixed tab bar inside it, so phones use a solid top bar */
  .topbar { padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); justify-content: space-between; background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
  #nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 0; flex: none;
    background: var(--glass); border-top: 1px solid var(--hairline);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { #nav { background: var(--card); } }
  #nav a {
    flex: 1; flex-direction: column; justify-content: center; gap: 3px; text-align: center; border-radius: 0;
    padding: 8px 2px 6px; font-size: .68rem; font-weight: 600; min-height: 56px; background: transparent !important; position: relative;
  }
  #nav a svg { display: block; transition: transform var(--t-med) var(--spring); }
  #nav a.active { color: var(--accent); }
  #nav a.active svg { transform: translateY(-1px) scale(1.08); }
  #nav a.active svg { fill: var(--accent-soft); }
  .who { margin-left: 0; }
  .brand-logo, .brand-logo img { height: 26px; }
}

/* ---------- surfaces ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-2); padding: var(--s-5); margin-bottom: var(--s-4);
}
.card > :last-child { margin-bottom: 0; }
.card > h2:first-child, .card > .card-title:first-child { margin-bottom: var(--s-4); }
.group { padding: 0; overflow: hidden; }
.group-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3);
  padding: 14px var(--s-5) 10px; font-size: var(--fs-cap); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.group-head b { color: var(--ink); font-size: .9rem; letter-spacing: 0; text-transform: none; }

.pagehead { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); }
.pagehead h1 { margin: 0; }

.row { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: end; }
.row > .field { flex: 1 1 180px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-4); }
.field > label, .label { font-size: .82rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; color: inherit; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; width: 100%; min-height: 48px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2393a2b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[type="file"] { padding: 6px; font-size: .9rem; color: var(--muted); }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 8px 14px; border: 0; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--accent-line); }
.field.needs input, .field.needs select { border-color: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, .22); }
.hint { font-size: .85rem; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* checkbox + iOS-style switch */
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 500; color: var(--ink); }
.check.switch { justify-content: space-between; flex-direction: row-reverse; }
.check.switch input {
  appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; border-radius: 999px; border: 0; padding: 0;
  background: var(--line); position: relative; cursor: pointer; transition: background var(--t-med) var(--ease); box-shadow: none;
}
.check.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform var(--t-med) var(--spring);
}
.check.switch input:checked { background: var(--accent); }
.check.switch input:checked::after { transform: translateX(20px); }
.check.switch input:focus-visible { box-shadow: 0 0 0 4px var(--ring); }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; letter-spacing: -.005em;
  min-height: 48px; padding: 0 var(--s-5); border-radius: var(--r-md); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); white-space: nowrap;
  transition: background var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast), color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--accent-press); }
:root:not([data-theme="light"]) .btn:hover { color: #031c1a; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn.is-loading { opacity: .5; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: var(--accent); }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); filter: brightness(.96); color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 var(--s-3); font-size: .875rem; border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn.link { background: transparent; color: var(--accent); min-height: 44px; padding: 0 12px; margin-left: -12px; }
.btn.link:hover { background: var(--accent-soft); color: var(--accent); }
.btn.link.danger-text { color: var(--danger); margin-left: 0; margin-right: -12px; }
.btn.link.danger-text:hover { background: var(--danger-soft); }
.btn .i { width: 18px; height: 18px; }
.btn.icon { width: 44px; padding: 0; min-height: 44px; }
.actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- segmented control & chips ---------- */
.seg, .chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.seg { gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--r-md); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg .chip { flex: 1 1 0; border: 0; background: transparent; border-radius: calc(var(--r-md) - 3px); min-height: 42px; padding: 0 var(--s-3); white-space: nowrap; color: var(--muted); }
.seg .chip:hover { color: var(--ink); }
.seg .chip[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--hairline), 0 1px 4px rgba(16, 24, 40, .1); }
:root:not([data-theme="light"]) .seg .chip[aria-pressed="true"] { background: var(--line); }
.seg .chip .ct { font-weight: 500; opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 6px 16px; min-height: 44px; font-weight: 600; font-size: .9rem;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

/* ---------- Log hours ---------- */
.hero { display: grid; gap: var(--s-5); margin-bottom: var(--s-5); }
.hero h1 { margin: 0; }
.hero-stats { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-5); }
.big { font-size: clamp(2.5rem, 2rem + 3vw, 3.5rem); font-weight: 750; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.big small { font-size: .38em; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.hero .k { color: var(--muted); font-weight: 600; font-size: .9rem; margin-top: 6px; }
.hero .k b { color: var(--ink); }
.spark { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 64px; width: min(240px, 52%); }
.spark span { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; font-size: .66rem; font-weight: 600; color: var(--muted); }
.spark i { display: block; width: 100%; min-height: 4px; border-radius: 5px; background: var(--accent-line); transform-origin: bottom; animation: grow var(--t-slow) var(--ease) both; }
.spark .on i { background: var(--accent); }
.spark .now { color: var(--accent); }
@keyframes grow { from { transform: scaleY(.1); opacity: 0; } }

.log-grid { display: grid; gap: 0 var(--s-6); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .log-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } .log-grid > .col-recent { position: sticky; top: 84px; } }
.log-card { padding: var(--s-5); }
.log-card h2 { margin-bottom: var(--s-4); }
.day-line { font-size: .9rem; color: var(--muted); margin: var(--s-2) 2px var(--s-5); min-height: 1.3em; }
.section-label { font-size: .82rem; font-weight: 600; color: var(--muted); margin: 0 0 var(--s-2) 2px; display: block; }

/* hour picker: the signature control */
.hp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
@media (min-width: 560px) { .hp-grid { grid-template-columns: repeat(6, 1fr); } }
.hp-btn {
  font: inherit; cursor: pointer; background: var(--surface-2); color: var(--ink);
  border: 1.5px solid transparent; border-radius: var(--r-md); padding: 10px 2px; min-height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15;
  transition: transform var(--t-med) var(--spring), background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.hp-btn b { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hp-btn span { font-size: .68rem; color: var(--muted); margin-top: 2px; }
.hp-grid:not(.all) .hp-btn.q { display: none; }
.hp-more { margin-top: var(--s-2); }
.hp-btn:hover { border-color: var(--accent-line); }
.hp-btn:active { transform: scale(.94); }
.hp-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.04); box-shadow: 0 6px 16px -4px var(--ring); }
.hp-btn[aria-pressed="true"] span { color: inherit; opacity: .85; }
.hp-other { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-4); flex-wrap: wrap; }
.stepper { display: flex; align-items: center; background: var(--surface-2); border-radius: var(--r-md); padding: 3px; }
.stepper .btn { width: 44px; min-height: 42px; padding: 0; background: var(--card); color: var(--accent); border-radius: calc(var(--r-md) - 3px); box-shadow: var(--shadow-1), 0 0 0 1px var(--hairline); font-size: 1.4rem; font-weight: 500; }
.stepper .btn:hover { background: var(--card); color: var(--accent-press); }
.stepper input { width: 88px; border: 0; background: transparent; text-align: center; font-weight: 700; font-size: 1.1rem; min-height: 42px; padding: 0; box-shadow: none; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { box-shadow: none; }
.hp-total {
  margin: var(--s-3) 0 0; padding: 12px 16px; border-radius: var(--r-md); background: var(--accent-soft);
  color: var(--accent); font-weight: 700; display: flex; justify-content: space-between;
}
.hp-total.empty-sel { background: var(--surface-2); color: var(--muted); font-weight: 500; }

/* save stays in reach: pinned just above the tab bar on phones */
.savebar { margin-top: var(--s-5); }
@media (max-width: 720px) {
  .savebar {
    position: sticky; bottom: calc(56px + env(safe-area-inset-bottom) + 8px); z-index: 5;
    margin: var(--s-4) calc(var(--s-5) * -1) calc(var(--s-5) * -1); padding: 12px var(--s-5) 14px;
    background: var(--glass); border-top: 1px solid var(--hairline); border-radius: 0 0 var(--radius) var(--radius);
    -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  }
}
.savebar .btn { min-height: 52px; font-size: 1.02rem; }

/* month switcher */
.mnav { display: flex; align-items: center; gap: var(--s-2); }
.mnav .btn { width: 44px; padding: 0; font-size: 1.6rem; line-height: 1; }
.mnav-label { min-width: 8.5em; text-align: center; }
.mnav.wide {
  justify-content: space-between; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 4px; margin-bottom: var(--s-4); box-shadow: var(--shadow-2);
}
.mnav.wide .btn { background: transparent; border-color: transparent; color: var(--accent); }
.mnav.wide .btn:hover { background: var(--accent-soft); }
.mnav.wide .btn:disabled { color: var(--muted); opacity: .35; }
.mnav.wide .mnav-label { font-size: 1.05rem; font-weight: 650; }

/* summary strip */
.summary {
  display: flex; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2); margin-bottom: var(--s-4); overflow: hidden;
}
.summary > div { flex: 1 1 110px; padding: var(--s-4) var(--s-5); border-left: 1px solid var(--line); }
.summary > div:first-child { border-left: 0; }
.summary .v { font-size: 1.75rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.summary .k { font-size: .78rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.summary .primary { background: var(--accent-soft); flex-grow: 1.4; }
.summary .primary .v { color: var(--accent); font-size: 2.1rem; }
@media (max-width: 560px) { .summary > div { flex: 1 1 40%; border-left: 0; border-top: 1px solid var(--line); } .summary > .primary { flex-basis: 100%; border-top: 0; } }

/* ---------- entries (grouped lists) ---------- */
.entry {
  position: relative; display: grid; grid-template-columns: 52px 1fr auto; gap: 0 var(--s-3); align-items: center;
  padding: 12px var(--s-5); min-height: 68px;
}
.entry::after { content: ""; position: absolute; left: calc(var(--s-5) + 52px + var(--s-3)); right: 0; bottom: 0; height: 1px; background: var(--hairline); }
.entry:last-child::after { display: none; }
.entry.pick { grid-template-columns: 26px 64px 1fr auto; cursor: pointer; }
.entry.pick::after { left: calc(var(--s-5) + 26px + var(--s-3)); }
.entry.pick:hover, .entry.tap:hover { background: var(--surface-2); }
.entry.tap { cursor: pointer; }
.entry.tap:active { background: var(--surface-2); }
.e-date { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; font-size: .9rem; }
.e-day {
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
  height: 52px; border-radius: var(--r-md); background: var(--surface-2); font-variant-numeric: tabular-nums;
}
.e-day b { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.e-day small { font-size: .64rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.entry.other .e-day { background: var(--accent-soft); }
.entry.other .e-day b { color: var(--accent); }
.e-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.e-who { font-weight: 650; }
.e-note { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; line-height: 1.3; }
.e-hours { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.e-hours .e-h { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.e-hours small { font-size: .7rem; font-weight: 500; color: var(--muted); }
.e-hours .chev { width: 16px; height: 16px; color: var(--muted); opacity: .6; }
.e-hours .chev.ghosted { visibility: hidden; }
.e-actions { display: none; }

/* pills / badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 650; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent; vertical-align: middle; line-height: 1.5; white-space: nowrap;
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.empty { text-align: center; padding: var(--s-7) var(--s-4); color: var(--muted); display: grid; gap: var(--s-2); justify-items: center; }
.empty b { color: var(--ink); font-size: var(--fs-head); }
.empty p { margin: 0; max-width: 34ch; }
.empty .btn { margin-top: var(--s-3); }
.empty-ic { width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: var(--s-2); }
.empty-ic svg { width: 26px; height: 26px; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-5); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5); box-shadow: var(--shadow-2); }
.stat .v { font-size: clamp(1.4rem, 5.6vw, 1.85rem); font-weight: 750; white-space: nowrap; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .k { font-size: .82rem; color: var(--muted); font-weight: 600; margin-top: 4px; }
.stat .sub { font-size: .78rem; margin-top: 8px; color: var(--muted); }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } .stats .hero-stat { grid-column: 1 / -1; } }
.stat.hero-stat { background: var(--accent-soft); border-color: transparent; }
@media (max-width: 720px) { .btn .lbl { display: none; } }
.stat.hero-stat .v { color: var(--accent); }
.stat .sub .bad { color: var(--danger); font-weight: 650; }

/* invoice + person lists */
.inv, .person {
  display: grid; grid-template-columns: 1fr auto; gap: 3px var(--s-3); align-items: center; padding: 14px var(--s-5);
  color: inherit; text-decoration: none; position: relative; min-height: 68px;
}
.inv::after, .person::after { content: ""; position: absolute; left: var(--s-5); right: 0; bottom: 0; height: 1px; background: var(--hairline); }
.inv:last-child::after, .person:last-child::after { display: none; }
.inv:hover, .person:hover { background: var(--surface-2); }
.inv-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.inv-main b { font-size: 1.02rem; }
.inv-amt { font-weight: 750; font-size: 1.1rem; letter-spacing: -.01em; text-align: right; font-variant-numeric: tabular-nums; }
.inv > .inv-main { grid-column: 1; grid-row: 1; }
.inv > .inv-amt { grid-column: 2; grid-row: 1; }
.inv > .inv-meta { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: .84rem; color: var(--muted); }
.inv-meta .late { color: var(--danger); font-weight: 650; }
@media (min-width: 721px) {
  .inv { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) auto; }
  .inv > .inv-meta { grid-column: 2; grid-row: 1; }
  .inv > .inv-amt { grid-column: 3; grid-row: 1; min-width: 110px; }
}
.person { grid-template-columns: 44px 1fr auto; }
.person::after { left: calc(var(--s-5) + 44px + var(--s-3)); }
.person .avatar { grid-row: span 2; }
.person .p-hrs { text-align: right; font-weight: 750; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.person .p-hrs small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); }
.person .p-sub { grid-column: 2 / -1; font-size: .82rem; color: var(--muted); }
.mcard { display: grid; }

table.t { width: 100%; border-collapse: collapse; }
table.t th, table.t td { padding: 10px 8px; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: middle; }
table.t th { font-size: .75rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
table.t td.r, table.t th.r { text-align: right; }
.scroll-x { overflow-x: auto; }
@media (max-width: 560px) { .card table.t { font-size: .8rem; } .card table.t th, .card table.t td { padding: 10px 5px; } table.t th { font-size: .64rem; letter-spacing: .02em; } }
.only-mobile { display: none; }
@media (max-width: 720px) { .only-mobile { display: block; } .only-desktop { display: none; } }

/* ---------- finance ---------- */
.fin-scope { margin: calc(var(--s-2) * -1) 0 var(--s-4); }
.stat .up { color: var(--accent); font-weight: 650; }
.stat .down { color: var(--muted); font-weight: 650; }
button.person { font: inherit; text-align: left; background: none; border: 0; width: 100%; cursor: pointer; color: inherit; }
.fchart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; height: 220px; align-items: stretch; }
.fcol { display: grid; grid-template-rows: 16px 1fr 18px; gap: 4px; min-width: 0; text-align: center; }
.fval { font-size: .66rem; font-weight: 650; color: var(--muted); white-space: nowrap; overflow: hidden; }
.fplot { display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.fbar { width: 100%; display: flex; flex-direction: column; border-radius: 6px 6px 2px 2px; overflow: hidden; transform-origin: bottom; animation: grow var(--t-slow) var(--ease) both; }
.fbar i, .flegend i { display: block; }
.fbar .pd, .flegend .pd { background: var(--accent); }
.fbar .unp, .flegend .unp { background: var(--accent-line); }
.flbl { font-size: .66rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; }
.fcol.cur .flbl, .fcol.cur .fval { color: var(--accent); }
.fcol:hover .fbar { filter: brightness(1.08); }
.flegend { display: flex; gap: var(--s-4); font-size: .8rem; color: var(--muted); margin-top: var(--s-3); }
.flegend span { display: inline-flex; align-items: center; gap: 6px; }
.flegend i { width: 12px; height: 12px; border-radius: 4px; }
.share-row { padding: 12px var(--s-5); position: relative; }
.share-row::after { content: ""; position: absolute; left: var(--s-5); right: 0; bottom: 0; height: 1px; background: var(--hairline); }
.share-row:last-child::after { display: none; }
.card:not(.group) .share-row { padding-left: 0; padding-right: 0; }
.card:not(.group) .share-row::after { display: none; }
.share-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); margin-bottom: 8px; }
.share { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.share i { display: block; height: 100%; border-radius: 999px; background: var(--accent); animation: grow-x var(--t-slow) var(--ease) both; transform-origin: left; }
@keyframes grow-x { from { transform: scaleX(.05); } }
.an-pair { display: grid; gap: 0 var(--s-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .an-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; } }
.fchart.wd, .fchart.moy { height: 190px; }
@media (max-width: 560px) {
  .fchart.keepvals .fcol .fval { visibility: visible; }
  .fchart.weeks .fcol:nth-child(even) .flbl { visibility: hidden; }
  .fchart { gap: 4px; height: 190px; }
  .fchart .fcol:not(.cur) .fval { visibility: hidden; } /* the table below lists every figure */
}

/* ---------- feedback ---------- */
.alert { padding: 12px 16px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); margin: var(--s-3) 0; font-weight: 550; font-size: .95rem; }
.notice { padding: 12px 16px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--ink); margin-bottom: var(--s-4); font-size: .93rem; }
.notice a { color: inherit; font-weight: 650; }
.notice.install {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  background: var(--accent-soft);
}
.notice.install .actions { flex: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translate(-50%, 24px) scale(.96); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  box-shadow: var(--shadow-3); transition: opacity var(--t-med) var(--ease), transform var(--t-slow) var(--spring); z-index: 80; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.err { background: var(--danger); color: #fff; }
@media (min-width: 721px) { .toast { bottom: 32px; } }

/* dialog: centred card on desktop, bottom sheet on phones */
dialog {
  border: 0; border-radius: var(--r-xl); padding: var(--s-6); width: min(540px, calc(100vw - 24px));
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-3);
  max-height: calc(100dvh - 24px); overflow: auto; animation: pop var(--t-med) var(--ease);
}
dialog::backdrop { background: rgba(8, 16, 24, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade var(--t-med) var(--ease); }
dialog h2 { margin-bottom: var(--s-4); }
@media (max-width: 720px) {
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--s-6) var(--s-5); padding-bottom: calc(var(--s-5) + env(safe-area-inset-bottom)); max-height: 92dvh; animation: sheet-up var(--t-slow) var(--ease); }
  dialog::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: -12px auto 16px; }
}

/* skeletons */
.sk { display: grid; gap: var(--s-3); }
.sk i { display: block; height: 16px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk i.h { height: 34px; width: 55%; }
.sk i.b { height: 76px; border-radius: var(--r-lg); }
.sk i.w { width: 70%; }

/* ---------- login ---------- */
.login-page { min-height: calc(100dvh - 140px); display: grid; align-content: center; }
.login { max-width: 400px; width: 100%; margin: 0 auto; padding: var(--s-7) var(--s-6); text-align: left; box-shadow: var(--shadow-2); }
.login-brand { display: grid; gap: var(--s-2); margin-bottom: var(--s-6); }
.login-logo, .login-logo img { display: block; height: 34px; width: auto; margin-bottom: var(--s-5); }
.login-brand h1 { margin: 0; font-size: 1.6rem; }
.login-brand p { margin: 0; }
.login-help { font-size: var(--fs-sub); text-align: center; margin: var(--s-4) 0 0; }

/* brand panel beside the form; always on the dark brand background, so it uses the dark logo */
.login-split {
  display: grid; grid-template-columns: 1fr 1fr; max-width: 920px; width: 100%; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-3); overflow: hidden;
}
.login-split .login { max-width: none; margin: 0; padding: var(--s-8) var(--s-7); box-shadow: none; align-self: center; }
.login-split .login .login-logo { display: none; }
.login-aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: var(--s-7);
  padding: var(--s-7); background: #0e1418; color: #e8eef3; min-height: 520px;
}
/* the logo's chevron, drawn large and faint behind the copy */
.login-aside::before, .login-aside::after {
  content: ""; position: absolute; right: -90px; width: 380px; height: 150px; background: #2dd4bf; opacity: .07;
}
.login-aside::before { bottom: 176px; clip-path: polygon(32% 0, 100% 0, 68% 100%, 0 100%); }
.login-aside::after { bottom: 16px; clip-path: polygon(0 0, 68% 0, 100% 100%, 32% 100%); }
.la-logo { position: relative; width: 100%; max-width: 280px; height: auto; display: block; }
.la-copy { position: relative; margin-top: auto; }
.la-copy .overline { color: #2dd4bf; }
.la-copy h2 { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 var(--s-5); color: #fff; }
.la-copy ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); color: #93a2b0; }
.la-copy li { display: flex; align-items: center; gap: var(--s-3); }
.la-copy li::before { content: ""; width: 14px; height: 9px; flex: none; background: #2dd4bf; clip-path: polygon(30% 0, 100% 0, 70% 100%, 0 100%); }
.la-foot { position: relative; margin: 0; font-size: var(--fs-cap); color: #93a2b0; }
@media (prefers-color-scheme: dark) { .login-aside { background: #0a1013; border-right: 1px solid var(--line); } }
@media (max-width: 760px) {
  .login-split { grid-template-columns: 1fr; max-width: 440px; border-radius: var(--r-xl); }
  .login-aside { display: none; }
  .login-split .login { padding: var(--s-7) var(--s-6); }
  .login-split .login .login-logo { display: block; }
}

/* first sign-in setup: one short step per screen inside the sign-in card */
.su h1 { margin: 0 0 var(--s-1); font-size: 1.6rem; }
.su .su-lead { margin: 0 0 var(--s-6); }
.su input { font-size: 1.05rem; }
.su .btn.block + .btn.block { margin-top: var(--s-2); }
.su-progress { display: flex; gap: 6px; margin-bottom: var(--s-5); }
.su-progress i { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-2); transition: background var(--t-med) var(--ease); }
.su-progress i.on { background: var(--accent); }
.su-step { color: var(--accent); }
.opt { font-weight: 500; opacity: .75; margin-left: 4px; }
.su-bank > .field:first-child { flex: 0 1 130px; }
.su-money { display: flex; align-items: center; gap: var(--s-2); }
.su-money input { flex: 0 1 140px; font-size: 1.35rem; font-weight: 650; }
.su-money span { color: var(--muted); font-weight: 600; }
.su-money span:first-child { font-size: 1.35rem; }
.su-choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.su-choice {
  display: grid; gap: 2px; text-align: left; padding: var(--s-3) var(--s-4); min-height: 64px; cursor: pointer;
  background: var(--card); color: var(--ink); border: 1.5px solid var(--line); border-radius: var(--r-md); font: inherit;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.su-choice span { font-size: var(--fs-sub); color: var(--muted); }
.su-choice:hover { border-color: var(--muted); }
.su-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.su-choice[aria-pressed="true"] b { color: var(--accent); }
.su-done { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--s-4); }
.su-done .i { width: 28px; height: 28px; stroke-width: 2.4; }
.su-sum { border: 1px solid var(--line); border-radius: var(--r-md); margin: var(--s-5) 0 var(--s-3); }
.su-line { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-4); }
.su-line + .su-line { border-top: 1px solid var(--line); }
.su-line span { color: var(--muted); flex: none; }
.su-line b { text-align: right; overflow-wrap: anywhere; }
.su-line b.missing { color: var(--warn-ink); font-weight: 550; }

/* footer under signed-in pages (hidden with the top bar on sign-in screens) */
#topbar:not([hidden]) ~ .wrap { padding-bottom: var(--s-6); }
.site-foot {
  max-width: 1040px; margin: 0 auto; padding: var(--s-5) var(--s-4) 72px; border-top: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center; gap: var(--s-2); flex-wrap: wrap; font-size: var(--fs-cap); color: var(--muted);
}
.site-foot img { display: block; height: 12px; width: auto; margin-right: 2px; }
#topbar[hidden] ~ .site-foot { display: none; }
@media (max-width: 720px) { .site-foot { padding-bottom: calc(96px + env(safe-area-inset-bottom)); } }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 52px; }
.input-wrap .eye { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); border-radius: var(--r-md); cursor: pointer; display: grid; place-items: center; }
.eye:hover { color: var(--ink); background: var(--surface-2); }

/* ---------- import past invoices ---------- */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--r-lg); padding: var(--s-7) var(--s-5); text-align: center;
  display: grid; justify-items: center; gap: var(--s-2); transition: background var(--t-med), border-color var(--t-med), transform var(--t-med) var(--ease);
}
.dropzone .empty-ic { margin-bottom: 4px; }
.dropzone p { margin: 0; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dropzone label.btn { cursor: pointer; margin-top: var(--s-2); }
.dropzone:focus-within label.btn { outline: 2px solid var(--accent); outline-offset: 2px; }
.im-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: var(--s-4) var(--s-5) var(--s-1); margin-bottom: var(--s-3); border-left: 4px solid var(--line); }
.im-row[data-state="done"] { opacity: .65; border-left-color: var(--accent); }
.im-row[data-state="error"] { border-color: var(--danger); border-left-color: var(--danger); }
.im-row[data-state="saving"] { border-left-color: var(--accent-line); }
.im-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); font-weight: 650; }
.im-head > span:last-child { flex: none; display: inline-flex; align-items: center; gap: 4px; }
.im-file { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-row .alert { margin-bottom: var(--s-3); }
.im-note { margin: -2px 0 var(--s-3); font-size: .9rem; color: var(--muted); }
.im-note.ok { color: var(--accent); font-weight: 550; }
.im-note.warn { color: var(--ink); background: var(--warn-soft); border-radius: var(--r-sm); padding: 8px 12px; }
.im-row input:disabled, .im-row select:disabled { opacity: .55; }
.importbar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: var(--s-3) var(--s-4);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
}
@media (max-width: 720px) { .importbar { bottom: calc(68px + env(safe-area-inset-bottom)); } }

/* ---------- invoice detail ---------- */
.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--s-2) var(--s-6); margin: 0; }
.facts dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.facts dd { margin: 0; }
.pdf-frame { display: block; width: 100%; height: 80vh; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; }
@media (max-width: 720px) { .pdf-frame { display: none; } }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; margin-bottom: var(--s-1); min-height: 32px; }
.back-link svg { width: 18px; height: 18px; }
.danger-zone { margin-top: var(--s-6); text-align: center; }
.danger-zone .hint { margin: var(--s-2) 0 0; }

/* ---------- settings ---------- */
.logo-box { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.logo-box img { max-height: 64px; max-width: 200px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; background: #fff; }
.logo-tile { width: 88px; height: 88px; border-radius: var(--r-lg); border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); background: var(--surface-2); flex: none; }
.set-sec { margin-bottom: var(--s-5); }
.set-sec > h2 { font-size: var(--fs-cap); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 650; margin: 0 0 var(--s-2) var(--s-2); }
.set-sec > .card { margin-bottom: 0; }
.set-sec > .hint { margin: var(--s-2) var(--s-2) 0; }
.set-savebar { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5; }
@media (min-width: 721px) { .set-savebar { bottom: 16px; } }
.set-savebar .inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px 10px var(--s-5); box-shadow: var(--shadow-3); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px); }

/* ---------- new invoice ---------- */
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-4); }
.step-head h2 { margin: 0; }
.step-n {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .82rem; font-weight: 750;
}
.totalbar {
  position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-5); box-shadow: var(--shadow-3);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
}
@media (min-width: 721px) { .totalbar { bottom: 16px; } }
.totalbar .tb-amt { font-size: 1.7rem; font-weight: 750; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.totalbar .tb-sub { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.totalbar .btn { min-height: 52px; padding: 0 var(--s-5); }
.totalbar #in-totals { flex: 1 1 auto; min-width: 0; }
@media (max-width: 720px) { .totalbar { flex-wrap: nowrap; gap: var(--s-3); } .totalbar .tb-amt { font-size: 1.45rem; } }
.pick-tools { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-2); }
.pick-box { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; max-height: 420px; overflow-y: auto; }
.pick-box .entry { min-height: 60px; padding: 10px var(--s-4); }
.pick-box .entry.pick::after { left: calc(var(--s-4) + 26px + var(--s-3)); }
.xrow { display: grid; grid-template-columns: 1fr 72px 100px 44px; gap: var(--s-2); align-items: start; margin-bottom: var(--s-2); }
.xrow .field { margin: 0; }
@media (max-width: 560px) { .xrow { grid-template-columns: 1fr 1fr 44px; } .xrow .xd { grid-column: 1 / -1; } }

/* ---------- the invoice sheet always renders as white paper ---------- */
.sheet {
  background: #fff; color: #111; border: 1px solid var(--line); border-radius: 8px;
  padding: 48px 48px 40px; max-width: 820px; margin: 0 auto; box-shadow: var(--shadow-3);
  font: 14px/1.5 var(--font); font-feature-settings: "tnum"; position: relative;
}
.sheet h1 { font-size: 30px; font-weight: 300; letter-spacing: .14em; margin: 0 0 12px; color: #111; }
.sheet .s-head { display: flex; justify-content: space-between; gap: 32px; margin-bottom: 36px; flex-wrap: wrap; padding-bottom: 28px; border-bottom: 3px solid #0f766e; }
.sheet .s-logo { max-height: 80px; max-width: 220px; margin-bottom: 10px; display: block; }
.sheet .s-name { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.sheet .s-meta { text-align: right; }
.sheet .s-meta div { margin-top: 3px; }
.sheet .s-meta .k { color: #6b7280; margin-right: 6px; }
.sheet .s-cols { display: flex; gap: 32px; margin-bottom: 28px; flex-wrap: wrap; }
.sheet .s-cols > div { flex: 1 1 240px; }
.sheet .s-label { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6b7280; margin-bottom: 6px; }
.sheet pre { font: inherit; margin: 0; white-space: pre-wrap; }
.sheet table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.sheet th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6b7280; border-bottom: 1px solid #111; padding: 10px 8px; }
.sheet td { padding: 11px 8px; border-bottom: 1px solid #eceef1; vertical-align: top; }
.sheet th.r, .sheet td.r { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .s-totals { margin-left: auto; width: 300px; max-width: 100%; }
.sheet .s-totals div { display: flex; justify-content: space-between; padding: 5px 8px; color: #374151; }
.sheet .s-totals .grand { background: #0f766e; color: #fff; border-radius: 8px; margin-top: 10px; padding: 12px 14px; font-size: 18px; font-weight: 700; }
.sheet .s-pay { margin-top: 32px; padding: 16px 18px; background: #f4f6f7; border-radius: 8px; }
.sheet .s-pay div { margin-top: 2px; }
.sheet .s-notes { margin-top: 20px; color: #374151; }
.sheet .paid-stamp { display: inline-block; border: 2.5px solid #0f766e; color: #0f766e; font-weight: 800; padding: 3px 14px; border-radius: 8px; transform: rotate(-6deg); margin-top: 12px; letter-spacing: .14em; font-size: 15px; }

@media (max-width: 560px) { .sheet { padding: 22px 18px; } .sheet .s-meta { text-align: left; } .sheet .s-totals { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .no-print, #nav, .topbar, .toast { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  #main.enter > * { animation: none; }
  .sheet { border: 0; box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  .sheet .s-meta { text-align: right; }
  .sheet .s-head { border-bottom-color: #0f766e; }
  .sheet .s-totals .grand, .sheet .s-head, .sheet .s-pay { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (min-width: 721px) { .stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* hours listed on an imported invoice */
.im-hours { border: 1px solid var(--line); border-radius: var(--r-md); margin: 0 0 var(--s-3); background: var(--surface-2); overflow: hidden; }
.im-hours > summary { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: 10px 14px; min-height: 48px; cursor: pointer; font-weight: 600; list-style: none; }
.im-hours > summary::-webkit-details-marker { display: none; }
.im-hours > summary b { color: var(--muted); font-weight: 600; margin-left: 6px; }
.im-hours-body { padding: var(--s-3) 14px 6px; background: var(--card); border-top: 1px solid var(--line); }
.im-hours-body .im-note { margin: 0 0 var(--s-2); }
.im-lines td, .im-lines th { padding: 6px 4px; white-space: nowrap; }
.im-lines input { min-height: 40px; padding: 6px 10px; min-width: 120px; }
.im-lines input[type="number"] { min-width: 84px; width: 96px; }
@media (max-width: 560px) {
  .im-lines thead { display: none; }
  .im-lines, .im-lines tbody { display: block; }
  .im-lines tr { display: grid; grid-template-columns: 1fr 92px 44px; gap: 6px 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
  .im-lines tr:last-child { border-bottom: 0; }
  .im-lines td { display: block; padding: 0; white-space: normal; border: 0; }
  .im-lines td:nth-child(1) { grid-column: 1; }
  .im-lines td:nth-child(2) { grid-column: 2; }
  .im-lines td:nth-child(6) { grid-column: 3; grid-row: 1; }
  .im-lines td:nth-child(3) { grid-column: 1; grid-row: 2; font-weight: 600; }
  .im-lines td:nth-child(4) { grid-column: 2 / 4; grid-row: 2; font-size: .85rem; }
  .im-lines td:nth-child(5) { grid-column: 1 / 4; grid-row: 3; }
  .im-lines input, .im-lines input[type="number"] { min-width: 0; width: 100%; }
}
@media (max-width: 560px) {
  table.t.im-lines td { border: 0; padding: 0; min-width: 0; }
  .im-lines tr { grid-template-columns: minmax(0, 1fr) 84px 40px; }
  .im-lines td input { min-width: 0; }
  .im-lines td input[type="date"] { padding-right: 6px; }
}
