/* Scriben Insights.

   INKJET. Black ink on white paper, hairline rules, and colour spent only where
   something is wrong. There is no brand accent on this page on purpose: every
   figure here is a number to be read, and a decorative hue beside a number
   competes with the one place colour is doing a job — the red that means a
   person should look at something.

   Structure is borrowed from Sentry, which gets ops surfaces right: a fixed
   left rail, dense bordered panels, numbers right-aligned into columns, a
   sparkline beside every series.

   LIGHT IS THE DEFAULT because paper is. The dark theme is a full second
   palette rather than an inversion — ink becomes the light value and the red
   is lifted, or it disappears into the ground. */

:root {
  --bg: #FFFFFF;
  --rail: #FAFAFA;
  --panel: #FFFFFF;
  --panel-2: #FAFAFA;
  --hover: #F5F5F5;
  --line: #E3E3E3;
  --line-soft: #EFEFEF;
  --ink: #0F0F0F;
  --muted: #565656;
  --faint: #8A8A8A;
  --accent: #0F0F0F;
  --accent-dim: #454545;
  --accent-soft: #F0F0F0;
  --series-2: #8A8A8A;
  --good: #2C6E52;
  --warn: #7A5D00;
  --bad: #C8102E;
  --bad-soft: #FDF1F2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0A0A;
    --rail: #060606;
    --panel: #121212;
    --panel-2: #171717;
    --hover: #1C1C1C;
    --line: #262626;
    --line-soft: #1B1B1B;
    --ink: #F5F5F5;
    --muted: #A0A0A0;
    --faint: #6E6E6E;
    --accent: #F5F5F5;
    --accent-dim: #9A9A9A;
    --accent-soft: #1F1F1F;
    --good: #6FBF9A;
    --warn: #D2A63C;
    --bad: #FF6B6B;
    --bad-soft: #241415;
  }
}

:root[data-theme="dark"] {
  --bg: #0A0A0A;
  --rail: #060606;
  --panel: #121212;
  --panel-2: #171717;
  --hover: #1C1C1C;
  --line: #262626;
  --line-soft: #1B1B1B;
  --ink: #F5F5F5;
  --muted: #A0A0A0;
  --faint: #6E6E6E;
  --accent: #F5F5F5;
  --accent-dim: #9A9A9A;
  --accent-soft: #1F1F1F;
  --series-2: #7E7E7E;
  --good: #6FBF9A;
  --warn: #D2A63C;
  --bad: #FF6B6B;
  --bad-soft: #241415;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Rubik, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mark {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: var(--accent);
  flex: none;
  position: relative;
}
.mark::after {
  content: "";
  position: absolute;
  inset: 4px 3.5px;
  background: linear-gradient(
    to right,
    var(--panel) 0 1.6px, transparent 1.6px 3.2px,
    var(--panel) 3.2px 4.8px, transparent 4.8px 6.4px,
    var(--panel) 6.4px 8px
  );
}

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

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }

.loginbox {
  width: min(348px, 100%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 30px;
}

.loginbox .mark { width: 22px; height: 22px; border-radius: 5px; margin-bottom: 14px; }
.loginbox .mark::after { inset: 6px 5px; }
.loginbox h1 { font-size: 17px; font-weight: 500; margin: 0; letter-spacing: -0.01em; }

.gate-note { margin: 2px 0 16px; color: var(--muted); font-size: 12.5px; }
.gate-note code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
}

.loginbox label {
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}

.loginbox input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 11px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 13px;
}
.loginbox input:focus-visible { border-color: var(--accent); }

.loginbox button {
  margin-top: 20px;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  border-radius: 4px;
  padding: 10px;
  font-weight: 500;
  cursor: pointer;
}
.loginbox button:hover { background: var(--accent-dim); }
.linkish:hover { color: var(--ink); }
.loginbox button:disabled { opacity: 0.45; cursor: default; }

.error { color: var(--bad); font-size: 12.5px; margin: 12px 0 0; }

/* --- frame ----------------------------------------------------------- */

.shell { display: grid; grid-template-columns: 196px 1fr; min-height: 100dvh; }

.rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.rail-top { padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 500; font-size: 15px; }
.brand-sub {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 3px 0 0 24px;
}

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.nav a {
  display: block;
  padding: 7px 16px;
  color: var(--muted);
  font-size: 13px;
  border-left: 2px solid transparent;
}
.nav a:hover { color: var(--ink); background: var(--hover); }
.nav a.on { color: var(--ink); border-left-color: var(--accent); background: var(--hover); }

