/* Continuum Console — design system.
 *
 * Every tenant-variable value is a custom property set at sign-in from the organization's
 * branding objects. Nothing below hard-codes a brand colour, so re-theming is data.
 */

:root {
  --brand-primary:   #6b4ef5;
  --brand-secondary: #0ea5a4;
  --brand-on:        #ffffff;

  --bg:        #f6f7f9;
  --surface:   #ffffff;
  --surface-2: #f0f1f4;
  --border:    #e2e5ea;
  --text:      #14161a;
  --text-dim:  #5b6270;
  --text-faint:#8b93a1;

  --ok:    #0d9f6e;
  --warn:  #c2760a;
  --alert: #d1373b;

  --radius: 14px;
  --radius-sm: 9px;
  --gap: 18px;
  --shadow: 0 1px 2px rgba(16,18,24,.05), 0 6px 20px rgba(16,18,24,.05);

  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0d0f13;
    --surface:   #16191f;
    --surface-2: #1e222a;
    --border:    #272c36;
    --text:      #f2f4f7;
    --text-dim:  #a3abb9;
    --text-faint:#6d7684;
    --ok:    #34d399;
    --warn:  #fbbf24;
    --alert: #f87171;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- chrome */

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar img.logo { height: 26px; width: auto; }
.topbar .wordmark {
  font-weight: 650; letter-spacing: -.015em; font-size: 16px;
}
.topbar .spacer { flex: 1; }

.place-picker {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px 5px 14px;
  font-size: 13.5px; color: var(--text-dim);
}
.place-picker select {
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-weight: 550; padding: 2px 4px; cursor: pointer;
}
.place-picker select:focus { outline: none; }

.who { font-size: 13.5px; color: var(--text-dim); }

.btn {
  font: inherit; font-weight: 550; cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  padding: 9px 15px;
}
.btn:hover { border-color: var(--text-faint); }
.btn.primary {
  background: var(--brand-primary); color: var(--brand-on);
  border-color: transparent;
}
.btn.primary:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------------------------------------------------------------- layout */

main { max-width: 1180px; margin: 0 auto; padding: 26px 22px 70px; }

.view-head { margin-bottom: 22px; }
.view-head h1 {
  margin: 0 0 5px; font-size: 25px; font-weight: 660; letter-spacing: -.022em;
}
.view-head .intent {
  margin: 0; color: var(--text-dim); font-size: 14.5px; max-width: 62ch;
}

.grid { display: flex; flex-direction: column; gap: var(--gap); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card > header {
  display: flex; align-items: baseline; gap: 10px;
  padding: 15px 18px 0;
}
.card > header h2 {
  margin: 0; font-size: 15px; font-weight: 620; letter-spacing: -.01em;
}
.card > header .sub { font-size: 12.5px; color: var(--text-faint); }
.card .body { padding: 15px 18px 18px; }

/* ------------------------------------------------------------ stat_row */

.stat-row {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat .label {
  font-size: 12.5px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .045em; font-weight: 600;
}
.stat .value {
  font-size: 34px; font-weight: 660; letter-spacing: -.03em;
  line-height: 1.15; margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat .note { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.stat.tone-ok    .value { color: var(--ok); }
.stat.tone-warn  .value { color: var(--warn); }
.stat.tone-alert .value { color: var(--alert); }

/* --------------------------------------------------------------- table */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; font-size: 11.5px; font-weight: 640;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint);
  padding: 0 12px 9px; border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 11px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 570;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-dim);
}
.pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}
.pill.ok    { color: var(--ok); }
.pill.warn  { color: var(--warn); }
.pill.alert { color: var(--alert); }

/* ------------------------------------------------------------ bar_chart
 * Deliberately CSS-only. The same markup renders inside an HTML email,
 * where images are blocked by default. See docs/15 section 11a.
 */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 54px; gap: 12px; align-items: center; }
.bar-row .name { font-size: 13.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--surface-2); border-radius: 999px; height: 9px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 999px; background: var(--brand-primary); }
.bar-row .val { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }

/* ---------------------------------------------------------- empty / gap */

