/* Campaign Budget Planning.
   A finance workbench: the numbers are the content, so the page gets out of their way. Figures are tabular and
   ruled like a ledger (a single rule above a total, a double rule under the grand total), the chrome is quiet, and a
   box is drawn only around the data a person works on. The family is ds-application's: white shell, Inter and Noto
   Sans Thai, a navy and blue accent. Fonts come from /static/fonts because the CSP allows only our own origin. */

:root {
  /* paper and ink */
  --desk: #f5f5f6;          /* the page behind the sheets (Claude Design: bg-page) */
  --sheet: #ffffff;         /* surfaces you work on */
  --ink: #18181b;           /* text and headings */
  --ink-2: #3f3f46;         /* running text */
  --muted: #5b6170;         /* labels and notes (4.5:1 on the page and on white) */
  --rule: #e5e5e8;          /* borders of sheets and inputs */
  --rule-strong: #d2d3d8;   /* borders of inputs and chips */
  --hairline: #ececef;      /* rules between table rows */
  --wash: #fafafb;          /* banded cells, hover */
  --sunken: #f1f1f3;

  /* brand, from the ds-application family */
  --brand: #1e3a8a;
  --brand-dk: #172f72;
  --signal: #1d4ed8;        /* links, selection, focus */
  --signal-tint: #e8f0fe;

  /* states, always a dark text on its own tint */
  --ok: #126b33;   --ok-tint: #e6f4ea;
  --wait: #8a5a00; --wait-tint: #fdeccd;
  --bad: #b91c1c;  --bad-tint: #fdecec;

  --r-sheet: 14px;          /* sheets and cards */
  --r-control: 8px;         /* inputs and buttons */
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .05);
  --sidebar-w: 248px;
  --rail-w: 72px;
  --topbar-h: 56px;
  --focus: 0 0 0 3px rgba(29, 78, 216, .35);
}

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/static/fonts/inter-latin-variable.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/static/fonts/inter-latin-ext-variable.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/static/fonts/noto-sans-thai-thai-variable.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink-2);
  background: var(--desk);
  font-family: "Inter", "Noto Sans Thai", "Segoe UI", system-ui, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv11" 1, "ss03" 1;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); }
h1 { font-size: 26px; font-weight: 650; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 17px; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 650; line-height: 1.3; }
a { color: var(--signal); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--brand); }
.subtle { color: var(--muted); }
.strong { font-weight: 650; font-size: 17px; color: var(--ink); }
.strong-cell { font-weight: 600; color: var(--ink); }
.num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "cv11" 1; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-control); }

