/* Datalynk Staff Hub, 2026 revision
   Brand tokens are unchanged from the live stack:
   --primary rgb(63,111,133)  datalynk/static/style/datalynk.css:4
   --primary-dark #254d68     datalynk/js/theme/grouped/style.css:661
   --accent #c42d27           login/_common/theme.css (Auxilium red)
   --danger #a00              grouped/style.css:259
   Roboto                     login/_common/theme.css
   What changed is structure: colour moved off the frame and onto actions and status,
   neutrals are tinted toward --primary-dark, radii and type scale are new (see README). */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');

:root {
  --primary: rgb(63, 111, 133);
  --primary-hover: #345d70;
  --primary-dark: #254d68;
  --primary-tint: #e9f0f4;
  --primary-fore: #fff;
  --accent: #c42d27;

  --canvas: #f6f7f8;
  --surface: #fff;
  --border: #e3e7ea;
  --border-strong: #6e777f;     /* input edge, above 3:1 on white */
  --text: #1d2b33;
  --muted: #5b6770;
  --faint: #6b757d;

  --nav-bg: var(--primary-dark);
  --nav-text: #c9d6de;
  --nav-section: #b3c4d0;

  --ok: #2f8a55;     --ok-bg: #e3f4ea;   --ok-fg: #1d6b3d;
  --warn: #b57a00;   --warn-bg: #fff6e0; --warn-fg: #7a5100; --warn-border: #f0d9a0;
  --danger: #a00;    --danger-bg: #fdecec; --danger-fg: #a02323; --danger-border: #f1b8b8;
  --neutral-bg: #eef1f3; --neutral-fg: #4f5a62;
  --overlay: rgba(29, 43, 51, .4);

  --r-sm: 6px;    /* controls */
  --r-md: 10px;   /* panels */
  --r-lg: 14px;   /* dialogs */
  --shadow-pop: 0 12px 32px rgba(29,43,51,.18), 0 2px 6px rgba(29,43,51,.08);

  --font: Roboto, Arial, Helvetica, sans-serif;
  --mono: "Roboto Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 13px; font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }

/* ---------- Shell: brand lives in the sidebar, content area is neutral ---------- */
.layout { display: flex; min-height: 100vh; }
.nav {
  width: 232px; flex: 0 0 232px; background: var(--nav-bg); color: var(--nav-text);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh;
}
.nav .brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.nav .brand img { height: 22px; }
.nav .brand span { color: #fff; font-weight: 500; font-size: 13px; border-left: 1px solid rgba(255,255,255,.25); padding-left: 10px; line-height: 1.2; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--nav-text); font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 500; }
.nav svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .85; }
.nav .section { padding: 18px 10px 6px; font-size: 12px; font-weight: 500; color: var(--nav-section); }
.nav .count { margin-left: auto; font-size: 12px; color: var(--nav-section); }
.nav .spacer { flex: 1; }
.nav .me { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid rgba(255,255,255,.12); margin-top: 8px; font-size: 13px; color: #fff; }
.nav .me small { display: block; color: var(--nav-section); font-size: 12px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 32px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar .spacer { flex: 1; }
.cmdk {
  display: flex; align-items: center; gap: 8px; width: 420px; height: 34px; padding: 0 10px; border-radius: var(--r-sm);
  background: var(--canvas); border: 1px solid var(--border); color: var(--muted); font: 14px var(--font); cursor: text;
}
.cmdk svg { width: 15px; height: 15px; }
.kbd { margin-left: auto; font: 500 12px var(--font); color: var(--muted); border: 1px solid var(--border); background: var(--surface); border-radius: 4px; padding: 0 5px; }
.env { font-size: 12px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.env:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.main { padding: 28px 32px 40px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.page-head .sub { color: var(--muted); margin-top: 4px; max-width: 68ch; }
.page-head .actions { display: flex; gap: 8px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.summary { display: flex; gap: 22px; color: var(--muted); font-size: 13px; margin: -6px 0 18px; }
.summary b { color: var(--text); font-weight: 600; font-size: 15px; margin-right: 4px; }

/* ---------- Panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: auto; }
.card .card-h { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card .card-h + .tbl, .card .card-h + table { border-top: 1px solid var(--border); }
.card .card-b { padding: 16px 18px; }
.card .card-f { padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.card-h h2 { font-size: 15px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 16px; align-content: start; }
.section-gap { margin-bottom: 16px; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--r-sm); font: 500 14px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: 0 1px 0 rgba(29,43,51,.04);
}
.btn:hover { background: var(--canvas); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fore); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger-fg); }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger-border); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--canvas); color: var(--text); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
/* one filled primary per screen: row-level actions are quieter */
.tbl .btn.primary { background: var(--surface); color: var(--primary); border-color: var(--border); }
.tbl .btn.primary:hover { background: var(--primary-tint); border-color: var(--primary-tint); }

.input { height: 34px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 0 10px; font: 14px var(--font); background: #fff; color: var(--text); }
select.input { padding-right: 6px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.search { position: relative; }
.search .input { padding-left: 32px; width: 280px; }
.search svg { position: absolute; left: 10px; top: 10px; width: 14px; height: 14px; color: var(--muted); }

.chips { display: inline-flex; background: var(--canvas); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.chip { font: 500 13px var(--font); height: 28px; padding: 0 12px; border-radius: 4px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(29,43,51,.12); }
.chip .n { color: var(--faint); margin-left: 4px; font-weight: 400; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; white-space: nowrap; line-height: 18px; }
.pill:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.plain:before, .pill.n:before { display: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.danger { background: var(--danger-bg); color: var(--danger-fg); }
.pill.n { background: var(--neutral-bg); color: var(--neutral-fg); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); } .dot.n { background: var(--faint); }

.toggle { width: 36px; height: 22px; border-radius: 11px; border: 0; padding: 0; background: #8d969d; position: relative; display: inline-block; cursor: pointer; vertical-align: middle; }
.toggle:after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s ease-out; }
.toggle.on { background: var(--ok); } .toggle.on:after { transform: translateX(14px); }
.toggle-label { font-size: 13px; color: var(--muted); margin-left: 8px; vertical-align: middle; }

.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; flex: 0 0 28px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; vertical-align: middle; }

/* ---------- Tables: no fill on the header, hairline rows ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fafbfc; }
.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl td.nw, .tbl td:first-child { white-space: nowrap; }
.tbl td:has(.toggle) { white-space: nowrap; }
.tbl .code { font-family: var(--mono); font-size: 13px; color: var(--text); font-weight: 500; }
.tbl .sub { display: block; font-size: 12.5px; color: var(--muted); }
.tbl a.code:hover { color: var(--primary); }

.kv { display: grid; grid-template-columns: 112px 1fr; row-gap: 10px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.kv dd:has(.toggle) { white-space: nowrap; }

.alert { padding: 12px 16px; border-radius: var(--r-md); font-size: 14px; border: 1px solid; display: block; }
.alert:has(.btn) { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.alert.danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.alert.info { background: var(--primary-tint); border-color: #cddbe3; color: var(--primary-dark); }

.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.list-row:last-child { border-bottom: 0; }

/* ---------- Dialogs ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 20; }
.modal { width: 480px; background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.modal .m-h { padding: 20px 22px 4px; font-size: 17px; font-weight: 600; color: var(--text); }
.modal .m-sub { padding: 0 22px; color: var(--muted); font-size: 13px; }
.modal .m-b { padding: 16px 22px; }
.modal .m-f { padding: 14px 22px; display: flex; justify-content: flex-end; gap: 8px; background: var(--canvas); border-top: 1px solid var(--border); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field .input { width: 100%; }
.field .err { color: var(--danger-fg); font-size: 12.5px; margin-top: 5px; }
.input.invalid { border-color: var(--danger); }

/* command palette */
.palette { width: 620px; background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; }
.palette .q { display: flex; align-items: center; gap: 10px; padding: 0 18px; height: 54px; border-bottom: 1px solid var(--border); font-size: 16px; }
.palette .q svg { width: 18px; height: 18px; color: var(--muted); }
.palette .grp { padding: 10px 18px 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.palette .it { display: flex; align-items: center; gap: 12px; padding: 9px 18px; font-size: 14px; }
.palette .it.sel { background: var(--primary-tint); }
.palette .it .r { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.palette .foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--canvas); }

.footer { padding: 12px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------- Focus, motion, states ---------- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav :focus-visible { outline-color: #fff; }
a, button, input, select, textarea, .btn { scroll-margin-top: 72px; }
.skip {
  position: absolute; left: 12px; top: 12px; z-index: 40; transform: translateY(-150%);
  background: #fff; color: var(--text); padding: 8px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
}
.skip:focus { transform: none; }
::placeholder { color: var(--muted); opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .nav { width: auto; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .nav .brand { padding-bottom: 8px; }
  .nav .spacer { display: none; }
  .nav .section { width: 100%; padding: 8px 10px 0; }
  .nav .me { width: 100%; margin-top: 4px; }
  .topbar, .main { padding-left: 16px; padding-right: 16px; }
  .cmdk { width: 100%; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}
.off-note { font-size: 13px; color: var(--muted); margin-right: 8px; }
.toast { position: fixed; right: 28px; bottom: 28px; background: var(--text); color: #fff; padding: 12px 16px; border-radius: var(--r-md); display: flex; gap: 16px; align-items: center; box-shadow: var(--shadow-pop); font-size: 14px; }
.toast a { color: #fff; text-decoration: underline; }
.empty { padding: 44px 16px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.skeleton { display: inline-block; height: 12px; border-radius: 4px; background: var(--neutral-bg); }
.secret { font-family: var(--mono); background: var(--canvas); border: 1px solid var(--border); padding: 10px 12px; border-radius: var(--r-sm); word-break: break-all; font-size: 13px; }
.state-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 32px 0 10px; }

.tbl.nw-2 td:nth-child(2) { white-space: nowrap; }

/* ---------- App additions (live hub) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.cmdk-form { margin: 0; }
.cmdk input { border: 0; background: transparent; outline: none; font: inherit; color: var(--text); flex: 1; min-width: 0; }
.cmdk:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); background: var(--surface); }
.radio { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 4px 0; cursor: pointer; }
.radio input { margin-top: 3px; accent-color: var(--primary); }
.chips label.chip { cursor: pointer; }
.chips .chip:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
.actions form, .page-head .actions form { margin: 0; }
.tbl td.actions > * { margin-left: 4px; }
tr.muted td { color: var(--muted); }
