/* ---- Graphite: the dark graphite-and-brass look ---------------------------
   Loaded only for a workspace whose admin chose it (Business settings -> Look),
   only on screen (media="screen" in base.html), and only takes effect under
   <html data-theme="graphite">. On paper the light print sheet in style.css
   takes over, so nothing here needs a print rule.

   The first block is the palette: every colour lives there and nowhere else
   (tests/test_theme_tokens.py holds this file to that). The rest is finish:
   panels are lit plates (a highlight on the top edge, a shade on the bottom,
   a cast shadow), controls are raised, inputs are set into the surface, and
   one warm metal, brass, marks what to act on. */

[data-theme="graphite"] {
  color-scheme: dark;
  accent-color: var(--accent);   /* checkboxes, radios and ranges in brass */

  /* the grey ramp, darkest first */
  --g950: #0B0C0E;
  --g900: #101114;
  --g850: #17181B;
  --g800: #1C1E22;
  --g750: #24262B;
  --g700: #2B2E33;
  --g600: #343840;
  --edge: #090A0C;
  --well: #0F1013;
  --lip: rgba(255,255,255,.075);
  --lip2: rgba(255,255,255,.035);
  --cut: rgba(0,0,0,.6);
  --brass-hi: #F0E6CB;
  --brass-lo: #A88E57;
  --brass-edge: #6F5D35;

  /* the app's own tokens (style.css :root), in graphite */
  --paper: #0E0F12;
  --surface: #1C1E22;
  --subtle: #24262B;
  --ink: #EDEAE4;
  --muted: #A9A59C;
  --faint: #9A968D;
  --line: #2E3137;
  --line-strong: #3D414A;
  --accent: #D8C9A3;
  /* graphite keeps its brass even in a white-label workspace: the brand colour
     is chosen for a light page and is often unreadable on graphite */
  --brand: var(--accent);
  --accent-soft: rgba(216,201,163,.13);
  --accent-strong: #F0E6CB;
  --danger: #FF9E92;
  --danger-soft: #36201E;
  --danger-line: #5A302B;
  --warn: #EBC47E;
  --warn-soft: #33291A;
  --warn-line: #5A4724;
  --ok: #93D6AC;
  --ok-soft: #172B1E;
  --ok-line: #2A5038;
  --info: #9DBBE8;
  --info-soft: #18212E;
  --info-line: #2C4060;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 10px 26px -10px rgba(0,0,0,.85);
  --sidebar-bg: #17181B;
  --sidebar-ink: #EDEAE4;
  --sidebar-strong: #F7F5F0;
  --sidebar-muted: #A9A59C;
  --sidebar-line: rgba(255,255,255,.07);
  --sidebar-line-soft: rgba(255,255,255,.05);
  --sidebar-hover: rgba(255,255,255,.035);
  --sidebar-active: rgba(216,201,163,.08);
  --sidebar-scroll: rgba(255,255,255,.18);
  --sidebar-scroll-hover: rgba(255,255,255,.32);
  --sidebar-scroll-track: rgba(0,0,0,.3);
  --on-accent: #231F16;
  --accent-hover: #E6D9B6;
  --danger-border: #5A302B;
  --raw-bg: #262A31;
  --raw-ink: #B9C2D0;
  --scrim: rgba(0,0,0,.6);
  --shadow-drawer: 8px 0 26px rgba(0,0,0,.65);
  --shadow-pop: 0 14px 34px -10px rgba(0,0,0,.9);
  --highlight: #D8C9A3;
  --caution: #EBC47E;
  --qc-flag: #F2A574;
  --gain: #93D6AC;
  --loss: #FF9E92;
  --line-soft: #2A2D33;
  --drop-target: rgba(216,201,163,.10);
  --reveal-bg: #2A261C;
  --reveal-line: #5A4B2C;

  /* charts: brass first, then quiet metals and earths that sit beside it */
  --chart-1: #D8C9A3; --chart-2: #8FA7C4; --chart-3: #93C2A2; --chart-4: #C98F6B;
  --chart-5: #B5A1CF; --chart-6: #7F8A99; --chart-7: #A8A672; --chart-8: #CF8E98;
  --chart-9: #6FA9A3; --chart-10: #8C7A5E;
  --chart-muted: #4A4F58;
  --chart-text: #A9A59C;
  --chart-fill: rgba(216,201,163,.14);
  --chart-grid: rgba(255,255,255,.07);

  /* finishes, as whole values */
  --sheen: linear-gradient(177deg, rgba(255,255,255,.045) 0%, rgba(255,255,255,0) 46%, rgba(0,0,0,.18) 100%);
  --plate: inset 0 1px 0 var(--lip), inset 0 -1px 0 rgba(0,0,0,.55),
           0 14px 34px -14px rgba(0,0,0,.9), 0 3px 8px -3px rgba(0,0,0,.6);
  --plate-sm: inset 0 1px 0 var(--lip), 0 6px 14px -6px rgba(0,0,0,.85);
  --raised: inset 0 1px 0 var(--lip), inset 0 -1px 0 rgba(0,0,0,.6), 0 3px 8px rgba(0,0,0,.5);
  --raised-brass: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -1px 0 rgba(0,0,0,.25), 0 4px 12px rgba(0,0,0,.55);
  --recess: inset 0 2px 3px rgba(0,0,0,.6), inset 0 -1px 0 var(--lip2);
  --bar-shade: inset 0 1px 0 var(--lip), 0 2px 10px rgba(0,0,0,.5);
  --side-shade: inset -1px 0 0 var(--lip2), 6px 0 22px -6px rgba(0,0,0,.6);
  --glow-brass: 0 0 10px rgba(216,201,163,.5);
  --focus-ring: 0 0 0 3px rgba(216,201,163,.22);
  --field-edge: #646973;     /* an input's border: 3:1 against panel and page */
  /* a panel is lit at the top only, so a long one does not darken toward the end */
  --sheen-panel: linear-gradient(180deg, rgba(255,255,255,.045) 0, rgba(255,255,255,0) 140px);
  /* the public site: a plate lit from the upper left, and headings in metal */
  --hero-light: radial-gradient(110% 60% at 12% -8%, #2E3239 0%, #1A1C20 38%, rgba(14,15,18,0) 72%);
  --metal-text: linear-gradient(176deg, #FFFFFF 0%, #EBE7DF 38%, #B8B3AA 100%);

  --sans: "Archivo", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- type ---------------------------------------------------------------- */
[data-theme="graphite"] body { -webkit-font-smoothing: antialiased; }
/* Numbers read in the house face with even-width digits. Codes people copy or
   check by eye (part, lot and batch numbers, API keys) stay monospaced. */
[data-theme="graphite"] .num,
[data-theme="graphite"] td.num, [data-theme="graphite"] th.num,
[data-theme="graphite"] .metric .value,
[data-theme="graphite"] .att-n {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
}
[data-theme="graphite"] .metric .value { font-weight: 700; letter-spacing: -.03em; }
[data-theme="graphite"] .att-n { font-weight: 700; letter-spacing: -.035em; }
[data-theme="graphite"] .topbar h1 { font-weight: 700; letter-spacing: -.015em; }
[data-theme="graphite"] .metric .label,
[data-theme="graphite"] .content .panel:not([style*="padding"]) > h2,
[data-theme="graphite"] table.grid th,
[data-theme="graphite"] .kanban-head {
  font-size: 10.5px; font-weight: 700; letter-spacing: .16em; color: var(--faint);
}

/* ---- the mark: brass on graphite, the classic one when switched off ----- */
.brand-mark.logo-graphite { display: none; }
[data-theme="graphite"] .brand-mark.logo-graphite { display: block; }
[data-theme="graphite"] .brand-mark.logo-classic { display: none; }

/* ---- sidebar ------------------------------------------------------------- */
[data-theme="graphite"] .sidebar {
  background: linear-gradient(180deg, var(--g800) 0%, var(--g850) 42%, var(--g900) 100%);
  border-right: 1px solid var(--edge);
  box-shadow: var(--side-shade);
}
[data-theme="graphite"] .brand .logo { font-weight: 700; letter-spacing: -.02em; }
[data-theme="graphite"] .brand .name { color: var(--accent); }
[data-theme="graphite"] .nav a { border-left: 0; margin: 1px 10px; padding-left: 14px; border-radius: 5px; position: relative; }
[data-theme="graphite"] .nav a.active {
  color: var(--sidebar-strong);
  background-color: var(--g700);
  background-image: var(--sheen);
  box-shadow: var(--raised);
}
[data-theme="graphite"] .nav a.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass-lo));
  box-shadow: var(--glow-brass);
}
[data-theme="graphite"] .nav .group-label { font-weight: 700; letter-spacing: .16em; }

