:root {
  --fog: #eef1f4;
  --paper: #ffffff;
  --ink: #1c2733;
  --ink-soft: #55616f;
  --line: #d5dbe2;
  --cobalt: #2f5dcc;
  --cobalt-soft: #e3eafa;
  --on-cobalt: #ffffff;
  --ok: #2e7d5b;
  --warn: #a86b12;
  --bad: #b4232c;
  --radius-control: 6px;
  --radius-panel: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fog: #121820;
    --paper: #1a222c;
    --ink: #e4e9ef;
    --ink-soft: #9aa6b4;
    --line: #2c3743;
    --cobalt: #7d9cf0;
    --cobalt-soft: #22314f;
    --on-cobalt: #0e1626;
    --ok: #5fbf92;
    --warn: #e0a54a;
    --bad: #f07178;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--fog);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}

[hidden] { display: none !important; }

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

code, .mono { font-family: var(--mono); font-size: 0.9em; }

button, input, select, textarea { font: inherit; color: inherit; }

button {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius-control);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}
button:hover { border-color: var(--ink-soft); }
button.primary { background: var(--cobalt); border-color: var(--cobalt); color: var(--on-cobalt); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
button.quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }

input, select, textarea {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0.45rem 0.6rem;
}
textarea { font-family: var(--mono); font-size: 0.9rem; min-height: 9rem; resize: vertical; }

label { display: block; font-size: 0.85rem; color: var(--ink-soft); margin: 0.75rem 0 0.25rem; }

.form-error { color: var(--bad); min-height: 1.25em; margin: 0.5rem 0; }

.signin { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.signin-card {
  width: min(26rem, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 2rem;
}
.signin-card p { color: var(--ink-soft); }
.signin-card .primary { width: 100%; margin-top: 0.5rem; }

.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-weight: 700; font-size: 1.05rem; margin: 0 0 1rem; }
.switch-label { margin-top: 0; }
.nav { list-style: none; padding: 0; margin: 1.25rem 0; display: grid; gap: 0.15rem; }
.nav button { width: 100%; text-align: left; border-color: transparent; background: transparent; }
.nav button[aria-current="page"] { background: var(--cobalt-soft); color: var(--cobalt); font-weight: 600; }
#signout { margin-top: auto; text-align: left; }

.view { padding: 1.75rem 2rem 3rem; min-width: 0; }
.view:focus { outline: none; }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.view-head p { margin: 0.25rem 0 0; color: var(--ink-soft); max-width: 60ch; }

.toolbar { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.toolbar .field { min-width: 12rem; }
.toolbar label { margin-top: 0; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: color-mix(in srgb, var(--cobalt-soft) 55%, transparent); }
tbody tr.selected { background: var(--cobalt-soft); }
td.num, th.num { text-align: right; }
td { overflow-wrap: break-word; }
td:first-child { min-width: 9rem; }
td .mono, td.nowrap { white-space: nowrap; }
.muted { color: var(--ink-soft); }

.empty { padding: 2rem; text-align: center; color: var(--ink-soft); }
.empty button { margin-top: 0.75rem; }

.status { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.status::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }
.status-active { color: var(--ok); }
.status-suspended, .status-deactivated { color: var(--warn); }
.status-revoked, .status-expired { color: var(--bad); }

.flag { color: var(--bad); font-weight: 600; }

.grid-cell { text-align: center; }
.grid-cell.yes { color: var(--ok); font-weight: 700; }
.grid-cell.no { color: var(--ink-soft); }
.release-ready { color: var(--ok); }
.release-missing { color: var(--warn); }

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(36rem, 100%);
  background: var(--paper);
  border-left: 1px solid var(--line);
  padding: 1.5rem;
  overflow-y: auto;
  box-shadow: -12px 0 32px rgb(15 25 40 / 0.12);
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.drawer section { margin-top: 1.5rem; }
.drawer .actions.compact button { padding: 0.25rem 0.6rem; font-size: 0.88rem; }
.drawer h3 { margin-bottom: 0.6rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 1rem 0 0; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--paper);
  color: var(--ink);
  padding: 1.5rem;
  width: min(32rem, calc(100% - 2rem));
}
dialog::backdrop { background: rgb(15 25 40 / 0.45); }
dialog .actions { justify-content: flex-end; }

.key-reveal { text-align: center; padding: 0.5rem 0; }
.key-reveal .key {
  font-family: var(--mono);
  font-size: clamp(0.95rem, 4.6vw, 1.45rem);
  letter-spacing: 0.04em;
  white-space: nowrap;
  font-weight: 600;
  color: var(--cobalt);
  background: var(--cobalt-soft);
  border-radius: var(--radius-panel);
  padding: 1.1rem 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  user-select: all;
}
.key-reveal .warning { color: var(--warn); font-weight: 600; }

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.75rem);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-control);
  transition: transform 160ms ease-out, opacity 160ms ease-out, visibility 160ms;
  max-width: calc(100% - 2rem);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