/* ---------------------------------------------------------------- shell */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-body { flex: 1; display: flex; min-height: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--topbar-h); padding: 0 16px 0 10px;
  background: var(--sheet); border-bottom: 1px solid var(--rule);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  color: var(--muted); background: none; border: 0; border-radius: var(--r-control); cursor: pointer;
}
.topbar-icon-btn:hover { background: var(--desk); color: var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand strong { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 28px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: #fff; background: var(--brand); border-radius: 7px;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-left: 8px; padding-left: 16px; border-left: 1px solid var(--rule);
  color: var(--muted); font-size: 13px; min-width: 0; }
.breadcrumb-sep { color: #b6bdcc; }
.breadcrumb-current { color: var(--ink); font-weight: 600; }

.sidebar {
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  padding: 14px 10px 16px; background: var(--sheet); border-right: 1px solid var(--rule); overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.sidebar.collapsed { flex-basis: var(--rail-w); width: var(--rail-w); }
.sidebar.collapsed .nav-group-label, .sidebar.collapsed .nav-label, .sidebar.collapsed .sidebar-foot { display: none; }
.sidebar.collapsed .nav a { justify-content: center; padding: 0; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label { padding: 0 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; margin-top: 1px;
  color: var(--ink-2); font-weight: 500; text-decoration: none; border-radius: var(--r-control);
}
.nav a:hover { background: var(--desk); color: var(--ink); }
.nav a.active { color: var(--brand); background: var(--signal-tint); font-weight: 650; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; background: var(--signal); border-radius: 0 3px 3px 0; }
.sidebar.collapsed .nav a.active::before { left: -10px; }
.nav-icon { flex: none; }

.content-col { flex: 1; min-width: 0; }
.main { max-width: 1600px; margin: 0 auto; padding: 26px 32px 72px; }
.main > * + * { margin-top: 20px; }
.main.plain { max-width: 560px; padding: 72px 24px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 32px; }
.page-title { min-width: 0; }
.page-eyebrow { margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.lede { max-width: 72ch; margin-top: 4px; color: var(--ink-2); }
.lede:empty { display: none; }
.page-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-tools:empty { display: none; }

/* ---------------------------------------------------------------- user menu */
.topbar-item { position: relative; }
.user-trigger {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px;
  font: inherit; color: inherit; text-align: left; background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.user-trigger:hover, .user-trigger[aria-expanded="true"] { background: var(--desk); }
.user-avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  font-size: 12px; font-weight: 650; color: #fff; background: var(--brand); border-radius: 50%;
}
.user-trigger-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-trigger-text strong { font-size: 13px; color: var(--ink); white-space: nowrap; }
.user-trigger-text .subtle { font-size: 12px; white-space: nowrap; }
.user-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  width: 264px; padding: 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 27, 61, .14);
}
.user-menu.open { display: block; }
.user-menu > * + * { margin-top: 6px; }
.kicker { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-note { font-size: 12px; color: var(--muted); word-break: break-all; }
.user-menu-divider { height: 1px; margin: 10px 0 !important; background: var(--hairline); }
.user-menu-item {
  display: block; width: 100%; padding: 8px 10px; font: inherit; text-align: left;
  color: var(--ink); background: none; border: 0; border-radius: var(--r-control); cursor: pointer;
}
.user-menu-item:hover { background: var(--desk); }

/* ---------------------------------------------------------------- surfaces */
.card { padding: 20px 24px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-sm); }
.card > * + * { margin-top: 14px; }
.card > h2 + .lede, .card > h2 + p { margin-top: 4px; }
.card.flat { background: transparent; border-style: dashed; }
.empty { text-align: left; }
.empty h2 { color: var(--ink); }
.empty p { max-width: 64ch; }

.notice {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
  font-size: 13px; color: var(--wait); background: var(--wait-tint); border-radius: 8px;
}
.notice .nav-icon { margin-top: 2px; }
.notice.ok { color: var(--ok); background: var(--ok-tint); }
.notice.error { color: var(--bad); background: var(--bad-tint); }

/* a row of key facts: a small label over a value, set apart by hairlines */
.summary dl { display: flex; flex-wrap: wrap; gap: 14px 0; margin-block: 0; }
.summary dl > div { padding: 0 28px; border-left: 1px solid var(--hairline); }
.summary dl > div:first-child { padding-left: 0; border-left: 0; }
.summary dt { font-size: 12px; color: var(--muted); }
.summary dd { margin: 2px 0 0; color: var(--ink); font-weight: 500; }
.summary dd.strong, .summary dd .strong { font-size: 17px; }

/* ---------------------------------------------------------------- buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; padding: 6px 14px;
  font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--brand); border-radius: var(--r-control); cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn-primary { color: #fff; background: var(--brand); }
.btn-primary:hover { color: #fff; background: var(--brand-dk); border-color: var(--brand-dk); }
.btn-quiet { color: var(--brand); background: var(--sheet); border-color: var(--rule); }
.btn-quiet:hover { color: var(--brand); background: var(--signal-tint); border-color: #bccdf6; }
.btn-danger { color: #fff; background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { color: #fff; background: #8f1d17; border-color: #8f1d17; }
.btn-small { min-height: 28px; padding: 3px 10px; font-size: 13px; }

input[type="text"]:not([class*="d-"]), input[type="number"]:not([class*="d-"]), input[type="search"]:not([class*="d-"]), input[type="file"]:not([class*="d-"]), select:not([class*="d-"]) {
  min-height: 34px; font: inherit; color: var(--ink); background: var(--sheet);
  border: 1px solid var(--rule); border-radius: var(--r-control); padding: 5px 10px;
}
input[type="number"]:not([class*="d-"]) { width: 92px; }
input:hover:not([class*="d-"]), select:hover:not([class*="d-"]) { border-color: #b9c1d3; }
input:focus-visible:not([class*="d-"]), select:focus-visible:not([class*="d-"]) { border-color: var(--signal); }
input:not([class*="d-"])::placeholder { color: #98a1b8; }
input[type="checkbox"]:not([class*="d-"]) { width: 16px; height: 16px; accent-color: var(--brand); }
input:disabled:not([class*="d-"]), select:disabled:not([class*="d-"]) { color: var(--muted); background: var(--wash); cursor: not-allowed; }
select:not([class*="d-"]) { padding-right: 28px; }
fieldset { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 0; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.inline-form label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.stack-form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.form-grid input[type="text"], .form-grid select { width: 100%; }
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.picker label { color: var(--muted); font-size: 13px; }
.picker select { font-weight: 600; color: var(--ink); }

/* ---------------------------------------------------------------- badges and states */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; font-size: 12px; font-weight: 600; line-height: 20px;
  color: var(--brand); background: var(--signal-tint); border-radius: 999px; vertical-align: middle; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.badge-ok { color: var(--ok); background: var(--ok-tint); }
.badge-soon { color: var(--wait); background: var(--wait-tint); }
.badge-error { color: var(--bad); background: var(--bad-tint); }
.badge-quiet { color: var(--muted); background: var(--hairline); }
.chips .badge::before, .user-menu .badge::before { display: none; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--hairline); }
th { font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--rule); }
th.num, td.num { text-align: right; }
tbody tr:hover td { background: var(--wash); }
td a { font-weight: 500; }
/* the ledger rule: a single line above a total, a double line under the grand total */
.total-row td { font-weight: 650; color: var(--ink); border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); background: transparent; }
.is-off td { color: var(--muted); }
.delta-up { color: var(--ok); }
.delta-down { color: var(--bad); }
.wide table { width: max-content; min-width: 100%; }
.wide th:first-child, .wide td:first-child { position: sticky; left: 0; z-index: 1; background: var(--sheet); box-shadow: 1px 0 0 var(--hairline); }
.wide tbody tr:hover td:first-child { background: var(--wash); }
.ledger-total { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }

