/* Sindat Finanční report: reusable components and chart styles */

/* ---------------------------------------------------------------- card */
.card {
  position: relative; min-width: 0; background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow-card); border: 1px solid var(--line); padding: 22px 24px 22px;
}
.card.flush { padding: 0; }
.card.quiet { background: transparent; box-shadow: none; border-color: var(--line); }
.card.clickable { cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.card.clickable:hover { border-color: var(--line-strong); box-shadow: var(--shadow-card), 0 8px 24px -16px rgba(16, 24, 40, 0.25); }
.card.clickable:active { transform: translateY(1px); }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-head .ch-text { min-width: 0; flex: 1; }
.card-head h2 { font-size: 15.5px; }
.card-head .sub { margin-top: 3px; font-size: 13px; color: var(--text-3); }
.card-head .ch-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.card .divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 13.5px; font-weight: 560; line-height: 1;
  white-space: nowrap; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn .ic { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--navy-700); color: #fff; box-shadow: 0 1px 2px rgba(4, 48, 109, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.btn-primary:hover { background: var(--navy-800); }
.btn-primary:active { background: var(--navy-900); }
.btn-secondary { background: var(--paper); color: var(--text); border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04); }
.btn-secondary:hover { background: var(--paper-2); border-color: var(--ink-400); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: var(--radius-md); }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--line-strong); border-top-color: var(--navy-700); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0;
  background: transparent; color: var(--text-2); transition: background var(--t-fast), color var(--t-fast); flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn.bordered { border: 1px solid var(--line-strong); background: var(--paper); }
.link-btn { border: 0; background: none; padding: 0; color: var(--link); font-weight: 560; font-size: inherit; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.link-btn .ic { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- segmented control */
.seg {
  display: inline-flex; align-items: stretch; padding: 3px; gap: 2px; height: 36px; flex: none;
  background: var(--paper-sunk); border-radius: 9px; border: 1px solid var(--line);
}
.seg button {
  border: 0; background: transparent; color: var(--text-2); padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 520;
  white-space: nowrap; transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] {
  background: var(--paper); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.10), 0 0 0 1px var(--line);
}
.seg.sm { height: 30px; }
.seg.sm button { padding: 0 9px; font-size: 12.5px; }

/* ---------------------------------------------------------------- month stepper */
.mstep {
  position: relative; display: inline-flex; align-items: center; height: 36px; flex: none;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 9px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.mstep .ms-arrow { width: 32px; height: 34px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-2); border-radius: 8px; }
.mstep .ms-arrow:hover { color: var(--text); background: var(--hover); }
.mstep .ms-arrow[disabled] { opacity: 0.3; pointer-events: none; }
.mstep .ms-arrow .ic { width: 16px; height: 16px; }
.mstep .ms-label {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px; border: 0; background: transparent;
  font-weight: 600; font-size: 13.5px; min-width: 116px; justify-content: center; border-radius: 6px;
}
.mstep .ms-label .ic { width: 14px; height: 14px; color: var(--text-3); }
.mstep .ms-label:hover { background: var(--hover); }

.popover {
  position: absolute; z-index: 60; min-width: 220px; padding: 8px; background: var(--paper); border-radius: 12px;
  box-shadow: var(--shadow-pop); border: 1px solid var(--line); animation: pop-in var(--t-med) var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 252px; }
.month-grid .mg-year { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; font-weight: 600; font-size: 13px; }
.month-grid button {
  height: 36px; border: 0; border-radius: 7px; background: transparent; font-size: 13px; color: var(--text); font-weight: 500;
}
.month-grid button:hover:not([disabled]) { background: var(--hover); }
.month-grid button[aria-current="true"] { background: var(--navy-700); color: #fff; font-weight: 600; }
.month-grid button[disabled] { color: var(--text-4); cursor: default; }
.month-grid .mg-note { grid-column: 1 / -1; padding: 8px 6px 2px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--line); margin-top: 4px; }

.menu { display: flex; flex-direction: column; min-width: 220px; }
.menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .menu-head b { display: block; font-size: 13.5px; }
.menu .menu-head span { font-size: 12.5px; color: var(--text-3); }
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; background: none; border-radius: 7px;
  font-size: 13.5px; color: var(--text); text-align: left;
}
.menu button:hover, .menu a:hover { background: var(--hover); text-decoration: none; }
.menu .ic { width: 16px; height: 16px; color: var(--text-3); }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  position: relative; border: 0; background: none; padding: 10px 12px 12px; font-size: 13.5px; font-weight: 520; color: var(--text-3); white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 620; }
.tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--navy-700);
}
:root[data-theme="dark"] .tabs button[aria-selected="true"]::after { background: var(--c-actual); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs button[aria-selected="true"]::after { background: var(--c-actual); } }
.tabs .tab-count { margin-left: 6px; font-size: 11.5px; color: var(--text-3); font-weight: 500; }