.toast.error { background: var(--bad); color: #fff; }

pre.meta { margin: 0; font-family: var(--mono); font-size: 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-soft); }

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar, .nav { min-width: 0; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; }
  .brand { margin: 0; flex: 1 0 100%; }
  .switch-label { display: none; }
  #product-switch { flex: 1; }
  .nav { display: flex; flex-wrap: wrap; margin: 0; flex: 1 0 100%; }
  .nav button { white-space: nowrap; }
  #signout { margin-top: 0; }
  .view { padding: 1.25rem 1rem 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

.hint { font-size: 0.82rem; color: var(--ink-soft); margin: 0.3rem 0 0; }
.field-label { font-size: 0.85rem; color: var(--ink-soft); margin: 0.75rem 0 0.25rem; }
label.inline { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0; color: var(--ink); font-size: 0.95rem; cursor: pointer; }
label.inline input { width: auto; }
.actions.compact { margin-top: 0.5rem; gap: 0.4rem; align-items: center; }
.actions .push-left { margin-right: auto; }
button.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
button.danger.solid:disabled { opacity: 0.45; }
.section { margin-top: 2rem; }
.section > h2 { margin-bottom: 0.75rem; }
dialog .wide { min-width: min(40rem, calc(100vw - 4rem)); }
dialog:has(.wide) { width: min(46rem, calc(100% - 2rem)); }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; }
.figure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-panel);
  text-align: left;
}
.figure-value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.figure-label { color: var(--ink-soft); }
.figure-warn .figure-value { color: var(--warn); }
.figure-bad .figure-value { color: var(--bad); }

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li + li { border-top: 1px solid var(--line); }
.alert-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 3rem;
  gap: 1rem;
  align-items: center;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.75rem 1rem;
  text-align: left;
}
.alert-row:hover { background: var(--cobalt-soft); }
.alert-row .num { text-align: right; color: var(--bad); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.step { display: grid; grid-template-columns: 2.25rem 1fr; gap: 0.75rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 1rem; }
.step-n { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--cobalt-soft); color: var(--cobalt); font-weight: 700; }
.step p { margin: 0.25rem 0 0.6rem; }

.header-rows { display: grid; gap: 0.4rem; margin-bottom: 0.5rem; }
.header-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 0.4rem; }
.hashes { display: grid; gap: 0.1rem; font-size: 0.85rem; }
.load-more { display: flex; justify-content: center; margin-top: 1rem; }
.load-more button[hidden] { display: none; }

@media (max-width: 760px) {
  .header-row { grid-template-columns: 1fr; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure-value { font-size: 1.6rem; }
}

.key-reveal .key.key-long { font-size: 0.9rem; white-space: normal; overflow-wrap: anywhere; letter-spacing: 0; }

/* Google sign-in */
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
}
a.button.primary { background: var(--cobalt); border-color: var(--cobalt); color: var(--on-cobalt); font-weight: 600; width: 100%; margin-top: 0.5rem; }
a.button.primary:hover { filter: brightness(1.08); }
.google-mark {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--paper);
  color: var(--cobalt);
  font-weight: 700;
  font-size: 0.9rem;
}
.signin-help { margin-top: 1rem; font-size: 0.9rem; }
.signin-help summary { cursor: pointer; color: var(--ink-soft); }
.signin-help p { margin: 0.5rem 0; }
.signin-help form button { margin-top: 0.6rem; }
.copyable { user-select: all; overflow-wrap: anywhere; background: var(--fog); border-radius: var(--radius-control); padding: 0.4rem 0.6rem; }
.who { font-size: 0.82rem; margin: auto 0 0.25rem; overflow-wrap: anywhere; }
#signout { margin-top: 0; }

/* Settings */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.section-head p { margin: 0.25rem 0 0; }
.section > p.muted { margin: -0.4rem 0 0.75rem; max-width: 70ch; }
.inline-form { margin-top: 0.75rem; }
.toolbar .field.grow { flex: 1 1 18rem; }
.setting-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 0.75rem; }
.setting-group { margin: 0; padding: 0.25rem 1rem 1rem; overflow: visible; }
.setting-group legend { font-weight: 650; padding: 0 0.35rem; }
.setting label { margin-top: 0.9rem; }
.padded { padding: 0.25rem 1.1rem 1rem; }
.facts dd .hint { margin-top: 0.15rem; }
.fact-value { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.fact-value .mono { overflow-wrap: anywhere; }
.fact-value button { padding: 0.15rem 0.55rem; font-size: 0.82rem; }
.ua { max-width: 22rem; font-size: 0.85rem; }

/* Integration snippets */
.snippet { margin-top: 1.1rem; }
.snippet-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.snippet-head .actions { margin-top: 0; }
.snippet-head button { padding: 0.2rem 0.6rem; font-size: 0.85rem; }
pre.code {
  margin: 0.4rem 0 0;
  padding: 0.75rem 0.9rem;
  background: var(--fog);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  font-family: var(--mono);
  font-size: 0.82rem;
  white-space: pre;
  overflow-x: auto;
}

@media (max-width: 760px) {
  .who { flex: 1 0 100%; margin: 0; }
  .setting-groups { grid-template-columns: minmax(0, 1fr); }
}


/* Guide */
.guide-notes { margin: 0.75rem 0; padding-left: 1.2rem; display: grid; gap: 0.4rem; }
.step button { margin-top: 0.1rem; }