/* a darker cell for a bigger share of the money; one hue, so it reads as weight, not as a rainbow */
.h1 { background: #f1f5fe; }
.h2 { background: #e3ecfd; }
.h3 { background: #cfdcfa; }
.h4 { background: #b4c8f6; color: var(--ink); }

/* ---------------------------------------------------------------- steps, options, tabs */
.step-head { display: flex; align-items: center; gap: 10px; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; font-size: 13px; font-weight: 650; color: #fff; background: var(--brand); border-radius: 50%; flex: none; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.option { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; padding: 16px 18px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; }
.option.is-recommended { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); background: #fafcff; }
.option .btn { margin-top: auto; }
.count { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
.rules { margin: 0; padding-left: 18px; max-width: 78ch; }
.rules li + li { margin-top: 6px; }
.split { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }

/* the model list: sheet tabs, with a dot that says whether a rate is in */
.tabs-side { padding: 14px 10px; }
.tabs-side h2 { padding: 0 8px 6px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.tabs-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tabs-side a { position: relative; display: grid; grid-template-columns: 10px 1fr; column-gap: 10px; padding: 7px 10px; color: var(--ink); text-decoration: none; border-radius: var(--r-control); }
.tabs-side a::before { content: ""; grid-row: 1 / span 2; align-self: center; width: 9px; height: 9px; border: 1.5px solid #a5aec3; border-radius: 50%; }
.tabs-side a:hover { background: var(--wash); }
.tabs-side a.is-current { background: var(--signal-tint); color: var(--brand); font-weight: 650; }
.tabs-side a.has-rate::before { background: var(--ok); border-color: var(--ok); }
.tab-note { grid-column: 2; font-size: 12px; font-weight: 400; color: var(--muted); }
.tab-note.ok { color: var(--ok); }

/* ---------------------------------------------------------------- the grid MKT types into */
.rate-grid { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.rate-grid th, .rate-grid td { padding: 0 8px; height: 34px; border-bottom: 1px solid var(--hairline); border-right: 1px solid var(--hairline); }
.rate-grid th { height: 32px; background: var(--wash); border-bottom-color: var(--rule); }
.rate-grid th:first-child, .rate-grid td:first-child { position: sticky; left: 0; z-index: 2; padding-left: 12px; min-width: 150px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; background: var(--sheet); box-shadow: 1px 0 0 var(--rule); }
.rate-grid th:first-child { background: var(--wash); }
.rate-grid td.cell { padding: 0; min-width: 62px; }
.rate-grid input { display: block; width: 100%; min-height: 33px; height: 33px; padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink);
  background: transparent; border: 0; border-radius: 0; }
.rate-grid input:not(:placeholder-shown) { font-weight: 550; }
.rate-grid input:hover { background: var(--signal-tint); }
.rate-grid input:focus-visible { background: #fff; box-shadow: inset 0 0 0 2px var(--signal); border-radius: 0; }
.rate-grid .vol-row td { color: var(--ink); font-weight: 650; background: #eef3ff; border-bottom: 1px solid var(--rule); }
.rate-grid .vol-row td:first-child { background: #eef3ff; }
.rate-grid td.total { font-weight: 650; color: var(--ink); background: var(--wash); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.rate-grid tr.is-off td { background: repeating-linear-gradient(135deg, #f5f6f9 0 5px, #ebedf2 5px 10px); color: #98a1b8; }
.rate-grid tr.is-off td:first-child { background: #f1f2f6; }
.rate-grid tr.is-off input { cursor: not-allowed; background: transparent; }
.rate-grid .code { color: var(--ink); font-weight: 650; }
.rate-grid .cname { color: var(--muted); font-weight: 400; margin-left: 6px; }
.actions-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.actions-bar p { max-width: 74ch; }
.confirm-zone { border-left: 4px solid var(--brand); }
.confirm-zone h2 { display: flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- the route of a cycle: open, volume, budget per unit, calculated */
.route { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; }
.route-step { position: relative; padding: 0 12px 0 0; }
.route-step::before { content: ""; position: absolute; top: 11px; left: 26px; right: 0; height: 2px; background: var(--rule); }
.route-step:last-child::before { display: none; }
.route-step.is-done::before { background: var(--ok); }
.route-dot { position: relative; display: grid; place-items: center; width: 24px; height: 24px; margin-bottom: 8px;
  color: var(--muted); background: var(--sheet); border: 2px solid var(--rule); border-radius: 50%; font-size: 12px; font-weight: 700; z-index: 1; }
.route-step.is-done .route-dot { color: #fff; background: var(--ok); border-color: var(--ok); }
.route-step.is-current .route-dot { color: var(--brand); border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-tint); }
.route-name { display: block; font-weight: 650; color: var(--ink); }
.route-step.is-todo .route-name { color: var(--muted); font-weight: 600; }
.route-who { display: block; font-size: 12px; color: var(--muted); }
.route-note { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.route-step.is-current .route-note { color: var(--wait); font-weight: 600; }
.cycle-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 36px; margin-bottom: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); font-weight: 500; }
.cycle-links { display: flex; flex-wrap: wrap; gap: 8px; }
.todo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 14px 18px;
  background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--signal); border-radius: var(--r-sheet); }
.todo h2 { font-size: 15px; }
.todo p { color: var(--ink-2); }

/* a vertical sequence: download, fill in, upload */
.stepper { list-style: none; margin: 0; padding: 0; }
.stepper > li { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 16px; padding-bottom: 28px; }
.stepper > li:last-child { padding-bottom: 0; }
.stepper > li::before { content: ""; position: absolute; left: 12px; top: 32px; bottom: 6px; width: 2px; background: var(--hairline); }
.stepper > li:last-child::before { display: none; }
.step-body > * + * { margin-top: 10px; }
.step-body h3 { padding-top: 2px; }

/* an action kept out of the way until it is asked for: the summary is the button, the form opens under it */
details.inline > summary { list-style: none; cursor: pointer; display: inline-flex; }
details.inline > summary::-webkit-details-marker { display: none; }
details.inline > form { margin-top: 8px; }
.cell-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
td.detail { white-space: normal; min-width: 260px; max-width: 70ch; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; align-items: start; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.tally { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.tally-item { min-width: 120px; padding: 10px 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sheet); }
.tally-item .tally-n { display: block; font-size: 22px; font-weight: 650; color: var(--ink); letter-spacing: -0.01em; }
.tally-item.is-bad { border-color: #efb9b4; background: var(--bad-tint); }
.tally-item.is-bad .tally-n { color: var(--bad); }
.tally-item.is-wait { border-color: #ecd49a; background: var(--wait-tint); }
.tally-item.is-wait .tally-n { color: var(--wait); }
.tally-item.is-ok .tally-n { color: var(--ok); }

/* the dimension picker */
.dim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 14px; margin: 14px 0; }
.dim { padding: 6px 12px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; }
.dim[open] { background: #fbfcfe; }
.dim summary { cursor: pointer; font-weight: 600; color: var(--ink); padding: 3px 0; }
.dim-values { display: flex; flex-direction: column; gap: 3px; max-height: 14rem; overflow-y: auto; margin: 6px 0 4px; }

.page-list { margin: 0; padding-left: 20px; }

/* ---------------------------------------------------------------- sign-in */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr); }
.login-story { display: flex; flex-direction: column; justify-content: center; gap: 40px; padding: 48px 56px; color: #dbe4fb; background: var(--brand); }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand-mark { display: inline-grid; place-items: center; width: 44px; height: 36px; font-size: 13px; font-weight: 700; color: var(--brand); background: #fff; border-radius: 9px; }
.login-brand-name { font-size: 17px; font-weight: 650; color: #fff; }
.login-story h1 { max-width: 16ch; font-size: 38px; line-height: 1.1; letter-spacing: -0.03em; color: #fff; }
.equation { width: 100%; max-width: 440px; margin: 0; font-variant-numeric: tabular-nums; }
.equation div { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .22); }
.equation dt { color: #b9c8ef; }
.equation dd { margin: 0; font-size: 20px; font-weight: 600; color: #fff; }
.equation .op { font-weight: 400; color: #8fa5e0; margin-right: 6px; }
.equation .result { border-bottom: 3px double #fff; border-top: 1px solid #fff; }
.equation .result dt, .equation .result dd { font-weight: 650; color: #fff; }
.equation .result dd { font-size: 26px; }
.login-note { max-width: 46ch; color: #b9c8ef; font-size: 13px; }
.login-side { display: grid; place-items: center; padding: 40px 28px; background: var(--sheet); }
.login-card { width: 100%; max-width: 380px; }
.login-card > * + * { margin-top: 18px; }
.login-card h2 { font-size: 22px; letter-spacing: -0.02em; }
.login-tagline { color: var(--muted); }
.login-google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 42px; padding: 8px 16px;
  font-weight: 600; color: var(--ink); text-decoration: none; background: var(--sheet); border: 1px solid #b9c1d3; border-radius: var(--r-control);
}
.login-google-btn:hover { color: var(--ink); background: var(--wash); border-color: var(--brand); }
.login-divider { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.login-dev-list { display: flex; flex-direction: column; gap: 6px; }
.login-dev-list form { margin: 0; }
.login-dev-account {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 12px;
  font: inherit; text-align: left; color: inherit; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; cursor: pointer;
}
.login-dev-account:hover { background: var(--signal-tint); border-color: #bccdf6; }
.login-dev-account span { display: flex; flex-direction: column; }
.login-dev-account strong { color: var(--ink); }
.login-dev-account .subtle { font-size: 12px; }
.login-dev-role { align-self: center; }

/* ---------------------------------------------------------------- narrower screens */
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .route { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .route-step:nth-child(2)::before { display: none; }
  .login-page { grid-template-columns: 1fr; }
  .login-story { padding: 32px 28px; }
  .login-story h1 { font-size: 30px; }
}
@media (max-width: 800px) {
  .sidebar { flex-basis: var(--rail-w); width: var(--rail-w); }
  .sidebar .nav-group-label, .sidebar .nav-label { display: none; }
  .sidebar .nav a { justify-content: center; padding: 0; }
  .sidebar.open { position: fixed; z-index: 15; top: var(--topbar-h); bottom: 0; flex-basis: var(--sidebar-w); width: var(--sidebar-w); box-shadow: 10px 0 30px rgba(15, 27, 61, .16); }
  .sidebar.open .nav-group-label, .sidebar.open .nav-label { display: initial; }
  .sidebar.open .nav a { justify-content: flex-start; padding: 0 10px; }
  .main { padding: 18px 16px 48px; }
  .user-trigger-text, .breadcrumb { display: none; }
  .summary dl > div { padding: 0 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }


/* Roles and permissions page */
.perm-matrix td.num, .perm-matrix th.num { text-align: center; width: 6rem; }
.perm-matrix .group-row th { background: var(--desk); text-align: left; font-weight: 600; padding-top: .7rem; }
.perm-matrix td.is-changed { background: color-mix(in srgb, var(--signal) 14%, transparent); }
.perm-matrix input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
.perm-matrix input[disabled] { opacity: .45; }

/* The user manual page */
.manual { max-width: 52rem; }
.manual h1 { display: none; }
.manual h2 { margin-top: 2rem; scroll-margin-top: 1rem; }
.manual h2:first-child { margin-top: 0; }
.manual ol, .manual ul { padding-left: 1.4rem; }
.manual li { margin: .25rem 0; }
.manual code { background: var(--desk); padding: .05rem .3rem; border-radius: 4px; }
.manual-layout .tabs-side { position: sticky; top: 1rem; align-self: start; }

/* Model groups: the rule builder */
.dim-grid { align-items: start; }
.pick-chips { gap: 8px; }
.chip-check { cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-block; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); font-size: 14px; color: var(--ink-2); }
.chip-check input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip-check input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }
.rule-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.rule-sentence { margin: 0; }

/* ---------------------------------------------------------------- Claude Design traits */

/* the cycle chip in the top bar: which cycle the application is on, and where it stands */
.cycle-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 12px; border: 1px solid var(--rule);
  border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--ink); text-decoration: none; background: var(--sheet); }
.cycle-chip:hover { background: var(--wash); color: var(--ink); }
.cycle-chip-label { color: var(--muted); font-weight: 500; }
.cycle-chip .badge { height: 22px; }

/* the foot of the sidebar: who is signed in and what the role does */
.sidebar-foot { margin-top: auto; padding: 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--wash);
  font-size: 12px; line-height: 16px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.sidebar-foot .kicker { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.sidebar-foot strong { font-size: 13px; color: var(--ink); }
.sidebar-foot .chips { gap: 4px; }
.sidebar-foot p + p { margin-top: 2px; }

/* the summary card of a page reads as one strip of labelled facts */
.card.summary { padding: 0; }
.card.summary dl { display: flex; flex-wrap: wrap; align-items: stretch; margin: 0; }
.card.summary dl > div { display: flex; flex-direction: column; gap: 2px; padding: 12px 20px; border-right: 1px solid var(--rule); min-width: 0; }
.card.summary dl > div:last-child { border-right: 0; }
.card.summary dt { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.card.summary dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.card.summary > :not(dl) { margin: 0; padding: 12px 20px; border-top: 1px solid var(--rule); }

/* notices come in more than two colours */
.notice.warn { color: var(--wait); background: var(--wait-tint); border-color: #f2cf8f; }
.notice.info { color: var(--brand); background: var(--signal-tint); border-color: #c9d8fb; }

/* the model list of the budget per unit: a dot says whether a rate is in */
.tabs-side .tab-note::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; border: 2px solid var(--muted); vertical-align: -1px; }
.tabs-side .tab-note.ok::before { background: var(--ok); border-color: var(--ok); }

/* ---------------------------------------------------------------- rows that open details */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--wash); }
.row-go { width: 44px; padding-left: 0; padding-right: 8px; text-align: right; }
.row-go a { display: inline-grid; place-items: center; width: 30px; height: 30px; color: var(--muted); border-radius: var(--r-control); }
.row-go a:hover, tr[data-href]:hover .row-go a { color: var(--brand); background: var(--signal-tint); }

/* read-only details: label above value */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px 28px; margin: 0; }
.facts > div { min-width: 0; }
.facts dt { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 550; color: var(--ink); overflow-wrap: anywhere; }
.facts dd:empty::after { content: "-"; color: var(--muted); font-weight: 400; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