.empty {
  color: var(--text-faint); font-size: 14px;
  padding: 22px 4px; text-align: center;
}
.gap {
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  padding: 15px 16px; background: var(--surface-2);
}
.gap h3 { margin: 0 0 4px; font-size: 14px; font-weight: 620; }
.gap p  { margin: 0; font-size: 13.5px; color: var(--text-dim); }

/* ------------------------------------------------------------- explains */

.explains { margin-top: 30px; }
.explains summary {
  cursor: pointer; font-size: 13.5px; color: var(--text-dim);
  font-weight: 550; padding: 5px 0;
}
.explains ul { margin: 9px 0 0; padding-left: 20px; color: var(--text-dim); font-size: 13.5px; }
.explains li { margin-bottom: 5px; }

/* --------------------------------------------------------------- signin */

.signin-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.signin {
  width: 100%; max-width: 372px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px;
}
.signin h1 { margin: 0 0 6px; font-size: 21px; font-weight: 660; letter-spacing: -.02em; }
.signin p.lede { margin: 0 0 22px; color: var(--text-dim); font-size: 14px; }
.field { margin-bottom: 13px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); margin-bottom: 5px;
}
.field input, .field select {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--brand-primary); outline-offset: -1px; border-color: transparent;
}
.signin .btn { width: 100%; margin-top: 9px; padding: 11px; }
.error {
  margin-top: 13px; font-size: 13.5px; color: var(--alert);
  background: color-mix(in srgb, var(--alert) 9%, transparent);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.hint { margin-top: 15px; font-size: 12.5px; color: var(--text-faint); }

.loading { padding: 60px 0; text-align: center; color: var(--text-faint); }

/* A starter dashboard announces itself. Nobody should mistake the generic one for theirs. */
.banner{display:flex;align-items:center;gap:14px;margin:0 0 20px;padding:13px 16px;
        border-left:2px solid var(--brand-primary);border-radius:0 var(--radius-sm) var(--radius-sm) 0;
        background:var(--surface-2);font-size:14px;color:var(--text-dim)}
.banner span{flex:1}
.banner .btn{white-space:nowrap;padding:7px 13px;font-size:13.5px}

/* The place picker shows the tree, so walking into the chicken coop and backing out to the
   farm is one control rather than a navigation concept. */
.place-picker select option[data-depth="1"]{padding-left:14px}

/* Sign-in: the second factor is a step in the form, not a browser prompt. Prompts get
   suppressed, look like malware, and cannot be styled or retried. */
.check { display: flex; align-items: center; gap: 9px; margin: 4px 0 6px;
         font-size: 13.5px; color: var(--text-dim); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand-primary); cursor: pointer; }

.status { margin-top: 13px; font-size: 13.5px; color: var(--text-dim);
          background: var(--surface-2); border-radius: var(--radius-sm); padding: 9px 12px; }

/* ------------------------------------------------------------------ brand
 * Two files, one viewBox, so swapping them costs no layout. Both carry the same alt text
 * and exactly one is ever displayed, so the name is announced once.
 */
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .logo-light { display: none; }
  .logo-dark  { display: block; }
}

.signin-brand { margin-bottom: 18px; }
.signin-brand img { height: 30px; width: auto; display: block; }

/* The wordmark span now holds the lockup rather than text. */
.topbar .wordmark img { height: 22px; width: auto; display: block; }
.topbar .wordmark { display: flex; align-items: center; }

/* A visible record of each sign-in step. Two silent failures in a row is two too many:
   whatever goes wrong next should be readable without a browser console. */
.trace { margin-top: 14px; }
.trace summary { cursor: pointer; font-size: 12.5px; color: var(--text-faint); }
.trace ol { margin: 9px 0 0; padding-left: 20px; font-family: var(--mono); font-size: 11.5px;
            color: var(--text-dim); line-height: 1.7; }
.trace li.bad { color: var(--alert); }

/* ------------------------------------------------------------------ hidden
 * `.signin-wrap { display: grid }` beat the UA stylesheet's `[hidden] { display: none }`,
 * so the sign-in card stayed on screen at full height and the console rendered *below* it.
 * It looked exactly like a failed login. Author `display` always wins over the attribute
 * unless we say otherwise, so say otherwise, once, for everything.
 */
[hidden] { display: none !important; }

/* --------------------------------------------------------------- published
 * What Skills have concluded here. Severity is carried in the dot, not the text, so the
 * panel scans at a glance and reads correctly in monochrome.
 */
