/* MXO dashboard — neutral canvas, hairline borders, compact type, line icons (light + dark). */

:root {
  --font: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --canvas: oklch(98.75% 0 0);
  --base: #fff;
  --elevated: oklch(98% 0 0);
  --recessed: oklch(96% 0 0);
  --tint: oklch(97% 0 0);
  --fill: oklch(92.2% 0 0);
  --line: oklch(14.5% 0 0 / .1);
  --hairline: oklch(93.5% 0 0);
  --text: oklch(21% .006 285.885);
  --strong: oklch(14.5% 0 0);
  --subtle: oklch(55.6% 0 0);
  --placeholder: oklch(70.8% 0 0);
  --brand: oklch(57.72% .2324 260);
  --brand-hover: oklch(48.8% .243 264.376);
  --accent: #f6821f;
  --link: oklch(42.4% .199 265.638);
  --success: oklch(43.2% .095 166.913);
  --success-tint: oklch(96.2% .043 156.7 / .57);
  --danger: oklch(50.5% .213 27.518);
  --danger-tint: oklch(93.6% .032 17.7 / .42);
  --warning: oklch(59.7% .144 57.5);
  --warning-tint: oklch(93.1% .107 94.6 / .25);
  --info-tint: oklch(93.2% .032 255.6 / .45);
  --focus: oklch(15% 0 0);
  --shadow: 0 0 1px .5px oklch(0% 0 0 / .12), 0 1px 2px oklch(0% 0 0 / .08);
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar: 248px;
  --header: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: oklch(10% 0 0);
    --base: oklch(17% 0 0);
    --elevated: oklch(12% 0 0);
    --recessed: oklch(15% 0 0);
    --tint: oklch(26.9% 0 0);
    --fill: oklch(26.9% 0 0);
    --line: oklch(32% 0 0);
    --hairline: oklch(26.9% 0 0);
    --text: oklch(97% 0 0);
    --strong: oklch(98.5% 0 0);
    --subtle: oklch(70.8% 0 0);
    --placeholder: oklch(55.6% 0 0);
    --brand: oklch(51.948% .2324 260);
    --link: oklch(70.7% .165 254.624);
    --success: oklch(90.5% .093 164.15);
    --success-tint: oklch(39.3% .096 152.3 / .2);
    --danger: oklch(70.4% .191 22.216);
    --danger-tint: oklch(42.9% .176 28.7 / .17);
    --warning: oklch(75% .183 55.934);
    --warning-tint: oklch(35.3% .079 65 / .37);
    --info-tint: oklch(38% .145 265.5 / .22);
    --focus: oklch(93.5% 0 0);
    --shadow: 0 0 1px .5px oklch(100% 0 0 / .1), 0 1px 2px oklch(0% 0 0 / .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0; background: var(--canvas); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.5; letter-spacing: -.01em;
  font-feature-settings: "cv02", "cv03", "cv04", "calt";
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, pre, .secret { font-family: var(--mono); letter-spacing: 0; }
code { font-size: 12.5px; background: var(--tint); border: 1px solid var(--hairline); border-radius: 4px; padding: 1px 5px; }
h1 { font-size: 22px; font-weight: 500; letter-spacing: -.02em; color: var(--strong); margin: 0 0 6px; }
h2 { font-size: 15px; font-weight: 500; color: var(--strong); margin: 28px 0 10px; }
.card > h2:first-child { margin-top: 0; }
p { margin: 8px 0; }

/* Icons */
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* Top bar */
header.top {
  position: sticky; top: 0; z-index: 20; height: var(--header);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--base); border-bottom: 1px solid var(--line);
}
header.top .spacer { flex: 1; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--strong); font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; }
.brand .mark .ic { width: 18px; height: 18px; stroke-width: 2.25; vertical-align: 0; }
.brand .tag, .tag { font-size: 11px; font-weight: 500; color: var(--subtle); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.brand.big { font-size: 20px; justify-content: center; margin-bottom: 20px; }
.brand.big .mark { width: 36px; height: 36px; border-radius: 9px; }
.divider { width: 1px; height: 24px; background: var(--line); }
.org { display: inline-flex; align-items: center; gap: 6px; color: var(--subtle); }
.org select { border: 0; background: transparent; padding: 6px 4px; font-weight: 500; color: var(--text); max-width: 260px; box-shadow: none; }
.org select:focus-visible { box-shadow: 0 0 0 2px var(--brand); }
.toplink { display: inline-flex; align-items: center; gap: 6px; color: var(--text); padding: 6px 10px; border-radius: var(--radius); }
.toplink:hover { background: var(--tint); text-decoration: none; }
.who { color: var(--subtle); font-size: 13px; padding: 0 4px; }

/* Layout */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - var(--header)); }
nav.side {
  position: sticky; top: var(--header); align-self: start; height: calc(100vh - var(--header)); overflow-y: auto;
  padding: 12px; border-right: 1px solid var(--line); background: var(--base);
  display: flex; flex-direction: column; gap: 2px;
}
nav.side button, nav.side .navlink {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; padding: 7px 10px; border-radius: var(--radius);
  color: var(--text); font: inherit; cursor: pointer;
}
nav.side button .ic, nav.side .navlink .ic { color: var(--subtle); }
nav.side button:hover, nav.side .navlink:hover { background: var(--tint); text-decoration: none; }
nav.side button.active { background: var(--recessed); color: var(--strong); font-weight: 500; box-shadow: inset 0 0 0 1px var(--hairline); }
nav.side button.active .ic { color: var(--strong); }
nav.side .navlink { margin-top: auto; color: var(--subtle); }
nav.side .navlink .ic:last-child { width: 12px; height: 12px; margin-left: auto; }

