/* Fitted Console - house style of fittedsolutions.nl: black, white and grey, Inter.
   Layout: a narrow top bar, one content column (max 1080 px); lists as tables,
   tenant state as pills. Semantic colours (live / busy / failed) are the only hues. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #f1f1f1;
  --surface: #ffffff;
  --ink: #000000;
  --ink-2: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e0e0e0;
  --field: #ffffff;
  --button: #1f1f1f;
  --button-ink: #ffffff;
  --button-hover: #000000;
  --ok: #1d6b3a;
  --ok-bg: #e3f1e7;
  --busy: #7a5300;
  --busy-bg: #fbf0d6;
  --bad: #a3261d;
  --bad-bg: #f8e2df;
  --idle-bg: #ececec;
  --focus: #1f1f1f;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --surface: #1c1c1c; --ink: #ffffff; --ink-2: #e5e5e5; --muted: #a3a3a3; --line: #2e2e2e;
    --field: #141414; --button: #e5e5e5; --button-ink: #111111; --button-hover: #ffffff;
    --ok: #7fd39b; --ok-bg: #173323; --busy: #f2c76b; --busy-bg: #3a2e12; --bad: #ff9a90; --bad-bg: #3d1a17;
    --idle-bg: #2a2a2a; --focus: #e5e5e5; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --surface: #1c1c1c; --ink: #ffffff; --ink-2: #e5e5e5; --muted: #a3a3a3; --line: #2e2e2e;
  --field: #141414; --button: #e5e5e5; --button-ink: #111111; --button-hover: #ffffff;
  --ok: #7fd39b; --ok-bg: #173323; --busy: #f2c76b; --busy-bg: #3a2e12; --bad: #ff9a90; --bad-bg: #3d1a17;
  --idle-bg: #2a2a2a; --focus: #e5e5e5; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink-2); font: 400 15px/1.55 var(--font); }
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { color: var(--ink); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.25; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }
p { margin: 0; max-width: 68ch; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.bar-inner, main { max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.bar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding-block: 14px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand img { height: 20px; width: auto; display: block; }
.brand span { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
nav { display: flex; flex-wrap: wrap; gap: 4px 18px; flex: 1; }
nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.92rem; }
nav a[aria-current="page"], nav a:hover { color: var(--ink); }
.who { display: flex; align-items: center; gap: 12px; font-size: 0.88rem; color: var(--muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand img, :root:not([data-theme="light"]) .logo-mark { filter: invert(1); } }
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .logo-mark { filter: invert(1); }

main { padding-block: 32px 64px; display: grid; gap: 24px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.head > div { display: grid; gap: 6px; min-width: 0; }
.eyebrow { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 14px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.88rem; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td a { font-weight: 500; }
td.nowrap, td .mono, td.mono { white-space: nowrap; }

/* State pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 500; white-space: nowrap; background: var(--idle-bg); color: var(--ink-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.live { background: var(--ok-bg); color: var(--ok); }
.pill.queued, .pill.running { background: var(--busy-bg); color: var(--busy); }
.pill.failed { background: var(--bad-bg); color: var(--bad); }
.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 0.76rem; color: var(--muted); }

/* Forms */
form.stack, .stack { display: grid; gap: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 20px; margin: 0; display: grid; gap: 16px; min-width: 0; }
legend { font-weight: 600; color: var(--ink); padding: 0 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: end; }
label { display: grid; gap: 6px; font-size: 0.88rem; font-weight: 500; color: var(--ink-2); }
label small, .hint { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 11px; width: 100%; min-width: 0;
}
input[type="color"] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); }
textarea { min-height: 96px; font-family: var(--mono); font-size: 0.86rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--button); }
.colour { display: flex; gap: 8px; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
button, .button {
  font: 500 0.92rem/1 var(--font); border-radius: var(--radius); padding: 11px 18px; cursor: pointer; text-decoration: none;
  background: var(--button); color: var(--button-ink); border: 1px solid var(--button); display: inline-flex; align-items: center; gap: 8px;
}
button:hover, .button:hover { background: var(--button-hover); border-color: var(--button-hover); }
button.secondary, .button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { border-color: var(--ink); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-bg); }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 500; }
button.link:hover { color: var(--ink); background: none; }

/* Messages */
.flash { border-radius: var(--radius); padding: 12px 16px; font-size: 0.92rem; border: 1px solid var(--line); background: var(--surface); }
.flash.error { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.flash.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }

/* Login and activation */
.auth { min-height: 100vh; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 28px; display: grid; gap: 20px; }
.auth-card .logo-mark { height: 24px; width: auto; }
.auth-card .eyebrow { margin-top: -10px; }
.qr { justify-self: center; background: #ffffff; padding: 10px; border-radius: var(--radius); border: 1px solid var(--line); }
.secret { font-family: var(--mono); font-size: 0.82rem; overflow-wrap: anywhere; color: var(--muted); }

/* Branding preview: a miniature of the LibreChat login card with the chosen colours */
.preview { border: 1px solid var(--line); border-radius: var(--radius); background: #ffffff; color: #1f1f1f; padding: 22px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.preview img { max-height: 44px; max-width: 220px; }
.preview .pv-title { font-weight: 600; font-size: 1.05rem; color: #0d0d0d; }
.preview .pv-input { width: 100%; max-width: 260px; height: 34px; border: 1px solid #d9d9d9; border-radius: 8px; }
.preview .pv-button { width: 100%; max-width: 260px; height: 36px; border-radius: 8px; color: #ffffff; display: grid; place-items: center; font-size: 0.86rem; font-weight: 500; background: var(--pv-primary, #1f1f1f); }
.preview .pv-link { font-size: 0.8rem; color: var(--pv-primary, #1f1f1f); }
.preview .pv-foot { font-size: 0.74rem; color: #6b6b6b; }
.swatches { display: flex; gap: 8px; }
.swatches span { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); }

details.danger-zone { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 20px; }
details.danger-zone summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details.danger-zone[open] summary { margin-bottom: 14px; }

@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dd { margin-bottom: 8px; }
  main { padding-block: 20px 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
