/* =====================================================================
   AutoWerke admin theme
   Paper-white surfaces, deep racing green, typewriter type for headings,
   labels and numbers; a normal sans-serif for reading text.
   Loaded last on admin pages, so it overrides the older styles.
   ===================================================================== */

:root {
  --paper: #F4F1E8;        /* page */
  --card: #FBF9F3;         /* raised surfaces */
  --sidebar: #ECE8DC;
  --line: #DEDACD;
  --line-soft: #E9E5D9;
  --ink: #1F2622;
  --ink-2: #3D4640;
  --muted: #7B7B70;

  --green: #2F4A3B;        /* British racing / Belgravia green */
  --green-hover: #263E31;
  --green-2: #4A6A57;
  --green-soft: #E3E9DF;
  --green-bright: #5BA35E; /* selected states only */
  --on-green: #F4F1E8;
  --on-green-muted: #B9C7BB;

  --amber: #A06414;  --amber-soft: #F5EBD7;
  --red: #A33A2E;    --red-soft: #F5E1DC;

  --mono: 'Courier Prime', 'Courier New', ui-monospace, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  --radius: 10px;

  /* Motion: strong custom curves (the built-in CSS easings are too weak for deliberate motion) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);       /* entering, exiting, feedback */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);   /* moving or drawing on screen */
}

body.theme {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  padding: 0;
}

/* ---------- Shell: sidebar + main ---------- */
.theme .shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.theme .side {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 26px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme .side-brand img { width: 150px; display: block; margin: 0 6px 26px; }

.theme .side-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 8px 8px;
}

.theme .side-nav { display: flex; flex-direction: column; gap: 2px; }

.theme .side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
}

.theme .side-nav a svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.theme .side-nav a:hover { background: rgba(47, 74, 59, 0.06); }
.theme .side-nav a.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(31, 38, 34, 0.06); }
.theme .side-nav a.on svg { color: var(--green); }

.theme .side-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
}

.theme .side-foot {
  margin-top: auto;
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  padding: 0 6px;
}

.theme .side-foot svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.theme .shell-main { min-width: 0; }

.theme .admin-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.theme .earnings-wrap { max-width: 1120px; }

/* ---------- Green header band ---------- */
.theme .band {
  background: var(--green);
  color: var(--on-green);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.theme .band h1 {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.2px;
  color: var(--on-green);
}

.theme .band-sub {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-green-muted);
  margin-top: 4px;
}

.theme .band-stats { display: flex; gap: 30px; flex-wrap: wrap; }
.theme .band-stat { text-align: right; }

.theme .band-stat-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-green-muted);
}

.theme .band-stat-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--on-green);
  font-variant-numeric: tabular-nums;
}

.theme .band-stat-sub { font-size: 11px; color: var(--on-green-muted); }

.theme .page-note { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

/* ---------- Section titles (typewriter, small caps feel) ---------- */
.theme .section-title,
.theme .admin-wrap h1:not(.band h1) {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 30px 0 6px;
}

.theme .admin-wrap .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.theme .section-sub { font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- Cards, text, inputs ---------- */
.theme .card,
.theme .panel,
.theme .kpi,
.theme .stat-card,
.theme .company-table-wrap {
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: none;
  border-radius: var(--radius);
}

.theme .card h3 { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--ink); }
.theme .card .meta,
.theme .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.theme .empty-state { color: var(--muted); font-family: var(--mono); font-size: 13px; }

.theme input[type=text], .theme input[type=email], .theme input[type=number], .theme input[type=date],
.theme input[type=time], .theme input[type=search], .theme select, .theme textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font-family: var(--sans);
}

.theme input:focus, .theme select:focus, .theme textarea:focus {
  outline: none;
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(74, 106, 87, 0.15);
}

/* ---------- Buttons ---------- */
.theme .approve-btn,
.theme .btn-small.primary,
.theme .btn-primary {
  background: var(--green);
  color: var(--on-green);
  border: none;
  border-radius: 7px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px;
}

.theme .approve-btn:hover,
.theme .btn-small.primary:hover,
.theme .btn-primary:hover { background: var(--green-hover); }

