/* Reap web app shell styles — tokens loaded by page */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--fg-default);
  background: var(--bg-page);
  min-height: 100vh;
}

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

/* Sidebar */
.sidebar {
  background: var(--bg-surface-2);
  border-right: 1px solid var(--border-default);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 20px;
}
.sidebar-brand .mark { width: 28px; height: 28px; }
.sidebar-brand .name {
  font-family: var(--font-display); font-size: 24px; font-weight: 500;
  letter-spacing: -0.02em; color: var(--fg-default);
  font-variation-settings: "opsz" 48, "SOFT" 40;
}
.workspace-switcher {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  background: transparent; border: 1px solid transparent;
  margin-bottom: 10px;
}
.workspace-switcher:hover { background: rgba(255,255,255,0.6); border-color: var(--border-subtle); }
.workspace-switcher .logo {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--reap-pine-500); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
}
.workspace-switcher .meta { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.workspace-switcher .title {
  font-family: var(--font-display); font-size: 15px; font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.1;
  font-variation-settings: "opsz" 24, "SOFT" 50;
}
.workspace-switcher .sub { font-size: 11px; color: var(--fg-muted); }

.nav-group-label {
  font-size: 10px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-subtle);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 13px; color: var(--fg-default);
  cursor: pointer; user-select: none;
  transition: background var(--dur-quick) var(--ease-standard);
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.7); }
.nav-item.active {
  background: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.nav-item.active .lucide { color: var(--fg-brand); }
.nav-item .lucide { width: 15px; height: 15px; color: var(--fg-muted); stroke-width: 1.75; flex: 0 0 15px; }
.nav-item .badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  background: var(--reap-pine-500); color: #fff;
  padding: 1px 6px; border-radius: 999px;
}

.sidebar-footer { margin-top: auto; padding: 12px 6px 0; border-top: 1px solid var(--border-subtle); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; height: 60px;
  background: rgba(252,250,244,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-default);
}
.topbar h1 {
  font-family: var(--font-display); font-size: 26px; font-weight: 500;
  letter-spacing: -0.02em; margin: 0;
  font-variation-settings: "opsz" 48, "SOFT" 40;
}
.topbar .sub { font-size: 13px; color: var(--fg-muted); }

.main { display: flex; flex-direction: column; min-width: 0; }
.screen { padding: 28px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none;
  transition: background var(--dur-quick) var(--ease-standard), transform var(--dur-quick);
  white-space: nowrap;
}
.btn .lucide { width: 14px; height: 14px; stroke-width: 1.75; }
.btn-primary { background: var(--reap-pine-500); color: #fff; }
.btn-primary:hover { background: var(--reap-pine-600); }
.btn-primary:active { background: var(--reap-pine-700); transform: translateY(1px); }
.btn-secondary { background: #fff; color: var(--fg-default); border: 1px solid var(--border-default); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--bg-surface-2); }
.btn-ghost { background: transparent; color: var(--fg-default); }
.btn-ghost:hover { background: var(--bg-surface-2); }
.btn-danger { background: var(--reap-clay-100); color: var(--reap-clay-700); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 8px; }

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-body { padding: 20px 24px; }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface);
}
.card-header h3 {
  font-family: var(--font-display); font-size: 17px; font-weight: 500;
  letter-spacing: -0.01em; margin: 0;
  font-variation-settings: "opsz" 24, "SOFT" 40;
}

/* Page header */
.page-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px;
}
.page-header h2 {
  font-family: var(--font-display); font-size: 38px; font-weight: 500;
  letter-spacing: -0.025em; margin: 0; line-height: 1.05;
  font-variation-settings: "opsz" 96, "SOFT" 40, "WONK" 0;
}
.page-header .muted {
  color: var(--fg-muted); font-style: italic;
  font-family: var(--font-display); font-size: 17px; font-weight: 400;
  font-variation-settings: "opsz" 18, "SOFT" 60;
}
.page-header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 500;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--fg-muted); padding: 10px 14px;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg-surface-2); }
.tbl .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl .right { text-align: right; }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.01em;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-moss { background: var(--reap-moss-100); color: var(--reap-moss-700); }
.pill-moss .pill-dot { background: var(--reap-moss-500); }
.pill-amber { background: var(--reap-amber-100); color: var(--reap-amber-700); }
.pill-amber .pill-dot { background: var(--reap-amber-500); }
.pill-clay { background: var(--reap-clay-100); color: var(--reap-clay-700); }
.pill-clay .pill-dot { background: var(--reap-clay-500); }
.pill-sky { background: var(--reap-sky-100); color: var(--reap-sky-700); }
.pill-sky .pill-dot { background: var(--reap-sky-500); }
.pill-ink { background: var(--bg-surface-2); color: var(--fg-default); }
.pill-ink .pill-dot { background: var(--fg-muted); }

