/* =============================================================================
   Views — widgets, domain pages, action flow, audit timeline.
   Built only on tokens.css; shared primitives (.card, .btn, .chip, .badge, .facts…) live in components.css.
   ============================================================================= */

/* ── Shared bits ─────────────────────────────────────────────────────────── */

.tone-icon {
  --tone: var(--neutral); --tone-soft: var(--neutral-soft); --tone-border: var(--neutral-border);
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  color: var(--tone); background: var(--tone-soft); border: 1px solid var(--tone-border);
}
.tone-icon .icon { width: 16px; height: 16px; }
.tone-icon--info    { --tone: var(--info);    --tone-soft: var(--info-soft);    --tone-border: var(--info-border); }
.tone-icon--success { --tone: var(--success); --tone-soft: var(--success-soft); --tone-border: var(--success-border); }
.tone-icon--warning { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-border: var(--warning-border); }
.tone-icon--danger  { --tone: var(--danger);  --tone-soft: var(--danger-soft);  --tone-border: var(--danger-border); }
.tone-icon--accent  { --tone: var(--accent);  --tone-soft: var(--accent-soft);  --tone-border: var(--accent-border); }
.tone-icon--muted   { --tone: var(--muted);   --tone-soft: var(--muted-soft);   --tone-border: var(--muted-border); }

.tone-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--neutral); flex: none; }
.tone-dot--info { background: var(--info); }
.tone-dot--success { background: var(--success); }
.tone-dot--warning { background: var(--warning); }
.tone-dot--danger { background: var(--danger); }
.tone-dot--accent { background: var(--accent); }
.tone-dot--muted { background: var(--muted); }

.live-dot {
  position: relative; display: inline-block; flex: none;
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  animation: v-pulse 2s var(--ease) infinite;
}
.live-dot.is-off { background: var(--muted); animation: none; box-shadow: none; }
@keyframes v-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.live-meta { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); }

.chip-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }

@media (max-width: 767px) {
  .hide-sm { display: none !important; }
}

/* ── Widget host ─────────────────────────────────────────────────────────── */