.theme .btn-small.secondary,
.theme .btn-outline,
.theme .update-actions .btn-changes {
  background: var(--card);
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
}

.theme .btn-outline:hover, .theme .btn-small.secondary:hover { border-color: var(--green-2); color: var(--green); }
.theme .link-btn { color: var(--green); }

/* ---------- Segmented controls (like "All | Open | Cleared") ---------- */
/* Full definition here so any admin page can use it, not just earnings */
.theme .seg {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 3px;
  box-shadow: none;
}

.theme .seg button {
  border: none;
  background: none;
  padding: 6px 13px;
  font-size: 13px;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-2);
}

.theme .seg button:hover:not(.on) { background: rgba(47, 74, 59, 0.06); }
.theme .seg button.on { background: var(--green-bright); color: #fff; font-weight: 600; }

.theme .filter-bar select {
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: none;
}

/* ---------- Pipeline overview ---------- */
.theme .stat-card .stat-value { font-family: var(--mono); color: var(--ink); }
.theme .stat-card.accent .stat-value { color: var(--green); }
.theme .stat-card .stat-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.theme .company-table th { font-family: var(--mono); color: var(--muted); }
.theme .company-table tbody tr.selected { background: var(--green-soft); }
.theme .active-pill { background: var(--green-soft); color: var(--green); font-family: var(--mono); }
.theme .filter-banner { background: var(--green-soft); color: var(--green); }
.theme .card-title-line { color: var(--green); font-family: var(--mono); }

/* ---------- Earnings ---------- */
.theme .kpi .k-label { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.theme .kpi .k-value { font-family: var(--mono); font-weight: 700; color: var(--ink); letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.theme .kpi .k-sub { color: var(--muted); }
.theme .kpi.hero { background: var(--green); border-color: var(--green); }
.theme .kpi.hero .k-label, .theme .kpi.hero .k-sub { color: var(--on-green-muted); }
.theme .kpi.hero .k-value { color: var(--on-green); }

.theme .panel h2 { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.theme .panel .p-sub { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.theme .legend { font-family: var(--mono); font-size: 11.5px; }

.theme .cbar-row.on { background: var(--green-soft); }
.theme .cbar-fill { background: var(--green); }
.theme .cbar-track { background: var(--line-soft); }
.theme .cbar-name, .theme .cbar-amt { font-family: var(--mono); }
.theme .funnel { background: var(--line-soft); }
.theme .funnel-rows { font-family: var(--mono); font-size: 12.5px; }

/* Ledger-style table, like a check register */
.theme .e-table th {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.theme .e-table td { border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.theme .e-table tbody tr:nth-child(even) td { background: rgba(236, 232, 220, 0.35); }
.theme .e-table td:first-child { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
.theme .e-table td:nth-child(2) { font-family: var(--mono); font-weight: 700; }
.theme .e-table td.num { font-family: var(--mono); }
.theme .type-tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; background: var(--line-soft); color: var(--ink-2); }
.theme .type-tag.project { background: var(--green); color: var(--on-green); }

.theme .missing { background: var(--amber-soft); border-color: #E8D4A8; }
.theme .missing h2 { font-family: var(--mono); color: #6B430B; }
.theme .missing-row button { background: var(--green); }

/* ---------- Project delivery ---------- */
.theme .project-title { font-family: var(--mono); font-size: 19px; }
.theme .project-title .untitled { color: var(--muted); }
.theme .new-badge { background: var(--green-bright); color: #fff; font-family: var(--mono); letter-spacing: 0.1em; }
.theme .status-pill { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; background: var(--green-soft); color: var(--green); }
.theme .status-pill.closed { background: var(--green); color: var(--on-green); }
.theme .scope-snippet { color: var(--ink-2); }

.theme .overall { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.theme .overall-bar { background: var(--line-soft); height: 6px; }
.theme .overall-bar > div { background: var(--green); }

.theme .phase-row { background: var(--card); border-color: var(--line-soft); border-radius: 8px; }
.theme .phase-row.done { background: #F6F8F2; }
.theme .phase-row.current { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.theme .phase-num { font-family: var(--mono); background: var(--line-soft); color: var(--ink-2); }
.theme .phase-row.done .phase-num { background: var(--green-2); color: #fff; }
.theme .phase-row.current .phase-num { background: var(--green); color: #fff; }
.theme .card .phase-main .phase-title { font-family: var(--mono); font-size: 14.5px; }
.theme .phase-row.done .phase-title { color: var(--green-2); }
.theme .current-tag { color: var(--green); font-family: var(--mono); }
.theme .phase-summary, .theme .phase-body-toggle { font-family: var(--mono); font-size: 11.5px; }
.theme .phase-body-toggle { color: var(--green); }
.theme .phase-check input { accent-color: var(--green); }
.theme .phase-tools button { background: var(--card); border-color: var(--line); color: var(--muted); }

.theme .update-box { background: var(--paper); border-color: var(--line-soft); }
.theme .update-box h4, .theme .signoff-box h4 { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.theme .signoff-box { background: var(--green-soft); border-color: #CBD6C6; }
.theme .signoff-box.locked { background: var(--paper); border-color: var(--line-soft); }
.theme .signoff-status.ok { background: #fff; color: var(--green); }
.theme .closed-badge { background: var(--green-soft); color: var(--green); border-color: #CBD6C6; font-family: var(--mono); }
.theme .dirty-flag { color: var(--amber); font-family: var(--mono); }
.theme .saved-flag { color: var(--green-bright); font-family: var(--mono); }

/* ---------- Health banner ---------- */
.theme .health-banner { background: var(--red-soft); border-color: #E7C2BB; }
.theme .health-banner.ok { background: var(--green-soft); border-color: #CBD6C6; color: var(--green); }

/* ---------- Small screens: sidebar becomes a top bar ---------- */
@media (max-width: 860px) {
  .theme .shell { grid-template-columns: 1fr; }
  .theme .side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .theme .side-brand img { width: 120px; margin: 0 10px 0 0; }
  .theme .side-label, .theme .side-foot { display: none; }
  .theme .side-nav { flex-direction: row; flex-wrap: wrap; }
  .theme .admin-wrap { padding: 18px 14px 40px; }
  .theme .band-stat { text-align: left; }
}

.theme .type-tag.domain { background: #DCE8EC; color: #2F5866; }

/* Priority + screenshots on admin cards */
.theme .prio-pill { display: inline-block; font-size: 12.5px; padding: 5px 10px; border-radius: 7px; margin: 8px 0 2px; background: var(--green-soft); color: var(--green); }
.theme .prio-pill strong { font-family: var(--mono); margin-right: 4px; }
.theme .prio-pill.p3 { background: var(--amber-soft); color: #6B430B; }
.theme .prio-pill.p4, .theme .prio-pill.p5 { background: var(--red-soft); color: var(--red); }
.theme .prio-pill.p5 { box-shadow: inset 0 0 0 1px var(--red); }
.theme .card-shots { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 4px; }
.theme .card-shots img { width: 96px; height: 68px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.theme .card-shots a:hover img { border-color: var(--green); }
.theme .card-shots-note { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* Signed-in user + session clock */
.theme .side-user { margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--line); }
.theme .side-user + .side-foot { margin-top: 10px; }
.theme .side-user-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.theme .side-user-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 2px 0 8px; }
.theme .side-signout { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--card); border: 1px solid var(--line); color: var(--ink-2); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.theme .side-signout:hover { border-color: var(--red); color: var(--red); }

/* "Still there?" */
.idle-overlay { position: fixed; inset: 0; background: rgba(31, 38, 34, .55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.idle-card { background: var(--card); border-radius: 14px; padding: 26px 26px 18px; max-width: 380px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.idle-emoji { font-size: 40px; animation: idle-peek 1.6s ease-in-out infinite; }
@keyframes idle-peek { 50% { transform: translateX(6px) rotate(8deg); } }
.idle-card h2 { font-family: var(--mono); font-size: 20px; margin: 6px 0; color: var(--ink); }
.idle-card p { font-size: 14px; color: var(--ink-2); margin: 0 0 16px; }
.idle-card .btn-primary { width: 100%; }
.idle-card .link-btn { margin-top: 10px; }
@media (max-width: 860px) { .theme .side-user { display: none; } }

.theme .type-tag.consultancy { background: #F1E4D3; color: #6B4A22; }