.rail-foot {
  margin-top: auto;
  padding: 14px 16px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.whoami {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.linkish {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  color: var(--faint);
  font-size: 12px;
  cursor: pointer;
}
.linkish:hover { color: var(--accent); }

.main { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar h1 { font-size: 16px; font-weight: 500; margin: 0; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px 2px 7px;
  font-size: 11px;
  color: var(--muted);
}
.pill.stale { border-color: var(--bad); color: var(--bad); }
.pill.stale .pip { background: var(--bad); }

.freshness {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--faint);
}

.pip { width: 6px; height: 6px; border-radius: 50%; background: var(--good); flex: none; }
.pip.beat { animation: beat 2.6s ease-in-out infinite; }
@keyframes beat { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .pip.beat { animation: none; } }

.notes {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 24px;
  background: var(--bad-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.section { padding: 22px 24px 26px; border-bottom: 1px solid var(--line); scroll-margin-top: 56px; }

.section h2 {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 16px;
}

/* --- headline figures ------------------------------------------------ */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.fig { background: var(--panel); padding: 13px 15px; }

.fig .n {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.fig .n.zero { color: var(--faint); }
.fig .n.bad { color: var(--bad); }
.fig .n.live { color: var(--accent); }
.fig .k { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.fig .sub {
  font-size: 10.5px;
  color: var(--faint);
  font-family: "IBM Plex Mono", monospace;
  margin-top: 2px;
}

.livelist { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 16px; align-items: baseline; }
.livename { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.livename .meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.quiet { color: var(--muted); font-size: 12.5px; }

/* --- trends ---------------------------------------------------------- */

.trends {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 4px 14px 12px;
}

.trend {
  display: grid;
  grid-template-columns: 152px 1fr 84px;
  align-items: center;
  gap: 16px;
  padding: 6px 0;
  border-top: 1px solid var(--line-soft);
}
.trend:first-child { border-top: 0; }
.trend:hover { background: var(--hover); }

.trend .label { font-size: 12.5px; color: var(--muted); }
.trend .total {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.trend svg { display: block; width: 100%; height: 32px; }

.axis {
  display: flex;
  justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--faint);
  margin: 8px 84px 0 168px;
}

/* --- panels ---------------------------------------------------------- */

.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(272px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.panel { background: var(--panel); padding: 15px 16px 16px; }

.panel h3 {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 11px;
}

.rows { display: flex; flex-direction: column; }

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 5px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.row:first-child { border-top: 0; }
.row .k { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row .k.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: var(--ink);
  white-space: nowrap;
}
.row .v {
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.row .v.bad { color: var(--bad); }
.row .v.good { color: var(--good); }
.row .v.warn { color: var(--warn); }

.empty { color: var(--faint); font-size: 12.5px; padding: 4px 0; }

/* --- table ----------------------------------------------------------- */

.scroll {
  overflow: auto;
  /* Bounded on purpose: these two tables grow with every account, and a page
     that gets taller forever pushes everything below it out of reach. The
     header row is sticky inside this box, so the columns stay labelled however
     far you scroll. */
  max-height: 62vh;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  /* The panel background is on the container, not the cell, so without this
     the rows scroll visibly through the header. */
  box-shadow: inset 0 -1px 0 var(--line);
}

.table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--hover); }

.table td.num {
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.table th.num { text-align: right; }
.table td.dim { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 11.5px; }
.table td.wrap { white-space: normal; color: var(--muted); font-size: 11.5px; min-width: 200px; }
.table .who { font-weight: 500; display: flex; align-items: center; gap: 7px; }
.table .addr { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--faint); margin-top: 1px; }

.tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
}
.tag.console { color: var(--accent); border-color: var(--accent-dim); }

.foot { padding: 20px 24px 40px; color: var(--faint); font-size: 11.5px; max-width: 74ch; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; padding: 10px 14px; overflow-x: auto; }
  .rail-top { padding: 0; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; }
  .nav a { border-left: 0; border-bottom: 2px solid transparent; padding: 5px 9px; }
  .nav a.on { border-left: 0; border-bottom-color: var(--accent); }
  .rail-foot { margin: 0 0 0 auto; border-top: 0; padding: 0; }
  .trend { grid-template-columns: 104px 1fr 62px; gap: 10px; }
  .axis { margin: 8px 62px 0 114px; }
  .section, .topbar, .foot, .notes { padding-left: 14px; padding-right: 14px; }
}

/* Straight out to the console, for the things this page deliberately does not
   try to reproduce. */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  font-size: 12.5px;
}
.links a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.links a:hover { color: var(--ink); text-decoration-color: var(--ink); }
.links a::after { content: " ↗"; color: var(--faint); }

/* Zero recordings is the point of the all-users table, not an absence to fade. */
.table td.num.none { color: var(--bad); }

/* The count belongs to its heading, so it inherits the heading's quiet. */
.count {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--faint);
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

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

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  margin: -4px 0 18px;
}

.chips { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }

.chip {
  background: var(--panel);
  border: 0;
  border-left: 1px solid var(--line);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.chip:first-child { border-left: 0; }
.chip:hover { background: var(--hover); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); }

/* --- charts ------------------------------------------------------------ */

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 18px;
}

.chartcard {
  background: var(--panel);
  margin: 0;
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chartcard h3 {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  margin: 0;
}

/* The definition line. This is the point of the naming rule: the title is the
   term a growth or sales person already knows, and this says what it means. */
.define { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.4; }

.chartbox { margin-top: 8px; }
.chart { display: block; width: 100%; height: auto; }

.chartcard .note {
  font-size: 11px;
  color: var(--faint);
  margin: 2px 0 0;
}

@media (max-width: 720px) {
  .charts { grid-template-columns: 1fr; }
}