/* ---- top bar ------------------------------------------------------------- */
[data-theme="graphite"] .topbar {
  background: linear-gradient(180deg, var(--g750) 0%, var(--g800) 60%, var(--g850) 100%);
  border-bottom: 1px solid var(--edge);
  box-shadow: var(--bar-shade);
  position: relative; z-index: 2;
}
[data-theme="graphite"] .theme-toggle,
[data-theme="graphite"] .nav-toggle {
  background-color: var(--g700); background-image: var(--sheen);
  border-color: var(--edge); box-shadow: var(--raised);
}

/* ---- plates: panels, metric cards, attention cards, board cards ---------- */
[data-theme="graphite"] .panel,
[data-theme="graphite"] .metric,
[data-theme="graphite"] .att,
[data-theme="graphite"] .kanban-card {
  background-image: var(--sheen);
  border-color: var(--edge);
  box-shadow: var(--plate);
  border-radius: 6px;
}
[data-theme="graphite"] .panel { background-image: var(--sheen-panel); }
[data-theme="graphite"] .kanban-card { box-shadow: var(--plate-sm); }
[data-theme="graphite"] .kanban-card:hover { border-color: var(--accent); }
[data-theme="graphite"] .att-late { border-left-color: var(--danger); }
[data-theme="graphite"] .att-soon { border-left-color: var(--warn); }
[data-theme="graphite"] .att-todo { border-left-color: var(--info); }
[data-theme="graphite"] .att-zero { border-left-color: var(--line-strong); }
[data-theme="graphite"] .att:hover { box-shadow: var(--plate), var(--focus-ring); }
/* the colour is in the edge and the number, not a tinted slab */
[data-theme="graphite"] .att-late, [data-theme="graphite"] .att-soon,
[data-theme="graphite"] .att-todo { background-color: var(--surface); }
[data-theme="graphite"] .kanban-col { background: var(--g850); border-color: var(--edge); box-shadow: var(--recess); }
[data-theme="graphite"] .panel > h2 { border-bottom-color: var(--line); }