/* Widgets in the same row share its height, so side-by-side cards line up instead of leaving holes. */
.widget-grid { align-items: stretch; }
.widget { min-width: 0; display: flex; flex-direction: column; }
.widget--card { padding: 0; overflow: hidden; }
.widget__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-4) var(--s-4) var(--s-3);
}
.widget--bare > .widget__head { padding: 0 0 var(--s-2); align-items: center; }
.widget__titles { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.widget__title {
  display: flex; align-items: center; gap: var(--s-2);
  margin: 0; font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: var(--lh-tight); color: var(--text);
}
.widget__count {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums;
  padding: 1px 7px; border-radius: var(--r-full); color: var(--text-2); background: var(--surface-3);
}
.widget__desc { margin: 0; font-size: var(--fs-sm); color: var(--text-3); line-height: var(--lh); }
.widget__tools { display: flex; align-items: center; gap: var(--s-1); flex: none; margin: -4px -6px 0 0; }
.widget__stamp { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.widget__warn { display: inline-flex; color: var(--warning); }
.widget__warn .icon { width: 15px; height: 15px; }
.widget__refresh.is-busy .icon { animation: v-spin 0.9s linear infinite; }
@keyframes v-spin { to { transform: rotate(360deg); } }
.widget__body { min-width: 0; flex: 1; }
.widget--card > .widget__body { padding: 0 var(--s-4) var(--s-4); }
.widget--card > .widget__head + .widget__body:has(> .widget-table) { padding: 0; }
.widget__foot {
  display: flex; justify-content: flex-end;
  padding: var(--s-2) var(--s-4); border-top: 1px solid var(--border); background: var(--surface-2);
}
.widget__more {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--accent); text-decoration: none;
}
.widget__more:hover { text-decoration: underline; }
.widget__more .icon { width: 14px; height: 14px; }
.widget__note { margin: var(--s-2) var(--s-4); font-size: var(--fs-xs); color: var(--text-3); }
.widget__empty { margin: 0; padding: var(--s-6) 0; text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.widget-table { min-width: 0; }
.widget-table > .table-wrap, .widget-table > * { border-radius: 0; }

/* ── KPIs ─────────────────────────────────────────────────────────────────── */

/* Flex rows sized by --kpi-cols (set by widgets/kpis.js): the last row's tiles grow to fill it. */
.kpis { --kpi-cols: 4; --kpi-gap: var(--s-3); display: flex; flex-wrap: wrap; gap: var(--kpi-gap); }
.kpis--compact { --kpi-gap: var(--s-2); }
.kpis > .kpi { flex: 1 1 calc((100% - (var(--kpi-cols) - 1) * var(--kpi-gap)) / var(--kpi-cols)); }
.kpi {
  --tone: var(--text-2); --tone-soft: var(--neutral-soft); --tone-border: var(--border);
  position: relative; display: flex; flex-direction: column; gap: var(--s-2); min-width: 0;
  padding: var(--s-4); border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.kpis--compact .kpi { padding: var(--s-3); gap: var(--s-1); }
.kpi--info    { --tone: var(--info);    --tone-soft: var(--info-soft);    --tone-border: var(--info-border); }
.kpi--success { --tone: var(--success); --tone-soft: var(--success-soft); --tone-border: var(--success-border); }
.kpi--warning { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-border: var(--warning-border); }
.kpi--danger  { --tone: var(--danger);  --tone-soft: var(--danger-soft);  --tone-border: var(--danger-border); }
.kpi--accent  { --tone: var(--accent);  --tone-soft: var(--accent-soft);  --tone-border: var(--accent-border); }
.kpi--muted   { --tone: var(--muted);   --tone-soft: var(--muted-soft);   --tone-border: var(--muted-border); }
.kpi__top { display: flex; align-items: flex-start; gap: var(--s-2); min-width: 0; min-height: 32px; }
.kpi__icon {
  display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px;
  border-radius: var(--r-sm); color: var(--tone); background: var(--tone-soft);
}
.kpi__icon .icon { width: 15px; height: 15px; }
.kpi__label {
  flex: 1; min-width: 0; font-size: var(--fs-sm); line-height: var(--lh-tight); color: var(--text-2); font-weight: var(--fw-medium);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kpi__go { width: 14px; height: 14px; color: var(--text-3); transition: transform var(--dur) var(--ease); }
.kpi__value {
  font-size: var(--fs-3xl); font-weight: var(--fw-semibold); line-height: 1.1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere;
}
.kpis--compact .kpi__value { font-size: var(--fs-xl); }
.kpi__value .badge { font-size: var(--fs-sm); letter-spacing: 0; }
.kpi__value time { font-size: var(--fs-lg); }
.kpi__hint { font-size: var(--fs-xs); color: var(--text-3); line-height: var(--lh); }
.kpi--alert { border-color: var(--tone-border); background: linear-gradient(180deg, var(--tone-soft), transparent 70%), var(--surface); }
.kpi--alert .kpi__value { color: var(--tone); }
.kpi__pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex: none;
  animation: v-pulse-tone 1.8s var(--ease) infinite;
}
@keyframes v-pulse-tone {
  0% { box-shadow: 0 0 0 0 var(--tone-border); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
a.kpi:hover { border-color: var(--tone-border); background: var(--surface-hover); }
a.kpi:hover .kpi__go { transform: translateX(2px); color: var(--text-2); }
a.kpi:focus-visible { outline: none; box-shadow: var(--ring); }
.kpi--skeleton { gap: var(--s-3); }
.kpi__value-skel { height: 28px; width: 45%; }

/* ── Bars ─────────────────────────────────────────────────────────────────── */

.bars { display: flex; flex-direction: column; gap: var(--s-3); }
.bar {
  --tone: var(--accent);
  display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none;
  border-radius: var(--r-sm);
}
.bar--info { --tone: var(--info); }
.bar--success { --tone: var(--success); }
.bar--warning { --tone: var(--warning); }
.bar--danger { --tone: var(--danger); }
.bar--neutral { --tone: var(--neutral); }
.bar--muted { --tone: var(--muted); }
.bar__head { display: flex; align-items: baseline; gap: var(--s-2); font-size: var(--fs-sm); }
.bar__label { flex: 1; min-width: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__value { color: var(--text); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }
.bar__pct { min-width: 48px; text-align: right; color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.bar__track { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.bar__fill {
  height: 100%; border-radius: inherit; background: var(--tone);
  transition: width var(--dur-slow) var(--ease);
}
.bar--link:hover .bar__label { color: var(--accent); text-decoration: underline; }
.bar--link:focus-visible { outline: none; box-shadow: var(--ring); }
.bars__total {
  display: flex; justify-content: space-between; padding-top: var(--s-2); margin-top: var(--s-1);
  border-top: 1px dashed var(--border-strong); font-size: var(--fs-sm); color: var(--text-2);
}
.bars__total strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ── Checks ───────────────────────────────────────────────────────────────── */

.checks { display: flex; flex-direction: column; gap: var(--s-3); }
.checks__summary {
  --tone: var(--success); --tone-soft: var(--success-soft); --tone-border: var(--success-border);
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border-radius: var(--r); border: 1px solid var(--tone-border); background: var(--tone-soft);
}
.checks__summary--warning { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-border: var(--warning-border); }
.checks__summary--danger  { --tone: var(--danger);  --tone-soft: var(--danger-soft);  --tone-border: var(--danger-border); }
.checks__summary--neutral { --tone: var(--neutral); --tone-soft: var(--neutral-soft); --tone-border: var(--neutral-border); }
.checks__summary-icon { display: inline-grid; place-items: center; color: var(--tone); }
.checks__summary-icon .icon { width: 22px; height: 22px; }
.checks__summary-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.checks__summary-main strong { font-size: var(--fs-md); color: var(--text); }
.checks__summary-sub { font-size: var(--fs-sm); color: var(--text-2); }
.checks__list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.checks__toggle { align-self: center; }
.check + .check { border-top: 1px solid var(--border); }
.check__head {
  display: flex; align-items: center; gap: var(--s-3); width: 100%;
  min-height: 56px; padding: var(--s-3) var(--s-4);
  background: transparent; border: 0; color: inherit; font: inherit; text-align: left;
}
button.check__head { cursor: pointer; }
button.check__head:hover { background: var(--surface-hover); }
button.check__head:focus-visible { outline: none; box-shadow: inset var(--ring); }
.check__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.check__label { font-weight: var(--fw-medium); color: var(--text); }
.check__desc {
  font-size: var(--fs-sm); color: var(--text-3); line-height: var(--lh);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.check.is-open .check__desc { display: block; -webkit-line-clamp: unset; }
.check__desc code { font-size: 0.92em; padding: 0 4px; border-radius: var(--r-xs); background: var(--surface-3); }
.span-3 .check__head, .span-4 .check__head { padding: var(--s-3); gap: var(--s-2); }
.check--pass .check__label { color: var(--text-2); }
.check__count {
  flex: none; min-width: 40px; text-align: center; padding: 2px 10px; border-radius: var(--r-full);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums;
  color: var(--text-3); background: var(--surface-3);
}
.check__count--danger { color: var(--danger); background: var(--danger-soft); }
.check__count--warning { color: var(--warning); background: var(--warning-soft); }
.check__count--pass { color: var(--success); background: var(--success-soft); }
.check__chev { width: 16px; height: 16px; color: var(--text-3); transition: transform var(--dur) var(--ease); flex: none; }
.check__chev-space { width: 16px; flex: none; }
.check.is-open .check__chev { transform: rotate(180deg); }
.check.is-open .check__head { background: var(--surface-2); }
.check__rows { border-top: 1px solid var(--border); background: var(--bg-elevated); }
.check__error {
  margin: 0; padding: var(--s-3) var(--s-4); white-space: pre-wrap; overflow-wrap: anywhere;
  font: var(--fs-sm) / var(--lh) var(--font-mono); color: var(--danger);
}

/* ── Note ─────────────────────────────────────────────────────────────────── */

.note {
  --tone: var(--info); --tone-border: var(--info-border);
  display: flex; gap: var(--s-3); padding: var(--s-4);
  border-radius: var(--r-lg); border: 1px solid var(--border); border-left: 3px solid var(--tone);
  background: var(--surface);
}
.note--success { --tone: var(--success); }
.note--warning { --tone: var(--warning); }
.note--danger { --tone: var(--danger); }
.note--accent { --tone: var(--accent); }
.note--neutral { --tone: var(--neutral); }
.note--muted { --tone: var(--muted); }
.note__main { min-width: 0; display: flex; flex-direction: column; gap: var(--s-1); }
.note__title { margin: 0; font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.note__body { font-size: var(--fs-sm); color: var(--text-2); line-height: var(--lh); }
.note__body p { margin: 0; }
.note__body p + p { margin-top: var(--s-2); }
.note__body code { font-size: 0.92em; padding: 1px 5px; border-radius: var(--r-xs); background: var(--surface-3); }
.note__body strong { color: var(--text); }

/* ── Timeline list ───────────────────────────────────────────────────────── */

.tl { display: flex; flex-direction: column; }
.tl-day + .tl-day { border-top: 1px solid var(--border); }
.tl-day__label {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: var(--s-2); margin: 0;
  padding: var(--s-2) var(--s-4); font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3);
  background: color-mix(in srgb, var(--surface-2) 92%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.tl-day__label::first-letter { text-transform: uppercase; }
.tl-day__label .icon { width: 14px; height: 14px; }
.tl-day--pending .tl-day__label { color: var(--warning); background: var(--warning-soft); }
.tl-day__hint { margin-left: auto; font-weight: var(--fw-regular); text-transform: none; letter-spacing: 0; color: var(--text-3); }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-item {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-3);
  align-items: start; padding: var(--s-3) var(--s-4);
  transition: background var(--dur-fast) var(--ease);
}
.tl-item + .tl-item { border-top: 1px solid var(--border); }
.tl-item.is-clickable { cursor: pointer; }
.tl-item.is-clickable:hover { background: var(--surface-hover); }
.tl-item:focus-visible { outline: none; box-shadow: inset var(--ring); }
.tl-item.is-pending { background: linear-gradient(90deg, var(--warning-soft), transparent 60%); }
.tl-item.is-new { animation: v-flash 2.4s var(--ease); }
@keyframes v-flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
.tl-item__icon { margin-top: 1px; }
.tl-item__main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tl-item__sentence { font-size: var(--fs-base); line-height: var(--lh); color: var(--text-2); overflow-wrap: anywhere; }
.tl-sentence__what { color: var(--text); font-weight: var(--fw-semibold); }
.tl-sentence__target { color: var(--text); font-weight: var(--fw-medium); }
.tl-sentence a.link:hover .tl-sentence__target, .tl-actor a.link:hover strong { color: var(--accent); }
.tl-actor { display: inline-flex; align-items: center; gap: 4px; }
.tl-actor strong { color: var(--text); font-weight: var(--fw-medium); }
.tl-actor--system { color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-sm); }
.tl-actor--system .icon { width: 13px; height: 13px; color: var(--text-3); }
.tl-item__summary:empty { display: none; }
.tl-item__summary { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2); }
.tl-sum { font-size: var(--fs-sm); color: var(--text-2); }
.tl-sum--mono { font-family: var(--font-mono); font-size: var(--fs-xs); padding: 1px 6px; border-radius: var(--r-xs); background: var(--surface-3); }
.tl-sum--kv {
  display: inline-flex; gap: 5px; max-width: 100%;
  font-family: var(--font-mono); font-size: var(--fs-xs); padding: 1px 6px; border-radius: var(--r-xs);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-sum__k { color: var(--text-3); }
.tl-item__targets { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.tl-item__targets > a { text-decoration: none; }
.tl-target {
  display: inline-flex; align-items: center; max-width: 280px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-full); font-size: var(--fs-xs);
  background: var(--surface-2);
}
.tl-target__type { padding: 2px 8px; color: var(--text-3); border-right: 1px solid var(--border); white-space: nowrap; }
.tl-target__label { padding: 2px 8px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a > .tl-target:hover { border-color: var(--accent-border); }
a > .tl-target:hover .tl-target__label { color: var(--accent); }
.tl-item__side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-1); }
.tl-item__time { font-size: var(--fs-sm); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl--compact .tl-item { padding: var(--s-2) var(--s-4); gap: var(--s-2) var(--s-3); }
.tl--compact .tl-item__icon { width: 26px; height: 26px; }
.tl--compact .tl-item__sentence { font-size: var(--fs-sm); }
.widget--timeline > .widget__body { padding: 0; max-height: 560px; overflow: auto; }

@media (max-width: 767px) {
  .tl-item { grid-template-columns: auto 1fr; padding: var(--s-3); }
  .tl-item__side { grid-column: 2; grid-row: 2; flex-direction: row; align-items: center; order: 3; }
  .tl-day__label { padding: var(--s-2) var(--s-3); }
  .tl-day__hint { display: none; }
}

/* ── Event detail drawer ─────────────────────────────────────────────────── */

.ev-detail { display: flex; flex-direction: column; gap: var(--s-5); }
.ev-hero { display: flex; gap: var(--s-3); align-items: flex-start; }
.ev-hero__main { min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.ev-hero__sentence { font-size: var(--fs-md); line-height: var(--lh); color: var(--text-2); }
.ev-hero__desc { margin: 0; font-size: var(--fs-sm); color: var(--text-3); line-height: var(--lh); }
.ev-hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.ev-type {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-xs);
  font: var(--fs-xs) / 1.5 var(--font-mono); color: var(--text-2); background: var(--surface-3); text-decoration: none;
}
.ev-type .icon { width: 11px; height: 11px; color: var(--text-3); }
.ev-type:hover { color: var(--accent); }
.ca-count__value .bool .icon { width: 20px; height: 20px; }
.ev-section { display: flex; flex-direction: column; gap: var(--s-3); }
.ev-section__title {
  display: flex; align-items: center; gap: var(--s-2); margin: 0;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3);
}
.ev-section__title .icon { width: 14px; height: 14px; }
.ev-section .facts { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.ev-links { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ev-filter-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px;
  border-radius: var(--r-full); border: 1px solid var(--border-strong); color: var(--text-2);
  font-size: var(--fs-sm); text-decoration: none;
}
.ev-filter-link:hover { border-color: var(--accent-border); color: var(--accent); background: var(--accent-softer); }
.ev-filter-link .icon { width: 13px; height: 13px; }
.ev-ctx { display: inline-flex; align-items: center; gap: var(--s-2); min-width: 0; }
.ev-ctx__filter { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); color: var(--text-3); }
.ev-ctx__filter:hover { color: var(--accent); background: var(--accent-softer); }
.ev-ctx__filter .icon { width: 13px; height: 13px; }
.ev-targets { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r); }
.ev-target {
  display: grid; grid-template-columns: minmax(110px, auto) 1fr auto auto; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3); font-size: var(--fs-sm);
}
.ev-target + .ev-target { border-top: 1px solid var(--border); }
.ev-target__type { display: inline-flex; align-items: center; gap: var(--s-1); color: var(--text-3); }
.ev-target__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ev-ua { font-size: var(--fs-xs); color: var(--text-2); overflow-wrap: anywhere; }
.diff-table td { vertical-align: top; overflow-wrap: anywhere; }
.diff-table__from { color: var(--danger); background: color-mix(in srgb, var(--danger-soft) 60%, transparent); }
.diff-table__to { color: var(--success); background: color-mix(in srgb, var(--success-soft) 60%, transparent); }
.json-block {
  margin: 0; padding: var(--s-3) var(--s-4); max-height: 420px; overflow: auto;
  border-radius: var(--r); border: 1px solid var(--border); background: var(--bg-elevated);
  font: var(--fs-xs) / 1.6 var(--font-mono); color: var(--text-2); white-space: pre;
}
.json-key { color: var(--info); }
.json-str { color: var(--success); }
.json-num { color: var(--warning); }
.json-bool, .json-null { color: var(--accent); }

@media (max-width: 767px) {
  .ev-target { grid-template-columns: 1fr auto auto; }
  .ev-target__type { grid-column: 1 / -1; }
}

/* ── Action levels ───────────────────────────────────────────────────────── */

.level-pill {
  --tone: var(--success); --tone-soft: var(--success-soft); --tone-border: var(--success-border);
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 2px 9px 2px 7px; border-radius: var(--r-full); border: 1px solid var(--tone-border);
  background: var(--tone-soft); color: var(--tone);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: 0.02em; white-space: nowrap;
}
.level-pill .icon { width: 13px; height: 13px; }
.level-pill--caution { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-border: var(--warning-border); }
.level-pill--danger  { --tone: var(--danger);  --tone-soft: var(--danger-soft);  --tone-border: var(--danger-border); }
.level-pill--critical { color: #fff; background: var(--danger); border-color: var(--danger); }

.action-btn .icon { color: var(--text-2); }
.action-btn--safe .icon { color: var(--success); }
.action-btn--caution .icon { color: var(--warning); }
.action-btn--danger .icon, .action-btn--critical .icon { color: var(--danger); }
.action-btn.is-disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Action flow (confirm-action) ────────────────────────────────────────── */

.ca { display: flex; flex-direction: column; gap: var(--s-4); }

/* Intro: level on one line, description as plain text — no tinted box. */
.ca-hero { display: flex; flex-direction: column; gap: var(--s-2); }
.ca-hero__level { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.ca-hero__explain { font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-hero__desc { margin: 0; color: var(--text-2); font-size: var(--fs-base); line-height: var(--lh); }

/* Context: the record and the database in one bordered block, one row each. */
.ca-ctx { display: flex; flex-direction: column; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface-2); overflow: hidden; }
.ca-ctx__row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); min-width: 0; }
.ca-ctx__row + .ca-ctx__row { border-top: 1px solid var(--border); }
.ca-ctx__icon {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px;
  border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent);
}
.ca-ctx__icon .icon { width: 16px; height: 16px; }
.ca-ctx__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ca-ctx__title { font-size: var(--fs-md); color: var(--text); overflow-wrap: anywhere; }
.ca-ctx__sub { font-size: var(--fs-sm); color: var(--text-3); overflow-wrap: anywhere; }
.ca-ctx__side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); }
.ca-ctx__line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.ca-ctx__line strong { color: var(--text); }
.ca-ctx__where { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); overflow-wrap: anywhere; }
.ca-ctx__db.is-danger { background: var(--danger-soft); }
.ca-ctx__db.is-danger .ca-ctx__icon { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-border); }

.ca-db { display: flex; }
.ca-db--critical {
  flex-wrap: nowrap; align-items: flex-start; gap: var(--s-3); padding: var(--s-4);
  border: 2px solid var(--danger); border-radius: var(--r); color: var(--text);
  background: repeating-linear-gradient(-45deg, var(--danger-soft) 0 12px, transparent 12px 24px), var(--surface);
}
.ca-db__icon {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px;
  border-radius: var(--r); background: var(--danger); color: #fff;
}
.ca-db__icon .icon { width: 22px; height: 22px; }
.ca-db__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ca-db__kicker { font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.08em; color: var(--danger); }
.ca-db__name { font-size: var(--fs-xl); line-height: var(--lh-tight); color: var(--text); overflow-wrap: anywhere; }
.ca-db--critical .ca-db__where { font-size: var(--fs-sm); color: var(--text); }
.ca-db__hint { font-size: var(--fs-sm); color: var(--text-2); }

/* Caveats: one box, one bullet per note. */
.ca-notes {
  display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3) var(--s-4);
  border: 1px solid var(--warning-border); border-radius: var(--r); background: var(--warning-soft);
}
.ca-notes__head {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.06em; color: var(--warning);
}
.ca-notes__head .icon { width: 14px; height: 14px; }
.ca-notes__list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); line-height: 1.45; color: var(--text-2); }
.ca-notes__list li::marker { color: var(--warning); }
.ca-blocked:empty, .ca-error:empty { display: none; }
.ca-error__msg { font-family: var(--font-mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
/* The modal body clips overflow: ref pickers list their matches in-flow instead of as a dropdown. */
.ca .picker .listbox { position: static; margin-top: var(--s-2); max-height: 280px; box-shadow: none; }
.ca-places { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r); }
.ca-places li + li { border-top: 1px solid var(--border); }
.ca-place {
  display: flex; align-items: center; gap: var(--s-2); min-height: 44px; padding: var(--s-2) var(--s-3);
  color: var(--text); text-decoration: none; font-size: var(--fs-sm);
}
.ca-place .icon { width: 14px; height: 14px; color: var(--accent); }
.ca-place:hover { background: var(--surface-hover); color: var(--accent); }

.ca-section { display: flex; flex-direction: column; gap: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.ca-section__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.ca-section__title {
  display: flex; align-items: center; gap: var(--s-2); margin: 0;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text);
}
.ca-section__title .icon { width: 15px; height: 15px; color: var(--text-3); }
.ca-section__hint, .ca-preview__hint { margin: 0; font-size: var(--fs-sm); color: var(--text-3); }
.ca-preview__result { display: flex; flex-direction: column; gap: var(--s-3); }
.ca-preview__result.is-stale > :last-child { opacity: 0.45; filter: grayscale(0.6); }
.ca-preview__count { margin: 0 0 var(--s-2); font-size: var(--fs-sm); color: var(--text-2); }
.ca-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-2); }
.ca-count {
  display: flex; flex-direction: column; gap: 2px; padding: var(--s-3);
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2);
}
.ca-count__value { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; color: var(--text-3); line-height: 1.15; }
.ca-count__label { font-size: var(--fs-xs); color: var(--text-3); }
.ca-count.is-hit { border-color: var(--warning-border); background: var(--warning-soft); }
.ca-count.is-hit .ca-count__value { color: var(--text); }
.ca-count.is-hit .ca-count__label { color: var(--text-2); }
.ca-modal--danger .ca-count.is-hit, .ca-modal--critical .ca-count.is-hit { border-color: var(--danger-border); background: var(--danger-soft); }

