/* 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: #f6f8f7;
  --brand: #1caec4;
  --brand-tint: #e6f6f9;
  --brand-ink: #0b7385;
  --warn: #e08a1e;
  --danger: #b3261e;
  --good: #2f7d4f;
  color-scheme: light;
}

* { 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: #fff; }
.button.dark:hover { background: #2a2f2c; }
.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; }

/* 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: #fff; 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) ---------- */

.client-filter { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 2px; }
.client-filter button { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border: 1px solid transparent; border-radius: 2px; background: none; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.client-filter button:hover:not(.active) { background: var(--hover); color: var(--ink); }
.client-filter button.active { border-color: var(--ink); color: var(--ink); }
.client-filter .count { font-size: 11px; color: var(--muted); }
.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 .glyph { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 2px; background: var(--brand-tint); color: var(--brand-ink); }
.card .about { flex: 1; min-width: 0; }
.card .name { 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; 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; }
.preview { margin-top: 16px; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.preview-bar { display: flex; 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; }
.photo-actions { margin-top: 10px; }
.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: rgba(20, 23, 21, 0.4); }
.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 rgba(20, 23, 21, 0.25); }
.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); }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .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; }
}
