/* The panel, in TagRadar's design: IBM Plex Sans on white, hairline borders, square
   corners, caps labels and one brand colour. Fonts are served from the panel itself. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --ink: #141715;
  --muted: #686f6b;
  --faint: #9aa19d;
  --line: #e1e5e2;
  --surface: #fff;
  --hover: #f6feff;
  --brand: #1caec4;
  --brand-tint: #e6f6f9;
  --brand-ink: #0b7385;
  --warn: #e08a1e;
  --danger: #b3261e;
  --good: #2f7d4f;
  --page: #fff;
  /* Text on an ink-coloured button, and the button on hover. */
  --on-ink: #fff;
  --ink-hover: #2a2f2c;
  /* Quiet fills: striped "automatic" swatches, the dots' halos. */
  --soft: #f8faf9;
  --soft-2: #f3f5f4;
  --soft-3: #e9edeb;
  --good-tint: #e6f2ea;
  --scrim: rgba(20, 23, 21, 0.4);
  --shadow: rgba(20, 23, 21, 0.25);
  color-scheme: light dark;
}
/* Dark: the system's choice, unless the dashboard shown chose a theme (converage:theme sets
   data-theme on the panel too). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
  --ink: #e8edf1;
  --muted: #9aa5ae;
  --faint: #6d7881;
  --line: #2a3238;
  --surface: #14191d;
  --page: #0f1316;
  --hover: #1a2328;
  --brand: #2cc3da;
  --brand-tint: #11313a;
  --brand-ink: #67d6e8;
  --warn: #f0a243;
  --danger: #f06b60;
  --good: #52b27d;
  --on-ink: #0f1316;
  --ink-hover: #c9d3da;
  --soft: #192025;
  --soft-2: #1f272c;
  --soft-3: #2a3238;
  --good-tint: #173525;
  --scrim: rgba(0, 0, 0, 0.55);
  --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --ink: #e8edf1;
  --muted: #9aa5ae;
  --faint: #6d7881;
  --line: #2a3238;
  --surface: #14191d;
  --page: #0f1316;
  --hover: #1a2328;
  --brand: #2cc3da;
  --brand-tint: #11313a;
  --brand-ink: #67d6e8;
  --warn: #f0a243;
  --danger: #f06b60;
  --good: #52b27d;
  --on-ink: #0f1316;
  --ink-hover: #c9d3da;
  --soft: #192025;
  --soft-2: #1f272c;
  --soft-3: #2a3238;
  --good-tint: #173525;
  --scrim: rgba(0, 0, 0, 0.55);
  --shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 400 14px/1.5 "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
svg { display: block; }
h3 { margin: 26px 0 12px; font-size: 16px; font-weight: 600; }
p { margin: 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- shared controls ---------- */