.ca-confirm--critical { gap: var(--s-4); }
.ca-typed__expect { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.ca-expected {
  display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: var(--r-xs);
  font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--danger);
  background: var(--danger-soft); border: 1px dashed var(--danger-border); user-select: all; overflow-wrap: anywhere;
}
.ca-typed__input { position: relative; }
.ca-typed__input .input { padding-right: 40px; }
.ca-typed__mark {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%) scale(0.6);
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--success); color: #fff; opacity: 0; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.ca-typed__mark .icon { width: 13px; height: 13px; }
.ca-typed.is-match .ca-typed__mark { opacity: 1; transform: translateY(-50%) scale(1); }
.ca-typed.is-match .input { border-color: var(--success-border); }

.ca-result__hero { display: flex; align-items: flex-start; gap: var(--s-3); }
.ca-result__icon {
  display: inline-grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border);
}
.ca-result__icon .icon { width: 24px; height: 24px; }
.ca-result__title { font-size: var(--fs-lg); color: var(--text); }
.ca-result__target { margin: 2px 0 0; color: var(--text-2); overflow-wrap: anywhere; }
.ca-result__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: var(--s-1) 0 0; font-size: var(--fs-sm); color: var(--text-3); }
.ca-result__meta .icon { width: 13px; height: 13px; }
.ca-steps, .ca-audit { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r); }
.ca-step, .ca-audit__item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); }
.ca-step + .ca-step, .ca-audit__item + .ca-audit__item { border-top: 1px solid var(--border); }
.ca-step__n {
  display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); background: var(--surface-3); color: var(--text-2);
}
.ca-step__label { flex: 1; min-width: 0; color: var(--text); }
.ca-step__rows { font-variant-numeric: tabular-nums; color: var(--text-3); white-space: nowrap; }
.ca-step__rows.is-hit { color: var(--text); font-weight: var(--fw-semibold); }
.ca-audit__item .tone-icon { width: 26px; height: 26px; }
.ca-audit__label { flex: 1; min-width: 0; color: var(--text); }
.ca-audit__item code { font-size: var(--fs-xs); }
.ca-audit__hint { margin: 0; font-size: var(--fs-xs); color: var(--text-3); }