.pubs { display: flex; flex-direction: column; gap: 2px; }
.pub { display: grid; grid-template-columns: 16px 1fr; gap: 10px; align-items: start;
       padding: 9px 4px; border-radius: 7px; }
.pub:hover { background: var(--surface-2); }
.pub .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px;
            background: var(--text-faint); justify-self: center; }
.pub.good .dot     { background: var(--ok); }
.pub.warning .dot  { background: var(--warn); }
.pub.learning .dot { background: var(--warn); }
.pub.critical .dot { background: var(--alert); }
.pub-text { font-size: 13.5px; }
.pub-meta { font-size: 12px; color: var(--text-faint); font-family: var(--mono); margin-top: 2px; }

/* ---------------------------------------------------------------- timeline */
.tl { display: flex; flex-direction: column; }
.tl .ev { display: grid; grid-template-columns: 106px 18px 1fr; gap: 11px;
          padding: 8px 0; align-items: start; }
.tl .when { font-family: var(--mono); font-size: 11px; color: var(--text-faint);
            text-align: right; padding-top: 3px; }
.tl .rail { position: relative; min-height: 22px; height: 100%; }
.tl .rail::before { content: ""; position: absolute; left: 50%; top: 0; bottom: -8px;
                    width: 1px; background: var(--border); transform: translateX(-50%); }
.tl .ev:last-child .rail::before { bottom: 50%; }
.tl .rail i { position: absolute; left: 50%; top: 5px; width: 7px; height: 7px;
              border-radius: 50%; background: var(--text-faint); transform: translateX(-50%);
              border: 2px solid var(--surface); box-sizing: content-box; }
.tl .ev.p1 .rail i, .tl .ev.p2 .rail i { background: var(--brand-primary); }
.tl .ev.p3 .rail i { background: var(--alert); }
.tl .what { font-size: 13.5px; }
.tl .what b { font-weight: 570; }
.tl .what span { color: var(--text-dim); display: block; font-size: 12.5px; }

/* ------------------------------------------------------------- gauge_row */
.gauges { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.gauge { text-align: center; }
.gauge canvas { display: block; margin: 0 auto; }
.gauge .nm { font-size: 13px; color: var(--text-dim); margin-top: 2px;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gauge .st { font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* --------------------------------------------------------------- recency
 * Time since last report on a log axis. A place spans minutes to days; a linear axis
 * collapses everything recent into a smear at the left edge.
 */
.lolli { display: flex; flex-direction: column; gap: 1px; }
.lrow { display: grid; grid-template-columns: 168px 1fr 68px; gap: 13px;
        align-items: center; padding: 5px 0; border-radius: 6px; }
.lrow:hover { background: var(--surface-2); }
.lrow .nm { font-size: 13px; color: var(--text-dim);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .ago { font-family: var(--mono); font-size: 12px; color: var(--text-dim);
             text-align: right; font-variant-numeric: tabular-nums; }
.track { position: relative; height: 20px; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%;
                 height: 1px; background: var(--border); }
.stem { position: absolute; top: 50%; height: 2px; left: 0; transform: translateY(-50%);
        background: linear-gradient(90deg, transparent, var(--brand-primary));
        opacity: .42; border-radius: 2px; }
.knob { position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%;
        transform: translate(-50%, -50%); border: 2px solid var(--surface); }
.knob.fresh { background: var(--ok); }
.knob.mid   { background: var(--warn); }
.knob.old   { background: var(--text-faint); }

/* ------------------------------------------------------------------ misc */
.stat .v small { font-size: 16px; font-weight: 500; color: var(--text-dim);
                 letter-spacing: 0; margin-left: 2px; }
.stat .v .muted { color: var(--text-faint); }
.stat .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
           text-transform: uppercase; color: var(--text-faint); }
.stat .v { font-family: var(--mono); }
.stat .s { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }
.card .body p.note { margin: 12px 0 0; font-size: 12.5px; color: var(--text-faint);
                     line-height: 1.55; }
.gap h3 .tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em;
               text-transform: uppercase; color: var(--brand-primary);
               background: var(--surface); padding: 2px 7px; border-radius: 4px;
               margin-left: 8px; }
.gap h3 { display: flex; align-items: center; }
