:root {
  color-scheme: light;
  --canvas: #f5f7f9;
  --surface: #fff;
  --text: #172523;
  --muted: #61706e;
  --line: #e3e9e8;
  --sidebar: #172421;
  --accent: #176f5d;
  --accent-hover: #125848;
  --green: #176953;
  --green-bg: #e8f5ef;
  --amber: #865810;
  --amber-bg: #fcf3dd;
  --red: #9d3936;
  --red-bg: #fbeceb;
  --blue: #315e8a;
  --blue-bg: #eaf2fb;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid #428f7c; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; font-weight: 720; line-height: 1.16; overflow-wrap: anywhere; }
h2 { font-size: 16px; font-weight: 690; }
h3 { font-size: 14px; font-weight: 680; }
small, .muted { color: var(--muted); }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.workspace { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); color: #b9cbc5; position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 24px 14px 15px; z-index: 5; }
.brand-row { display: flex; justify-content: space-between; align-items: flex-start; margin: 0 8px 36px; gap: 8px; }
.brand { display: flex; gap: 12px; align-items: center; color: #f4faf7; }
.sidebar-close { background: transparent; border-color: #30423b; color: #c4d2cd; }
.sidebar-close:hover:not(:disabled) { background: #30443d; border-color: #42594f; }
.brand img, .login-brand img { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; object-position: center 23%; }
.brand strong { display: block; font-size: 17px; line-height: 1.2; font-weight: 680; }
.brand small { display: block; margin-top: 3px; color: #a5b9b0; font-size: 11px; }
.nav-heading { margin: 0 10px 10px; color: #91a79e; font-size: 10px; font-weight: 690; }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 10px; min-height: 42px; color: #c4d2cd; border-radius: 6px; font-size: 13px; font-weight: 550; }
.nav-link:hover { background: #213530; color: white; }
.nav-link[aria-current="page"] { color: #f5fbf8; background: #31534a; }
.nav-link[aria-current="page"] .icon { color: #a9e0cd; }
.account { margin-top: auto; border-top: 1px solid #30423b; padding: 15px 4px 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.account strong, .account small { display: block; max-width: 106px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.account strong { color: #eef6f2; }
.account-password { display: block; padding: 0; border: 0; background: transparent; color: #b5cec3; font-size: 11px; text-align: left; }
.account-password:hover { color: white; text-decoration: underline; }
.account small { color: #a7b9b2; font-size: 10px; }
.account-avatar { display: grid; place-items: center; width: 31px; height: 31px; background: #345048; color: #e4f7ef; border-radius: 50%; flex: 0 0 auto; font-weight: 680; }
.account .logout { margin-left: auto; color: #c0d3c9; border-color: transparent; background: transparent; width: 31px; height: 32px; }
.account .logout:hover { background: #30443d; }
.main-shell { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 61px; border-bottom: 1px solid var(--line); background: var(--surface); padding: 0 28px; }
.crumb, .top-right { display: flex; gap: 10px; align-items: center; min-width: 0; font-size: 12px; }
.crumb span { color: var(--muted); }
.crumb .icon { width: 14px; height: 14px; color: #899a96; }
.crumb strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-button { display: none !important; }
.page { max-width: 1600px; margin: 0 auto; padding: 26px 28px 48px; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 20px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 6px; }
.actions, .inline, .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.filters { margin-bottom: 16px; }
.date-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-form input { width: 132px; }
.date-form select { max-width: 140px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 7px 11px; background: var(--surface); border: 1px solid #dbe4e1; border-radius: 6px; font-size: 12px; font-weight: 640; line-height: 1.35; color: var(--text); text-align: center; overflow-wrap: anywhere; }
.button:hover:not(:disabled) { background: #f0f5f3; border-color: #c9d7d2; }
.button .icon { width: 15px; height: 15px; }
.primary { background: var(--accent); border-color: var(--accent); color: white; }
.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.danger { color: var(--red); }
.icon-button { width: 35px; height: 35px; min-width: 35px; padding: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 11px; font-weight: 630; border-radius: 4px; line-height: 1.4; max-width: 100%; overflow-wrap: anywhere; }
.badge.dot::before { content: ""; flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.neutral { background: #eef2f1; color: #53625e; }
.green { background: var(--green-bg); color: var(--green); }
.amber { background: var(--amber-bg); color: var(--amber); }
.red { background: var(--red-bg); color: var(--red); }
.blue { background: var(--blue-bg); color: var(--blue); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.overview-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metrics-note { display: block; margin: -7px 0 13px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 15px; min-width: 0; }
.metric-top { display: flex; align-items: center; gap: 9px; color: #455652; font-size: 12px; font-weight: 630; }
.metric-icon { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 6px; flex: 0 0 auto; }
.metric-icon .icon { width: 17px; height: 17px; }
.metric strong { display: block; font-size: 29px; line-height: 1.12; font-weight: 740; margin: 10px 0 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric small { display: block; font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(245px, 1fr); gap: 16px; margin-bottom: 16px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head small { display: block; margin-top: 2px; }
.panel-body { padding: 16px; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 13px; font-size: 11px; color: var(--muted); }
.legend span { display: flex; gap: 5px; align-items: center; }
.swatch { width: 8px; height: 8px; background: #82bfb1; border-radius: 2px; }
.swatch.ready { background: #216f5d; }
.chart-wrap { padding: 9px 14px 5px; min-height: 236px; display: flex; align-items: center; }
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid { stroke: #e4eae8; stroke-width: 1; }
.chart text { fill: #61706e; font-size: 11px; font-family: inherit; }
.chart .bar { fill: #83bcaf; }
.chart .bar.ready { fill: #216f5d; }
.chart .bar:hover { opacity: .76; }
.check-lines { display: grid; gap: 0; }
.check-row { display: flex; justify-content: space-between; align-items: center; min-height: 42px; border-top: 1px solid var(--line); gap: 8px; font-size: 12px; }
.check-row > span:first-child { display: flex; align-items: center; gap: 7px; color: #425551; min-width: 0; }
.check-row .icon { width: 15px; height: 15px; color: #61847b; }
.balance-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 0 0 13px; }
.balance-hero strong { display: block; font-size: 26px; font-weight: 720; line-height: 1.15; margin: 3px 0; }
.balance-hero small { display: block; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
thead { background: #f8faf9; color: #526461; }
th, td { padding: 10px 13px; border-bottom: 1px solid #e9edec; vertical-align: middle; }
th { font-weight: 630; font-size: 11px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfcfc; }
.person { display: flex; align-items: center; gap: 8px; min-width: 143px; }
.person-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; background: #e6f1ee; color: #286859; border-radius: 50%; font-size: 10px; font-weight: 720; }
.person-avatar.t1 { background: #ecf0fa; color: #405987; }
.person-avatar.t2 { background: #f6efe2; color: #875e2b; }
.person-avatar.t3 { background: #f1eaf1; color: #79546f; }
.person-name { color: var(--text); padding: 0; background: none; border: none; text-align: left; font-weight: 660; line-height: 1.25; }
.person-name:hover { color: var(--accent); text-decoration: underline; }
.person small { display: block; font-size: 10px; margin-top: 2px; }
.truncate { max-width: 290px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; padding: 26px 14px; color: var(--muted); }
.notice { display: flex; align-items: flex-start; gap: 8px; border: 1px solid #eadcb6; border-radius: 6px; background: var(--amber-bg); color: #724d16; padding: 10px 12px; margin-bottom: 13px; overflow-wrap: anywhere; }
.notice .icon { width: 16px; height: 16px; margin-top: 2px; }
.notice.error { color: var(--red); background: var(--red-bg); border-color: #f0ceca; }
.notice.ok { color: var(--green); background: var(--green-bg); border-color: #d4eadd; }
label { display: grid; gap: 5px; font-size: 12px; font-weight: 620; min-width: 0; }
input:not([type=checkbox]), select, textarea { min-width: 0; padding: 7px 9px; min-height: 35px; background: white; border: 1px solid #dbe4e1; border-radius: 6px; font-size: 13px; }
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
textarea { width: 100%; resize: vertical; line-height: 1.55; }
.check-label { display: flex; align-items: center; gap: 6px; }
.search { display: flex; align-items: center; gap: 7px; min-width: 190px; flex: 1; max-width: 340px; border: 1px solid #dbe4e1; background: white; border-radius: 6px; padding-left: 9px; }
.search .icon { color: #738681; width: 15px; height: 15px; }
.search input { border: 0; width: 100%; }
.pager { padding: 11px 14px; display: flex; gap: 8px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.stack { display: grid; gap: 14px; }
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.full { grid-column: 1 / -1; }
.tabs { display: flex; gap: 3px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 15px; }
.tab { border: none; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; padding: 9px 12px; font-size: 13px; font-weight: 650; }
.tab.active { color: var(--accent); border-color: var(--accent); }
.editor-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.editor-row:last-child { border-bottom: none; }
.editor-row header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.editor-row .button { min-height: 29px; height: 29px; width: 29px; min-width: 29px; }
.record { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.record:last-child { border-bottom: none; }
.record-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.copy { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.kv { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1.5fr); gap: 7px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.dialog { width: min(730px, calc(100% - 24px)); max-height: calc(100dvh - 38px); border: 1px solid var(--line); border-radius: 8px; padding: 0; color: var(--text); background: white; }
.dialog::backdrop { background: #12272070; }
.dialog-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); background: white; padding: 13px 16px; }
.dialog-head h2 { overflow-wrap: anywhere; }
.dialog-body { padding: 16px; min-width: 0; }
.confirm-dialog { width: min(440px, calc(100% - 24px)); }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 20; padding: 11px 14px; border-radius: 6px; background: #243832; color: white; box-shadow: 0 4px 18px #12272026; max-width: min(420px, calc(100vw - 40px)); overflow-wrap: anywhere; }
.toast.failure { background: #85332f; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
.login-box { width: min(420px, 100%); padding: 25px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-brand small { display: block; }
.login-box h1 { font-size: 25px; margin-bottom: 17px; }
.login-box form { display: grid; gap: 13px; }
.login-box .button { min-height: 39px; }
.form-error { color: var(--red); font-size: 12px; }
.loading { padding: 32px 0; color: var(--muted); }
.dim { opacity: .6; }
.right-align { margin-left: auto; }
.settings-status { margin-bottom: 8px; }
.broadcast-history { margin-top: 14px; }
.dialog-form { display: grid; gap: 12px; }
.dialog .panel-body { padding: 10px 0; }
.client-form-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.client-form-row > div { min-width: 0; }
.client-form-row small { display: block; }
.report-copy { padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf9; }
.detail-title { min-width: 0; }
.detail-error { margin-top: 10px; }
@media (max-width: 1120px) {
  .workspace { grid-template-columns: 194px minmax(0, 1fr); }
  .topbar, .page { padding-left: 20px; padding-right: 20px; }
  .metric { padding: 12px; }
  .metric-top { align-items: flex-start; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .overview-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .workspace { display: block; }
  .sidebar { display: none; position: fixed; inset: 0 auto 0 0; width: 224px; box-shadow: 0 0 0 100vmax #17242155; }
  .sidebar.open { display: flex; }
  .menu-button { display: inline-flex !important; }
  .topbar { height: 54px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(230px, 1fr); }
}
@media (max-width: 610px) {
  h1 { font-size: 25px; }
  .topbar, .page { padding-left: 12px; padding-right: 12px; }
  .page { padding-top: 17px; }
  .metrics, .two-cols, .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dashboard-grid, .field-grid { grid-template-columns: minmax(0, 1fr); }
  .metric strong { font-size: 25px; }
  .metric-top { gap: 6px; font-size: 11px; }
  .metric-icon { width: 26px; height: 26px; }
  .metric-icon .icon { width: 14px; height: 14px; }
  .metric small { font-size: 10px; }
  .crumb > span, .crumb > .icon { display: none; }
  .top-right { gap: 5px; }
  .top-right .badge { font-size: 10px; }
  .chart-wrap { min-height: 175px; padding: 6px; }
  .table-scroll table { min-width: 550px; }
  .two-cols.responsive { grid-template-columns: 1fr; }
  .dialog { max-height: calc(100dvh - 22px); }
  .date-form input { width: 121px; }
}
