/* =====================================================================
   Payroll Web - "ledger" skin
   Calm chrome, high-contrast data: cool paper background, white work surfaces,
   one indigo ink colour for actions and the active payroll period.
   Tokens can be overridden per user (Profil) via :root variables.
   ===================================================================== */
@font-face { font-family: "Plex"; src: url(../fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex"; src: url(../fonts/ibm-plex-sans-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex"; src: url(../fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url(../fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex"; src: url(../fonts/ibm-plex-sans-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --ink: #1c2433;
  --muted: #5e6b7e;
  --line: #dde3eb;
  --line-strong: #c6cfdb;
  --green: #2d4fa3;          /* primary ink (name kept for user profiles) */
  --green-2: #3e63c4;
  --primary-soft: #e7ecf8;
  --head: #18233a;
  --money: #1e7a5c;
  --danger: #b3261e;
  --danger-soft: #fbeceb;
  --warn: #8a5300;
  --warn-soft: #fdf3e1;
  --ok: #1e7a5c;
  --ok-soft: #e6f4ee;
  --info-soft: #eaf0fb;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(24, 35, 58, .06), 0 1px 1px rgba(24, 35, 58, .04);
  --font: "Plex", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  --header-h: 56px;
  --sidebar-w: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12161d; --panel: #1a2029; --panel-2: #202733; --ink: #e3e8ef; --muted: #98a3b3; --line: #2c3442; --line-strong: #3a4455;
  --green: #8fa8f0; --green-2: #a9bdf5; --primary-soft: #253154; --head: #edf1f7; --money: #6fcfa8; --danger: #f08a80; --danger-soft: #3a2224;
  --warn: #f0c070; --warn-soft: #3a3020; --ok: #6fcfa8; --ok-soft: #1d3329; --info-soft: #222c40; --shadow: none; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #12161d; --panel: #1a2029; --panel-2: #202733; --ink: #e3e8ef; --muted: #98a3b3; --line: #2c3442; --line-strong: #3a4455;
    --green: #8fa8f0; --green-2: #a9bdf5; --primary-soft: #253154; --head: #edf1f7; --money: #6fcfa8; --danger: #f08a80; --danger-soft: #3a2224;
    --warn: #f0c070; --warn-soft: #3a3020; --ok: #6fcfa8; --ok-soft: #1d3329; --info-soft: #222c40; --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: var(--green-2); }
code, pre, .mono { font-family: var(--mono); font-size: .93em; }
.num, td.num, th.num, .stat .v, .money { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
::selection { background: var(--primary-soft); }
h1, h2, h3 { color: var(--head); line-height: 1.25; }

/* ---------- header ---------- */
.app-header {
  height: var(--header-h); display: flex; align-items: center; gap: 18px; padding: 0 18px 0 0;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.app-header .brand {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 18px;
  color: var(--head); text-decoration: none; font-weight: 600; font-size: 15px; border-right: 1px solid var(--line); overflow: hidden;
}
.app-header .brand .mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--green); color: var(--panel); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: 0 0 28px;
}
.app-header .brand .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the active payroll period: the one strong element of the chrome */
.period-stamp {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 4px 12px 5px; border: 1px solid var(--line-strong); border-top: 3px solid var(--green);
  border-radius: 0 0 var(--radius) var(--radius); align-self: flex-start; margin-top: -1px; background: var(--panel); text-decoration: none; color: var(--ink);
}
.period-stamp .lbl { color: var(--muted); font-size: 12px; }
.period-stamp .val { font-size: 17px; font-weight: 600; color: var(--head); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.period-stamp .sub { color: var(--muted); font-size: 12px; }
.app-header .spacer { flex: 1; }
.app-header .userbox { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.app-header .userbox a { color: var(--ink); text-decoration: none; }
.app-header .userbox a:hover { color: var(--green); }
.app-header .userbox .who { color: var(--head); font-weight: 500; }
.app-header .menu-toggle { display: none; }

/* ---------- shell & sidebar ---------- */
.shell { display: flex; min-height: calc(100vh - var(--header-h)); }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--panel-2); border-right: 1px solid var(--line);
  position: sticky; top: var(--header-h); align-self: flex-start; height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 10px 0 24px;
}
.nav-sec { border-bottom: 1px solid var(--line); }
.nav-sec > button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 18px; border: 0; background: none;
  font: 600 13.5px var(--font); color: var(--head); cursor: pointer; text-align: left;
}
.nav-sec > button::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.nav-sec.open > button::after { transform: rotate(45deg); }
.nav-sec > button:hover { background: var(--primary-soft); }
.nav-sec .items { display: none; padding: 0 0 8px; }
.nav-sec.open .items { display: block; }
.nav-sec .grp { color: var(--muted); font-size: 12px; margin: 8px 18px 2px; }
.nav-grp > button.grp { display: flex; width: calc(100% - 20px); margin: 2px 10px; padding: 6px 8px; align-items: center; gap: 8px;
  border: 0; background: transparent; border-radius: 6px; color: var(--ink-2, var(--muted)); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left; }
.nav-grp > button.grp:hover { background: var(--primary-soft); }
.nav-grp > button.grp span:first-child { flex: 1; }
.nav-grp > button.grp .n { font-weight: 500; color: var(--muted); font-size: 11px; }
.nav-grp > button.grp::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
.nav-grp.open > button.grp::after { transform: rotate(45deg); }
.nav-grp .grp-items { display: none; padding-bottom: 4px; }
.nav-grp.open .grp-items { display: block; }
.nav-sec .nav-grp .grp-items a { padding-left: 30px; }
.nav-sec .items a {
  display: block; padding: 4px 18px 4px 26px; color: var(--ink); text-decoration: none; font-size: 13px; border-left: 3px solid transparent;
}
.nav-sec .items a:hover { background: var(--primary-soft); }
.nav-sec .items a.on { border-left-color: var(--green); color: var(--green); font-weight: 600; background: var(--primary-soft); }
.nav-foot { padding: 14px 18px; }

.main { flex: 1; min-width: 0; padding: 20px 26px 48px; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.page-title h1 { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.005em; }
.page-title .crumbs { color: var(--muted); font-size: 12.5px; }
.page-title .crumbs a { color: var(--muted); text-decoration: none; }
.page-title .crumbs a:hover { color: var(--green); text-decoration: underline; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow); }
.panel > .hd { padding: 11px 16px; font-weight: 600; color: var(--head); display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.panel > .hd small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.panel > summary.hd { list-style: none; }
.panel > summary.hd::-webkit-details-marker { display: none; }
.panel > .bd { padding: 16px; }
.panel > .bd.flush { padding: 0; }
.panel.sticky-actions { position: sticky; bottom: 0; z-index: 4; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.c5 { grid-template-columns: repeat(5, minmax(0,1fr)); }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 16px; }
.stat .k, .stat > span { color: var(--muted); font-size: 12.5px; display: block; }
.stat .v, .stat > strong { font-size: 22px; font-weight: 600; color: var(--head); margin-top: 2px; display: block; }
.stat .s { color: var(--muted); font-size: 12.5px; }
.stat.ok > strong { color: var(--ok); } .stat.bad > strong { color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }

/* ---------- alerts ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 12px; border: 1px solid transparent; border-left-width: 3px; font-size: 13.5px; background: var(--panel); }
.alert.success { background: var(--ok-soft); border-left-color: var(--ok); }
.alert.info { background: var(--info-soft); border-left-color: var(--green); }
.alert.warning { background: var(--warn-soft); border-left-color: var(--warn); }
.alert.danger, .alert.error { background: var(--danger-soft); border-left-color: var(--danger); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--green);
  background: var(--green); color: var(--panel); font: 500 13.5px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.3;
}
.btn:hover { background: var(--green-2); border-color: var(--green-2); color: var(--panel); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--green); color: var(--green); background: var(--panel); }
.btn.danger { background: var(--panel); color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--panel); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: var(--panel); }
.btn.warn:hover { filter: brightness(1.08); color: var(--panel); }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label { font-weight: 500; color: var(--head); font-size: 13px; display: block; margin-bottom: 3px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=email], input[type=url], input:not([type]), select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); font: 14px var(--font); background: var(--panel); color: var(--ink);
}
input[type=file] { font: 13px var(--font); color: var(--ink); }
input[type=color] { width: 56px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--green); }
textarea.invalid { border-color: var(--danger); }
textarea.code, textarea#fmt-def { font: 12.5px/1.5 var(--mono); min-height: 340px; white-space: pre; tab-size: 2; background: var(--panel-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.field.req > label::after { content: " *"; color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline .field { min-width: 160px; }
.inline-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.inline-row input { max-width: 260px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; max-height: 70vh; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: var(--panel-2); color: var(--muted); text-align: left; font-weight: 500; padding: 7px 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
table.tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tbody tr:hover td { background: var(--panel-2); }
table.tbl td.num, table.tbl th.num { text-align: right; }
table.tbl td.actions { white-space: nowrap; width: 1%; }
table.tbl a.rowlink { color: inherit; text-decoration: none; display: block; }
table.tbl.nowrap td { white-space: nowrap; }
table.tbl tr.row-bad td { background: var(--danger-soft); }
table.tbl tfoot td, table.tbl tr.total td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.pager { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--panel-2); flex-wrap: wrap; }
.pager .info { color: var(--muted); margin-right: auto; font-size: 13px; }
.badge, .chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok, .chip-in { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.error, .chip-bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.warning { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.manual, .badge.unchecked, .badge.obsolete, .chip-soft { background: var(--panel-2); color: var(--muted); }
.chip-out { background: var(--primary-soft); color: var(--green); border-color: transparent; }
.badge.t-select { background: var(--info-soft); color: var(--green); border-color: transparent; }
.badge.t-update, .badge.t-delete, .badge.t-append, .badge.t-maketable { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.t-crosstab, .badge.t-union { background: var(--panel-2); color: var(--head); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 14px; flex-wrap: wrap; }
.tabs button, .tabs .tab {
  border: 0; border-bottom: 2px solid transparent; background: none; padding: 8px 14px; cursor: pointer; font: 500 13.5px var(--font); color: var(--muted);
  text-decoration: none; margin-bottom: -1px;
}
.tabs button:hover, .tabs .tab:hover { color: var(--ink); }
.tabs button.on, .tabs .tab.on { color: var(--green); border-bottom-color: var(--green); }
.tabs .badge { margin-left: 4px; }
.tabpane { display: none; } .tabpane.on { display: block; }

/* ---------- format file cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px 12px; display: flex; flex-direction: column; }
.card.muted { opacity: .6; }
.card-hd { display: flex; gap: 6px; flex-wrap: wrap; }
.card h3 { font-size: 15px; font-weight: 600; margin: 10px 0 4px; }
.card p { margin: 0 0 12px; flex: 1; }
.card-ft { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-ft .mono { margin-left: auto; }
.small { font-size: 12.5px; }
.fmt-cols td { padding: 4px 6px; }
.fmt-cols input, .fmt-cols select { padding: 4px 6px; font-size: 13px; min-width: 90px; }
.fmt-cols input.wide { min-width: 260px; }
.fmt-cols input.num { min-width: 60px; width: 70px; }
.fmt-cols td.drag { cursor: grab; color: var(--muted); width: 1%; }
.fmt-cols tr.dragging td { opacity: .45; }
.prose p { max-width: 78ch; }

/* ---------- home ---------- */
.hero { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); padding: 22px 26px; margin-bottom: 16px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.hero h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.hero p { margin: 0 0 8px; color: var(--muted); max-width: 62ch; }
.hero .period-big { border-left: 3px solid var(--green); padding: 4px 0 4px 18px; }
.hero .period-big .val { font-size: 34px; font-weight: 600; color: var(--head); font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero .period-big .sub { color: var(--muted); }
.menu-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.menu-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 16px; }
.menu-card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.menu-card a { display: block; padding: 3px 0; text-decoration: none; color: var(--ink); }
.menu-card a:hover { color: var(--green); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 8px 4px 0; }
.bars .bar { flex: 1; background: var(--green); opacity: .85; border-radius: 3px 3px 0 0; position: relative; min-width: 14px; }
.bars .bar:last-child { opacity: 1; }
.bars .bar:hover { opacity: 1; }
.bars .bar span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- login / setup ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { width: 420px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.login-card .brandline { padding: 22px 24px 4px; display: flex; gap: 12px; align-items: center; }
.login-card .brandline .mark { width: 38px; height: 38px; border-radius: 9px; background: var(--green); color: var(--panel); display: grid; place-items: center; font-weight: 700; }
.login-card .brandline h1 { font-size: 18px; margin: 0; }
.login-card .brandline p { margin: 0; color: var(--muted); font-size: 13px; }
.login-card form { padding: 16px 24px 22px; display: grid; gap: 12px; }
.login-card .foot { color: var(--muted); font-size: 12px; text-align: center; padding: 10px 0 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.setup-wrap { max-width: 860px; margin: 32px auto; padding: 0 16px; }

/* ---------- query & report tools ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
.side-list { max-height: 520px; overflow: auto; font-size: 13px; }
.side-list a { display: block; padding: 2px 0; text-decoration: none; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 5px 12px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
.sqlbox { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--radius); overflow: auto; max-height: 360px; font: 12.5px/1.5 var(--mono); white-space: pre; margin: 0; }
.diff-del { background: var(--danger-soft); } .diff-add { background: var(--ok-soft); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.filters .field { min-width: 150px; }

/* report viewer: pages stay white paper in every theme */
.rpt-toolbar { position: sticky; top: var(--header-h); z-index: 5; background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; border-radius: var(--radius-lg); display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.rpt-toolbar .info { color: var(--muted); margin-left: auto; font-size: 12.5px; }
.rpt-doc { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; overflow-x: auto; max-width: 100%; padding-bottom: 6px; }
.rpt-page { flex: 0 0 auto; background: #fff; box-shadow: 0 2px 10px rgba(24, 35, 58, .15); position: relative; overflow: hidden; color: #000; }
.rpt-band { position: relative; }
.rpt-c { position: absolute; overflow: hidden; white-space: nowrap; line-height: 1.15; }
.rpt-c.wrap { white-space: pre-wrap; }
.rpt-line { position: absolute; border-top: 1px solid #000; }
.rpt-rect { position: absolute; border: 1px solid #000; }

/* report designer */
.designer { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 12px; }
.design-canvas { background: var(--panel-2); border: 1px solid var(--line); padding: 14px; overflow: auto; border-radius: var(--radius-lg); max-height: 74vh; }
.design-page { background: #fff; margin: 0 auto; position: relative; box-shadow: 0 1px 6px rgba(24, 35, 58, .15); }
.design-band { position: relative; border-bottom: 1px dashed #9aa7b8; background-image: linear-gradient(90deg, rgba(0,0,0,.04) 1px, transparent 1px), linear-gradient(rgba(0,0,0,.04) 1px, transparent 1px); background-size: 9.6px 9.6px; }
.design-band .band-label { position: absolute; left: -2px; top: -1px; transform: translateY(-100%); font-size: 11px; color: #fff; background: #4a5a74; padding: 1px 6px; border-radius: 3px 3px 0 0; pointer-events: none; }
.design-band + .design-band { margin-top: 16px; }
.design-c { position: absolute; border: 1px dotted #7d8aa0; background: rgba(255,255,255,.85); font-size: 10px; overflow: hidden; white-space: nowrap; cursor: move; color: #111; padding: 0 1px; user-select: none; }
.design-c.label { background: rgba(231,236,248,.9); }
.design-c.line { border: 0; border-top: 1px solid #000; background: transparent; height: 3px !important; }
.design-c.sel { outline: 2px solid #2d4fa3; z-index: 3; }
.design-c .rs { position: absolute; right: -3px; bottom: -3px; width: 7px; height: 7px; background: #2d4fa3; cursor: se-resize; }
.prop-panel { max-height: 74vh; overflow: auto; }
.prop-panel .field { margin-bottom: 8px; }

.muted { color: var(--muted); }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.modal-back { position: fixed; inset: 0; background: rgba(18, 22, 29, .45); display: grid; place-items: center; z-index: 999; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  body { background: #fff; } .app-header, .sidebar, .rpt-toolbar, .page-title, .no-print { display: none !important; }
  .main { padding: 0; } .rpt-doc { gap: 0; } .rpt-page { box-shadow: none; page-break-after: always; break-after: page; }
}
@media (max-width: 1000px) {
  .sidebar { position: fixed; left: 0; top: var(--header-h); bottom: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 16px rgba(0,0,0,.15); }
  .sidebar.open { transform: none; }
  .app-header .brand { width: auto; flex: 0 1 auto; border-right: 0; }
  .app-header .menu-toggle { display: inline-flex; margin-left: 12px; }
  .grid.c2, .grid.c3, .grid.c4, .grid.c5, .split, .designer, .hero { grid-template-columns: 1fr; }
  .main { padding: 16px 14px 32px; }
  .period-stamp .sub, .app-header .userbox .hide-sm { display: none; }
}
@media (max-width: 640px) { .period-stamp { display: none; } .app-header .userbox { gap: 10px; } }

/* monthly cycle on the home page (a real sequence, hence the numbers) */
.cycle { list-style: none; counter-reset: step; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; }
.cycle li { counter-increment: step; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.cycle li::before { content: counter(step); grid-row: span 2; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; border: 1.5px solid var(--line-strong); color: var(--muted); font-variant-numeric: tabular-nums; }
.cycle li.ok::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: var(--panel); }
.cycle li.part::before { border-color: var(--warn); color: var(--warn); }
.cycle li > a:first-of-type { font-weight: 500; color: var(--head); text-decoration: none; }
.cycle li > a:first-of-type:hover { color: var(--green); text-decoration: underline; }
.cycle li span { color: var(--muted); font-size: 13px; grid-column: 2; }
.cycle li .alt { grid-column: 3; grid-row: 1 / span 2; font-size: 13px; }

/* web installer */
.login-wrap > div:has(> .install) { width: min(760px, 100%); }
.install { padding: 8px 0 30px; }
.install .brandline { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.install .brandline .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; }
.install h1 { font-size: 22px; margin: 14px 0 6px; }
.install .panel { margin-top: 14px; }
.install .opt { margin: 8px 0 0 26px; }
.install .check { display: flex; gap: 8px; align-items: flex-start; }
.install-go { display: flex; gap: 14px; align-items: center; margin: 18px 0 0; flex-wrap: wrap; }
@media (max-width: 640px) {
  .install .form-grid { grid-template-columns: 1fr; }
  .install .form-grid > .field { grid-column: auto !important; }
  .install .opt { margin-left: 0; }
}
/* "Ganti kode" pop-over and inline action rows */
details.rekey { position: relative; }
details.rekey > summary { list-style: none; cursor: pointer; }
details.rekey > summary::-webkit-details-marker { display: none; }
details.rekey .rekey-box { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 320px; display: grid; gap: 8px; padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 30, 60, .16); }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ dashboards
   categorical slots in fixed order (validated: CVD adjacent ΔE ≥ 8.4, normal-vision ≥ 19.3, light & dark) */
.dash { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
        --grid: #e6e9ef; --axis: #c6cfdb; --up: #1e7a5c; --down: #b3261e; }
:root[data-theme="dark"] .dash { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --grid: #2c3442; --axis: #3a4455; --up: #6fcfa8; --down: #f08a80; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .dash { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --grid: #2c3442; --axis: #3a4455; --up: #6fcfa8; --down: #f08a80; }
}
.dash-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.dash-head h1 { margin: 0; font-size: 24px; }
.dash-head p { margin: 2px 0 0; color: var(--muted); }
.dash-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.dfl { display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 6px 10px 8px; min-width: 160px; }
.dfl span { font-size: 11.5px; color: var(--muted); }
.dfl select { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 600; color: var(--ink); min-width: 140px; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.kpi .k i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.kpi .v { font-size: clamp(17px, 1.3vw, 22px); overflow-wrap: anywhere; font-weight: 700; margin: 6px 0 2px; color: var(--head); letter-spacing: -.01em; }
.kpi .s { font-size: 12.5px; color: var(--muted); }
.kpi .s .up { color: var(--up); font-weight: 600; } .kpi .s .down { color: var(--down); font-weight: 600; }
.dash-grid { display: grid; gap: 14px; grid-template-columns: repeat(12, minmax(0, 1fr)); margin-bottom: 14px; }
.dash-grid > .card { grid-column: span 4; }
.dash-grid > .card.w5 { grid-column: span 5; } .dash-grid > .card.w6 { grid-column: span 6; } .dash-grid > .card.w7 { grid-column: span 7; } .dash-grid > .card.w8 { grid-column: span 8; } .dash-grid > .card.w12 { grid-column: span 12; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 10px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.donut-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: center; }
.viz { width: 100%; height: auto; display: block; overflow: visible; }
.viz.donut { max-width: 200px; }
.viz .grid { stroke: var(--grid); stroke-width: 1; } .viz .base { stroke: var(--axis); stroke-width: 1; }
.viz .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; } .viz .lbl { fill: var(--ink); font-size: 11.5px; font-weight: 600; }
.viz .c-top { fill: var(--muted); font-size: 12px; } .viz .c-val { fill: var(--head); font-size: 15px; font-weight: 700; }
.viz [data-tip] { cursor: default; outline: none; transition: opacity .12s; }
.viz:hover [data-tip]:not(:hover) { opacity: .55; }
.viz [data-tip]:focus-visible { stroke: var(--ink); stroke-width: 2; }
.viz .pt { stroke: var(--panel); stroke-width: 2; }
.viz-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13px; }
.viz-legend.row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12.5px; }
.viz-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.viz-legend.row li { display: flex; }
.viz-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.viz-legend b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; padding-left: 10px; }
.viz-legend .pct { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--green); color: #fff; }
.dash-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--head); color: var(--panel); font-size: 12.5px; padding: 6px 9px; border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18); max-width: 300px; opacity: 0; transition: opacity .1s; }
.dash-tip.on { opacity: 1; }
.tbl tr.sub td { color: var(--muted); font-size: 12.5px; }
.tbl tr.sub td:first-child { padding-left: 28px; }
.tbl tr.grp td:first-child button { text-align: left; border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--ink); font-weight: 600; padding: 0; display: inline-flex; gap: 6px; align-items: center; }
.tbl tr.grp td:first-child .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.insights { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; }
.mini-donut { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; }
.mini-donut .viz.donut { max-width: 130px; }
@media (max-width: 1500px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .dash-grid > .card, .dash-grid > .card.w5, .dash-grid > .card.w7 { grid-column: span 6; } .dash-grid > .card.w8 { grid-column: span 12; } }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid > .card, .dash-grid > .card[class*="w"] { grid-column: span 12; } .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }

.tbl.compact { table-layout: fixed; width: 100%; }
.tbl.compact td, .tbl.compact th { white-space: normal; overflow-wrap: anywhere; }
.tbl tr.grp td:first-child button { align-items: flex-start; }
.tbl tr.grp td:first-child .dot { margin-top: 5px; flex: none; }

.viz-empty { margin: 0; padding: 36px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.dash .tbl td.num { white-space: nowrap; }
