/* SENTINEL v12 — shared components. Every view builds from these; a view's
   own stylesheet adds layout, not new kinds of thing. */

/* ── view scaffolding ─────────────────────────────────────────────── */
.view { padding-block: var(--s-6) var(--s-8); }
.view-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--s-3) var(--s-5);
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-6);
  border-bottom: 1px solid var(--rule);
}
.view-head .eyebrow { grid-column: 1 / -1; }
.view-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: var(--t-36);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
.view-lede {
  grid-column: 1 / -1;
  font-family: var(--f-display);
  font-size: var(--t-22);
  line-height: 1.38;
  color: var(--paper);
  max-width: 64ch;
}
.view-lede em { font-style: italic; color: var(--amber); }
.view-lede .src { font-family: var(--f-body); font-size: var(--t-13); color: var(--mist); display: block; margin-top: var(--s-2); }
.view-tools { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }

.stack { display: flex; flex-direction: column; gap: var(--s-5); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); align-items: start; }
@media (max-width: 1080px) {
  .split, .split-even { grid-template-columns: minmax(0, 1fr); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .view-head { grid-template-columns: minmax(0, 1fr); }
  .view-title { font-size: var(--t-28); }
  .view-lede { font-size: var(--t-18); }
}

/* ── panel ─────────────────────────────────────────────────────────── */
.panel {
  background: var(--slate);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  min-width: 0;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-4) var(--s-5) var(--s-3);
  border-bottom: 1px solid var(--rule);
}
.panel-title { font-size: var(--t-16); font-weight: 700; letter-spacing: 0.01em; }
.panel-title small { font-weight: 400; color: var(--fog); font-size: var(--t-14); margin-left: var(--s-2); }
.panel-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); font-size: var(--t-13); color: var(--fog); }
.panel-body { padding: var(--s-4) var(--s-5) var(--s-5); }
.panel-body.flush { padding: 0; }
.panel-foot { padding: var(--s-3) var(--s-5) var(--s-4); border-top: 1px solid var(--rule); font-size: var(--t-13); color: var(--fog); }
@media (max-width: 560px) {
  .panel-head, .panel-body, .panel-foot { padding-left: var(--s-4); padding-right: var(--s-4); }
}