/* ---- tables -------------------------------------------------------------- */
[data-theme="graphite"] table.grid th { background: var(--g850); border-bottom-color: var(--edge); }
[data-theme="graphite"] table.grid td { border-bottom-color: var(--line); }
[data-theme="graphite"] table.grid tr:hover td { background: var(--subtle); }

/* ---- buttons ------------------------------------------------------------- */
[data-theme="graphite"] .btn {
  background: linear-gradient(180deg, var(--g700) 0%, var(--g800) 100%);
  border-color: var(--edge);
  box-shadow: var(--raised);
  font-weight: 600;
}
[data-theme="graphite"] .btn:hover { color: var(--brass-hi); background: linear-gradient(180deg, var(--g600) 0%, var(--g750) 100%); }
[data-theme="graphite"] .btn.primary {
  color: var(--on-accent);
  border-color: var(--brass-edge);
  background: linear-gradient(180deg, var(--brass-hi) 0%, var(--accent) 55%, var(--brass-lo) 100%);
  box-shadow: var(--raised-brass);
}
[data-theme="graphite"] .btn.primary:hover { color: var(--on-accent); background: linear-gradient(180deg, var(--brass-hi) 0%, var(--accent-hover) 60%, var(--accent) 100%); }
[data-theme="graphite"] .btn.danger { color: var(--danger); border-color: var(--danger-border); }
[data-theme="graphite"] .btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
[data-theme="graphite"] .theme-toggle:hover, [data-theme="graphite"] .nav-toggle:hover { background-color: var(--g600); }
[data-theme="graphite"] input[type=file]::file-selector-button {
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer;
  background: linear-gradient(180deg, var(--g700), var(--g800));
  border: 1px solid var(--edge); border-radius: 5px; box-shadow: var(--raised);
  padding: 6px 12px; margin-right: 10px;
}

