/* Sekoya Command Center */
:root {
  --ink: #13212e;
  --ink-2: #33475a;
  --muted: #677a8a;
  --paper: #f3f6f8;
  --panel: #ffffff;
  --line: #dde5eb;
  --line-2: #eef2f5;
  --sky: #cbedfb;
  --sky-deep: #1d6c91;
  --bar: #58b4dc;
  --orange: #d9440d;
  --orange-dark: #b5370a;
  --good: #1c7a52;
  --good-bg: #e3f4ec;
  --warn: #9a5f06;
  --warn-bg: #fdf1dc;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --info-bg: #e6f5fc;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: 'tnum' 1;
}
a { color: var(--sky-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.dim { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--ink); color: #dce7ef; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { font-size: 12px; color: #9fb4c4; font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: #c9d7e2; font-weight: 600; font-size: 14px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(203, 237, 251, 0.08); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(203, 237, 251, 0.13); color: #fff; border-left-color: var(--orange); }
.nav .count { background: var(--orange); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.side-foot { margin-top: auto; padding: 0 8px; font-size: 12.5px; color: #8ea4b5; }
.side-foot button { background: none; border: 0; color: #c9d7e2; font: inherit; font-weight: 600; padding: 0; cursor: pointer; }
.side-foot button:hover { color: #fff; text-decoration: underline; }

.main { padding: 28px 36px 60px; max-width: 1280px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions { display: inline-flex; gap: 14px; align-items: center; }

/* Overview status headline */
.status-line { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; max-width: 30ch; }
.status-line .ok { color: var(--good); }
.status-line .bad { color: var(--bad); }
.status-date { color: var(--muted); font-weight: 600; margin-bottom: 8px; }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.panel-head .hint { color: var(--muted); font-size: 12.5px; }
.panel.flush { padding: 0; }
.panel.flush .panel-head { padding: 16px 20px 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.grid-2 > .panel + .panel { margin-top: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-3 > .panel + .panel { margin-top: 0; }
.section-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; margin: 30px 0 12px; scroll-margin-top: 20px; }

/* Figures strip: one panel divided into columns */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.figure { padding: 16px 20px; border-left: 1px solid var(--line-2); }
.figure:first-child { border-left: 0; }
.figure .k { color: var(--muted); font-size: 13px; font-weight: 600; }
.figure .v { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.figure .v small { font-size: 15px; font-weight: 700; color: var(--muted); }
.figure .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.figure .s.bad { color: var(--bad); font-weight: 600; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tbody tr:hover td { background: #fafcfd; }
.tbl .site-name { font-weight: 700; color: var(--ink); }
.tbl .site-sub { font-size: 12.5px; color: var(--muted); }
.tbl .total td { font-weight: 800; border-top: 1px solid var(--line); }
.tbl-compact td { padding: 8px 12px; }

/* ---------- Pills & indicators ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--sky-deep); }
.pill-muted { background: var(--line-2); color: var(--muted); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--line-2); border-radius: 6px; padding: 1px 8px; white-space: nowrap; }

.exp { font-weight: 700; white-space: nowrap; }
.exp-plain { color: var(--ink); font-weight: 600; }
.exp-warn { color: var(--warn); }
.exp-bad { color: var(--bad); }

.pulse { display: block; }
.pulse .pz-ok { fill: #3aa875; }
.pulse .pz-fail { fill: var(--bad); }
.pulse .pz-none { fill: #e4ebf0; }

.meter { display: inline-block; width: 64px; height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; vertical-align: middle; }
.meter b { display: block; height: 100%; border-radius: 99px; }
.meter-good b { background: var(--good); }
.meter-warn b { background: #d4900f; }
.meter-bad b { background: var(--orange); }
.meter-n { font-size: 12.5px; font-weight: 700; margin-left: 8px; vertical-align: middle; }

.share { display: inline-block; width: 90px; height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; vertical-align: middle; }
.share b { display: block; height: 100%; background: var(--bar); }
.share-n { font-size: 12.5px; color: var(--muted); margin-left: 8px; vertical-align: middle; display: inline-block; min-width: 32px; }

.trend { font-size: 12.5px; font-weight: 600; }
.trend.up { color: var(--good); }
.trend.down { color: var(--bad); }
.trend.flat { color: var(--muted); }

.ck { width: 18px; height: 18px; flex: none; }
.ck circle { stroke-width: 1.6; }
.ck-yes circle { fill: var(--good); stroke: var(--good); }
.ck-yes path { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ck-no circle { fill: none; stroke: #b9c6d0; stroke-dasharray: 2.5 2; }

a.ext::after { content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 4px; background: currentColor; opacity: 0.6;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><path d="M3 1h6v6M9 1L1 9" stroke="black" stroke-width="1.6" fill="none"/></svg>') no-repeat center / contain;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><path d="M3 1h6v6M9 1L1 9" stroke="black" stroke-width="1.6" fill="none"/></svg>') no-repeat center / contain; }

/* ---------- Attention list ---------- */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.alerts li:last-child { border-bottom: 0; }
.alerts .bar-l { border-radius: 4px; }
.alerts .critical .bar-l { background: var(--bad); }
.alerts .warning .bar-l { background: #d4900f; }
.alerts .info .bar-l { background: #b9c6d0; }
.alerts a { color: var(--ink); font-weight: 700; }
.alerts .d { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); padding: 18px 0; }
.empty strong { color: var(--ink); display: block; margin-bottom: 2px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: 170px; display: block; }
.chart .bar { fill: var(--bar); }
.chart .bar:hover { fill: var(--orange); }
.chart .grid { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }

/* ---------- Detail pages ---------- */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.fact { padding: 14px 18px; border-left: 1px solid var(--line-2); min-width: 0; }
.fact:first-child { border-left: 0; }
.fact .k { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.fact .v { font-size: 17px; font-weight: 800; margin-top: 3px; }
.fact .s { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin: 18px 0 4px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 8px 12px; font-weight: 700; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); text-decoration: none; border-bottom-color: var(--line); }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.links-row { display: flex; gap: 16px; flex-wrap: wrap; font-weight: 600; margin-top: 6px; }
.note { background: var(--info-bg); border-radius: 8px; padding: 10px 14px; color: var(--ink-2); font-size: 13.5px; }
.note.warn { background: var(--warn-bg); }
.checklist { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 32px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; break-inside: avoid; }
.checklist .t { font-weight: 600; }
.checklist .hint { color: var(--muted); font-size: 12.5px; }
.checklist .src { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-left: 4px; }
.code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12.5px; background: var(--ink); color: #e7f1f8;
  padding: 14px 16px; border-radius: 8px; overflow-x: auto; white-space: pre; display: block;
}
.copy-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.contract { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.contract + .contract { margin-top: 12px; }
.contract h3 { font-size: 15px; font-weight: 800; }
.terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; margin-top: 10px; }
.terms .k { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.terms .v { font-weight: 700; }

/* ---------- Forms & buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 700;
  font-size: 13.5px; border: 1px solid var(--orange); background: var(--orange); color: #fff; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--orange-dark); border-color: var(--orange-dark); text-decoration: none; }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-2); border-color: #c8d3db; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-danger { background: var(--panel); color: var(--bad); border-color: #f2c4bf; }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-link { background: none; border: 0; color: var(--sky-deep); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--bad); }
.btn-link.small { font-size: 12.5px; }
form.inline { display: inline; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg a { padding: 6px 12px; font-weight: 700; font-size: 13px; color: var(--ink-2); border-left: 1px solid var(--line); }
.seg a:first-child { border-left: 0; }
.seg a.on { background: var(--ink); color: #fff; }
.seg a:hover { text-decoration: none; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters a { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); font-weight: 700; font-size: 13px; color: var(--ink-2); background: var(--panel); }
.filters a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters a:hover { text-decoration: none; }

fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend { font-size: 16px; font-weight: 800; margin-bottom: 4px; padding: 0; }
.legend-hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.fgrid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=url], input[type=email], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid #cdd8e0; border-radius: 8px; padding: 8px 11px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: transparent; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; }
.checkbox { display: flex; gap: 9px; align-items: center; font-weight: 600; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--orange); }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 6px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.add-row { display: grid; grid-template-columns: 140px 130px 1fr 90px auto; gap: 8px; align-items: end; padding: 14px 20px; border-top: 1px solid var(--line-2); background: #fafcfd; border-radius: 0 0 var(--radius) var(--radius); }
.add-row.costs { grid-template-columns: 1fr 140px 110px 120px 110px 140px auto; }
.add-row label { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 3px; }
details.add { margin-top: 0; }
details.add summary { cursor: pointer; font-weight: 700; color: var(--sky-deep); list-style: none; }
details.add summary::-webkit-details-marker { display: none; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-weight: 600; }
.flash-good { background: var(--good-bg); color: var(--good); }
.flash-bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.login { background: var(--panel); border-radius: 14px; padding: 32px; width: 100%; max-width: 380px; }
.login .brand { color: var(--ink); padding: 0; margin-bottom: 22px; }
.login .brand-sub { color: var(--muted); }
.login h1 { font-size: 20px; font-weight: 800; margin-bottom: 14px; }
.login .btn { width: 100%; justify-content: center; margin-top: 14px; padding: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .fact:nth-child(3) { border-left: 0; }
  .fact:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .add-row, .add-row.costs { grid-template-columns: 1fr 1fr; }
  .add-row > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; gap: 14px; overflow-x: auto; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 7px 10px; white-space: nowrap; }
  .nav a.on { border-bottom-color: var(--orange); }
  .side-foot { margin: 0 0 0 auto; }
  .main { padding: 20px 16px 48px; }
  .status-line { font-size: 24px; }
  .fgrid { grid-template-columns: 1fr; }
  .checklist { columns: 1; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- v2 additions ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12.5px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.chip:hover { text-decoration: none; border-color: #c8d3db; color: var(--ink); }
.subnav.tabs { margin-top: 0; }
.subnav.tabs a.on { color: var(--ink); border-bottom-color: var(--orange); }
.add-row.links { grid-template-columns: 200px 1fr 1fr auto; }
tr.unread td { background: #fffaf2; }
tr.unread .site-name { font-weight: 800; }
td.msg { color: var(--ink-2); max-width: 360px; }
.pos { color: var(--good); font-weight: 700; }
.neg { color: var(--bad); font-weight: 700; }
.legend { display: inline-flex; align-items: center; gap: 6px 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.lg-rev { background: var(--bar); }
.lg-exp { background: var(--orange); }
.lg-est { background: repeating-linear-gradient(45deg, #f2a585, #f2a585 2px, #fbe0d4 2px, #fbe0d4 4px); }
.chart-pair { height: 200px; }
.chart .bar-rev { fill: var(--bar); }
.chart .bar-exp { fill: var(--orange); }
.chart .bar-exp.est { fill: #f2a585; }
select.mini { width: auto; min-width: 120px; max-width: 200px; padding: 4px 8px; font-size: 13px; border-radius: 6px; }
tr.muted-row td { color: var(--muted); }
tr.muted-row strong { font-weight: 600; }
tr.saved td { background: var(--good-bg); transition: background .2s; }
.month-filter { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; }
.month-filter input { width: auto; padding: 4px 8px; font-size: 13px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.checkbox.big { font-size: 15px; font-weight: 700; }
.checks.one-col { grid-template-columns: 1fr; }
details.advanced summary { cursor: pointer; font-weight: 700; color: var(--sky-deep); margin-top: 4px; }
iframe.preview { width: 100%; height: 640px; border: 0; border-top: 1px solid var(--line-2); border-radius: 0 0 var(--radius) var(--radius); background: #f3f6f8; }
.grid-2 > div > .panel + .panel { margin-top: 16px; }
.chat-layout, .report-layout { align-items: start; }
.testchat { display: flex; flex-direction: column; gap: 10px; }
.tc-msgs { min-height: 220px; max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--paper); border-radius: 10px; }
.tc-m { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; }
.tc-m.bot { background: #fff; border: 1px solid var(--line); align-self: flex-start; }
.tc-m.me { background: var(--orange); color: #fff; align-self: flex-end; }
.tc-m.err { color: var(--bad); }
.tc-t { font-size: 11px; opacity: .7; margin-top: 4px; }
.tc-form { display: flex; gap: 8px; }
.transcript { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 1100px) { .add-row.links { grid-template-columns: 1fr 1fr; } }