@media (max-width: 767px) {
  .ca-ctx__row { flex-wrap: wrap; }
  .ca-ctx__side { width: 100%; justify-content: flex-start; padding-left: 44px; }
  .ca-audit__item code { display: none; }
  .ca-db__name { font-size: var(--fs-lg); }
}

/* ── Pages: shared toolbars ──────────────────────────────────────────────── */

.page-params { margin-bottom: var(--s-4); }

/* Filter bar: one row of "Label: value ▾" pills (ui/param-bar.js). */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); min-width: 0; }
.filter-pill {
  display: inline-flex; align-items: stretch; max-width: 100%; min-width: 0; height: 34px;
  border: 1px solid var(--border-strong); border-radius: var(--r-full); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.filter-pill:hover { border-color: var(--text-3); }
.filter-pill.is-active { border-color: var(--accent-border); background: var(--accent-softer); }
.filter-pill__main {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 0 10px 0 12px;
  border-radius: inherit; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap;
}
.filter-pill__main:focus-visible { box-shadow: var(--ring); }
.filter-pill__label { color: var(--text-3); }
.filter-pill__label::after { content: ':'; }
.filter-pill__value { font-weight: var(--fw-medium); color: var(--text); overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.filter-pill.is-active .filter-pill__value { color: var(--accent-fg, var(--accent)); }
.filter-pill__chev { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.filter-pill__clear {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; margin-left: -4px;
  border-radius: 0 var(--r-full) var(--r-full) 0; color: var(--text-3);
}
.filter-pill__clear:hover { color: var(--text); background: var(--surface-hover); }
.filter-pill__clear .icon { width: 13px; height: 13px; }
.filter-bar__reset { height: 34px; color: var(--text-3); }

/* Panel opened by a pill (entity search / typed value). */
.popover--panel { width: 320px; padding: var(--s-2); }
.filter-panel { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.filter-panel .field { margin: 0; }
.filter-panel__list { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.filter-panel__option {
  display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 36px; padding: 6px 10px;
  border-radius: var(--r-sm); text-align: left; color: var(--text); font-size: var(--fs-sm);
}
.filter-panel__option:hover, .filter-panel__option:focus-visible { background: var(--surface-hover); }
.filter-panel__option.is-selected { color: var(--accent-fg, var(--accent)); }
.filter-panel__option .icon { width: 15px; height: 15px; margin-left: auto; flex: none; }
.filter-panel__text { display: flex; flex-direction: column; min-width: 0; }
.filter-panel__text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-panel__text small { font-size: var(--fs-xs); color: var(--text-3); }
.filter-panel__empty { padding: var(--s-3); text-align: center; font-size: var(--fs-sm); color: var(--text-3); }
.filter-panel__actions { display: flex; justify-content: flex-end; gap: var(--s-2); }

.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-4); }
.list-toolbar__search { flex: 1 1 280px; max-width: 420px; min-width: 0; }
.list-toolbar > .filter-bar { flex: 1 1 auto; }
.list-count { font-variant-numeric: tabular-nums; }
.list-table { overflow: hidden; }
.list-footer { display: flex; justify-content: center; padding: var(--s-4) 0 var(--s-2); }
.list-footer__end { font-size: var(--fs-sm); color: var(--text-3); }
.list-sentinel { height: 1px; }

@media (max-width: 767px) {
  .list-toolbar__search { flex-basis: 100%; max-width: none; }
  /* Phones: pills scroll sideways in one line instead of stacking. */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--s-4)); padding: 2px var(--s-4); scrollbar-width: none; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-pill { flex: none; height: 38px; }
  .filter-pill__value { max-width: 160px; }
}


/* ── Entity detail ───────────────────────────────────────────────────────── */

.detail-kind { font-size: var(--fs-sm); color: var(--text-3); }
.detail-facts { padding: var(--s-4); margin-bottom: var(--s-4); }
.widget--kpis.widget--compact { margin-bottom: var(--s-4); }
.detail-tabs { margin-bottom: var(--s-4); }
.detail-panel { min-width: 0; }

/* ── Actions catalog ─────────────────────────────────────────────────────── */

.level-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.level-card {
  --tone: var(--success); --tone-border: var(--success-border); --tone-soft: var(--success-soft);
  display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3) var(--s-4); text-align: left;
  border-radius: var(--r); border: 1px solid var(--border); border-top: 3px solid var(--tone);
  background: var(--surface); color: inherit; font: inherit; cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.level-card--caution { --tone: var(--warning); --tone-border: var(--warning-border); --tone-soft: var(--warning-soft); }
.level-card--danger, .level-card--critical { --tone: var(--danger); --tone-border: var(--danger-border); --tone-soft: var(--danger-soft); }
.level-card:hover { background: var(--surface-hover); }
.level-card.is-active { border-color: var(--tone-border); border-top-color: var(--tone); background: var(--tone-soft); box-shadow: 0 0 0 1px var(--tone-border); }
.level-card:focus-visible { outline: none; box-shadow: var(--ring); }
.level-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.level-card__count { font-size: var(--fs-xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; color: var(--text); }
.level-card__text { margin: 0; font-size: var(--fs-sm); color: var(--text-2); line-height: var(--lh); }

.catalog-toolbar { margin-bottom: var(--s-5); }
.catalog-toolbar__search { max-width: 560px; }
.catalog { display: flex; flex-direction: column; gap: var(--s-8); }
.catalog-group { display: flex; flex-direction: column; gap: var(--s-3); }
.catalog-group__head { display: flex; align-items: center; gap: var(--s-3); }
.catalog-group__icon {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px;
  border-radius: var(--r); background: var(--accent-soft); color: var(--accent);
}
.catalog-group__icon .icon { width: 18px; height: 18px; }
.catalog-group__titles { flex: 1; min-width: 0; }
.catalog-group__title { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.catalog-group__count {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); padding: 1px 8px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-2);
}
.catalog-group__desc { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-3); }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-3); }
.action-card {
  display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); min-height: 100%;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.action-card--danger, .action-card--critical { border-left: 3px solid var(--danger-border); }
