/* UFSO One design tokens — grown from Meridian's system, approved on the
 * direction board. Crimson = brand voice + danger family; teal = action;
 * warm neutrals, never pure grey. `.dark` on <html> flips the theme. */

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f3;
  --line: #e5e4e2;
  --ink: #1a1817;
  --ink-muted: #6d6b68;
  --ink-faint: #9a9895;
  --accent: #3c8380;
  --accent-soft: rgba(60, 131, 128, 0.12);
  --accent-ink: #ffffff;
  --brand: #8e171a;
  --brand-soft: rgba(142, 23, 26, 0.08);
  --good: #16a34a;
  --good-soft: rgba(22, 163, 74, 0.1);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.1);
  --bad: #a91d21;
  --bad-soft: rgba(169, 29, 33, 0.09);
  --shadow-lift: 0 12px 32px -12px rgba(26, 24, 23, 0.18);
}

html.dark {
  --bg: #0e0c0c;
  --surface: #161313;
  --surface-2: #1e1a1a;
  --line: #2a2525;
  --ink: #efeceb;
  --ink-muted: #a29d9b;
  --ink-faint: #676260;
  --accent: #56a5a1;
  --accent-soft: rgba(86, 165, 161, 0.14);
  --accent-ink: #0e0c0c;
  --brand: #c94a4e;
  --brand-soft: rgba(201, 74, 78, 0.14);
  --good: #34d399;
  --good-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --bad: #e0605f;
  --bad-soft: rgba(224, 96, 95, 0.13);
  --shadow-lift: 0 12px 40px -10px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 "Inter", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
  transition: background 200ms ease, color 200ms ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--brand); }
::selection { background: var(--accent-soft); }

main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 36px 24px 72px; position: relative; }

h1, h2, h3 { font-family: "Inter Tight", "Inter", sans-serif; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; font-weight: 700; margin: 0 0 16px; }
h2 { font-size: 1.15rem; font-weight: 650; margin: 30px 0 12px; }
.eyebrow {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 8px;
}

/* ------------------------------------------------------------- unified shell */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 24px; height: 60px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .left { display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: "Inter Tight", sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--ink); }
.brand svg { stroke: var(--brand); }
.brand span { color: var(--brand); }
.modules { display: flex; gap: 4px; align-items: center; }
.modules a {
  padding: 7px 13px; border-radius: 8px; font-size: 0.86rem; font-weight: 500;
  color: var(--ink-muted); transition: background 140ms ease, color 140ms ease;
}
.modules a:hover { background: var(--surface-2); color: var(--ink); }
.modules a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 30px; height: 30px; border-radius: 999px; background: var(--brand-soft);
  color: var(--brand); display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600;
}
.who { color: var(--ink-muted); font-size: 0.85rem; }
.iconbtn {
  padding: 7px; border-radius: 8px; color: var(--ink-muted);
  display: flex; align-items: center; transition: background 140ms ease;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 620px; }
.theme-card {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer;
  background: var(--surface); text-align: center; font-size: 0.88rem; font-weight: 600;
  color: var(--ink-muted); transition: border-color 140ms ease, color 140ms ease;
}
.theme-card:hover { border-color: var(--accent); }
.theme-card.selected { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.theme-card .swatch { height: 44px; border-radius: 8px; margin-bottom: 10px; border: 1px solid var(--line); }

/* ---------------------------------------------------------------- components */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; display: block; color: var(--ink);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
a.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-lift); color: var(--ink); }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 650; }
.card p { margin: 0; color: var(--ink-muted); font-size: 0.88rem; }
.card .go { margin-top: 14px; font-size: 0.83rem; font-weight: 600; color: var(--accent); }
.card.disabled { opacity: 0.55; pointer-events: none; }
.card svg { stroke: var(--accent); }

.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 10px; padding: 10px 18px; font-size: 0.9rem;
  cursor: pointer; font-weight: 600; font-family: inherit;
  transition: transform 100ms ease, filter 140ms ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 5px 12px; font-size: 0.8rem; }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.danger { background: var(--brand); color: #fff; }

table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.9rem; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
th {
  text-align: left; font-size: 0.71rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint); padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap; font-weight: 600;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover { background: var(--surface-2); }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.75rem; font-weight: 600; background: var(--surface-2); color: var(--ink-muted); margin-right: 4px; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }

.login-box {
  max-width: 400px; margin: 14vh auto 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 40px 36px;
  text-align: center; position: relative; z-index: 1;
}
.login-box h1 { margin-bottom: 4px; }
.login-box .tag { color: var(--ink-muted); margin: 0 0 26px; font-size: 0.9rem; }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.87rem; }

form.inline { display: inline; }
fieldset { border: 1px solid var(--line); border-radius: 14px; margin: 0 0 18px; padding: 16px 18px; background: var(--surface); }
legend { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); padding: 0 6px; font-weight: 600; }
label.check { display: inline-flex; gap: 6px; align-items: center; margin: 4px 14px 4px 0; font-size: 0.88rem; }
select, input[type=text] {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 0.88rem;
  background: var(--surface); color: var(--ink); font-family: inherit;
}
select:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }

.muted { color: var(--ink-muted); }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.84em; }

/* --------------------------------------------------------------- brand cube */
.cube-zone {
  position: absolute; right: 8px; top: -30px; width: 300px; height: 300px;
  perspective: 900px; pointer-events: none; opacity: 0.5; z-index: 0;
}
html.dark .cube-zone { opacity: 0.65; }
.cube { position: absolute; inset: 60px; transform-style: preserve-3d; animation: cube-spin 44s linear infinite; }
.cube .face {
  position: absolute; width: 180px; height: 180px;
  border: 1.5px solid var(--brand); opacity: 0.5;
}
.cube .f1 { transform: translateZ(90px); }
.cube .f2 { transform: rotateY(90deg) translateZ(90px); }
.cube .f3 { transform: rotateY(180deg) translateZ(90px); }
.cube .f4 { transform: rotateY(-90deg) translateZ(90px); }
.cube .f5 { transform: rotateX(90deg) translateZ(90px); }
.cube .f6 { transform: rotateX(-90deg) translateZ(90px); }
@keyframes cube-spin {
  from { transform: rotateX(-18deg) rotateY(0deg); }
  to { transform: rotateX(-18deg) rotateY(360deg); }
}

/* ------------------------------------------------------------ scroll reveals */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 250ms ease-out, transform 250ms ease-out; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .cube { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card, .btn, body { transition: none; }
}
