/* Monitoring Divre SCI — design system (light only) */
:root {
  color-scheme: light;
  --brand-900: #0b4a86;
  --brand-700: #1263aa;
  --brand-600: #1a71bd;
  --brand-500: #2f8fd8;
  --brand-400: #61b4e8;
  --brand-200: #cfe8fa;
  --brand-100: #e6f3fc;
  --accent-500: #22c3e6;
  --accent-600: #12a9cd;

  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #f7fafd;
  --text: #172336;
  --muted: #6b7c93;
  --border: #e2e9f2;
  --border-strong: #d3ddec;

  --success: #14915f;
  --success-soft: #e4f6ee;
  --warning: #b9761a;
  --warning-soft: #fdf3e2;
  --danger: #c0392b;
  --danger-soft: #fdecea;

  --shadow-sm: 0 1px 2px rgb(23 35 54 / 6%), 0 2px 8px rgb(23 35 54 / 5%);
  --shadow-md: 0 6px 20px rgb(23 35 54 / 8%);
  --shadow-brand: 0 14px 30px rgb(18 99 170 / 22%);

  --sidebar-w: 248px;
  --radius: 14px;
  --radius-sm: 10px;
  --topbar-h: 66px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }

h1, h2, h3, h4, h5 { color: var(--text); font-weight: 700; margin: 0; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  display: none;
  flex-direction: column;
  gap: 6px;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  padding: 22px 16px;
  background: linear-gradient(180deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color: #dfeaf6;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: flex-start;
  padding: 4px 8px 18px;
  color: #fff;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand .brand-name { display: block; }
.sidebar-brand strong { display: block; font-size: 1.02rem; font-weight: 800; letter-spacing: -.01em; }
.sidebar-brand small { display: block; color: #a9c6e2; font-size: .71rem; font-weight: 400; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.sidebar-nav .nav-label {
  margin: 14px 10px 6px;
  color: #8fb4d6;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #d7e6f5;
  font-size: .88rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav a:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.sidebar-nav a.is-active { background: #fff; color: var(--brand-700); font-weight: 700; box-shadow: var(--shadow-sm); }
.sidebar-nav a .nav-icon { flex: 0 0 18px; display: inline-grid; place-items: center; }

.sidebar-user {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgb(255 255 255 / 9%);
  color: #cfe0f1;
  font-size: .78rem;
}
.sidebar-user strong { color: #fff; display: block; font-size: .85rem; }

/* ---------- Topbar ---------- */
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar-h);
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--brand-700);
  cursor: pointer;
}
.topbar-toggle:hover { background: var(--brand-100); }

.topbar-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 460px;
}
.topbar-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
}
.topbar-search input:focus { outline: none; border-color: var(--brand-400); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-100); }
.topbar-search .search-icon { position: absolute; top: 50%; left: 13px; translate: 0 -50%; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-actions .icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.topbar-actions .icon-btn:hover { color: var(--brand-700); border-color: var(--brand-200); background: var(--brand-100); }
.topbar-user { display: flex; align-items: center; gap: 9px; }
.topbar-user .avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-weight: 700;
  font-size: .82rem;
}
.topbar-user .user-meta { line-height: 1.15; }
.topbar-user .user-meta strong { display: block; font-size: .84rem; }
.topbar-user .user-meta span { color: var(--muted); font-size: .72rem; text-transform: capitalize; }

