/* Replicord admin panel - built on /tokens.css (same tokens, buttons, eyebrow and
   drawn outline as the landing page), app-style layout: sidebar + top bar + cards. */

body.panel { font-size: 15px; line-height: 1.45; }
.panel h1 { font-size: 38px; line-height: 1.05; letter-spacing: -0.04em; }
.panel h2 { font-size: 17px; letter-spacing: -0.02em; }
.panel code { font-size: .92em; background: var(--bg); padding: 1px 5px; border-radius: 5px; }
.icon { width: 17px; height: 17px; flex: 0 0 auto; }

/* ---------- boot + spinners ---------- */
.boot {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--ink-2); font-size: 15px;
}
.spinner {
  width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink);
  animation: spin .8s linear infinite; flex: 0 0 auto;
}
.spinner-light { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.app[hidden] { display: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--bg); padding: 18px 12px 16px;
  scrollbar-width: thin;
}
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; }
.sidebar-head .logo { font-size: 21px; }
.panel-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent); border-radius: 5px; padding: 2px 6px;
}
.sidebar-foot { margin-top: auto; padding: 16px 10px 0; font-size: 13px; color: var(--ink-3); }
.sidebar-foot a:hover { color: var(--ink); }

.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 2px; }
.nav-group-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px;
  color: var(--ink-2); font-size: 14.5px; letter-spacing: -0.01em; transition: background .15s, color .15s;
}
a.nav-item:hover { background: rgba(23,18,14,.05); color: var(--ink); }
.nav-item.is-active {
  background: var(--surface); color: var(--ink); font-weight: 500;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(23,18,14,.05);
}
.nav-item.is-active .icon { color: var(--ink); }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-soon { color: var(--ink-3); cursor: default; }
.nav-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 4px; white-space: nowrap;
}
.nav-tag-legacy { color: var(--ink-2); background: var(--bg-alt); border-color: transparent; }

/* Only used by the phone off-canvas menu - on desktop it must not take a grid cell. */
.sidebar-backdrop { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 0 32px; border-bottom: 1px solid var(--line);
  background: rgba(244, 242, 239, .88);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: none; align-items: center; justify-content: center; cursor: pointer;
}

.content { padding: 32px 36px 80px; width: 100%; max-width: 1280px; outline: none; }
.view-loading { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 40px 0; }

/* ---------- company switcher ---------- */
.company-switcher, .user-menu { position: relative; }
.switcher-btn {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 6px; border-radius: 12px;
  border: 1px solid transparent; background: transparent; cursor: pointer; text-align: left; color: var(--ink);
  font: inherit;
}
.switcher-btn:not([disabled]):hover { background: var(--surface); border-color: var(--line); }
.switcher-btn[disabled] { cursor: default; }
.switcher-mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: var(--accent);
  display: grid; place-items: center; font: 600 12px/1 var(--mono); letter-spacing: .02em; flex: 0 0 auto;
}
.switcher-mark.small { width: 26px; height: 26px; border-radius: 7px; font-size: 10.5px; }
.switcher-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.switcher-name { font-weight: 500; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher-role { font-size: 12px; color: var(--ink-3); }
.switcher-chevron { color: var(--ink-3); }

/* ---------- agent status ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; color: var(--ink-2);
  white-space: nowrap; transition: border-color .15s;
}
.status-pill:hover { border-color: var(--ink); color: var(--ink); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; }
.status-ok .status-dot { background: var(--accent); box-shadow: 0 0 0 1.5px var(--ink); }
.status-running .status-dot { background: #f59e0b; animation: pulse 1.4s ease-in-out infinite; }
.status-error .status-dot { background: #d92d20; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.55); } 50% { box-shadow: 0 0 0 5px rgba(245,158,11,0); } }

/* ---------- user menu ---------- */
.avatar-btn {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px; border-radius: 999px;
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink); font: inherit;
}
.avatar-btn:hover { background: var(--surface); border-color: var(--line); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font: 600 12.5px/1 var(--font); box-shadow: inset 0 0 0 1px rgba(23,18,14,.15);
}
.avatar-name { font-size: 14px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 50px -18px rgba(23,18,14,.35);
}
.menu-right { left: auto; right: 0; }
.menu-label, .menu-head { padding: 8px 10px 6px; }
.menu-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.menu-head { display: flex; flex-direction: column; border-bottom: 1px solid var(--line); margin-bottom: 4px; padding-bottom: 10px; }
.menu-head small { color: var(--ink-3); font-size: 12.5px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px;
  border: none; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--bg); }