/* ---------------------------------------------------------------- badge, chip */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; background: var(--ink-100); color: var(--text-2);
}
.badge .ic { width: 12px; height: 12px; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.amber { background: var(--amber-100); color: var(--warn); }
.badge.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text-2); }
.badge.mono { font-variant-numeric: tabular-nums; font-weight: 560; }

.delta {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 7px; border-radius: 999px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; line-height: 1.25;
}
.delta .arr { font-size: 9px; line-height: 1; transform: translateY(-0.5px); font-family: "Segoe UI Symbol", "Apple Symbols", var(--font-sans); }
.delta.good { background: var(--good-bg); color: var(--good); }
.delta.bad { background: var(--bad-bg); color: var(--bad); }
.delta.flat { background: var(--ink-100); color: var(--text-3); }
.delta .pct { font-weight: 500; opacity: 0.85; }
.delta.lg { font-size: 14px; padding: 5px 11px 5px 10px; }
.delta.plain { background: none; padding: 0; }
.delta-text.good { color: var(--good); }
.delta-text.bad { color: var(--bad); }

/* ---------------------------------------------------------------- KPI tile */
.kpi { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 18px; }
.kpi .kpi-label { font-size: 13px; font-weight: 560; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.kpi .kpi-value {
  font-size: var(--fs-kpi); line-height: 1.08; font-weight: 640; letter-spacing: -0.022em; color: var(--text);
  font-variant-numeric: proportional-nums lining-nums; white-space: nowrap;
}
.kpi .kpi-value .unit { font-size: 0.56em; font-weight: 560; color: var(--text-3); letter-spacing: 0; margin-left: 4px; }
.kpi .kpi-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 24px; }
.kpi .kpi-vs { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.kpi .kpi-spark { margin-top: 4px; height: 48px; }
.kpi .kpi-foot { font-size: 12.5px; color: var(--text-3); padding-top: 10px; border-top: 1px solid var(--line); margin-top: auto; }
.kpi .kpi-foot b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field .f-label { font-size: 13px; font-weight: 560; color: var(--text-2); }
.field .f-hint { font-size: 12.5px; color: var(--text-3); }
.field .f-error { font-size: 12.5px; color: var(--bad); display: flex; align-items: center; gap: 6px; }
.field .f-error .ic { width: 14px; height: 14px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--text); font-size: 14.5px; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(42, 111, 214, 0.18); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(194, 55, 44, 0.16); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 42px; }
.input-wrap .icon-btn { position: absolute; right: 2px; top: 2px; }
.input-search { position: relative; }
.input-search .ic { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-search .input { padding-left: 34px; height: 36px; font-size: 13.5px; }

.check { display: inline-flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { appearance: none; -webkit-appearance: none; margin: 0; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--ink-400); background: var(--paper); display: grid; place-items: center; flex: none; }
.check input:checked { background: var(--navy-700); border-color: var(--navy-700); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input:focus-visible { box-shadow: var(--focus); }

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; margin: 0; width: 34px; height: 20px; border-radius: 999px; background: var(--ink-300); position: relative; flex: none; transition: background var(--t-fast); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform var(--t-med) var(--ease); }
.switch input:checked { background: var(--navy-700); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:focus-visible { box-shadow: var(--focus); }

/* ---------------------------------------------------------------- dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center;
  padding: 36px 24px; border-radius: var(--radius); border: 1.5px dashed var(--line-strong); background: var(--paper-2);
  color: var(--text-2); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--navy-500); background: var(--navy-50); }
.dropzone .dz-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--navy-100); color: var(--navy-700); }
:root[data-theme="dark"] .dropzone .dz-icon { color: var(--c-actual); }
.dropzone .dz-icon .ic { width: 22px; height: 22px; }
.dropzone b { font-size: 14.5px; color: var(--text); font-weight: 600; }
.dropzone span { font-size: 12.5px; color: var(--text-3); }
.dropzone input { display: none; }
.dropzone .dz-file { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); font-size: 13px; color: var(--text); }

/* ---------------------------------------------------------------- workflow stepper */
.wstep { display: flex; align-items: flex-start; gap: 0; list-style: none; margin: 0; padding: 0; counter-reset: ws; }
.wstep li { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; position: relative; padding-right: 12px; min-width: 0; }
.wstep li::before {
  counter-increment: ws; content: counter(ws); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 650; background: var(--paper); color: var(--text-3); box-shadow: inset 0 0 0 1.5px var(--line-strong); position: relative; z-index: 1;
}
.wstep li::after { content: ""; position: absolute; top: 14px; left: 34px; right: 6px; height: 1.5px; background: var(--line-strong); }
.wstep li:last-child::after { display: none; }
.wstep li.done::before { content: "\2713"; background: var(--good); color: #fff; box-shadow: none; }
.wstep li.done::after { background: var(--good); }
.wstep li.current::before { background: var(--navy-700); color: #fff; box-shadow: 0 0 0 4px var(--navy-100); }
.wstep .ws-label { font-size: 13px; font-weight: 600; color: var(--text); }
.wstep .ws-sub { font-size: 12px; color: var(--text-3); margin-top: -4px; }
.wstep li.todo .ws-label { color: var(--text-3); font-weight: 520; }

/* ---------------------------------------------------------------- data table */
.table-wrap { position: relative; overflow: auto; border-radius: var(--radius-md); -webkit-overflow-scrolling: touch; }
.table-wrap.bordered { border: 1px solid var(--line); }
.dtable { width: 100%; font-size: var(--fs-table); font-variant-numeric: tabular-nums lining-nums; }
.dtable th, .dtable td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.dtable thead th {
  position: sticky; top: 0; z-index: 2; background: var(--paper); font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--line-strong); padding-top: 10px; padding-bottom: 10px;
}
.dtable .r, .dtable th.r { text-align: right; }
.dtable .c { text-align: center; }
.dtable td.wrap { white-space: normal; min-width: 180px; }
.dtable tbody tr { transition: background var(--t-fast); }
.dtable tbody tr:hover { background: var(--paper-2); }
.dtable tbody tr.clickable { cursor: pointer; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tfoot td { font-weight: 650; border-top: 1px solid var(--line-strong); border-bottom: 0; background: var(--paper-2); }
.dtable .neg { color: var(--bad); }
.dtable .zero { color: var(--text-4); }
.dtable .sub { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.dtable.sticky-first th:first-child, .dtable.sticky-first td:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); }
.dtable.sticky-first thead th:first-child { z-index: 3; }
.dtable.sticky-first tbody tr:hover td:first-child { background: var(--paper-2); }
.dtable.compact th, .dtable.compact td { padding: 7px 10px; }

/* ---------------------------------------------------------------- drawer, modal, scrim */
.scrim { position: fixed; inset: 0; z-index: 70; background: var(--scrim); animation: fade-in var(--t-med) var(--ease); }
@keyframes fade-in { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 75; width: min(640px, 100vw); display: flex; flex-direction: column;
  background: var(--paper); box-shadow: var(--shadow-drawer); animation: drawer-in 260ms var(--ease);
}
@keyframes drawer-in { from { transform: translateX(32px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.drawer-head .dh-text { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 18px; }
.drawer-head .sub { margin-top: 4px; font-size: 13px; color: var(--text-3); }
.drawer-body { flex: 1; overflow: auto; padding: 20px 24px 28px; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--paper-2); }
@media (max-width: 640px) {
  .drawer { width: 100vw; }
  .drawer-head { padding: 16px 16px 14px; }
  .drawer-body { padding: 16px; }
}
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); border-radius: 16px;
  box-shadow: var(--shadow-pop); animation: pop-in 220ms var(--ease);
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 4px; }
.modal-head h2 { flex: 1; font-size: 18px; }
.modal-body { padding: 10px 24px 4px; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 20px 24px 22px; }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; z-index: 90; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 14px 11px 12px; border-radius: 12px;
  background: var(--ink-900); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-pop); animation: toast-in 260ms var(--ease);
}
:root[data-theme="dark"] .toast { background: #2a3448; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #2a3448; } }
.toast .ic { width: 18px; height: 18px; flex: none; }
.toast.good .ic { color: #4ad39a; }
.toast.bad .ic { color: #ff8a80; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 200ms, transform 200ms; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------------------------------------------------------------- tooltip */
.tip {
  position: fixed; z-index: 95; pointer-events: none; min-width: 150px; max-width: 300px; padding: 10px 12px 9px;
  border-radius: 10px; background: var(--paper); color: var(--text); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop); font-size: 12.5px; line-height: 1.4; font-variant-numeric: tabular-nums lining-nums;
}
.tip .t-title { font-weight: 650; font-size: 12.5px; margin-bottom: 6px; color: var(--text); }
.tip .t-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; padding: 1px 0; }
.tip .t-row .k { width: 10px; height: 10px; border-radius: 3px; }
.tip .t-row .k.line { height: 2px; border-radius: 2px; }
.tip .t-row .k.dash { height: 0; border-top: 2px dashed currentColor; background: none !important; }
.tip .t-row .l { color: var(--text-3); }
.tip .t-row .v { font-weight: 620; text-align: right; }
.tip .t-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 5px; }
.tip .t-note { margin-top: 6px; color: var(--text-3); font-size: 11.5px; }

/* ---------------------------------------------------------------- skeleton, empty */
.skel { position: relative; overflow: hidden; background: var(--ink-100); border-radius: 6px; }
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent); animation: shimmer 1.3s infinite;
}
:root[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent); } }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 12px; margin: 8px 0; }
.skel-block { height: 120px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.empty .e-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--navy-100); color: var(--navy-700); margin-bottom: 6px; }
:root[data-theme="dark"] .empty .e-icon { color: var(--c-actual); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .empty .e-icon, :root:not([data-theme="light"]) .dropzone .dz-icon { color: var(--c-actual); } }
.empty .e-icon .ic { width: 26px; height: 26px; }
.empty h3 { font-size: 17px; font-weight: 640; letter-spacing: -0.01em; }
.empty p { max-width: 420px; color: var(--text-3); font-size: 14px; }
.empty .e-actions { margin-top: 10px; display: flex; gap: 8px; }
.empty.big { padding: 88px 24px; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md); font-size: 13.5px; background: var(--info-bg); color: var(--text); }
.alert .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--info); }
.alert.good { background: var(--good-bg); } .alert.good .ic { color: var(--good); }
.alert.bad { background: var(--bad-bg); } .alert.bad .ic { color: var(--bad); }
.alert.warn { background: var(--warn-bg); } .alert.warn .ic { color: var(--warn); }