.action-card--caution { border-left: 3px solid var(--warning-border); }
.action-card__head { display: flex; align-items: center; gap: var(--s-3); }
.action-card__title { flex: 1; min-width: 0; font-weight: var(--fw-semibold); color: var(--text); line-height: var(--lh-tight); }
.action-card__desc {
  margin: 0; font-size: var(--fs-sm); color: var(--text-2); line-height: var(--lh);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.action-card__meta { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: auto; }
.action-card__meta .tag { display: inline-flex; align-items: center; gap: 4px; }
.action-card__meta .icon { width: 12px; height: 12px; }
.action-card.is-locked { opacity: 0.6; cursor: not-allowed; }
.action-card__role.is-locked { color: var(--warning); }

@media (max-width: 1199px) {
  .level-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .level-legend { gap: var(--s-2); }
  .level-card { padding: var(--s-3); }
  .level-card__text { display: none; }
  .catalog-grid { grid-template-columns: 1fr; }
  .catalog-group__desc { display: none; }
}

/* ── Timeline page ───────────────────────────────────────────────────────── */

.live-toggle.is-live { border-color: var(--success-border); background: var(--success-soft); color: var(--success); }
.tl-filters { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-3); margin-bottom: var(--s-3); }
.tl-filters__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.tl-filters__search { flex: 1 1 280px; min-width: 0; }
.tl-filters__range { flex: none; }
.tl-filters__more[aria-expanded="true"] { color: var(--accent); }
.tl-filters__custom { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: var(--s-3); }
.tl-filters__custom[hidden], .tl-filters__advanced[hidden] { display: none; }
.tl-filters__advanced {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s-3);
  padding-top: var(--s-3); border-top: 1px solid var(--border);
}
.tl-filters__advanced .field { margin: 0; }
.tl-filters__target-id:empty { display: none; }
.tl-types-btn { width: 100%; justify-content: flex-start; }
.tl-types-btn > span:first-of-type { flex: 1; text-align: left; }
.tl-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.tl-chips:empty { display: none; }
.tl-chip { gap: 6px; padding-right: 4px; max-width: 100%; }
.tl-chip__k { color: var(--text-3); font-weight: var(--fw-regular); }
.tl-chip__x {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: transparent; color: inherit; cursor: pointer;
}
.tl-chip__x:hover { background: var(--surface-3); }
.tl-chip__x .icon { width: 12px; height: 12px; }
.tl-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3);
  min-height: 28px; margin: 0 0 var(--s-2); font-size: var(--fs-sm); color: var(--text-3);
}
.tl-status__count { font-variant-numeric: tabular-nums; }
.tl-status__live { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--success); }
.tl-results { padding: 0; overflow: hidden; }
.tl-results .tl-day__label { top: 0; }