/* Avatars */
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.avatar-lg { width: 36px; height: 36px; font-size: 13px; }

/* Inputs */
.input-group {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border-default);
  border-radius: 10px; padding: 7px 11px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-quick), box-shadow var(--dur-quick);
}
.input-group:focus-within { border-color: var(--reap-pine-500); box-shadow: var(--shadow-focus); }
.input-group .lucide { width: 14px; height: 14px; color: var(--fg-muted); stroke-width: 1.75; flex-shrink: 0; }
.input-group input, .input-group select {
  border: none; outline: none; flex: 1; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--fg-default); min-width: 0;
}
.input-group input::placeholder { color: var(--fg-placeholder); }

/* Stat */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 11px; color: var(--fg-muted); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 500; }
.stat-value { font-family: var(--font-mono); font-size: 26px; font-variant-numeric: tabular-nums; font-weight: 500; }
.stat-delta { font-size: 11px; color: var(--fg-muted); font-family: var(--font-mono); }
.stat-delta.up { color: var(--reap-moss-700); }
.stat-delta.down { color: var(--reap-clay-700); }

/* Sub-tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-default); margin-bottom: 18px; }
.tab {
  padding: 8px 14px; font-size: 13px; color: var(--fg-muted); font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: transparent; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--fg-default); }
.tab.active { color: var(--fg-default); border-bottom-color: var(--reap-pine-500); }

/* ── Floating Timer — full redesign ─────────────────────────── */
@keyframes ft-enter {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes ft-rec-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(239,68,68,0.55); }
  50%       { transform: scale(1.18); box-shadow: 0 0 0 6px rgba(239,68,68,0);   }
}
@keyframes ft-rec-outer {
  0%   { transform: scale(1);   opacity: 0.6; }
  70%  { transform: scale(2.2); opacity: 0;   }
  100% { transform: scale(2.2); opacity: 0;   }
}
@keyframes ft-glow {
  0%, 100% { box-shadow: 0 8px 28px rgba(0,0,0,0.28), 0 0 0 0   rgba(47,93,80,0);    }
  50%       { box-shadow: 0 8px 28px rgba(0,0,0,0.28), 0 0 0 8px rgba(47,93,80,0.18); }
}
@keyframes ft-tick-flash {
  0%   { color: #a7f3d0; }
  100% { color: #5ecea0; }
}

.ft {
  position: fixed; bottom: 28px; right: 24px; z-index: 200;
  display: flex; align-items: center;
  border-radius: 999px;
  animation: ft-enter 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition: box-shadow 400ms, transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Idle ── */
.ft-idle {
  gap: 11px; padding: 7px 18px 7px 7px; cursor: pointer;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  box-shadow: 0 4px 18px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.07);
}
.ft-idle:hover {
  transform: translateY(-3px);
  border-color: var(--reap-pine-400, #4ade80);
  box-shadow: 0 10px 28px rgba(0,0,0,0.13);
}
.ft-idle-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--reap-pine-500, #2F5D50);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(47,93,80,0.35);
  transition: box-shadow 200ms, transform 200ms;
}
.ft-idle:hover .ft-idle-icon {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(47,93,80,0.45);
}
.ft-idle-label { font-size: 13px; font-weight: 600; color: var(--fg-default); white-space: nowrap; }

/* ── Active ── */
.ft-active {
  gap: 12px; padding: 7px 7px 7px 10px; min-width: 350px;
  background: #141f1c;
  border: 1.5px solid rgba(255,255,255,0.07);
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
}
.ft-active:hover { transform: translateY(-2px); }
.ft-running { animation: ft-enter 420ms cubic-bezier(0.34,1.56,0.64,1) both, ft-glow 3.2s ease-in-out 1s infinite; }

/* ── Recording dot ── */
.ft-rec-wrap {
  position: relative; flex-shrink: 0;
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
}
.ft-rec-dot {
  display: block; width: 9px; height: 9px; border-radius: 50%;
  background: #ef4444; position: relative; z-index: 1;
  transition: background 300ms;
}
.ft-rec-outer {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(239,68,68,0.4);
}
.ft-running .ft-rec-dot  { animation: ft-rec-pulse 1.6s ease-in-out infinite; }
.ft-running .ft-rec-outer { animation: ft-rec-outer 1.6s ease-out infinite; }
.ft-paused  .ft-rec-dot  { background: rgba(255,255,255,0.2); }
.ft-paused  .ft-rec-outer { display: none; }

/* ── Body ── */
.ft-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ft-task { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft-sub  { font-size: 10px; color: rgba(255,255,255,0.38); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Digits ── */
.ft-digits {
  font-family: var(--font-mono); font-size: 19px; font-weight: 700; letter-spacing: 0.02em;
  color: #5ecea0; flex-shrink: 0; transition: color 120ms;
  min-width: 76px; text-align: right;
}
.ft-digits.ft-tick { animation: ft-tick-flash 180ms ease-out both; }
.ft-paused .ft-digits { color: rgba(255,255,255,0.28); }

/* ── Controls ── */
.ft-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ft-btn-icon {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.09);
  display: flex; align-items: center; justify-content: center;
  transition: background 150ms, transform 150ms;
}
.ft-btn-icon:hover { background: rgba(255,255,255,0.16); transform: scale(1.1); }
.ft-btn-stop {
  height: 32px; padding: 0 14px; border-radius: 999px; border: none; cursor: pointer;
  background: #b94a3a; color: #fff;
  font-size: 12px; font-weight: 600; display: flex; align-items: center;
  transition: background 150ms, transform 150ms, box-shadow 150ms;
  box-shadow: 0 2px 8px rgba(185,74,58,0.4);
}
.ft-btn-stop:hover {
  background: #9e3a2c;
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(185,74,58,0.55);
}

/* ── Auth screens ────────────────────────────────────────────────── */
@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes auth-form-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
  background: var(--bg-page);
  background-image:
    radial-gradient(ellipse 70% 40% at 50% -10%, rgba(47,93,80,0.10), transparent);
}
.auth-card {
  width: 100%;
  max-width: 436px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  padding: 36px 40px 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 26px;
  animation: auth-card-in 420ms cubic-bezier(0.34,1.56,0.64,1) both;
}
.auth-loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
}

/* Brand */
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand-name {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 500; letter-spacing: -0.02em;
  color: var(--fg-default);
  font-variation-settings: "opsz" 48, "SOFT" 40;
}

/* Heading */
.auth-heading { display: flex; flex-direction: column; gap: 3px; }
.auth-title   { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--fg-default); }
.auth-sub     { margin: 0; font-size: 13px; color: var(--fg-muted); }