/* ---------------------------------------------------------------- legend, charts */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); }
.legend .lg-item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .sw.line { width: 16px; height: 2px; border-radius: 2px; }
.legend .sw.dash { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed; background: none !important; }
.legend .sw.ghost { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--c-budget); }
.legend .sw.tick { width: 2px; height: 12px; border-radius: 1px; }

.sw.actual, .k.actual { background: var(--c-actual); border-color: var(--c-actual); color: var(--c-actual); }
.sw.forecast, .k.forecast { background: var(--c-forecast); border-color: var(--c-forecast); color: var(--c-forecast); }
.sw.budget, .k.budget { background: var(--c-budget); border-color: var(--c-budget); color: var(--c-budget); }
.sw.good, .k.good { background: var(--good); color: var(--good); }
.sw.bad, .k.bad { background: var(--bad); color: var(--bad); }
.sw.total, .k.total { background: var(--c-total); color: var(--c-total); }

.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; }
.chart svg text { font-family: var(--font-sans); fill: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums lining-nums; }
.chart .grid-line { stroke: var(--c-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-line { stroke: var(--c-axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .zero-line { stroke: var(--c-axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart text.lbl-strong { fill: var(--text); font-weight: 620; font-size: 12px; }
.chart text.lbl-mid { fill: var(--text-2); font-weight: 520; }
.chart text.lbl-end { fill: var(--text); font-weight: 650; font-size: 12.5px; }

.mk-actual { fill: var(--c-actual); }
.mk-forecast { fill: var(--c-forecast); }
.mk-budget { fill: var(--c-budget); }
.mk-budget-ghost { fill: var(--c-budget-wash); stroke: var(--c-budget); stroke-width: 1; }
.mk-good { fill: var(--good); }
.mk-bad { fill: var(--bad); }
.mk-total { fill: var(--c-total); }
.mk-track { fill: var(--ink-100); }
.ln { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ln-actual { stroke: var(--c-actual); }
.ln-forecast { stroke: var(--c-forecast); }
.ln-budget { stroke: var(--c-budget); }
.ln-dash { stroke-dasharray: 4 4; }
.ln-thin { stroke-width: 1.5; }
.area-actual { fill: var(--c-actual-wash); }
.area-forecast { fill: var(--c-forecast-wash); }
.dot { stroke: var(--paper); stroke-width: 2; }
.dot-actual { fill: var(--c-actual); } .dot-forecast { fill: var(--c-forecast); } .dot-budget { fill: var(--c-budget); }
.crosshair { stroke: var(--line-strong); stroke-width: 1; shape-rendering: crispEdges; }
.connector { stroke: var(--c-axis); stroke-width: 1; stroke-dasharray: 2 2; shape-rendering: crispEdges; }
.target-tick { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.hit { fill: transparent; cursor: default; }
.hit.clickable { cursor: pointer; }
.hit:focus-visible { outline: none; fill: var(--hover); }
.hl-band { fill: var(--hover); }
.mk-hover-dim .mk { opacity: 0.45; transition: opacity var(--t-fast); }
.mk.is-hot { opacity: 1 !important; }

.grow-y { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y 300ms var(--ease) both; }
.grow-y.neg { transform-origin: 50% 0%; }
.grow-x { transform-box: fill-box; transform-origin: 0% 50%; animation: grow-x 300ms var(--ease) both; }
.grow-x.neg { transform-origin: 100% 50%; }
.draw-in { animation: draw-in 700ms var(--ease) both; }
.fade-in { animation: fade-in 400ms var(--ease) both; }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes draw-in { from { stroke-dashoffset: var(--len, 1000); } }

.twin { margin-top: 12px; }
.twin summary {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); cursor: pointer; list-style: none;
  padding: 4px 6px; margin-left: -6px; border-radius: 6px; user-select: none;
}
.twin summary::-webkit-details-marker { display: none; }
.twin summary:hover { color: var(--text); background: var(--hover); }
.twin summary .ic { width: 14px; height: 14px; transition: transform var(--t-fast); }
.twin[open] summary .ic { transform: rotate(90deg); }
.twin .table-wrap { margin-top: 8px; border: 1px solid var(--line); }

/* ranked bars (HTML) */
.rank { display: flex; flex-direction: column; }
.rank-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 10px 8px; margin: 0 -8px;
  border-radius: 8px; border: 0; background: none; text-align: left; width: calc(100% + 16px); color: inherit;
}
button.rank-item:hover { background: var(--hover); }
.rank-item .ri-label { font-size: 13.5px; color: var(--text); font-weight: 520; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-item .ri-meta { font-size: 12px; color: var(--text-3); margin-left: 6px; font-weight: 500; }
.rank-item .ri-value { font-size: 13.5px; font-weight: 640; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.rank-item .ri-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--ink-100); overflow: hidden; }
.rank-item .ri-bar i { display: block; height: 100%; border-radius: 3px; transform-origin: 0 50%; animation: grow-x 400ms var(--ease) both; }
.rank-item .ri-bar i.good { background: var(--good); } .rank-item .ri-bar i.bad { background: var(--bad); }
.rank-item .ri-bar i.actual { background: var(--c-actual); } .rank-item .ri-bar i.forecast { background: var(--c-forecast); }
.rank-item .ri-sub { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); margin-top: -2px; }

/* bullet (HTML) */
.bullet { position: relative; height: 22px; }
.bullet .b-track { position: absolute; left: 0; right: 0; top: 7px; height: 8px; border-radius: 4px; background: var(--ink-100); }
.bullet .b-bar { position: absolute; top: 7px; height: 8px; border-radius: 4px; transform-origin: 0 50%; animation: grow-x 400ms var(--ease) both; }
.bullet .b-bar.neg { transform-origin: 100% 50%; }
.bullet .b-bar.actual { background: var(--c-actual); }
.bullet .b-bar.forecast { background: var(--c-forecast); }
.bullet .b-target { position: absolute; top: 1px; width: 2px; height: 20px; border-radius: 1px; background: var(--text); transform: translateX(-1px); }
.bullet .b-zero { position: absolute; top: 3px; width: 1px; height: 16px; background: var(--c-axis); }
.bullet-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 6px; font-variant-numeric: tabular-nums; gap: 8px; }

/* heat table */
.heat td.hc { text-align: right; font-weight: 560; border-bottom: 2px solid var(--paper); border-right: 2px solid var(--paper); border-radius: 4px; }

/* key-value list */
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* placeholder page */

/* error / loading for page */
.page-loading { display: grid; gap: var(--gutter); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.page-loading > div { grid-column: span 3; }
.page-loading > .wide { grid-column: span 12; }
@media (max-width: 899px) { .page-loading > div { grid-column: span 12; } }

/* waterfall (HTML grid) */
.wf { position: relative; display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr) minmax(84px, auto); column-gap: 16px; align-items: center; }
.wf-grid { position: relative; align-self: stretch; z-index: 0; pointer-events: none; }
.wf-grid i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--c-grid); }
.wf-grid i.z { background: var(--c-axis); }
.wf-label {
  display: flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 8px; margin-left: -8px; border: 0; background: none; border-radius: 7px;
  font-size: 13.5px; color: var(--text-2); text-align: left; line-height: 1.25; min-width: 0;
}
.wf-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wf-label .ic { width: 14px; height: 14px; flex: none; color: var(--text-3); opacity: 0; transition: opacity var(--t-fast); }
button.wf-label { cursor: pointer; }
.wf-label.is-hot { background: var(--hover); color: var(--text); }
.wf-label.is-hot .ic, .wf-label:focus-visible .ic { opacity: 1; }
.wf-label.total { font-weight: 650; color: var(--text); }
.wf-track { position: relative; height: 38px; z-index: 1; }
.wf-track.clickable, .wf-val.clickable { cursor: pointer; }
.wf-bar { position: absolute; top: 12px; height: 14px; border-radius: 4px; }
.wf-label.total + .wf-track .wf-bar, .wf-track:has(+ .wf-val.total) .wf-bar { top: 10px; height: 18px; }
.wf-track.is-hot .wf-bar { filter: saturate(1.15) brightness(1.06); }
.wf-conn { position: absolute; top: -12px; height: 24px; border-left: 1px dashed var(--c-axis); }
.wf-val { text-align: right; font-size: 13.5px; font-weight: 620; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.wf-val.good { color: var(--good); } .wf-val.bad { color: var(--bad); }
.wf-val.total { color: var(--text); font-weight: 680; }
.wf-val .arr { font-size: 8.5px; margin-right: 5px; vertical-align: 1px; font-family: "Segoe UI Symbol", "Apple Symbols", var(--font-sans); }
.wf .sep { border-top: 0; }
.wf .wf-label.sep { margin-top: 6px; }
.wf .wf-track.sep, .wf .wf-val.sep { margin-top: 6px; }
.wf-axis { position: relative; height: 22px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wf-axis span { position: absolute; top: 6px; transform: translateX(-50%); white-space: nowrap; }
.wf-axis span.first { transform: none; }
.wf-axis span.last { transform: translateX(-100%); }
.mk-bg-budget { background: var(--c-budget); } .mk-bg-actual { background: var(--c-actual); } .mk-bg-forecast { background: var(--c-forecast); }
.mk-bg-good { background: var(--good); } .mk-bg-bad { background: var(--bad); } .mk-bg-total { background: var(--c-total); }
.wf-val .v-short { display: none; }
@media (max-width: 560px) {
  .wf { grid-template-columns: minmax(96px, 38%) minmax(0, 1fr) auto; column-gap: 10px; }
  .wf-val .v-full { display: none; }
  .wf-val .v-short { display: inline; }
  .wf-axis span.mid { display: none; }
  .dtable .hide-sm { display: none; }
  .wf-label, .wf-val { font-size: 12.5px; }
}
.show-sm { display: none !important; }
@media (max-width: 560px) {
  .show-sm { display: block !important; }
  .dtable td.wrap { min-width: 0; white-space: normal; }
}
.mk-cat1 { fill: var(--cat-1); } .mk-cat2 { fill: var(--cat-2); } .mk-cat3 { fill: var(--cat-3); } .mk-cat4 { fill: var(--cat-4); } .mk-cat5 { fill: var(--cat-5); }
.sw.cat1, .k.cat1 { background: var(--cat-1); } .sw.cat2, .k.cat2 { background: var(--cat-2); } .sw.cat3, .k.cat3 { background: var(--cat-3); }
.sw.cat4, .k.cat4 { background: var(--cat-4); } .sw.cat5, .k.cat5 { background: var(--cat-5); }
p, li { text-wrap: pretty; }