.type-picker { display: flex; flex-direction: column; gap: var(--s-4); }
.type-picker__groups { display: flex; flex-direction: column; gap: var(--s-5); }
.type-picker__group { display: flex; flex-direction: column; gap: var(--s-2); }
.type-picker__head { display: flex; align-items: center; gap: var(--s-2); color: var(--text); }
.type-picker__head .icon { width: 15px; height: 15px; color: var(--text-3); }
.type-picker__head .btn { margin-left: auto; }
.type-chip { gap: 6px; }
.type-chip .tone-icon { width: 20px; height: 20px; border: 0; background: transparent; }
.type-chip .tone-icon .icon { width: 13px; height: 13px; }
.type-chip.is-empty:not(.is-active) { opacity: 0.55; }

@media (max-width: 767px) {
  .tl-filters__range { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tl-filters__range::-webkit-scrollbar { display: none; }
  .tl-filters__more { margin-left: auto; }
  .tl-filters__custom { grid-template-columns: 1fr; }
  .tl-filters__advanced { grid-template-columns: 1fr; }
}

/* Keycloak mode: explicit acknowledgement for danger actions (ui/confirm-action.js). */
.ca-ack {
  display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3);
  border: 1px solid var(--danger-border); border-radius: var(--r); background: var(--danger-soft);
  font-size: var(--fs-sm); color: var(--text); cursor: pointer;
}
.ca-ack .switch { flex: none; margin-top: 1px; }

/* "i" explanation button on cards and KPI tiles (ui/info.js). */
.info-btn {
  display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; margin: -3px 0;
  border-radius: 50%; color: var(--text-3); cursor: pointer; vertical-align: middle;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.info-btn .icon { width: 15px; height: 15px; }
.info-btn:hover, .info-btn:focus-visible { color: var(--accent); background: var(--accent-soft); outline: none; }
.widget__title .info-btn { margin-left: 2px; }
.kpi__top .info-btn { position: relative; z-index: 1; }
.info-body { display: flex; flex-direction: column; gap: var(--s-3); color: var(--text-2); line-height: var(--lh); }
.info-body p { margin: 0; }
@media (max-width: 767px) { .info-btn { width: 30px; height: 30px; margin: -6px -4px; } }