/* Tabs */
.auth-tabs {
  display: flex; gap: 3px;
  background: var(--bg-surface-2);
  border-radius: 10px; padding: 3px;
}
.auth-tab {
  flex: 1; padding: 7px 10px; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: transparent; color: var(--fg-muted);
  transition: background 180ms, color 180ms, box-shadow 180ms;
}
.auth-tab.active {
  background: var(--bg-surface); color: var(--fg-default);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.09);
}

/* Form wrap — re-animates on mode change (key prop) */
.auth-form-wrap { animation: auth-form-in 220ms ease both; }

/* Form layout */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

/* Fields */
.auth-field  { display: flex; flex-direction: column; gap: 5px; }
.auth-label  { font-size: 13px; font-weight: 500; color: var(--fg-default); }
.auth-field-err  { font-size: 12px; color: #ef4444; }
.auth-field-hint { font-size: 12px; color: var(--fg-muted); }
.auth-pw-label-row { display: flex; justify-content: space-between; align-items: baseline; }

/* Password toggle */
.auth-pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--fg-muted); display: flex; align-items: center;
  transition: color 150ms;
}
.auth-pw-toggle:hover { color: var(--fg-default); }

/* Error input state */
.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12) !important;
}

/* Error banner */
.auth-err-banner {
  display: flex; align-items: center; gap: 9px;
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; color: #b91c1c; line-height: 1.4;
}