.wordmark { display: inline-flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.wordmark b { font-weight: 700; color: var(--brand); }
.wordmark img { display: block; width: auto; height: 44px; }
.sign-in-logo { display: block; width: 200px; height: auto; margin-left: -6px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 2px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.button:hover { border-color: var(--faint); }
.button.dark { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.button.dark:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.button.active { border-color: var(--brand); color: var(--brand-ink); }
.button.big { height: 38px; font-size: 13px; }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.danger-outline { border-color: var(--danger); color: var(--danger); }
.button:disabled { opacity: 0.5; cursor: default; }

.icon-button { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 2px; background: none; color: var(--ink); }
.icon-button:hover { background: var(--hover); }
.icon-button:disabled { opacity: 0.3; cursor: default; }

.input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.input:focus { outline: 0; border-color: var(--brand); }
.input.small { width: auto; height: 30px; font-size: 12px; }
.input[readonly] { color: var(--muted); background: var(--hover); }
select.input { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 11px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.code-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: 0.3em; text-align: center; height: 44px; }

.caps { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.badge { display: inline-block; padding: 0 5px; border: 1px solid var(--line); border-radius: 2px; font-size: 10px; font-weight: 600; line-height: 15px; color: var(--muted); white-space: nowrap; }
.badge.warn { border-color: var(--warn); color: var(--warn); }
.badge.brand { border-color: var(--brand); color: var(--brand-ink); }
.badge.danger { border-color: var(--danger); color: var(--danger); }
.link { padding: 0; border: 0; background: none; font: inherit; color: var(--brand-ink); text-decoration: underline; cursor: pointer; }
.warn-text { color: var(--warn); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.switch { appearance: none; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 11px; background: var(--line); position: relative; cursor: pointer; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.switch:checked { background: var(--brand); }
.switch:checked::after { left: 19px; }
.switch:disabled { opacity: 0.5; cursor: default; }

.avatar { flex: none; border-radius: 50%; object-fit: cover; }
.avatar.initial { display: inline-grid; place-items: center; background: var(--brand-tint); color: var(--brand-ink); font-weight: 600; }
.client-logo { flex: none; display: block; padding: 3px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); object-fit: contain; }
.client-logo.initial { display: inline-grid; place-items: center; padding: 0; border-color: transparent; background: var(--brand-tint); color: var(--brand-ink); font-weight: 600; }

/* A picture that is its own control: hover or focus shows what a click does. */
.picture { position: relative; flex: none; }
.picture-pick { position: relative; display: block; padding: 0; border: 0; background: none; line-height: 0; cursor: pointer; }
/* The picture is a block, so the button is exactly its size and the overlay covers it exactly. */
.picture-pick > .avatar, .picture-pick > .client-logo { display: block; }
.picture-pick > .avatar.initial, .picture-pick > .client-logo.initial { display: grid; line-height: 1; }
.picture.photo .picture-pick, .picture.photo .picture-overlay { border-radius: 50%; }
.picture.logo .picture-pick, .picture.logo .picture-overlay { border-radius: 2px; }
.picture-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: rgba(20, 23, 21, 0.58); color: #fff; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; line-height: 1.2; opacity: 0; transition: opacity 0.15s; }
.picture-pick:hover .picture-overlay, .picture-pick:focus-visible .picture-overlay { opacity: 1; }
.picture-remove { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); opacity: 0; transition: opacity 0.15s; cursor: pointer; }
.picture:hover .picture-remove, .picture-remove:focus-visible { opacity: 1; }
.picture-remove:hover { border-color: var(--danger); color: var(--danger); }
@media (hover: none) { .picture-overlay { opacity: 0.85; background: linear-gradient(transparent 55%, rgba(20, 23, 21, 0.7) 55%); justify-content: flex-end; padding-bottom: 4px; } .picture-overlay svg { display: none; } .picture-remove { opacity: 1; } }

/* A message under a form or at the top of a page. */
.notice { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 2px; font-size: 13px; }
.notice.ok { border-left-color: var(--brand); }
.notice.error { border-left-color: var(--danger); }
.notice.warn { border-left-color: var(--warn); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 40; transform: translateX(-50%); padding: 10px 16px; border-radius: 2px; background: var(--ink); color: var(--on-ink); font-size: 13px; box-shadow: 0 8px 24px rgba(20, 23, 21, 0.2); }
.toast.error { background: var(--danger); }

/* ---------- top bar ---------- */

.topbar { display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar nav { display: flex; align-items: center; gap: 8px; }
.user { display: flex; align-items: center; gap: 8px; max-width: 300px; padding: 4px 6px 4px 12px; font-size: 12px; }
.user a { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- pages ---------- */

.column { max-width: 720px; margin: 0 auto; padding: 40px 16px 64px; }
.column.wide { max-width: 1180px; }
.column h1 { margin: 0 0 8px; font-size: 24px; font-weight: 600; }
.column .lead { margin: 0 0 30px; max-width: 70ch; }
.column-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; }
.column-top h1 { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.back:hover { color: var(--ink); }
.column-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.column-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.column-head.section, .section { margin-top: 40px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form .input { width: 220px; height: 30px; font-size: 13px; }
.table-note { margin: 14px 0 0; font-size: 13px; }

/* ---------- tables ---------- */

.table-head, .row { display: grid; align-items: center; column-gap: 18px; }
.table-head { padding: 18px 16px 12px; }
.rows { border: 1px solid var(--line); }
.row { width: 100%; min-height: 64px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; }
.row:last-child { border-bottom: 0; }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: var(--hover); }
.muted-row > :not(.row-actions) { opacity: 0.55; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name { font-weight: 500; }
.sub { font-size: 12px; color: var(--muted); }

.cols-people { grid-template-columns: minmax(230px, 1.6fr) 140px 130px 80px 90px 28px; }
.cols-clients { grid-template-columns: minmax(200px, 1.4fr) minmax(160px, 1.2fr) 100px 20px; }
.cols-accounts { grid-template-columns: 190px minmax(140px, 1fr) minmax(140px, 1fr) 28px; min-height: 56px; }
.cols-versions { grid-template-columns: 90px minmax(160px, 1fr) minmax(120px, 1fr) 170px auto; }
.cols-grants { grid-template-columns: minmax(0, 1fr) 170px 28px; min-height: 52px; }
.cols-viewers { grid-template-columns: minmax(0, 1fr) auto; min-height: 52px; }
.cols-keys { grid-template-columns: minmax(160px, 1.2fr) minmax(140px, 1fr) 130px 120px 28px; }
.cols-audit { grid-template-columns: minmax(0, 1fr) 160px 120px; min-height: 44px; font-size: 13px; }
.cols-sessions { grid-template-columns: minmax(0, 1fr) 140px 140px; min-height: 48px; font-size: 13px; }

/* ---------- dashboard cards (the home list) ---------- */

.card { display: flex; align-items: center; gap: 20px; margin-top: 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; }
.card:hover { border-color: var(--brand); }
.card .about { flex: 1; min-width: 0; }
.card .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { margin-top: 2px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.card .badges:empty { display: none; }

/* ---------- the viewer ---------- */

.viewer { display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); height: 100vh; }
.viewer-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.viewer-title b { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.viewer iframe { width: 100%; height: 100%; border: 0; }
.view-as-badge { line-height: 22px; padding: 0 8px; font-size: 12px; text-decoration: none; white-space: nowrap; }
.notice.view-as { margin-bottom: 12px; }
.preview { margin-top: 16px; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--hover); font-size: 13px; }
.preview iframe { display: block; width: 100%; height: 720px; border: 0; }
.diff { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--hover); font: 12px/1.55 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow: auto; max-height: 420px; }
.diff .add { color: var(--good); }
.diff .del { color: var(--danger); }

/* ---------- settings lines, forms, danger zone ---------- */

.setting { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting .titles { flex: 1; min-width: 0; }
.setting-title { font-weight: 500; }
.setting .muted { font-size: 13px; }
.setting .input { width: 260px; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 5px; }
.form label > span { font-size: 13px; font-weight: 500; }
.form small { color: var(--muted); font-size: 12px; }
.danger-title { color: var(--danger); }
.danger-box { margin: 12px 0; padding: 16px; border: 1px solid var(--danger); border-radius: 2px; }
.danger-box p { margin: 0 0 12px; font-size: 13px; }
.code { display: block; width: 100%; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--hover); font: 12px/1.6 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.key-once { display: flex; gap: 8px; margin: 14px 0; }
.key-once .input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- dialogs ---------- */

.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background: var(--scrim); }
.modal { display: flex; flex-direction: column; width: min(560px, 100%); max-height: calc(100vh - 48px); background: var(--surface); border-radius: 2px; box-shadow: 0 24px 60px var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-body { display: grid; gap: 12px; padding: 18px 22px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* ---------- sign-in ---------- */

.sign-in { max-width: 380px; margin: 12vh auto 48px; padding: 0 16px; }
.sign-in h1 { margin: 24px 0 6px; font-size: 20px; font-weight: 600; }
.sign-in > p { margin: 0 0 18px; color: var(--muted); }
.sign-in .google { width: 100%; height: 40px; font-size: 14px; }
.sign-in .divider { display: flex; align-items: center; gap: 10px; margin: 22px 0 18px; font-size: 12px; color: var(--muted); }
.sign-in .divider::before, .sign-in .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.sign-in .form .button { height: 38px; font-size: 13px; }
.sign-in .notice { margin-bottom: 16px; }
.sign-in .foot { margin-top: 18px; font-size: 13px; }
.sign-in .foot a { color: var(--brand-ink); }

.switch-cell { display: inline-flex; align-items: center; gap: 8px; }
.mobile-label { display: none; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; }
  .topbar nav { order: 3; width: 100%; }
  .user { max-width: 60vw; }
  .column { padding-top: 28px; }
  .table-head { display: none; }
  .row { row-gap: 8px; }
  .cols-people { grid-template-columns: minmax(0, 1fr) auto auto; }
  .cols-people .person { grid-column: 1 / -1; }
  .cols-clients, .cols-versions, .cols-keys, .cols-audit, .cols-sessions { grid-template-columns: minmax(0, 1fr) auto; }
  .cols-accounts { grid-template-columns: minmax(0, 1fr) 28px; }
  .cols-accounts > :nth-child(2), .cols-accounts > :nth-child(3) { grid-column: 1; }
  .setting { flex-wrap: wrap; }
  .setting .input { width: 100%; }
  .preview iframe { height: 560px; }
}

@media (max-width: 640px) {
  .topbar { gap: 10px 12px; padding: 10px 16px; }
  .wordmark img { height: 38px; }
  .topbar nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .topbar nav .button { min-width: 0; height: 34px; padding: 0 4px; gap: 4px; font-size: 11px; }
  .topbar nav .button .label { overflow: hidden; text-overflow: ellipsis; }
  .user { padding: 0; gap: 4px; }
  .user .grow { display: none; }
  .viewer .topbar { flex-wrap: wrap; }
  .viewer .topbar > .viewer-refresh { order: 5; width: 100%; justify-content: center; }
  .viewer .topbar > .view-as-badge { order: 4; }
  .viewer .topbar .button .label { display: none; }
  .viewer .topbar .button { padding: 0 9px; }
  .viewer-title { flex-direction: column; align-items: flex-start; gap: 0; }
  .viewer-title b, .viewer-title span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .viewer-title b { font-size: 14px; }
  .viewer-title span { font-size: 11px; }
  .column { padding: 24px 16px 48px; }
  .column h1 { font-size: 21px; }
  .column-top { flex-wrap: wrap; margin-bottom: 22px; }
  .inline-form { width: 100%; }
  .inline-form .input, .inline-form select.input, .inline-form input[type="date"] { width: 100% !important; flex: 1 1 100%; }
  .inline-form .button { flex: 1 1 auto; }
  .mobile-label { display: inline; font-size: 12px; color: var(--muted); }
  .cols-people { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cols-people > :last-child { grid-column: 1 / -1; justify-self: end; }
  .card { gap: 14px; padding: 14px; }
  .card .meta { white-space: normal; }
  .preview iframe { height: 520px; }
  .setting .input { width: 100%; }
  .key-once { flex-direction: column; }
  .sign-in { margin-top: 8vh; }
}
.mfa-secret { overflow-wrap: anywhere; word-break: break-all; }
.mfa-qr { display: block; width: 200px; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); }
.mfa-setup { display: flex; gap: 20px; align-items: center; margin-top: 12px; }
.mfa-setup .form { flex: 1; min-width: 0; }
.code-input { font: 600 20px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .3em; }
@media (max-width: 560px) { .mfa-setup { flex-direction: column; align-items: stretch; } .mfa-qr { margin: 0 auto; } }
.mode-setting { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- home: dashboards grouped by client ---------- */
.client-group { margin-top: 28px; }
.client-group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.client-group-head h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.25; }
.client-group-head .sub { margin-top: 1px; }
.client-group-link { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; color: var(--muted); }
.client-group-link:hover { color: var(--brand-ink); }
.dash-row { display: flex; align-items: center; gap: 14px; min-height: 62px; }
.dash-row, .card { position: relative; }
.row-link { color: inherit; text-decoration: none; }
.row-link::after { content: ''; position: absolute; inset: 0; }
.row-link:focus-visible { outline: none; }
.row-link:focus-visible::after { outline: 2px solid var(--brand); outline-offset: -2px; }
.dash-row .row-actions, .card .icon-button, .dash-row .badge { position: relative; z-index: 1; }
.dash-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.dash-title .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row .sub { margin-top: 2px; }
.dash-row .row-actions { color: var(--faint); }
.dash-row:hover .row-actions { color: var(--ink); }
.badge.good { border-color: var(--good); color: var(--good); }

/* ---------- category colours ---------- */
.color-groups { display: grid; gap: 22px; margin-top: 18px; }
.color-group { border: 1px solid var(--line); padding: 16px 16px 18px; }
.color-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.color-group-head .sub { margin-top: 2px; }
.color-strip { display: flex; flex: none; width: 168px; height: 8px; overflow: hidden; margin-top: 4px; border-radius: 4px; }
.color-strip span { flex: 1; }
.color-strip span.auto, .color-swatch.auto { background: repeating-linear-gradient(135deg, var(--soft-3) 0 4px, var(--soft) 4px 8px); }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.color-tile { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.color-tile:hover { border-color: var(--faint); }
.color-tile.chosen { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.color-anchor { position: relative; flex: none; }
.color-tile.popping { position: relative; z-index: 40; }
.color-pick { display: block; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.color-swatch { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .15s; }
.color-pick:hover .color-swatch { transform: scale(1.06); }
.color-pick:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* The colour popover: brand colours, the default, any other colour. */
.color-pop { position: absolute; z-index: 30; top: calc(100% + 8px); left: -6px; width: 248px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 12px 32px rgba(1, 13, 35, .16), 0 2px 6px rgba(1, 13, 35, .08); animation: pop-in .14s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pop-title { margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.pop-section + .pop-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.pop-section .caps { margin-bottom: 8px; }
.pop-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pop-swatch { position: relative; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.pop-dot { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); transition: transform .12s; }
.pop-dot.auto { background: repeating-linear-gradient(135deg, var(--soft-3) 0 4px, var(--soft) 4px 8px); }
.pop-swatch:hover .pop-dot { transform: scale(1.1); }
.pop-swatch svg { position: absolute; color: #fff; opacity: 0; filter: drop-shadow(0 0 1px rgba(0,0,0,.6)); }
.pop-swatch.on svg { opacity: 1; }
.pop-swatch.on .pop-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.pop-swatch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pop-custom { display: flex; gap: 8px; align-items: center; }
.pop-native { flex: none; width: 44px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
.pop-hex { flex: 1; min-width: 0; height: 32px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; text-transform: uppercase; }
.pop-hex.bad { border-color: var(--bad, #c0392b); }
.color-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-meta { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 11px; color: var(--muted); }
.color-code { flex: none; font-size: 11px; color: var(--ink); }
.color-origin { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-reset { flex: none; color: var(--muted); }
.color-reset[hidden] { display: none; }
.color-reset:hover { color: var(--ink); }
.small { font-size: 13px; }
@media (max-width: 640px) {
  .color-group-head { flex-direction: column; }
  .color-strip { width: 100%; }
  .color-grid { grid-template-columns: 1fr; }
}

/* The colours editor shows what the dashboard paints; the rest behind a switch. */
.color-groups:not(.show-all) .color-tile.absent, .color-groups:not(.show-all) .color-group.absent { display: none; }
.color-groups.show-all .color-tile.absent { opacity: .55; border-style: dashed; }
.color-groups.show-all .color-tile.absent:hover { opacity: 1; }
.link-button { height: 30px; padding: 0 4px; border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--brand-ink); }
.link-button:hover { text-decoration: underline; }

/* The client's brand colours above the categories; a whole tile opens its colour. */
.brand-palette { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.brand-palette .caps { margin-right: 4px; }
.brand-palette-dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); }
.brand-palette .muted { margin-left: 6px; }
.color-tile { cursor: pointer; }

/* The index's search: a soft field with its shortcut, a ring on focus, matches marked. */
.search { display: flex; align-items: center; gap: 8px; width: min(420px, 100%); height: 40px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); cursor: text; transition: border-color .15s, box-shadow .15s; }
.search:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); color: var(--ink); }
.search-input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; outline: 0; }
.search-input::placeholder { color: var(--faint); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-kbd { flex: none; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--soft); color: var(--muted); font: 500 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.search-clear { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
.search-clear:hover { background: var(--hover); color: var(--ink); }
.search-clear[hidden], .search-kbd[hidden], .dash-row[hidden], .client-group[hidden], .search-empty[hidden] { display: none; }
mark.hit { padding: 0 1px; border-radius: 3px; background: color-mix(in srgb, var(--brand) 22%, transparent); color: inherit; }
.search-empty { margin-top: 28px; }
.search-empty .link { margin-top: 6px; }
@media (max-width: 640px) {
  .column-head .search { width: 100%; }
  .search-kbd { display: none; }
}

/* ---------- clientes ---------- */

/* Converage's logo: the colour one on light, the white one on dark. */
.logo { display: inline-flex; align-items: center; }
/* Fixed heights (a percentage height can leave an image 0 px wide). */
.logo img { display: block; flex: none; width: auto; }
.logo .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .logo .logo-light { display: none; } :root:not([data-theme='light']) .logo .logo-dark { display: block; } }
:root[data-theme='dark'] .logo .logo-light { display: none; }
:root[data-theme='dark'] .logo .logo-dark { display: block; }
/* The "V" reaches above and below the letters: the word itself sits centred with this nudge. */
.top-logo { transform: translateY(-3px); }
.top-logo img { height: 24px; }
.sign-in-logo.logo { width: auto; margin-left: 0; }
.sign-in-logo.logo img { height: 34px; }
.sign-in-kicker { margin: 14px 0 0 !important; }
.topbar-title { padding-left: 14px; border-left: 1px solid var(--line); white-space: nowrap; }

.lead-small { margin: 12px 0 18px; font-size: 13px; max-width: 75ch; }
.small-text { font-size: 12px; }
.textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.button.small { height: 26px; padding: 0 10px; font-size: 11px; }

/* A client's head and its tabs. */
.client-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.client-head h1 { margin: 0 0 2px; }
.tabs { display: flex; gap: 2px; margin-bottom: 30px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { border-bottom-color: var(--brand); color: var(--ink); font-weight: 600; }
.tab svg { flex: none; }

/* Clients to choose from. */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.client-card { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.client-card:hover { border-color: var(--brand); }
.client-card .name { font-weight: 600; }
.client-card .muted { font-size: 12px; }

/* Services: what the client has, and what it could have. */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 18px; }
.service-card { display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.service-card h3 { margin: 6px 0 0; font-size: 17px; }
.service-card p { font-size: 13px; line-height: 1.55; flex: 1; }
.service-top { display: flex; align-items: center; justify-content: space-between; }
.service-top .badge { display: inline-flex; align-items: center; gap: 3px; }
.service-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 2px; background: var(--soft-2); color: var(--faint); }
.service-icon.on { background: var(--brand-tint); color: var(--brand-ink); }
.service-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.service-card.locked { background: var(--soft); border-style: dashed; }
.service-card.locked h3 { color: var(--muted); }

/* The account tiles and the contact. */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 18px; }
.tile { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 2px; }
.tile:hover { border-color: var(--brand); }
.tile-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 2px; background: var(--soft-2); color: var(--ink); }
.tile-value { margin: 2px 0; font-size: 17px; font-weight: 600; }
.manager-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 2px; background: var(--soft); }
.manager-card .name { font-weight: 600; }

/* Tables of this app. */
.cols-team { grid-template-columns: minmax(220px, 1.6fr) 170px minmax(140px, 1fr) 64px; }
.cols-activity { grid-template-columns: minmax(0, 1fr) 140px; min-height: 48px; font-size: 13px; }
.cols-activity .person { gap: 10px; white-space: normal; }
.activity-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--soft-2); }
.cols-clients-admin { grid-template-columns: minmax(200px, 1.5fr) 130px minmax(140px, 1fr) minmax(120px, 0.9fr) 70px 20px; }
.service-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.create-client .input { width: 200px; }
.cols-services { grid-template-columns: minmax(200px, 1fr) minmax(200px, 1.2fr) 44px; }
.cols-services .form-like, .cols-services label { display: grid; gap: 4px; font-size: 12px; }
.cols-services .sub { font-size: 12px; }
.sites { width: 100%; }
.section-body { margin-top: 18px; max-width: 520px; }
.cols-people-admin { grid-template-columns: minmax(220px, 1.5fr) 130px minmax(140px, 1.2fr) 120px 20px; }
.cols-interest { grid-template-columns: minmax(0, 1fr) 130px 130px; }
.cols-log { grid-template-columns: minmax(0, 1fr) 160px 130px; min-height: 44px; font-size: 13px; }
.person.big { margin-bottom: 18px; }
.person.big h1 { margin: 0 0 4px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 2px; }
.seg { padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.seg + .seg { border-left: 1px solid var(--line); }
.seg.active { background: var(--soft-2); color: var(--ink); }
.empty svg { margin: 0 auto 10px; color: var(--faint); }

@media (max-width: 760px) {
  .topbar-title { display: none; }
  .cols-team, .cols-clients-admin, .cols-people-admin, .cols-services, .cols-interest, .cols-log { grid-template-columns: 1fr; row-gap: 6px; }
  .table-head.cols-team, .table-head.cols-clients-admin, .table-head.cols-people-admin { display: none; }
  .client-head { flex-wrap: wrap; }
}
/* A narrower window: the admin menu as icons (their names on hover), then the user's name goes. */
@media (max-width: 1240px) {
  .topbar nav .button .label { display: none; }
  .topbar nav .button { padding: 0 9px; }
}
@media (max-width: 1000px) {
  .topbar-title { display: none; }
  .topbar .user .grow { display: none; }
}

/* TagRadar */
.site-card { padding: 20px; border: 1px solid var(--line); border-radius: 2px; }
.site-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.site-head h3 { margin: 0 0 2px; font-size: 17px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 2px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status.ok { background: var(--good-tint); color: var(--good); }
.status.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.status.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.cols-destination { grid-template-columns: minmax(180px, 1.4fr) 90px 90px 130px 90px; min-height: 58px; }
.cols-destination .num { text-align: right; font-variant-numeric: tabular-nums; }
.cols-destination .sub { font-size: 11px; }
.spark { display: block; }
.spark-line { fill: none; stroke: var(--brand); stroke-width: 1.5; stroke-linejoin: round; }
.spark-fill { fill: var(--brand-tint); stroke: none; }
.subhead { margin: 22px 0 10px; font-size: 14px; font-weight: 600; }
.cols-warning { grid-template-columns: 22px minmax(0, 1fr) 130px; min-height: 52px; font-size: 13px; }
.warning-icon { color: var(--warn); }
.warning-icon.resolved { color: var(--good); }
.resolved { margin-top: 14px; }
.resolved summary { margin-bottom: 10px; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .cols-destination { grid-template-columns: 1fr 1fr; } .cols-destination .spark { display: none; } .table-head.cols-destination { display: none; } }
.cols-destination > .badge { justify-self: start; }

/* Contracts */
.contracts { display: grid; gap: 10px; }
.contract { border: 1px solid var(--line); border-radius: 2px; }
.contract-main { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.contract-main .name { font-weight: 600; }
.contract-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 2px; background: var(--soft-2); }
.versions { padding: 0 16px 12px 68px; }
.versions summary { font-size: 12px; color: var(--muted); }
.version { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.file-input { height: auto; padding: 8px 10px; }
@media (max-width: 760px) { .contract-main { flex-wrap: wrap; } .versions { padding-left: 16px; } }

/* Invoices */
.cols-invoices { grid-template-columns: minmax(160px, 1.4fr) 110px 110px 130px 130px 28px; min-height: 56px; }
.cols-invoices .num { text-align: right; font-variant-numeric: tabular-nums; }
.cols-invoices .sub { font-size: 11px; }
.summary { margin-top: 0; }
.tile.static:hover { border-color: var(--line); }
.tile.alarm .tile-icon { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
@media (max-width: 760px) { .cols-invoices { grid-template-columns: 1fr 1fr; } .table-head.cols-invoices { display: none; } }