.menu-item .icon { color: var(--ink-2); }
.menu-item-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.menu-item-text small { color: var(--ink-3); font-size: 12px; }
.menu-check { color: var(--ink); }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head .eyebrow { margin-bottom: 12px; font-size: 12px; }
.page-sub { margin-top: 10px; color: var(--ink-2); font-size: 15px; }
.page-actions { display: flex; gap: 10px; }
.page-actions .btn .icon { width: 15px; height: 15px; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 16px; display: flex; flex-direction: column; min-width: 0;
}
.kpi-label { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.kpi-value { font-size: 34px; font-weight: 500; letter-spacing: -0.045em; line-height: 1.1; margin-top: 12px; }
.kpi-hint { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.kpi-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- cards + grids ---------- */
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; min-width: 0;
}
.card-narrow { max-width: 640px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-weight: 500; }
.card-meta { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.card-note { font-size: 13.5px; color: var(--ink-2); margin-top: 14px; }
.count-badge {
  font-family: var(--mono); font-size: 11px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--ink); color: var(--bg); display: inline-grid; place-items: center;
}
.empty-inline { color: var(--ink-3); font-size: 14px; padding: 18px 0; display: flex; align-items: center; gap: 8px; }
.empty-inline.ok { color: var(--ink-2); }
.empty-inline.ok .icon { color: var(--ink); background: var(--accent); border-radius: 50%; padding: 2px; width: 18px; height: 18px; }

.empty-state { max-width: 560px; padding: 48px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.empty-state p { color: var(--ink-2); }
.empty-state .eyebrow { margin-bottom: 0; }

/* ---------- chart ---------- */
.chart { position: relative; padding-top: 18px; }
.chart-max { position: absolute; top: 0; left: 0; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.bar-chart { display: block; width: 100%; height: 170px; }
.bar-chart .bar { fill: var(--ink); }
.bar-chart .bar-today { fill: var(--accent); stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.bar-chart .bar-empty { fill: var(--line); }
.bar-chart .axis { stroke: var(--line); vector-effect: non-scaling-stroke; }
.chart-labels { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--ink); display: inline-block; }

/* ---------- attention list ---------- */
.attention-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attention-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.attention-item:first-child { border-top: none; padding-top: 2px; }
.severity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--ink-3); }
.severity-error .severity-dot { background: #d92d20; }
.severity-warning .severity-dot { background: #f59e0b; }
.attention-title { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }
.attention-detail, .attention-question { font-size: 13px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.attention-question { color: var(--ink-3); }
.attention-time { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ---------- simple lists ---------- */
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.simple-list li:first-child { border-top: none; padding-top: 2px; }
.simple-main { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.simple-time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.doc-type {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--bg-alt); color: var(--ink-2); border-radius: 5px; padding: 2px 6px; margin-right: 6px; vertical-align: 1px;
}
.doc-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- details + forms ---------- */
.details { margin: 0 0 18px; display: grid; gap: 10px; }
.details div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.details dt { color: var(--ink-3); font-size: 13.5px; }
.details dd { margin: 0; font-size: 14px; text-align: right; }
.mono-value { font-family: var(--mono); font-size: 13px !important; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13.5px; font-weight: 500; }
.field input {
  height: 44px; padding: 0 14px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: 400 15px/1 var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(23,18,14,.06); }
.field-hint { font-size: 12.5px; color: var(--ink-3); }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.form-actions .btn .icon { width: 15px; height: 15px; }
.form-note { font-size: 12.5px; color: var(--ink-3); }
.form-error {
  padding: 10px 12px; border-radius: 10px; font-size: 13.5px;
  background: #fdecea; color: #8a1c12; border: 1px solid #f5c2bc;
}
.form-error[hidden] { display: none; }

.role-badge {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 6px; white-space: nowrap;
}
.role-platform_admin { background: var(--ink); color: var(--bg); }
.role-admin { background: var(--accent); color: var(--accent-ink); }
.role-viewer { background: var(--bg-alt); color: var(--ink-2); }

/* ---------- embed ---------- */
.code-block {
  margin: 0 0 16px; padding: 18px 20px; border-radius: 12px; background: var(--dark); color: var(--on-dark);
  font: 13.5px/1.7 var(--mono); overflow-x: auto; white-space: pre;
}
.code-block code { background: none; padding: 0; color: inherit; font-size: inherit; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--ink-2); }
.steps strong { color: var(--ink); font-weight: 500; }
.soon-card { background: transparent; border-style: dashed; }
.soon-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  max-width: 380px; padding: 12px 16px 12px 14px; border-radius: 12px; font-size: 14px;
  background: var(--ink); color: var(--bg); border-left: 4px solid var(--ink-3);
  box-shadow: 0 16px 40px -16px rgba(23,18,14,.5); animation: toast-in .25s cubic-bezier(.22,1,.36,1);
  transition: opacity .4s, transform .4s;
}
.toast-success { border-left-color: var(--accent); }
.toast-error { border-left-color: #f04438; }
.toast-out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0; width: 280px; height: 100vh;
    transform: translateX(-100%); transition: transform .25s cubic-bezier(.22,1,.36,1);
    box-shadow: 0 0 60px -20px rgba(23,18,14,.4);
  }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(23,18,14,.3); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .icon-btn { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 8px; }
  .content { padding: 24px 16px 64px; }
}
@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .avatar-name, .avatar-btn > .icon, .switcher-role { display: none; }
  .panel h1 { font-size: 32px; }
}
@media (max-width: 560px) {
  .status-text { display: none; }
  .status-pill { width: 34px; padding: 0; justify-content: center; }
  .kpi { padding: 14px 14px 12px; }
  .kpi-value { font-size: 27px; }
  .switcher-name { max-width: 130px; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
  .toast { max-width: none; }
}

/* ---------- phase 3: sections, statuses, schedule ---------- */
.section-label {
  display: flex; align-items: baseline; gap: 10px; margin: 6px 0 10px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.section-label span { text-transform: none; letter-spacing: 0; font-family: var(--font); font-size: 12px; }
.kpi-link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.answer-status {
  display: inline-block; margin-left: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .05em;
  text-transform: uppercase; border-radius: 5px; padding: 1px 5px; vertical-align: 1px;
}
.answer-answered { background: var(--bg-alt); color: var(--ink-2); }
.answer-unanswered { background: #fef3c7; color: #92400e; }
.answer-pending { background: var(--bg); color: var(--ink-3); }

.status-progress {
  max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-3); font-size: 12.5px; border-left: 1px solid var(--line); padding-left: 8px;
}

.notice {
  margin-bottom: 14px; padding: 12px 16px; border-radius: 12px; font-size: 14px; color: #78350f;
  background: #fffbeb; border: 1px solid #fde68a;
}

.select {
  height: 44px; padding: 0 12px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: 400 15px/1 var(--font); outline: none;
}
.select:focus { border-color: var(--ink); }
.time-range { display: flex; align-items: center; gap: 10px; }
.time-range input {
  height: 44px; padding: 0 12px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: 400 15px/1 var(--font); outline: none;
}
.time-range input:focus { border-color: var(--ink); }

.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 4px 0 6px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row small { display: block; color: var(--ink-3); font-size: 12.5px; }
.switch-row strong { font-weight: 500; }
.switch {
  position: relative; width: 44px; height: 26px; flex: 0 0 auto; border-radius: 999px; background: var(--line);
  transition: background .2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(23,18,14,.3); transition: transform .2s cubic-bezier(.22,1,.36,1);
}
.switch-row input:checked + .switch { background: var(--ink); }
.switch-row input:checked + .switch::after { transform: translateX(18px); background: var(--accent); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--ink); outline-offset: 2px; }

.day-field { border: none; margin: 0; padding: 0; }
.day-field legend { font-size: 13.5px; font-weight: 500; margin-bottom: 6px; padding: 0; }
.day-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span {
  display: inline-grid; place-items: center; width: 44px; height: 36px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 14px; color: var(--ink-2);
  transition: background .15s, border-color .15s, color .15s;
}
.day-chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.day-chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.details dd small { color: var(--ink-3); font-size: 12.5px; }

.trigger-list { list-style: none; margin: 0; padding: 0; }
.trigger-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.trigger-list li:first-child { border-top: none; padding-top: 0; }
.trigger-list li > div { flex: 1; display: flex; flex-direction: column; }
.trigger-list strong { font-weight: 500; font-size: 14.5px; }
.trigger-list small { color: var(--ink-3); font-size: 13px; }
.trigger-state {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  border: 1.5px solid var(--line);
}
.trigger-state .icon { width: 13px; height: 13px; }
.trigger-state.on { background: var(--accent); border-color: var(--ink); color: var(--ink); }
.trigger-state.soon { border-style: dashed; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; font-family: var(--mono); font-size: 10.5px; font-weight: 400; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.run-badge { font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; padding: 2px 7px; }
.run-ok { background: var(--accent); color: var(--accent-ink); }
.run-warning { background: #fef3c7; color: #92400e; }
.run-error { background: #fee4e2; color: #b42318; }
.run-running { background: #fff7ed; color: #9a3412; }
.run-muted { background: var(--bg-alt); color: var(--ink-2); }

@media (max-width: 1280px) { .status-progress { display: none; } }

/* ---------- phase 4: timelines (Osie czasu) ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.page-note { margin-top: 8px; font-size: 13.5px; color: var(--ink-3); }
.error-text { color: #b42318; font-size: 14px; }
.warn-text { color: #b54708; }
.muted-inline { color: var(--ink-3); }

/* filters */
.tl-filters {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px;
}
.tl-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-search { position: relative; flex: 1 1 260px; min-width: 200px; display: flex; align-items: center; }
.tl-search .icon { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.tl-search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); font: 400 14.5px/1 var(--font); outline: none;
  transition: border-color .15s, background .15s;
}
.tl-search input:focus { border-color: var(--ink); background: var(--surface); }
.tl-field { display: flex; }
.select-sm { height: 40px; font-size: 14px; border-radius: 10px; padding: 0 10px; max-width: 320px; }
.tl-custom-range { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.tl-custom-range[hidden] { display: none; }
.date-input {
  height: 40px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: 400 14px/1 var(--font); outline: none;
}
.date-input:focus { border-color: var(--ink); }

.chip-rows:empty { display: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 500 13.5px/1 var(--font);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.is-empty { opacity: .55; }
.chip-count { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--ink-3); }
.chip.is-active .chip-count { color: var(--accent); }

.live-toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; margin-left: auto;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
  font: 500 13.5px/1 var(--font); cursor: pointer; transition: border-color .15s, color .15s;
}
.live-toggle:hover { border-color: var(--ink); color: var(--ink); }
.live-toggle.is-on { color: var(--ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: 0 0 auto; }
.live-toggle.is-on .live-dot { background: var(--ink-3); }
.live-toggle.is-on[data-status="connected"] .live-dot { background: #12b76a; animation: live-pulse 2s ease-in-out infinite; }
.live-toggle.is-on[data-status="reconnecting"] .live-dot { background: #f59e0b; }
@keyframes live-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(18,183,106,.45); } 50% { box-shadow: 0 0 0 5px rgba(18,183,106,0); } }

/* results */
.tl-results.is-loading .tl { opacity: .45; pointer-events: none; transition: opacity .15s; }
.tl-summary {
  min-height: 15px; margin: 0 0 8px 2px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
}
.tl-footer { display: flex; justify-content: center; margin-top: 4px; }
.tl-footer:empty { display: none; }
.more-count { color: var(--ink-3); font-weight: 400; }
.tl-empty {
  padding: 30px 22px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--ink-2); font-size: 14.5px; text-align: center;
}

.tl-day { margin-bottom: 18px; }
.panel .tl-day-label {
  position: sticky; top: 64px; z-index: 5; display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 2px;
  background: linear-gradient(var(--bg) 75%, rgba(244,242,239,0));
  font: 400 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}
.tl-day-count {
  padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 10.5px; color: var(--ink-3);
}
.tl-list {
  list-style: none; margin: 0; padding: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.tl-item + .tl-item { border-top: 1px solid var(--line); }

.tl-row {
  display: grid; align-items: start; column-gap: 12px; width: 100%; padding: 13px 16px;
  grid-template-columns: 48px 30px minmax(0, 1fr) 20px; grid-template-areas: "time marker body chevron";
  background: none; border: 0; color: inherit; font: inherit; text-align: left;
}
.tl-row.no-time { grid-template-columns: 30px minmax(0, 1fr) 20px; grid-template-areas: "marker body chevron"; }
div.tl-row { grid-template-columns: 48px 30px minmax(0, 1fr); grid-template-areas: "time marker body"; }
div.tl-row.no-time { grid-template-columns: 30px minmax(0, 1fr); grid-template-areas: "marker body"; }
summary.tl-row { cursor: pointer; list-style: none; }
summary.tl-row::-webkit-details-marker { display: none; }
.tl-row-button { cursor: pointer; }
summary.tl-row:hover, .tl-row-button:hover { background: #fbfaf8; }
summary.tl-row:focus-visible, .tl-row-button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

.tl-time { grid-area: time; padding-top: 7px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.tl-marker {
  grid-area: marker; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink-2);
}
.tl-marker .icon { width: 15px; height: 15px; }
.tone-new .tl-marker { background: var(--accent); border-color: rgba(23,18,14,.25); color: var(--ink); }
.tone-change .tl-marker { background: var(--ink); border-color: var(--ink); color: var(--accent); }
.tone-info .tl-marker { background: #eef4ff; border-color: #c7d7fe; color: #3538cd; }
.tone-warning .tl-marker { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.tone-error .tl-marker { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.tone-muted .tl-marker { color: var(--ink-3); }
.tl-body { grid-area: body; display: flex; flex-direction: column; gap: 5px; min-width: 0; padding-top: 4px; }
.tl-title { font-size: 14.5px; line-height: 1.4; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tl-title strong { font-weight: 600; }
.tl-subject { color: var(--ink-2); }
.value-old { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(23,18,14,.35); }
.tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--ink-3); }
.tl-meta-item { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.tl-chevron { grid-area: chevron; display: flex; padding-top: 7px; color: var(--ink-3); transition: color .15s; }
.tl-chevron .icon { transition: transform .2s; }
details[open] > summary .tl-chevron { color: var(--ink); }
details[open] > summary .tl-chevron .icon { transform: rotate(180deg); }
.tl-row-button:hover .tl-chevron { color: var(--ink); }
.tl-row-button:hover .tl-chevron .icon { transform: translateX(2px); }
.tl-item-new { animation: tl-new 2.6s ease-out; }
@keyframes tl-new { from { background: rgba(228,242,34,.32); } to { background: transparent; } }

.type-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--bg-alt); color: var(--ink-2); border-radius: 5px; padding: 2px 6px;
}
.state-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; border-radius: 5px; padding: 2px 6px; }
.state-warning, .state-no_text { background: #fef3c7; color: #92400e; }
.state-failed { background: #fee4e2; color: #b42318; }
.state-no_results, .state-muted { background: var(--bg); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.rating { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.rating .icon { width: 14px; height: 14px; }
.rating-up { color: #067647; }
.rating-down { color: #b42318; }

/* expanded entry */
.tl-details { padding: 0 16px 18px 118px; }
summary.no-time + .tl-details { padding-left: 58px; }
.tl-details-loading { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13.5px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 0 0 14px; font-size: 13.5px; }
.kv > div { display: contents; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.quote {
  margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  background: var(--bg); font-size: 14px; line-height: 1.5;
}
.details-text { margin-bottom: 12px; font-size: 14px; color: var(--ink-2); }
.panel .details-h {
  display: flex; align-items: center; gap: 8px; margin: 18px 0 8px;
  font: 400 11.5px/1.2 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2);
}
.details-h span { color: var(--ink-3); }
.details-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.doc-text {
  max-height: 260px; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink-2); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.doc-text:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.status-note {
  margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink-2); font-size: 13.5px;
}
.status-note span { opacity: .8; }
.status-note.status-failed { background: #fef3f2; border-color: #fecdca; color: #912018; }
.status-note.status-no_text { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.text-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink);
  text-decoration: underline; text-decoration-color: rgba(23,18,14,.3); text-underline-offset: 3px;
}
.text-link:hover { text-decoration-color: var(--ink); }
.text-link .icon { width: 14px; height: 14px; }
.doc-actions { margin: 0 0 4px; }
.log-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.log-mini li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; padding-left: 10px; border-left: 2px solid var(--line); }
.log-mini time { padding-top: 1px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.log-mini .level-warning { border-left-color: #f59e0b; }
.log-mini .level-error { border-left-color: #d92d20; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.btn-xs { height: 32px; padding: 0 12px; gap: 6px; font-size: 13px; }
.btn-xs .icon { width: 14px; height: 14px; }
.json {
  max-height: 280px; overflow: auto; margin: 0 0 10px; padding: 12px 14px; border-radius: 10px;
  background: var(--dark); color: var(--on-dark); font: 12px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.detail-foot { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.qa { margin: 0 0 10px; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.qa-label {
  display: block; margin-bottom: 2px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3);
}

/* investor activity: timeline + unanswered questions */
.tl-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.tl-aside { position: sticky; top: 84px; }
.card-note-top { margin: -6px 0 10px; }
.unanswered-list { list-style: none; margin: 0; padding: 0; }
.unanswered-list li + li { border-top: 1px solid var(--line); }
.unanswered-item {
  width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 10px 2px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.unanswered-item:hover .unanswered-q { text-decoration: underline; text-underline-offset: 3px; }
.unanswered-item:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.unanswered-q { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.unanswered-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.card-link { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.card-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* side panel (drawer) */
body.drawer-open { overflow: hidden; }
.drawer-root { position: fixed; inset: 0; z-index: 80; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(23,18,14,.32); opacity: 0; transition: opacity .2s; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(640px, 100%); display: flex; flex-direction: column;
  background: var(--bg); box-shadow: -24px 0 60px -30px rgba(23,18,14,.45); outline: none;
  opacity: 0; transform: translateX(24px); transition: transform .22s cubic-bezier(.22,1,.36,1), opacity .22s;
}
.drawer-root.is-open .drawer-backdrop { opacity: 1; }
.drawer-root.is-open .drawer { opacity: 1; transform: none; }
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 24px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.drawer-head .eyebrow { margin-bottom: 8px; font-size: 11.5px; }
.panel .drawer-head h2 { font-size: 21px; line-height: 1.25; overflow-wrap: anywhere; }
.drawer-close {
  width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.drawer-close:hover { border-color: var(--ink); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }

.transcript { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; flex-direction: column; gap: 5px; max-width: 92%; }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-agent { align-self: flex-start; }
.msg-bubble { padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-text { white-space: pre-line; }
.msg-user .msg-bubble { background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
.msg-agent .msg-bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.msg-meta .answer-status { margin-left: 0; }
.msg-sources {
  list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 5px; white-space: normal;
}
.msg-sources li { display: flex; align-items: flex-start; gap: 7px; font-size: 13px; }
.msg-sources .icon { width: 14px; height: 14px; margin-top: 2px; color: var(--ink-3); }
.msg-sources a { text-decoration: underline; text-decoration-color: rgba(23,18,14,.3); text-underline-offset: 3px; }
.msg-sources a:hover { text-decoration-color: var(--ink); }
.msg-report {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: 10px;
  background: #fffbeb; border: 1px solid #fde68a; color: #78350f; font-size: 13px;
}
.msg-report .icon { width: 15px; height: 15px; margin-top: 1px; }
.msg-report-comment { margin-top: 3px; }
.msg-tech { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.convo-signups { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.convo-signups p { display: flex; align-items: flex-start; gap: 8px; }
.convo-signups .icon { width: 15px; height: 15px; margin-top: 2px; }

@media (max-width: 1180px) {
  .tl-layout { grid-template-columns: minmax(0, 1fr); }
  .tl-aside { position: static; order: -1; }
}
@media (max-width: 760px) {
  .tl-row, .tl-row.no-time {
    grid-template-columns: 30px minmax(0, 1fr) 18px; grid-template-areas: "marker body chevron" "marker time chevron";
    column-gap: 10px; padding: 12px;
  }
  div.tl-row, div.tl-row.no-time { grid-template-columns: 30px minmax(0, 1fr); grid-template-areas: "marker body" "marker time"; }
  .tl-time { padding-top: 4px; font-size: 11px; }
  .tl-details, summary.no-time + .tl-details { padding: 0 12px 16px 52px; }
  .tl-search { flex-basis: 100%; }
  .tl-field { flex: 1 1 140px; min-width: 0; }
  .tl-field .select-sm { width: 100%; max-width: none; }
  .live-toggle { margin-left: 0; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dd { margin-bottom: 8px; }
  .log-mini li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .drawer-head { padding: 16px 16px 12px; }
  .drawer-body { padding: 16px 16px 32px; }
  .msg { max-width: 100%; }
}
@media (max-width: 480px) {
  .tl-details, summary.no-time + .tl-details { padding-left: 12px; }
}

/* ---------- phase 5: knowledge base (Wiedza) ---------- */
.panel .card-head h2 small, .panel .dossier-card h2 small {
  margin-left: 6px; font: 400 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
}

/* coverage map */
.cov-group { margin-bottom: 18px; }
.cov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cov-tile {
  position: relative; display: flex; flex-direction: column; gap: 3px; min-height: 148px; padding: 14px 16px 14px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.cov-tile:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(23,18,14,.45); border-color: var(--ink); }
.cov-tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* The level badge drops below a long domain name instead of sticking out of a narrow (phone) tile. */
.cov-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 4px 8px; }
.cov-name { min-width: 0; overflow-wrap: anywhere; font-size: 16px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.25; }
.cov-level {
  flex: 0 0 auto; font: 400 9.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 6px; border-radius: 5px; background: rgba(255,255,255,.6); color: var(--ink-2);
}
.cov-en { font: 400 10.5px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.cov-amount { margin-top: auto; padding-top: 12px; font-size: 13.5px; color: var(--ink-2); }
.cov-amount strong { font-size: 26px; font-weight: 500; letter-spacing: -0.04em; color: var(--ink); margin-right: 2px; }
.cov-meta { font-size: 12px; color: var(--ink-3); }
.cov-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cov-flag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px;
  font-size: 11.5px; background: rgba(255,255,255,.7); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line);
}
.cov-flag .icon { width: 12px; height: 12px; }
.cov-flag.flag-warning { background: #fffaeb; color: #b54708; box-shadow: inset 0 0 0 1px #fedf89; }
.cov-flag.flag-stale { background: #fff7ed; color: #9a3412; box-shadow: inset 0 0 0 1px #fed7aa; }

.level-none { background: transparent; border-style: dashed; }
.level-none .cov-name, .level-none .cov-amount { color: var(--ink-3); }
.level-low { background: #f9fbe0; }
.level-medium { background: #eff6a6; border-color: rgba(23,18,14,.14); }
.level-high { background: var(--accent); border-color: rgba(23,18,14,.28); }
.level-high .cov-level, .level-medium .cov-level { background: rgba(255,255,255,.75); color: var(--ink); }
.is-stale { border-color: #f59e0b; border-style: dashed; }

.cov-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 6px 0 4px; font-size: 12.5px; color: var(--ink-2); }
.cov-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-tile { width: 16px; height: 12px; border-radius: 3px; border: 1px solid var(--line); display: inline-block; }

/* domains index */
.dom-group { margin-bottom: 18px; }
.dom-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dom-list li + li { border-top: 1px solid var(--line); }
.dom-row {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 18px; align-items: center; gap: 14px;
  padding: 14px 16px; color: var(--ink); transition: background .15s;
}
.dom-row:hover { background: #fbfaf8; }
.dom-row:hover .dom-chevron { color: var(--ink); transform: translateX(2px); }
.dom-row:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.dom-level { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.dom-level.level-none { border-style: dashed; }
.dom-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dom-name { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.dom-name small { margin-left: 6px; font: 400 10.5px/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.dom-desc { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dom-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.dom-stats small { font-size: 12px; color: var(--ink-3); }
.dom-chevron { color: var(--ink-3); display: flex; transition: transform .15s, color .15s; }

/* domain page (dossier) */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.stat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 18px; }
.stat-chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2);
}
.stat-chip.level-chip { color: var(--ink); font-weight: 500; }
.stat-chip.chip-warning { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.dossier-card { margin-bottom: 14px; }

.fact-list { list-style: none; margin: 0; padding: 0; }
.fact + .fact { border-top: 1px solid var(--line); }
.fact summary { display: flex; align-items: baseline; gap: 6px; padding: 10px 0; cursor: pointer; list-style: none; }
.fact summary::-webkit-details-marker { display: none; }
.fact summary:hover .fact-text { text-decoration: underline; text-decoration-color: rgba(23,18,14,.25); text-underline-offset: 3px; }
.fact summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.fact-text { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.fact-date { flex: 0 0 auto; margin-left: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.fact-more { padding: 0 0 14px; }
.fn {
  flex: 0 0 auto; border: 0; background: none; padding: 0 1px; cursor: pointer;
  font: 500 11px/1 var(--mono); color: #3538cd; vertical-align: super;
}
.fn:hover { text-decoration: underline; }
.fn:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-radius: 3px; }

.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px; padding: 10px 0; font-size: 14.5px; }
.event-list li + li { border-top: 1px solid var(--line); }
.event-list time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding-top: 2px; }
.event-desc { margin-top: 3px; font-size: 13px; color: var(--ink-2); }
.issue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.issue-list li { display: flex; align-items: baseline; gap: 10px; }

.sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sources li { display: flex; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; transition: background .4s; }
.sources li.is-flash { animation: src-flash 1.8s ease-out; }
@keyframes src-flash { from { background: rgba(228,242,34,.55); } to { background: transparent; } }
.src-ref { flex: 0 0 auto; font: 500 12px/1.5 var(--mono); color: #3538cd; }
.src-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.src-main small { font-size: 12px; color: var(--ink-3); }

/* Akcjonariat */
.sh-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: center; }
.sh-chart { margin: 0; }
.donut-wrap { position: relative; width: 200px; height: 200px; }
.donut { width: 100%; height: 100%; transform: none; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none;
}
.donut-center strong { font-size: 24px; font-weight: 500; letter-spacing: -0.03em; }
.donut-center span { max-width: 110px; font-size: 11.5px; line-height: 1.3; color: var(--ink-3); }
.sh-table td { vertical-align: top; }
.sh-table td small { color: var(--ink-3); font-size: 11.5px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: 0; box-shadow: inset 0 0 0 1px rgba(23,18,14,.15); }
.sh-others td { color: var(--ink-3); }
.delta { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.delta-up { color: #067647; }
.delta-down { color: #b42318; }

/* Rejestr zarządu (Management Board Register) - functions as one blue ramp, dark = higher
   (validated: one hue, monotone lightness, light end 2.11:1 on white); uncertain = the same hue as a wash */
.fn-president, .fn-chair { --fn-color: #1c5cab; }
.fn-vice { --fn-color: #3987e5; }
/* The supervisory board's secretary: between the deputy chair and a member, same hue. */
.fn-secretary { --fn-color: #5f9fea; }
.fn-member { --fn-color: #86b6ef; }
.board-card .card-head { flex-wrap: wrap; gap: 8px 14px; }
.board-asof { display: flex; align-items: center; gap: 8px; }
.board-asof label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.board-asof input {
  height: 32px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font: 400 13.5px var(--font);
}
.board-asof input:focus { border-color: var(--ink); outline: none; }
[data-board-composition] { transition: opacity .15s; }
[data-board-composition].is-loading { opacity: .55; }
.board-members { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.board-member { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.board-avatar {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font: 500 14px var(--font); color: #fff; background: var(--fn-color, var(--ink));
}
.fn-member .board-avatar, .fn-secretary .board-avatar { color: var(--ink); }
.board-member-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.board-person {
  border: 0; background: none; padding: 0; text-align: left; cursor: pointer;
  font: 500 15px/1.3 var(--font); color: var(--ink); overflow-wrap: anywhere;
}
.board-person:hover { text-decoration: underline; text-underline-offset: 3px; }
.board-person:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.board-role { font-size: 13.5px; color: var(--ink-2); }
.board-line { font-size: 13px; color: var(--ink-2); }
.board-muted { color: var(--ink-3); }
.board-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.board-planned { margin-top: 14px; }
.board-krs { display: flex; gap: 6px; align-items: flex-start; margin-top: 14px; }
.board-krs .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.board-subhead { margin: 18px 0 4px; }

/* the time axis: percent positions, so it never scrolls sideways */
.board-chart { position: relative; margin: 4px 0 12px; }
.board-axis, .board-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; align-items: center; }
.board-axis-track, .board-track { position: relative; display: block; }
.board-axis-track { height: 22px; }
.board-year { position: absolute; top: 3px; padding-left: 4px; font: 400 11px var(--mono); color: var(--ink-3); white-space: nowrap; }
.board-row { border-top: 1px solid var(--line); }
.board-row-label { display: flex; flex-direction: column; min-width: 0; padding: 7px 0; }
.board-row-label small { font-size: 12px; color: var(--ink-3); }
.board-track { height: 42px; }
.board-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.board-now { position: absolute; top: 6px; bottom: 6px; width: 1px; background: var(--ink-3); }
.board-asof-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); }
.board-bar { position: absolute; top: 12px; height: 18px; box-shadow: -2px 0 0 0 var(--surface); border-radius: 4px; outline: none; }
.board-bar:hover .seg-solid { filter: brightness(1.08); }
.board-bar:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.board-seg { position: absolute; top: 0; bottom: 0; }
.seg-solid { background: var(--fn-color); border-radius: 4px; }
.seg-wash { background: color-mix(in srgb, var(--fn-color) 28%, transparent); border-radius: 4px; }
.seg-lead { right: 100%; width: 22px; background: linear-gradient(to right, transparent, color-mix(in srgb, var(--fn-color) 45%, transparent)); }
.board-tip {
  position: absolute; z-index: 5; max-width: 300px; padding: 8px 10px; border-radius: 10px;
  background: var(--ink); color: #fff; font-size: 12.5px; line-height: 1.45; white-space: pre-line;
  pointer-events: none; box-shadow: 0 8px 24px rgba(23,18,14,.18);
}
.board-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.board-legend span { display: inline-flex; align-items: center; gap: 6px; }
.board-key { display: inline-block; width: 18px; height: 10px; border-radius: 3px; background: var(--fn-color, var(--ink)); }
.board-key.key-wash { background: color-mix(in srgb, #3987e5 28%, transparent); }
.board-key.key-lead { background: linear-gradient(to right, transparent, color-mix(in srgb, #3987e5 45%, transparent)); }
.board-key.key-now { width: 1px; height: 14px; background: var(--ink-3); border-radius: 0; }
.board-key.key-asof { width: 2px; height: 14px; background: var(--ink); border-radius: 0; }
.board-table { margin: 4px 0 6px; }
.board-table summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); padding: 6px 0; }
.board-table[open] summary { margin-bottom: 8px; }
.board-kv dt { white-space: nowrap; }
.board-issues li { flex-wrap: wrap; }
.board-profile { margin-top: 6px; font-size: 13px; }
.board-profile summary { cursor: pointer; color: var(--ink-2); }
.board-profile[open] summary { margin-bottom: 6px; }
.board-profile .kv { margin-bottom: 6px; font-size: 13px; }
.board-career { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
/* the shared .simple-list lays a row out as key-value; the register's lists hold paragraphs */
.board-card .simple-list li, .board-drawer .simple-list li { display: block; }
.board-issues .row-buttons { flex-basis: 100%; }

/* the person's side panel */
.board-drawer { display: flex; flex-direction: column; gap: 12px; }
.board-evidence-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.board-evidence { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.board-evidence.is-rejected { background: var(--bg); }
.board-evidence.is-rejected .quote { opacity: .7; }
.board-evidence-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: 13.5px; }
.board-evidence .quote { margin: 8px 0; font-size: 13px; }
.board-evidence-source { font-size: 12.5px; overflow-wrap: anywhere; }
/* how far a statement can be trusted: verified, sources disagree, not verified yet */
.state-tag.verify-confirmed { background: #ecfdf3; color: #067647; }
.state-tag.verify-conflicting { background: #fee4e2; color: #b42318; }
.state-tag.verify-unverified { background: var(--bg); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.board-role .state-tag { margin-left: 4px; vertical-align: 1px; }
.board-verdict { margin: 6px 0; padding: 8px 10px; border-radius: 9px; background: var(--bg); font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 2px; }
.board-evidence.is-held { border-color: #fecdca; }
.board-held { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.board-held > li { padding: 12px 14px; border: 1px solid #fecdca; border-radius: 12px; }
.board-held .quote { margin: 8px 0; font-size: 13px; }
.board-held-box summary { color: #b42318; font-weight: 500; }
/* the verifier's held statements by reason, and people outside the court register */
.board-held-group { margin-bottom: 14px; }
.board-held-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0 8px; font-size: 13.5px; }
.board-held-head .row-buttons { margin-left: auto; }
.board-outside { margin: 4px 0 14px; }
.board-outside .issue-list li { flex-wrap: wrap; }
.board-outside .row-buttons { flex-basis: 100%; }
/* the court register's own history */
.board-krs-history { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.board-krs-history > li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; color: var(--ink-2); }
.board-krs-name { margin-bottom: 4px; overflow-wrap: anywhere; }
.board-krs-history .simple-list li { padding: 2px 0; }

.board-reject select, .board-merge select {
  height: 32px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 9px;
  background: var(--surface); font: 400 13px var(--font); color: var(--ink); max-width: 100%;
}

@media (max-width: 760px) {
  .board-axis, .board-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .board-axis-label { display: none; }
  .board-row-label { flex-direction: row; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; padding: 8px 0 0; }
  .board-track { height: 34px; }
  .board-bar { top: 8px; }
  .board-members { grid-template-columns: minmax(0, 1fr); }
  .board-krs-history { grid-template-columns: minmax(0, 1fr); }
  .board-kv dt { white-space: normal; }
}

/* review queue */
.review-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.review-card { padding: 18px 20px; }
.review-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 12px; }
.panel .review-head h3 { flex: 1 1 320px; font-size: 16px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.35; }
.review-time { font-size: 12.5px; color: var(--ink-3); }
.review-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.review-side { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.review-side.side-proposed { background: #fffbeb; border-color: #fde68a; }
.side-label { font: 400 10.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.side-value { margin: 4px 0 10px; font-size: 19px; font-weight: 500; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.side-statement { margin: -4px 0 10px; font-size: 13.5px; color: var(--ink-2); }
.review-side .quote { background: var(--surface); margin-bottom: 8px; font-size: 13px; }
.side-source { font-size: 12.5px; color: var(--ink-3); }
.review-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.review-actions[hidden] { display: none; }
.review-actions .btn .icon { width: 15px; height: 15px; }
.review-empty { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 20px; padding: 20px; }
.review-empty .icon { color: var(--ink); background: var(--accent); border-radius: 50%; padding: 2px; width: 18px; height: 18px; }
.gap-close { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.gap-close[hidden] { display: none; }
.field textarea {
  width: 100%; padding: 10px 12px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); font: 400 14.5px/1.45 var(--font); outline: none; resize: vertical; transition: border-color .15s, box-shadow .15s;
}
.field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(23,18,14,.06); }
.closed-gaps { margin-top: 6px; }
.closed-gaps summary { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; list-style: none; }
.closed-gaps summary::-webkit-details-marker { display: none; }
.closed-gaps[open] summary { margin-bottom: 12px; }

@media (max-width: 860px) {
  .sh-layout { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .sh-layout .table-wrap { width: 100%; }
  .review-compare { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .dom-row { grid-template-columns: 12px minmax(0, 1fr) 18px; }
  .dom-stats { grid-column: 2; grid-row: 2; align-items: flex-start; text-align: left; white-space: normal; }
  .dom-desc { white-space: normal; }
  .event-list li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .fact summary { flex-wrap: wrap; }
  .fact-date { margin-left: 0; width: 100%; }
  .cov-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .cov-tile { min-height: 132px; padding: 12px 13px; }
  .cov-amount strong { font-size: 22px; }
}

/* ---------- phase 6: agent (Stan agenta, Składniki, Źródła, Zachowanie czatu) ---------- */
.status-paused .status-dot { background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink-3); }

/* Stan agenta */
.health-hero { margin-bottom: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 22px 24px; }
.health-main { display: flex; align-items: flex-start; gap: 14px; }
.health-dot { width: 16px; height: 16px; border-radius: 50%; margin-top: 9px; flex: 0 0 auto; background: var(--ink-3); }
.health-ok .health-dot { background: var(--accent); box-shadow: 0 0 0 2px var(--ink); }
.health-running .health-dot { background: #f59e0b; animation: pulse 1.4s ease-in-out infinite; }
.health-warning .health-dot { background: #fdb022; box-shadow: 0 0 0 2px #b54708; }
.health-error .health-dot { background: #d92d20; }
.health-paused .health-dot { background: var(--surface); box-shadow: inset 0 0 0 3px var(--ink-3); }
.panel .health-title { font-size: 30px; letter-spacing: -0.035em; line-height: 1.15; }
.health-reason { margin-top: 4px; font-size: 14.5px; color: var(--ink-2); }
.health-warning { border-color: #fedf89; background: #fffdf5; }
.health-error { border-color: #fecdca; background: #fffbfa; }
.health-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.health-facts dt { font: 400 10.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.health-facts dd { margin: 6px 0 0; font-size: 18px; font-weight: 500; letter-spacing: -0.02em; }
.health-facts dd small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.health-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.health-actions .btn .icon { width: 15px; height: 15px; }
.config-kv { margin-top: 16px; }

/* Składniki agenta */
.lane { margin-bottom: 22px; }
.lane-flow {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.comp {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
/* The flow: an arrow to the next block (desktop rows). */
.lane-flow > .comp:not(:last-child)::after {
  content: '→'; position: absolute; right: -18px; top: 18px; font-size: 15px; color: var(--ink-3);
}
.comp-head { display: flex; align-items: center; gap: 8px; }
.comp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); flex: 0 0 auto; display: inline-block; }
.comp-ok .comp-dot { background: var(--accent); box-shadow: 0 0 0 1.5px var(--ink); }
.comp-warning .comp-dot { background: #fdb022; }
.comp-error .comp-dot { background: #d92d20; }
.comp-idle .comp-dot { background: var(--line); }
.comp-planned .comp-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.comp-name { flex: 1; font-size: 15.5px; font-weight: 500; letter-spacing: -0.015em; }
.comp-status { font: 400 9.5px/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.comp-en { margin-top: -4px; font: 400 10.5px/1.3 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.comp-version { font: 400 11.5px/1.35 var(--mono); color: var(--ink-2); background: var(--bg); border-radius: 6px; padding: 3px 7px; align-self: flex-start; }
.comp-desc { font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.comp-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; margin: 4px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
.comp-metrics dt { font-size: 11.5px; color: var(--ink-3); }
.comp-metrics dd { margin: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.comp-issue { display: flex; gap: 6px; align-items: flex-start; padding: 7px 9px; border-radius: 8px; background: #fffaeb; color: #93370d; font-size: 12.5px; }
.comp-issue .icon { width: 14px; height: 14px; margin-top: 1px; flex: 0 0 auto; }
.comp-error .comp-issue { background: #fef3f2; color: #912018; }
.comp-last { margin-top: auto; padding-top: 4px; font-size: 12px; color: var(--ink-3); }
.comp.comp-warning { border-color: #fedf89; }
.comp.comp-error { border-color: #fecdca; }
.comp.comp-planned { background: transparent; border-style: dashed; }
.comp.comp-planned .comp-name, .comp.comp-planned .comp-desc { color: var(--ink-3); }
.comp-legend i { margin-right: 2px; }

/* Źródła */
.source-card { padding: 18px 20px; }
.source-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 6px; }
.panel .source-head h3 { flex: 1 1 260px; font-size: 17px; font-weight: 500; letter-spacing: -0.015em; }
.source-url { margin-bottom: 12px; font-size: 13.5px; overflow-wrap: anywhere; }
.source-kv { margin-bottom: 4px; }
.source-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.dossier-card > .source-form { margin-top: 0; padding-top: 0; border-top: 0; }
.tier-field { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tier-field legend { margin-bottom: 6px; padding: 0; font-size: 13.5px; font-weight: 500; }
.tier-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 11px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.tier-option:hover { border-color: var(--ink-3); }
.tier-option:has(input:checked) { border-color: var(--ink); background: #fcfdf0; }
.tier-option input { margin-top: 3px; accent-color: var(--ink); }
.tier-option span { display: flex; flex-direction: column; gap: 1px; }
.tier-option strong { font-size: 14px; font-weight: 500; }
.tier-option small { font-size: 12.5px; color: var(--ink-3); }
.test-result { margin-top: 12px; padding: 12px 14px; border-radius: 11px; background: var(--bg); border: 1px solid var(--line); }
.test-result[hidden] { display: none; }
.test-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.test-line .icon { width: 16px; height: 16px; }
.test-line small { color: var(--ink-3); }
.test-sample { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.test-sample li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; }
.field select.select { width: 100%; }
.field .field-hint { font-size: 12.5px; color: var(--ink-3); }

/* Zachowanie czatu */
.behaviour-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.behaviour-fields { display: flex; flex-direction: column; gap: 14px; }
.behaviour-preview { position: sticky; top: 84px; }
.chat-preview { margin-top: 8px; padding: 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.chat-preview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.chat-preview-dot { width: 8px; height: 8px; border-radius: 50%; background: #2563eb; }
.chat-preview-bubble { padding: 10px 12px; border-radius: 12px 12px 12px 4px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.45; }
.chat-preview-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chat-preview-chips span { padding: 5px 10px; border-radius: 999px; border: 1px solid #c7d7fe; background: #f5f8ff; color: #1d4ed8; font-size: 12px; }
.field input[type="range"] { height: auto; padding: 0; border: 0; accent-color: var(--ink); }
.field output { margin-left: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.prompt-preview { margin-top: 2px; }
.prompt-preview summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.prompt-preview summary .icon { width: 15px; height: 15px; }
.prompt-preview[open] summary { margin-bottom: 10px; }

@media (max-width: 1180px) {
  .behaviour-grid { grid-template-columns: minmax(0, 1fr); }
  .behaviour-preview { position: static; }
}
@media (max-width: 760px) {
  .health-facts { grid-template-columns: minmax(0, 1fr); }
  .lane-flow { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .lane-flow > .comp:not(:last-child)::after { content: '↓'; right: auto; left: 50%; top: auto; bottom: -22px; }
  .panel .health-title { font-size: 26px; }
}

/* ---------- phase 7: tools and channels ---------- */
[data-view] [hidden] { display: none !important; }
.grid-2.tight { gap: 12px; margin-bottom: 0; }
.btn.is-armed, .btn-danger { background: #b42318; border-color: #b42318; color: #fff; }
.btn.is-armed:hover, .btn-danger:hover { background: #912018; }
/* The second-click question is longer than the label it replaces: in a narrow column it wraps
   instead of running into the button's edges. */
.btn.is-armed { white-space: normal; height: auto; min-height: 48px; padding-block: 6px; line-height: 1.25; text-align: center; }
.btn-sm.is-armed { min-height: 40px; }
.field input[type="url"], .field input[type="date"], .field input[type="file"] { width: 100%; }
.field input[type="file"] { height: auto; padding: 10px 12px; }
.delta-bad { color: #b42318; }
.delta-good { color: #067647; }
.card-head h2 .icon { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }
.inline-form { flex-direction: row; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.inline-form .field { flex: 1 1 260px; }

/* Osadzanie czatu */
.key-kv { margin: 16px 0 6px; }
.look-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 24px; align-items: start; }
.look-colors { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"] { width: 44px; height: 44px; padding: 3px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; flex: 0 0 auto; }
.color-row input[type="text"] { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 14px; }
.color-row .btn-xs { flex: 0 0 auto; padding: 0 9px; }
.look-preview { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 8px; }
.preview-frame { width: 100%; height: 600px; border: 1px solid var(--line); border-radius: 12px; background: #f6f7f9; }
.suggest-hosts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.suggest-hosts .side-label { flex-basis: 100%; }
.suggest-hosts .chip .icon { width: 14px; height: 14px; }

/* Kanały */
.channel-card { display: flex; flex-direction: column; gap: 4px; }
.channel-card .side-label { margin-top: 8px; }
.channel-kv { margin-bottom: 8px; }
.channel-kv .icon { width: 14px; height: 14px; vertical-align: -2px; }
.channel-card .form-actions { margin-top: auto; padding-top: 10px; }
.host-list .state-tag { margin-left: 6px; }

/* Kontakty */
.leads-table td.lead-email { font-weight: 500; }
td.row-actions { white-space: normal; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; min-width: 150px; }
.erase { display: flex; flex-direction: column; gap: 14px; }

/* Piaskownica czatu */
.pg-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.pg-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pg-settings { border-top: 1px solid var(--line); padding-top: 12px; }
.pg-settings summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 500; }
.pg-settings summary small { font: 400 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.pg-settings summary .icon { width: 16px; height: 16px; }
.pg-settings[open] { display: flex; flex-direction: column; gap: 12px; }
.pg-history { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.pg-history .side-label { margin-right: 4px; }
.pg-loading { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.pg-answer, .pg-hood, .pg-prompt { margin-bottom: 14px; }
.pg-question { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--bg); font-weight: 500; }
.pg-text { font-size: 15px; line-height: 1.6; }
.pg-text p { margin: 0 0 10px; }
.pg-text ul { margin: 0 0 10px; padding-left: 20px; }
.pg-citations { margin: 6px 0 4px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.pg-citations q { display: block; margin-top: 3px; color: var(--ink-2); font-size: 13px; quotes: '„' '”'; }
.pg-metrics { margin: 14px 0 0; }
.pg-section { border-top: 1px solid var(--line); padding: 10px 0; }
.pg-section summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; cursor: pointer; font-weight: 500; list-style: none; }
.pg-section summary::-webkit-details-marker { display: none; }
.pg-section summary small { margin-left: 6px; font: 400 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.pg-count { font: 400 12.5px/1 var(--mono); color: var(--ink-3); white-space: nowrap; }
.pg-count strong { color: var(--ink); font-weight: 500; }
.pg-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pg-list > li { padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.pg-list > li.is-used { border-color: var(--ink); background: #fcfdf0; }
.pg-item-main { display: flex; align-items: baseline; gap: 8px; overflow-wrap: anywhere; }
.pg-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 5px; font-size: 12.5px; color: var(--ink-3); }
.pg-quote { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); quotes: '„' '”'; }
.used-mark { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; padding: 1px 7px 1px 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 500 10.5px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.used-mark .icon { width: 12px; height: 12px; }

/* Tester ekstrakcji */
.tester-form { margin-bottom: 14px; }
.tester-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tester-kinds legend { grid-column: 1 / -1; }
.state-tag.tone-new { background: var(--accent); color: var(--accent-ink); }
.state-tag.tone-change { background: #fef3c7; color: #92400e; }
.state-tag.tone-muted { background: var(--bg); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.tester-entities { margin-bottom: 10px; }

/* Klucze API, eksport */
.new-key { border-color: var(--ink); margin-bottom: 14px; }
.data-table tr.is-revoked td { color: var(--ink-3); }
.api-docs .details-h { margin: 18px 0 6px; font-size: 15px; font-weight: 500; }
.api-docs .code-block { margin-bottom: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.export-card { display: flex; flex-direction: column; }
.export-count { margin: 4px 0 12px; font-size: 14px; color: var(--ink-2); }
.export-count strong { font-size: 22px; font-weight: 500; color: var(--ink); letter-spacing: -0.02em; margin-right: 4px; }
.export-card .form-actions { margin-top: auto; }

/* Zużycie i koszty */
.range-chips { align-self: flex-end; }
.bar-chart .seg-extraction, .legend-swatch.seg-extraction { fill: var(--ink); background: var(--ink); }
.bar-chart .seg-other, .legend-swatch.seg-other { fill: #8a837c; background: #8a837c; }
.bar-chart .seg-answer, .legend-swatch.seg-answer { fill: #c9d61a; background: #c9d61a; }
.bar-chart .seg-test, .legend-swatch.seg-test { fill: #f59e0b; background: #f59e0b; }
.data-table .legend-swatch { vertical-align: -1px; margin-right: 6px; }

@media (max-width: 1180px) {
  .look-grid { grid-template-columns: minmax(0, 1fr); }
  .look-preview { position: static; }
}
@media (max-width: 760px) {
  .code-block { white-space: pre-wrap; overflow-wrap: anywhere; }
  .leads-table thead { display: none; }
  .leads-table, .leads-table tbody, .leads-table tr, .leads-table td { display: block; width: 100%; }
  .leads-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .leads-table tr:last-child { border-bottom: none; }
  .leads-table td { padding: 2px 0; border: none; white-space: normal; }
  .leads-table td[data-label]::before { content: attr(data-label) ': '; color: var(--ink-3); font-size: 12.5px; }
  .leads-table td.lead-email { font-size: 15px; overflow-wrap: anywhere; }
  .leads-table td.row-actions { padding-top: 8px; }
  .tester-kinds { grid-template-columns: minmax(0, 1fr); }
  .preview-frame { height: 520px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .row-buttons { justify-content: flex-start; }
  .page-head .range-chips { align-self: flex-start; }
}

/* ---------- phase 8: platform, team, webhooks ---------- */
.tenants-table td small { display: block; font-size: 12px; }
.created { display: flex; flex-direction: column; gap: 12px; }
.password-notice { font-size: 15px; }
.webhook-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.webhook-card.is-off { opacity: .7; }
.webhook-url { font-family: var(--mono); font-size: 14px !important; overflow-wrap: anywhere; }
.webhook-card .stat-chips { margin: 0 0 10px; }
.webhook-card .code-block { margin: 12px 0 0; }
.channel-card .code-block { margin: 4px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Użytkownicy i role: one row per account */
.people { list-style: none; margin: 0; padding: 0; }
.person { display: grid; grid-template-columns: minmax(0, 1fr) 210px minmax(0, 1fr); gap: 8px 18px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.person:first-child { border-top: none; padding-top: 0; }
.person.is-off .person-main { opacity: .6; }
.person-name { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.person-meta { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--ink-2); }
.person-role .select-sm { width: 100%; height: 36px; font-size: 13.5px; }
.person-actions { justify-content: flex-end; min-width: 0; }
@media (max-width: 1100px) {
  .person { grid-template-columns: minmax(0, 1fr) 200px; }
  .person-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .person { grid-template-columns: minmax(0, 1fr); }
}