/* Remember me */
.auth-remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--fg-muted); cursor: pointer;
}

/* Submit button */
.auth-submit-btn {
  height: 42px; font-size: 14px; font-weight: 600;
  border-radius: 10px; margin-top: 2px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* Switch mode link */
.auth-switch { margin: 0; font-size: 13px; color: var(--fg-muted); text-align: center; }
.auth-link-btn {
  color: var(--reap-pine-600, #15803d); font-weight: 600;
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: inherit;
}
.auth-link-btn:hover { text-decoration: underline; }

/* Password strength */
.auth-strength { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.auth-strength-bars { display: flex; gap: 4px; flex: 1; }
.auth-strength-bar  { flex: 1; height: 3px; border-radius: 2px; transition: background 280ms; }
.auth-strength-label { font-size: 11px; font-weight: 600; min-width: 38px; text-align: right; transition: color 280ms; }

/* Forgot — sent state */
.auth-sent-state { align-items: flex-start; }
.auth-sent-icon  {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--reap-pine-50, #f0fdf4);
  border: 1px solid var(--reap-pine-200, #bbf7d0);
  display: flex; align-items: center; justify-content: center;
}

/* Spinner */
.auth-spinner {
  display: inline-block; flex-shrink: 0;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.65s linear infinite;
}
.auth-spinner-lg {
  width: 28px; height: 28px; border-width: 3px;
  border-color: var(--border-default);
  border-top-color: var(--reap-pine-500, #2F5D50);
}

/* Footer note */
.auth-footer-note {
  margin: 16px 0 0; font-size: 12px; color: var(--fg-subtle, var(--fg-muted));
  text-align: center; opacity: 0.6;
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 20px 32px; border-radius: 16px; }
  .auth-title { font-size: 19px; }
}

/* ── Onboarding Wizard ─────────────────────────────────────────────── */
.onboarding-card { text-align: center; }
.onboarding-card .auth-form { text-align: left; }

.ob-dots {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 20px;
}
.ob-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border-default); transition: background 0.2s, transform 0.2s;
}
.ob-dot-active { background: var(--reap-pine-600, #15803d); transform: scale(1.25); }
.ob-dot-done   { background: var(--reap-pine-400, #4ade80); }

.ob-icon-wrap {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--reap-pine-50, #f0fdf4);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

.ob-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ob-next-btn { width: 100%; justify-content: center; }
.ob-skip-btn { width: 100%; justify-content: center; color: var(--fg-muted); font-size: 13px; }

/* Utility */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }
.muted { color: var(--fg-muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-display); font-variation-settings: "opsz" 24, "SOFT" 50; }

/* Entity titles — company / project / client names get a serif polish */
.entity-title {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--fg-default); line-height: 1.2;
  font-variation-settings: "opsz" 20, "SOFT" 50;
}
.entity-title-lg {
  font-size: 19px; letter-spacing: -0.015em; line-height: 1.15;
  font-variation-settings: "opsz" 36, "SOFT" 40;
}
.entity-sub {
  font-family: var(--font-sans); font-size: 12.5px;
  color: var(--fg-muted);
}
.entity-monogram {
  width: 44px; height: 44px; border-radius: 10px;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 500; font-size: 17px;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 24, "SOFT" 40;
  flex-shrink: 0;
}
.hide { display: none !important; }

/* Progress bars */
.bar { height: 6px; background: var(--bg-surface-2); border-radius: 999px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; background: var(--reap-moss-500); border-radius: 999px; }
.bar-fill.warn { background: var(--reap-amber-500); }
.bar-fill.over { background: var(--reap-clay-500); }
.bar-fill.brand { background: var(--reap-pine-500); }

/* Inputs (standalone) */
.input {
  font-family: inherit; font-size: 13px; color: var(--fg-default);
  background: #fff; border: 1px solid var(--border-default);
  border-radius: 10px; padding: 8px 12px; outline: none;
  transition: border-color var(--dur-quick), box-shadow var(--dur-quick);
  width: 100%;
}
.input:focus { border-color: var(--reap-pine-500); box-shadow: var(--shadow-focus); }
select.input { appearance: auto; background: #fff; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(32, 26, 20, 0.45);
  backdrop-filter: blur(2px);
  display: flex; justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  animation: reap-fade-in 160ms var(--ease-standard, ease-out);
  align-items: center;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  box-shadow: var(--shadow-xl, 0 20px 60px rgba(0,0,0,0.2));
  width: 480px; max-width: 100%;
  display: flex; flex-direction: column;
  animation: reap-slide-up 200ms var(--ease-standard, ease-out);
  margin-bottom: 40px;
  max-height: calc(90vh - 80px);
}
.modal-lg { width: 640px; }
.modal-sm { width: 400px; }

/* Confirm modal */
.confirm-body { display: flex; gap: 14px; padding: 4px 2px; }
.confirm-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.confirm-icon.warn { background: var(--reap-amber-100); color: var(--reap-amber-700); }
.confirm-icon.danger { background: var(--reap-clay-100); color: var(--reap-clay-700); }
.confirm-icon.info { background: var(--reap-sky-100); color: var(--reap-sky-700); }
.confirm-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.confirm-text .t { font-size: 14px; font-weight: 600; color: var(--fg-default); }
.confirm-text .m { font-size: 13px; color: var(--fg-muted); line-height: 1.5; }
.btn-danger-solid { background: var(--reap-clay-500); color: #fff; }
.btn-danger-solid:hover { background: #8E3A2A; }
.modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

@keyframes reap-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes reap-slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Menu (dropdown) */
.menu {
  position: absolute; z-index: 50;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 180px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  font-size: 13px; cursor: pointer; color: var(--fg-default);
  user-select: none;
}
.menu-item:hover, .menu-item.active { background: var(--bg-surface-2); }

/* Toasts */
.toaster {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--reap-ink-900, #1B2620); color: #fff;
  padding: 10px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: reap-toast-in 220ms var(--ease-standard, ease-out);
  pointer-events: auto;
}
.toast-success { background: var(--reap-moss-700); }
.toast-error { background: var(--reap-clay-700); }
@keyframes reap-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Sidebar off-canvas (mobile) */
.sidebar-toggle { display: none; }
.sidebar-scrim { position: fixed; inset: 0; background: rgba(32,26,20,0.4); z-index: 40; }

/* Mobile bottom tab bar (hidden on desktop) */
.bottom-nav { display: none; }

/* Invoice builder line grid */
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.invoice-lines { display: flex; flex-direction: column; gap: 6px; }
.invoice-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 90px 110px 36px;
  gap: 8px; align-items: center;
}
.invoice-line-head {
  font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--fg-muted); padding: 0 4px;
}
.invoice-line-total {
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px; margin-top: 4px;
}
.modal-xl { width: 760px; }

/* Invoice letter (detail) */
.invoice-letter {
  background: var(--reap-ink-0); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 28px;
}
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.invoice-from { font-size: 24px; letter-spacing: -0.01em; }
.invoice-meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  padding: 14px 0; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}
.invoice-meta .lbl { font-size: 10px; color: var(--fg-muted); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.invoice-meta .val { font-size: 14px; font-weight: 500; }
.invoice-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.invoice-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.invoice-table th { text-align: left; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); padding: 8px 4px; border-bottom: 1px solid var(--border-subtle); font-weight: 500; }
.invoice-table td { padding: 10px 4px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.invoice-table tfoot td { border-bottom: none; padding-top: 16px; }
.invoice-table .right { text-align: right; }
.invoice-table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.invoice-notes {
  margin-top: 20px; padding: 16px; border-left: 3px solid var(--reap-pine-500);
  font-style: italic; color: var(--fg-default); background: rgba(47,93,80,0.05);
  border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.5;
}
.invoice-pay { margin-top: 14px; font-size: 12px; }

/* Table horizontal scroll container */
.tbl-scroll { width: 100%; overflow-x: auto; }

/* ==========  Harvest-inspired invoice document  ========== */
.inv-doc-stage {
  background: #fff; border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 32px 36px;
}
.inv-doc {
  background: #fff; color: #111;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 13px; line-height: 1.5;
}
.inv-doc .muted { color: #777; }
.inv-doc .bold { font-weight: 600; color: #111; }
.inv-doc-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; padding-bottom: 40px;
}
.inv-word {
  font-family: var(--font-display), 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 60px; font-weight: 500; letter-spacing: -0.01em;
  margin: 0; line-height: 1; color: #111;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
}
.inv-from-block {
  display: flex; align-items: flex-start; gap: 16px;
  padding-left: 16px; border-left: 1px solid #d8d8d8;
}
.inv-from-lbl { font-size: 12px; color: #777; padding-top: 3px; }
.inv-from-name {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 500; color: #111; letter-spacing: -0.01em;
  font-variation-settings: "opsz" 24, "SOFT" 40;
}
.inv-doc .bold {
  font-family: var(--font-display); font-weight: 500;
  font-size: 14.5px; letter-spacing: -0.005em;
  font-variation-settings: "opsz" 20, "SOFT" 50;
}

.inv-doc-meta {
  display: grid; grid-template-columns: 1.1fr 1fr;
  gap: 40px; padding-bottom: 32px;
}
.inv-meta-col { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.inv-meta-row { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: start; }
.inv-meta-row dt { font-size: 12px; color: #777; margin: 0; }
.inv-meta-row dd { font-size: 13px; color: #111; margin: 0; }
.inv-doc-meta .inv-meta-col:nth-child(2) .inv-meta-row { grid-template-columns: 80px 1fr; }

.inv-lines-wrap { width: 100%; overflow-x: auto; }
.inv-lines {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
  border-top: 1px solid #e5e5e5;
}
.inv-lines thead th {
  text-align: left; font-size: 12px; font-weight: 400; color: #777;
  padding: 14px 12px; border-bottom: 1px solid #e5e5e5; white-space: nowrap;
}
.inv-lines tbody tr:nth-child(odd) { background: #fff; }
.inv-lines tbody tr:nth-child(even) { background: #f7f7f7; }
.inv-lines tbody td {
  padding: 16px 12px; border-bottom: 1px solid #ececec;
  color: #222; vertical-align: top;
}
.inv-lines .right { text-align: right; }
.inv-lines .num { font-variant-numeric: tabular-nums; }
.inv-lines .empty { text-align: center; padding: 24px; }

.inv-totals-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 20px 12px 4px; gap: 16px;
}
.inv-total-hours { font-size: 13px; color: #333; }
.inv-amount-due { display: flex; gap: 18px; align-items: baseline; }
.inv-amount-due .big { font-size: 20px; font-weight: 600; }

.inv-notes-block { margin-top: 44px; padding-top: 20px; border-top: 1px solid #e5e5e5; }
.inv-notes-lbl { font-size: 13px; font-weight: 600; color: #111; margin-bottom: 8px; }
.inv-notes-body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12.5px; color: #333; white-space: pre-wrap;
  margin: 0; line-height: 1.55;
}

/* Print host — off-screen but laid out so html2canvas can capture.
   Visible during @media print. */
.print-host {
  position: fixed; left: -10000px; top: 0;
  width: 794px; /* A4 width @ 96dpi minus margins */
  background: #fff; padding: 24px 28px;
  z-index: -1; pointer-events: none;
}
.print-host .inv-doc { padding: 0; }

/* Print rules — hide browser chrome by reclaiming @page margins */
@page { size: A4; margin: 12mm; }
@media print {
  html, body { background: #fff !important; }
  body * { visibility: hidden; }
  .print-host, .print-host * { visibility: visible; }
  .print-host {
    position: absolute; left: 0; top: 0;
    width: 100%; padding: 0; background: #fff;
    z-index: auto;
  }
  .ft, .toaster, .modal-backdrop, .sidebar, .topbar, .sidebar-scrim { display: none !important; }
  .inv-lines tbody tr { page-break-inside: avoid; }
  .inv-lines tbody tr:nth-child(odd) { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv-lines tbody tr:nth-child(even) { background: #f7f7f7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Responsive */
@media (max-width: 1024px) {
  .invoice-meta { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .inv-doc-meta { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 260px; z-index: 50;
    transform: translateX(-100%);
    transition: transform 220ms var(--ease-standard, ease-out);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .content { padding: 18px 16px 140px; }
  .ft { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-sidebar, var(--bg-surface));
    border-top: 1px solid var(--border-subtle);
    z-index: 45;
    align-items: stretch;
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fg-muted);
    font-size: 10px;
    font-weight: 500;
    padding: 0 4px;
    transition: color 120ms;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item.active { color: var(--reap-pine-600, #2F5D50); }
  .bottom-nav-item:active { opacity: 0.65; }
  .screen { padding: 14px 16px; }
  .page-header { flex-wrap: wrap; }
  .page-header h2 { font-size: 26px; }
  .page-header .muted { font-size: 14px; }
  .page-header .right { margin-left: 0; flex-wrap: wrap; }
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 20px; }
  .topbar .sub { display: none; }
  .tbl-scroll, .card { overflow-x: auto; }
  .card-header { flex-wrap: wrap; gap: 10px; }
  .ft { right: 12px; left: 12px; border-radius: 18px; }
  .ft-active { min-width: 0; }
  .ft-digits { font-size: 16px; min-width: 60px; }
  .ft-sub { display: none; }
  .stat-value { font-size: 22px; }
  .modal { width: calc(100vw - 24px); margin: 0 12px; }
  .modal-xl, .modal-lg { width: calc(100vw - 24px); }
  .invoice-line { grid-template-columns: minmax(0, 1fr) 56px 72px 28px; gap: 4px; }
  .invoice-line input:nth-child(3) { display: none; } /* hide rate on mobile; total editable */
  .invoice-line-head span:nth-child(3) { display: none; }
  .invoice-line .input { padding: 6px 8px; font-size: 12px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; flex-shrink: 0; }
  [style*="grid-template-columns: repeat("] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .screen { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .invoice-meta { grid-template-columns: 1fr 1fr; }
  .invoice-head { flex-direction: column; gap: 10px; }
  .invoice-letter { padding: 18px; }
  .invoice-table { font-size: 12px; }
  .invoice-table th, .invoice-table td { padding: 6px 3px; }
  .invoice-table th:nth-child(3), .invoice-table td:nth-child(3) { display: none; }
  /* Harvest-style invoice — mobile */
  .inv-doc-stage { padding: 18px; }
  .inv-doc-top { flex-direction: column; align-items: flex-start; padding-bottom: 24px; gap: 14px; }
  .inv-from-block { padding-left: 0; border-left: none; }
  .inv-word { font-size: 38px; }
  .inv-meta-row { grid-template-columns: 90px 1fr; gap: 10px; }
  .inv-lines thead th, .inv-lines tbody td { padding: 10px 6px; font-size: 12px; }
  .inv-lines th:first-child, .inv-lines td:first-child { display: none; } /* hide Item type column */
  .inv-totals-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hero-ctas { flex-wrap: wrap; }
  .card-header .row { flex-wrap: wrap; gap: 6px; }
  .card-header .input-group { max-width: none !important; flex: 1 1 auto; min-width: 120px; }
  .card-header select.input { min-width: 0; flex: 1; width: auto !important; }
  .page-header h2 { font-size: 22px; }
  .page-header .right { gap: 6px; }
  [style*="grid-template-columns: repeat("] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@keyframes reap-pulse-shadow {
  0% { box-shadow: 0 0 0 0 rgba(47, 93, 80, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(47, 93, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 93, 80, 0); }
}

/* Week Picker Styles */
.week-nav-pill .btn:hover { background: var(--bg-surface); }
.week-picker-inner { transition: background 150ms; }
.week-picker-inner:hover { background: var(--bg-surface); }