.page { padding: 22px 20px 40px; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.page-head .eyebrow {
  margin: 0 0 6px;
  color: var(--brand-600);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.page-head h1 { font-size: 1.5rem; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.period-caption { display: grid; gap: 2px; text-align: right; }
.period-caption .caption-label { color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.period-caption strong { font-size: 1rem; }
.period-caption small { color: var(--muted); font-size: .74rem; }

.section-block { margin-bottom: 22px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { font-size: 1.05rem; }
.section-heading .eyebrow { margin: 0 0 4px; }
.unit-note { color: var(--muted); font-size: .76rem; }
.field-label { color: var(--muted); font-size: .77rem; font-weight: 700; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 40px 18px; color: var(--muted); }
.dashboard-status { margin-top: 12px; font-size: .77rem; min-height: 1.2em; }
.pie-card .card-head h3 { font-size: .88rem; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { font-size: .98rem; }
.card-head .sub { margin: 2px 0 0; color: var(--muted); font-size: .78rem; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Stat cards ---------- */
.stat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.stat .stat-icon {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--brand-100);
  color: var(--brand-600);
}
.stat .stat-icon.tone-accent { background: #e2f8fd; color: var(--accent-600); }
.stat .stat-body { min-width: 0; }
.stat .stat-label { color: var(--muted); font-size: .76rem; font-weight: 600; }
.stat .stat-value {
  margin: 2px 0 0;
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat .stat-unit { color: var(--muted); font-size: .72rem; }
.stat .pill {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: .73rem;
  font-weight: 700;
}
.stat .pill.is-good { background: var(--success-soft); color: var(--success); }
.stat .pill.is-low { background: var(--warning-soft); color: var(--warning); }

/* ---------- Scorecards ---------- */
.scorecard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.scorecard::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--brand-500);
}
.scorecard.is-good::before { background: var(--success); }
.scorecard.is-low::before { background: var(--danger); }
.scorecard-head { display: flex; align-items: center; gap: 10px; }
.scorecard-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-100);
  color: var(--brand-600);
}
.scorecard.is-good .scorecard-icon { background: var(--success-soft); color: var(--success); }
.scorecard.is-low .scorecard-icon { background: var(--danger-soft); color: var(--danger); }
.scorecard-label { color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.scorecard-value {
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.scorecard-unit { color: var(--muted); font-size: .74rem; }
.scorecard-attainment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: 2px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
}
.scorecard-attainment.is-good { background: var(--success-soft); color: var(--success); }
.scorecard-attainment.is-low { background: var(--danger-soft); color: var(--danger); }

/* ---------- Controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { color: var(--muted); font-size: .77rem; font-weight: 700; }

.input, .select, select.control, input.control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.input:focus, .select:focus, select.control:focus, input.control:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-100);
}
select.control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7c93' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand-600);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--brand-700); color: #fff; }
.btn-primary { background: linear-gradient(140deg, var(--brand-500), var(--brand-700)); box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: linear-gradient(140deg, var(--brand-600), var(--brand-900)); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--brand-100); border-color: var(--brand-200); color: var(--brand-700); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a5301f; }
.btn-sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-group-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-muted); border: 1px solid var(--border); }
.btn-group-seg button {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-group-seg button.active { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-brand); }

/* ---------- Badges / alerts ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: .72rem;
  font-weight: 700;
}
.badge-good { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .86rem;
}
.alert-danger { border-color: #f3c8c2; background: var(--danger-soft); color: #8f2c1f; }
.alert-warning { border-color: #f0d9ac; background: var(--warning-soft); color: #7a5210; }
.alert-success { border-color: #bfe6d3; background: var(--success-soft); color: #0f6b47; }

/* ---------- Charts ---------- */
.chart-stage { position: relative; height: 320px; }
.chart-stage canvas { display: block; width: 100% !important; height: 100% !important; }
.chart-stage canvas[hidden] { display: none; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: .86rem; }
.chart-note { margin: 8px 0 0; color: var(--warning); font-size: .74rem; }
.stage-sm { height: 300px; }
.pie-card .chart-stage.stage-sm { height: 230px; }
.pie-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin: 14px 2px 0;
}
.pie-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .68rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.pie-legend-item[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.pie-legend-swatch {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 2px;
  border-radius: 50%;
}
.stage-lg { height: 380px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .82rem; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.data thead th { background: var(--surface-muted); color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
table.data tbody tr:hover { background: var(--surface-muted); }
table.data tfoot td, table.data tfoot th { background: var(--surface-muted); font-weight: 700; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .row-actions { display: flex; gap: 6px; }
.sort-button { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; padding: 0; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
.sort-button:hover { color: var(--brand-600); }
.filter-panel { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 20; }

.footer-note { margin-top: 22px; color: var(--muted); font-size: .75rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Login ---------- */
.login-page {
  display: grid;
  place-items: center;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  overflow: auto;
  background: #06183f;
}
.login-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr);
  grid-template-rows: auto 1fr auto;
  align-items: center;
  gap: 32px clamp(44px, 8vw, 120px);
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: clamp(42px, 7vw, 88px) clamp(36px, 9vw, 128px) 30px;
  overflow: auto;
  border-radius: 0;
  background: #06183f;
}
.login-panel::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse 48% 40% at 8% 46%, rgb(34 34 108 / 88%) 0 61%, transparent 61.5%),
    radial-gradient(ellipse 34% 82% at 27% 50%, transparent 48%, rgb(46 43 125 / 52%) 48.5% 66%, transparent 66.5%),
    radial-gradient(ellipse 31% 30% at 2% 100%, rgb(23 65 101 / 60%) 0 50%, transparent 51%);
  content: '';
  pointer-events: none;
}
.login-card {
  grid-column: 2;
  grid-row: 2;
  width: min(460px, 100%);
  justify-self: center;
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid rgb(23 35 54 / 6%);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgb(0 0 0 / 18%);
}
.login-brand {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: #fff;
}
.login-brand:hover { color: #fff; }
.login-brand strong { display: block; font-size: 1rem; }
.login-brand small { display: block; color: #a9c6e2; font-size: .76rem; }
.login-intro {
  grid-column: 1;
  grid-row: 2;
  max-width: 420px;
  color: #fff;
}
.login-intro h1 { margin: 0; color: #fff; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.12; }
.login-intro p { max-width: 360px; margin: 14px 0 0; color: #c8c2e8; font-size: 1rem; line-height: 1.65; }
.login-card h2 { margin: 0 0 6px; font-size: 1.35rem; }
.login-card-subtitle { margin: 0 0 26px; color: var(--muted); font-size: .84rem; }
.login-card .alert { margin-bottom: 18px; }
.login-card .field + .field { margin-top: 14px; }
.login-card .field label { font-size: .76rem; }
.login-card .input { min-height: 44px; }
.login-card .btn { width: 100%; margin-top: 24px; padding: 12px; background: #7655d9; border-color: #7655d9; }
.login-card .btn:hover { background: #6242c2; border-color: #6242c2; }
.login-foot {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 0;
  color: #c0cae0;
  font-size: .72rem;
  text-align: center;
}

@media (max-width: 760px) {
  .login-page { padding: 0; }
  .login-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr auto;
    gap: 20px;
    height: 100%;
    padding: 24px 24px 18px;
    border-radius: 0;
  }
  .login-brand { grid-column: 1; grid-row: 1; }
  .login-intro { grid-column: 1; grid-row: 2; }
  .login-intro h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .login-card { grid-column: 1; grid-row: 3; width: 100%; padding: 24px; }
  .login-foot { grid-row: 4; }
}

@media (max-width: 400px) {
  .login-panel { padding: 20px 18px 16px; }
  .login-card { padding: 20px; }
}

/* ---------- Sidebar backdrop (mobile) ---------- */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  background: rgb(9 30 54 / 45%);
}
body.sidebar-open .sidebar-backdrop { display: block; }

/* ---------- Responsive ---------- */
@media (min-width: 992px) {
  .sidebar { display: flex; }
  .topbar-toggle { display: none; }
}
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    translate: -100% 0;
    transition: translate .22s ease;
    box-shadow: 0 0 40px rgb(4 27 52 / 35%);
  }
  body.sidebar-open .sidebar { translate: 0 0; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .topbar-search { display: none; }
  .page { padding: 18px 14px 34px; }
  .chart-stage { height: 290px; }
  .pie-card .chart-stage.stage-sm { height: 230px; }
  .stage-lg { height: 320px; }
}
@media (max-width: 575.98px) {
  .topbar-user .user-meta { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Toolbar / tabs ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.toolbar .field { min-width: 150px; }
.toolbar .spacer { flex: 1 1 auto; }
.tabs a, .tabs button {
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tabs a:hover, .tabs button:hover { color: var(--brand-700); }
.tabs .is-active { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-brand); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--brand-100); color: var(--brand-700); font-size: .74rem; font-weight: 700; }

/* ---------- Table editor ---------- */
.table-editor { width: 100%; border-collapse: collapse; font-size: .82rem; }
.table-editor th, .table-editor td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.table-editor thead th { background: var(--surface-muted); color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.table-editor td.num, .table-editor th.num { text-align: right; }
.table-editor input, .table-editor select {
  width: 100%;
  min-width: 92px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.table-editor input:focus, .table-editor select:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); }
.table-editor input.num { text-align: right; }
.table-editor tbody tr:hover { background: var(--surface-muted); }
.simonik-tree { display: grid; gap: 10px; }
.simonik-group, .simonik-unit { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.simonik-group > summary, .simonik-unit > summary { padding: 11px 14px; color: var(--text); font-weight: 700; cursor: pointer; }
.simonik-group > summary { background: var(--surface-muted); }
.simonik-group[open] > summary, .simonik-unit[open] > summary { border-bottom: 1px solid var(--border); }
.simonik-group > .table-wrap, .simonik-unit > .table-wrap { margin: 12px; }
.simonik-unit { margin: 0 12px 12px; }
.simonik-unit > summary { font-size: .88rem; }
.table-editor .row-remove {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--danger);
  cursor: pointer;
}
.table-editor .row-remove:hover { background: var(--danger-soft); border-color: #f3c8c2; }

/* ---------- Empty state ---------- */
.empty-state { display: grid; place-items: center; gap: 6px; padding: 34px 18px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: .95rem; }

/* ---------- Dialog ---------- */
dialog.modal-card {
  width: min(560px, 92vw);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 70px rgb(4 27 52 / 32%);
}
dialog.modal-card::backdrop { background: rgb(9 30 54 / 45%); }
dialog.modal-card .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
dialog.modal-card .modal-head h2 { font-size: 1.02rem; }
dialog.modal-card .modal-body { padding: 18px 20px; }
dialog.modal-card .modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-muted); border-radius: 0 0 16px 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ---------- Month grid ---------- */
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.month-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.month-card:hover { border-color: var(--brand-200); box-shadow: var(--shadow-md); }
.month-card strong { font-size: .95rem; }
.month-card small { color: var(--muted); font-size: .74rem; }
.month-card .month-badge { align-self: flex-start; margin-top: 6px; }

@media (max-width: 575.98px) {
  .form-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .sidebar-backdrop, .no-print { display: none !important; }
  body, .app-shell { background: #fff; }
  .card, .stat { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .page { padding: 0; }
}