/* ── chips & badges ────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-data);
  font-size: var(--t-12);
  line-height: 1.5;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  color: var(--fog);
  white-space: nowrap;
  vertical-align: middle;
}
.chip--crit  { color: var(--sev-crit); border-color: color-mix(in srgb, var(--sev-crit) 55%, transparent); }
.chip--high  { color: var(--sev-high); border-color: color-mix(in srgb, var(--sev-high) 55%, transparent); }
.chip--med, .chip--amber { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 55%, transparent); }
.chip--low, .chip--cyan  { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 50%, transparent); }
.chip--ok    { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.chip--solid { background: var(--amber); color: var(--ink); border-color: var(--amber); font-weight: 600; }
.chip--dashed { border-style: dashed; }

.sev {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 3.4em;
  font-family: var(--f-data); font-size: var(--t-12); font-weight: 600;
  padding: 1px 6px; border-radius: 3px;
  color: var(--ink);
}
.sev--crit { background: var(--sev-crit); }
.sev--high { background: var(--sev-high); }
.sev--med  { background: var(--sev-med); }
.sev--low  { background: var(--sev-low); }
.sev--none { background: transparent; color: var(--mist); border: 1px dashed var(--rule-2); font-weight: 400; }
.sev--est  { background: transparent; border: 1px dashed currentColor; }
.sev--est.sev--crit { color: var(--sev-crit); } .sev--est.sev--high { color: var(--sev-high); }
.sev--est.sev--med { color: var(--sev-med); }  .sev--est.sev--low { color: var(--sev-low); }

/* ── buttons & controls ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--rule-2);
  background: transparent;
  color: var(--paper);
  font-size: var(--t-14);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:hover { border-color: var(--fog); background: var(--slate-2); color: var(--paper); }
.btn--primary { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn--primary:hover { background: #ffc764; border-color: #ffc764; color: var(--ink); }
.btn--ghost { border-color: transparent; color: var(--cyan); padding-inline: 8px; }
.btn--ghost:hover { background: transparent; color: var(--paper); border-color: transparent; }
.btn--sm { min-height: 30px; padding: 3px 10px; font-size: var(--t-13); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden; }
.seg button {
  border: 0; background: transparent; color: var(--fog);
  font-size: var(--t-13); font-weight: 600;
  padding: 6px 12px; min-height: 32px;
  border-right: 1px solid var(--rule);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--paper); background: var(--slate-2); }
.seg button[aria-pressed="true"] { color: var(--ink); background: var(--amber); }

.toggles { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.toggle {
  border: 1px solid var(--rule-2); background: transparent; color: var(--fog);
  font-size: var(--t-13); padding: 4px 12px; min-height: 32px; border-radius: 999px;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.toggle:hover { color: var(--paper); border-color: var(--fog); }
.toggle[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); background: rgba(242, 181, 68, .08); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: var(--t-13); font-weight: 600; color: var(--fog); }
.input, .select, .textarea {
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  color: var(--paper);
  font-size: var(--t-14);
  padding: 8px 12px;
  min-height: 38px;
  transition: border-color var(--t-fast) var(--ease);
}
.textarea { font-family: var(--f-data); min-height: 140px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--amber); outline: none; box-shadow: 0 0 0 3px rgba(242, 181, 68, .18); }
.input::placeholder, .textarea::placeholder { color: var(--mist); }

/* ── lists & rows ─────────────────────────────────────────────────── */
.list { list-style: none; }
.list > li + li { border-top: 1px solid var(--rule); }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px var(--s-4);
  padding: var(--s-3) var(--s-5);
  align-items: start;
}
.row-main { min-width: 0; }
.row-title { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.row-title a { color: var(--paper); text-decoration: none; }
.row-title a:hover { color: var(--cyan); text-decoration: underline; }
.row-sub { font-size: var(--t-13); color: var(--fog); margin-top: 2px; overflow-wrap: anywhere; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: var(--t-13); color: var(--fog); text-align: right; }
.row--button { cursor: pointer; transition: background var(--t-fast) var(--ease); }
.row--button:hover, .row--button:focus-visible { background: var(--slate-2); }
.row--button:focus-visible { outline-offset: -2px; }
.row--mine { box-shadow: inset 3px 0 0 var(--amber); }
@media (max-width: 560px) { .row { padding-inline: var(--s-4); } }

/* ── tables ───────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; font-size: var(--t-14); }
.tbl th {
  text-align: left; font-size: var(--t-12); font-weight: 700; letter-spacing: var(--track-label);
  text-transform: uppercase; color: var(--fog);
  padding: 10px var(--s-4); border-bottom: 1px solid var(--rule-2); white-space: nowrap;
  position: sticky; top: 0; background: var(--slate);
}
.tbl td { padding: 10px var(--s-4); border-bottom: 1px solid var(--rule); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tbody tr:hover td { background: var(--slate-2); }

/* ── meters & figures ─────────────────────────────────────────────── */
.meter { position: relative; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; min-width: 60px; }
.meter > i { position: absolute; inset: 0 auto 0 0; width: var(--v, 0%); background: var(--cyan); border-radius: 3px; transition: width var(--t-slow) var(--ease); }
.meter--amber > i { background: var(--amber); }
.meter--crit > i { background: var(--sev-crit); }

.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .num { font-size: var(--t-36); line-height: 1; font-weight: 500; letter-spacing: -0.02em; }
.stat .label { font-size: var(--t-13); color: var(--fog); }
.stat .delta { font-family: var(--f-data); font-size: var(--t-12); color: var(--mist); }
.stat .delta.up { color: var(--sev-high); } .stat .delta.down { color: var(--ok); }
.stat.unknown .num { color: var(--mist); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--s-4); font-size: var(--t-14); }
.kv dt { color: var(--fog); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.empty {
  padding: var(--s-6) var(--s-5);
  text-align: left;
  color: var(--fog);
  font-size: var(--t-14);
}
.empty b { display: block; color: var(--paper); font-size: var(--t-16); margin-bottom: 4px; }
.empty--fault b { color: var(--sev-high); }

.note { font-size: var(--t-13); color: var(--fog); line-height: 1.55; }
.note b { color: var(--paper); font-weight: 600; }

/* freshness chip */
.fresh { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-data); font-size: var(--t-12); color: var(--mist); white-space: nowrap; }
.fresh i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(111, 211, 155, .5); animation: pulse 3s var(--ease) infinite; }
.fresh--warn i { background: var(--amber); animation: none; }
.fresh--stale { color: var(--sev-high); }
.fresh--stale i { background: transparent; border: 1.5px solid var(--sev-crit); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(111, 211, 155, .45); } 70% { box-shadow: 0 0 0 7px rgba(111, 211, 155, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 211, 155, 0); } }

/* defanged indicator text */
.ioc { font-family: var(--f-data); font-size: var(--t-13); overflow-wrap: anywhere; color: var(--paper); }
.ioc b { color: var(--sev-high); font-weight: 400; }

/* pivot linkouts */
.pivots { display: flex; flex-wrap: wrap; gap: 6px; }
.pivots a {
  font-size: var(--t-12); font-family: var(--f-data);
  border: 1px solid var(--rule-2); border-radius: 999px; padding: 2px 10px;
  color: var(--cyan); text-decoration: none;
}
.pivots a:hover { border-color: var(--cyan); color: var(--paper); }
.out::after { content: " \2197"; font-size: .85em; }

/* skeleton while a feed loads */
.skeleton { display: grid; gap: 10px; padding: var(--s-5); }
.skeleton i { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--rule) 0%, var(--slate-2) 50%, var(--rule) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i:nth-child(2) { width: 82%; } .skeleton i:nth-child(3) { width: 64%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* entrance */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise var(--t-slow) var(--ease) both; }
  @keyframes rise { from { transform: translateY(10px); opacity: .001; } to { transform: none; opacity: 1; } }
}

/* v12.1: AI-enabled operations tag (violet is reserved for it) */
.chip--ai { color: #c6b1ff; border-color: rgba(198, 177, 255, .55); }