main { padding: 28px 32px 64px; max-width: 1180px; width: 100%; }
main.docs { margin: 0 auto; max-width: 860px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--subtle); font-size: 12px; margin-bottom: 4px; }
.eyebrow .ic { width: 14px; height: 14px; vertical-align: 0; }
#view > h1 + p, #view > h1 + .muted { margin-top: 0; }
#view > h1 { margin-bottom: 4px; }

/* Surfaces */
.card {
  background: var(--base); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; margin: 16px 0; box-shadow: 0 1px 1px oklch(0% 0 0 / .02);
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--base); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.tile .label { color: var(--subtle); font-size: 13px; }
.tile .value { font-size: 24px; font-weight: 500; letter-spacing: -.02em; color: var(--strong); font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .sub { color: var(--subtle); font-size: 12px; margin-top: 2px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
thead th { color: var(--subtle); font-weight: 500; font-size: 12px; background: var(--elevated); border-bottom: 1px solid var(--line); }
thead tr th:first-child { border-top-left-radius: var(--radius); }
thead tr th:last-child { border-top-right-radius: var(--radius); }
tbody tr:hover td { background: var(--elevated); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.card > table, .card > div > table { margin: -4px 0; }

/* Controls */
input, select, textarea, button { font: inherit; letter-spacing: inherit; color: var(--text); }
input, select, textarea {
  background: var(--base); border: 0; border-radius: var(--radius); padding: 7px 10px; min-height: 36px;
  box-shadow: 0 0 0 1px var(--line); transition: box-shadow .1s;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 1.5px var(--brand); }
input[type="checkbox"] { min-height: 0; width: 16px; height: 16px; accent-color: var(--brand); box-shadow: none; }
input[type="file"] { padding: 4px; }
input[type="file"]::file-selector-button { border: 0; border-radius: 6px; background: var(--fill); padding: 6px 10px; margin-right: 10px; font: inherit; color: var(--text); cursor: pointer; }
textarea { width: 100%; min-height: 160px; resize: vertical; line-height: 1.5; }
select { padding-right: 28px; }

button.primary, button.secondary, button.danger, button.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: var(--radius); border: 0; cursor: pointer;
  font-weight: 500; white-space: nowrap; transition: background-color .1s, box-shadow .1s;
}
button.primary { background: var(--brand); color: #fff; box-shadow: inset 0 1px 0 oklch(100% 0 0 / .2), var(--shadow); }
button.primary:hover { background: var(--brand-hover); }
button.secondary { background: var(--base); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
button.secondary:hover { background: var(--tint); }
button.danger { background: var(--base); color: var(--danger); box-shadow: 0 0 0 1px var(--line); }
button.danger:hover { background: var(--danger-tint); }
button.ghost { background: none; color: var(--subtle); padding: 0 10px; }
button.ghost:hover { background: var(--tint); color: var(--text); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button:disabled { opacity: .55; cursor: default; }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 10px 0; }
.row > label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 500; color: var(--subtle); }
.row > label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; min-height: 36px; }
.grow { flex: 1; min-width: 200px; }

/* Feedback */
.muted { color: var(--subtle); }
.small { font-size: 13px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 500; background: var(--tint); color: var(--text); vertical-align: 2px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.good { background: var(--success-tint); color: var(--success); }
.badge.bad { background: var(--danger-tint); color: var(--danger); }
.badge.warn { background: var(--warning-tint); color: var(--warning); }
.notice { padding: 10px 14px; border-radius: var(--radius); margin: 10px 0; background: var(--info-tint); border: 1px solid var(--line); font-size: 13px; }
.notice.bad { background: var(--danger-tint); color: var(--danger); border-color: transparent; }
.notice.good { background: var(--success-tint); color: var(--success); border-color: transparent; }
.secret { display: block; background: var(--recessed); border: 1px solid var(--hairline); padding: 8px 10px; border-radius: var(--radius); word-break: break-all; font-size: 12.5px; margin-top: 6px; }
code.secret { display: inline-block; margin: 0; }
pre { background: var(--recessed); border: 1px solid var(--hairline); padding: 12px 14px; border-radius: var(--radius); overflow: auto; font-size: 12.5px; line-height: 1.6; }
.output { white-space: pre-wrap; background: var(--recessed); border: 1px solid var(--hairline); padding: 12px 14px; border-radius: var(--radius); min-height: 140px; }
details > summary { cursor: pointer; color: var(--subtle); padding: 6px 0; }
details > summary:hover { color: var(--text); }

/* Sign in */
.center { max-width: 400px; margin: 12vh auto; padding: 0 16px; }
.center .card { padding: 28px; }
.center h1 { font-size: 20px; }

.hidden { display: none !important; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  nav.side { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav.side button, nav.side .navlink { width: auto; white-space: nowrap; }
  nav.side .navlink { margin-top: 0; }
  main { padding: 20px 16px 48px; }
  .who, #logout span, .divider { display: none; }
}

/* Native selects styled like inputs, with a small chevron glyph */
select:not(.org select) {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.row > label { min-width: 160px; }
.row > label > input:not([type="checkbox"]), .row > label > select { width: 100%; }