/* ---- inputs: set into the surface ---------------------------------------- */
[data-theme="graphite"] input[type=text], [data-theme="graphite"] input[type=password],
[data-theme="graphite"] input[type=number], [data-theme="graphite"] input[type=date],
[data-theme="graphite"] input[type=search], [data-theme="graphite"] input[type=email],
[data-theme="graphite"] input[type=tel], [data-theme="graphite"] select,
[data-theme="graphite"] textarea {
  background: var(--well);
  border-color: var(--field-edge);
  box-shadow: var(--recess);
}
[data-theme="graphite"] ::placeholder { color: var(--faint); opacity: 1; }
[data-theme="graphite"] .sidebar :focus-visible { outline-color: var(--accent); }
[data-theme="graphite"] .combo-list { background: var(--g800); border-color: var(--field-edge); box-shadow: var(--shadow-pop); }
[data-theme="graphite"] .combo-list .opt { border-bottom-color: var(--line-soft); }
[data-theme="graphite"] input:focus, [data-theme="graphite"] select:focus,
[data-theme="graphite"] textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--recess), var(--focus-ring);
}

/* ---- status and pills: a slot with a lit dot ------------------------------ */
[data-theme="graphite"] .status {
  background: var(--well);
  border-color: var(--edge);
  box-shadow: var(--recess);
  border-radius: 5px;
  letter-spacing: .03em;
}
[data-theme="graphite"] .status::before { box-shadow: 0 0 7px currentColor; }
[data-theme="graphite"] .status.ok, [data-theme="graphite"] .status.todo,
[data-theme="graphite"] .status.late, [data-theme="graphite"] .status.soon,
[data-theme="graphite"] .status.idle { background: var(--well); border-color: var(--edge); }
[data-theme="graphite"] .pill { border-radius: 5px; }

/* ---- the rest ------------------------------------------------------------ */
[data-theme="graphite"] .flash { background-image: var(--sheen); border: 1px solid var(--edge); box-shadow: var(--plate-sm); }
[data-theme="graphite"] .skip-link { box-shadow: var(--raised-brass); }
[data-theme="graphite"] .sort-n { background: var(--accent-soft); color: var(--accent); }

/* ---- the public site and the signed-out pages --------------------------- */
[data-theme="graphite"] body.public { background: var(--hero-light) no-repeat 0 0 / 100% 900px, var(--paper); }
[data-theme="graphite"] .public-wrap h1::selection { color: var(--ink); background: var(--accent-soft); }
[data-theme="graphite"] .login-wrap { background: var(--hero-light) no-repeat; }
[data-theme="graphite"] .public-wrap { max-width: 1040px; }
[data-theme="graphite"] .public-top { border-bottom-color: var(--line); }
[data-theme="graphite"] .public-wrap h1 {
  background: var(--metal-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -.03em;
}
[data-theme="graphite"] .login-card {
  background-color: var(--surface); background-image: var(--sheen);
  border-color: var(--edge); box-shadow: var(--plate);
}
[data-theme="graphite"] .login-card .logo { color: var(--accent); }
/* the sign-in pages carry the classic mark in their own markup */
[data-theme="graphite"] .login-card .brand-mark { content: url("logo-graphite.svg"); }
