/* Maintenance Scheduler — clean monospace UI */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #14171a;
  --ink-soft: #5b6470;
  --line: #e3e6ea;
  --line-strong: #cbd1d9;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --ok: #1a7f37;
  --ok-bg: #e8f5ec;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --danger: #b42318;
  --danger-bg: #fdeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,23,26,.06), 0 1px 3px rgba(20,23,26,.05);
  --font: 'Google Sans', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand-link { color: var(--ink); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-link:hover { text-decoration: none; }
.logo-mark { display: inline-flex; flex: none; }
.logo-mark svg { display: block; border-radius: 9px; box-shadow: 0 1px 3px rgba(31,111,235,.35); }
.brand-word { display: flex; flex-direction: column; line-height: 1.05; }
.brand-word b { font-weight: 800; font-size: 15px; letter-spacing: .3px; color: var(--ink); }
.brand-word .bw-sub { font-size: 10.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-soft); }
.nav-panel { display: contents; }         /* desktop: children flow in the topbar flex */
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.mainnav a {
  color: var(--ink-soft); padding: 6px 12px; border-radius: 8px; font-weight: 500;
}
.mainnav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.mainnav a.active { background: var(--ink); color: #fff; }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.uname { color: var(--ink-soft); font-size: 13px; }
.user form { margin: 0; }
/* Hamburger (hidden on desktop) */
.nav-toggle { display: none; margin-left: auto; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 8px; border-radius: 8px; }
.nav-toggle:hover { background: var(--bg); }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: .2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- Layout ---- */
/* ~83% of the viewport (like Bootstrap's 10/12 columns), capped on ultrawide screens. */
.container { width: 83.333%; max-width: 1800px; margin: 0 auto; padding: 28px 24px; flex: 1; }
.container-wide { max-width: 1600px; }
/* Use more width as the screen narrows so it stays comfortable. */
@media (max-width: 1200px) { .container { width: 90%; } }
@media (max-width: 768px)  { .container { width: 100%; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 700; }
.page-head .sub { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card + .card, form + .card { margin-top: 18px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }

/* ---- Stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat .l { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.stat.accent .n { color: var(--accent); }
.stat.warn .n { color: var(--warn); }
.stat.danger .n { color: var(--danger); }
.stat.ok .n { color: var(--ok); }

/* ---- Dashboard ---- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-left: 3px solid var(--line-strong); }
.kpi-n { font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.kpi-l { color: var(--ink-soft); font-size: 11.5px; margin-top: 2px; }
.kpi.ok { border-left-color: var(--ok); } .kpi.ok .kpi-n { color: var(--ok); }
.kpi.warn { border-left-color: var(--warn); } .kpi.warn .kpi-n { color: var(--warn); }
.kpi.accent { border-left-color: var(--accent); } .kpi.accent .kpi-n { color: var(--accent); }
.kpi.danger { border-left-color: var(--danger); } .kpi.danger .kpi-n { color: var(--danger); }
.kpi.muted-tile .kpi-n { color: var(--ink-soft); }

.dash-row { display: grid; gap: 18px; margin-bottom: 18px; align-items: stretch; }
.dash-row.cols-2 { grid-template-columns: 1fr 1fr; }
/* Cards in a row keep equal height; body centers so short + tall content stay balanced. */
.dash-card { display: flex; flex-direction: column; }
.dash-card > h2 { flex: none; }
.dash-card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }

/* Donut (conic-gradient) */
.donuts { display: flex; gap: 28px; flex-wrap: wrap; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.donut {
  --pct: 0; --col: var(--accent);
  width: 132px; height: 132px; border-radius: 50%;
  background: conic-gradient(var(--col) calc(var(--pct) * 1%), #e9edf2 0);
  display: grid; place-items: center; position: relative;
}
.donut-hole { width: 96px; height: 96px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-pct { font-size: 24px; font-weight: 700; }
.donut-cap { font-size: 11px; color: var(--ink-soft); }
.donut-legend { font-size: 12px; color: var(--ink-soft); }
.donut-legend b { color: var(--ink); }

/* Stacked distribution bar */
.stackbar { display: flex; height: 18px; border-radius: 9px; overflow: hidden; background: #eef1f5; }
.stackbar.sm { height: 10px; border-radius: 6px; }
.stackbar span { display: block; height: 100%; }
.distrib-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-top: 14px; }
.distrib-legend.inline { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.dl-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dl-item .dl-lab { color: var(--ink-soft); }
.dl-item .dl-n { margin-left: auto; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Monthly bar chart */
.barchart { display: flex; align-items: flex-end; gap: 6px; height: 170px; }
.bc-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bc-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bc-stack { width: 66%; max-width: 34px; min-height: 0; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; background: #eef1f5; }
.bc-stack span { display: block; width: 100%; }
.bc-col.is-current .bc-stack { outline: 2px solid var(--accent); outline-offset: 1px; }
.bc-total { font-size: 11px; color: var(--ink-soft); margin-top: 6px; height: 14px; }
.bc-label { font-size: 11px; color: var(--ink-soft); }
.bc-col.is-current .bc-label { color: var(--accent); font-weight: 700; }

/* By system */
.sysrows { display: flex; flex-direction: column; gap: 14px; }
.sysrow-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sysrow-name { font-weight: 600; font-size: 13px; }
.sysrow-meta { font-size: 12px; color: var(--ink-soft); }
.sysrow-meta b { color: var(--ink); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.table-wrap.flush { border: none; box-shadow: none; border-radius: 0; }
td.nowrap, th.nowrap { white-space: nowrap; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafbfc; color: var(--ink-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
td.wrap, th.wrap { white-space: normal; }
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }

/* ---- Schedule grid ---- */
.grid-table th.month, .grid-table td.month { text-align: center; min-width: 62px; padding: 6px 4px; }
.grid-table td.cell { font-size: 11px; text-align: center; line-height: 1.3; }
.grid-table .sys-row td { background: #eef1f5; font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; color: var(--ink); }
.cellchip { display: inline-block; padding: 2px 5px; border-radius: 5px; font-size: 10px; font-weight: 500; }
.cellchip.pending { background: #eef2f7; color: var(--ink-soft); }
.cellchip.done { background: var(--ok-bg); color: var(--ok); }
.cellchip.skipped { background: #f0eef7; color: #6b5bb0; }
.cellchip.overdue { background: var(--danger-bg); color: var(--danger); }
.cellchip.partial { background: var(--warn-bg); color: var(--warn); }
.cellchip.is-partial { box-shadow: inset 0 -3px 0 var(--warn); }
.cellchip.this-month { outline: 2px solid var(--accent); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.freq { background: #eef2f7; color: var(--ink-soft); }
.badge.done { background: var(--ok-bg); color: var(--ok); }
.badge.pending { background: #eef2f7; color: var(--ink-soft); }
.badge.skipped { background: #f0eef7; color: #6b5bb0; }
.badge.overdue { background: var(--danger-bg); color: var(--danger); }
.badge.partial { background: var(--warn-bg); color: var(--warn); }
.badge.sys { background: #e7edf9; color: var(--accent); }

/* ---- Occurrence progress / partial completion ---- */
.occ-list { display: flex; flex-direction: column; gap: 12px; }
.occ-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fbfcfd; }
.occ-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.occ-when { font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.occ-count { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.occ-count b { color: var(--ink); font-size: 15px; }
.progressbar { height: 8px; background: #e9edf2; border-radius: 6px; overflow: hidden; margin: 9px 0 11px; }
.progressbar span { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width .25s; }
.progressbar span.partial { background: var(--warn); }
.progressbar span.done { background: var(--ok); }
.progressbar span.skipped { background: #b0a8d0; }
.occ-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logwork { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.logwork .lw-label { margin: 0; }
.logwork input[type=number] { width: 68px; }
.logwork input[type=date] { width: auto; }
.logwork .lw-note { width: 150px; }
.occ-btns { display: flex; gap: 6px; margin-left: auto; }
.occ-btns form { margin: 0; }
.occ-history { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.hist { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.hist-qty { font-weight: 700; color: var(--ok); background: var(--ok-bg); border-radius: 5px; padding: 1px 6px; }
.hist-note { color: var(--ink-soft); }
.hist-del { margin-left: auto; }
.hist-del button { padding: 2px 6px; line-height: 1; }

/* ---- Buttons ---- */
.btn {
  font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); transition: .12s;
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---- Forms ---- */
label { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  font-family: var(--font); font-size: 13px; width: 100%;
  padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
/* Native select fallback (before JS enhances it): custom chevron, no default arrow. */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 30px; cursor: pointer;
  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='%235b6470' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.field { margin-bottom: 14px; }

/* ---- Custom select (progressive enhancement over a real <select>) ---- */
.cselect { position: relative; display: inline-flex; vertical-align: middle; }
.cselect.cselect-block { display: flex; width: 100%; }
.cselect select.cselect-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cselect-trigger {
  display: inline-flex; align-items: center; gap: 10px; justify-content: space-between;
  min-width: 120px; width: 100%; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: border-color .12s, box-shadow .12s; white-space: nowrap;
}
.cselect-trigger:hover { border-color: var(--ink-soft); }
.cselect.open .cselect-trigger { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
.cselect-trigger .chev { flex: none; transition: transform .18s; color: var(--ink-soft); }
.cselect.open .cselect-trigger .chev { transform: rotate(180deg); }
.cselect-value { overflow: hidden; text-overflow: ellipsis; }
.cselect-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20,23,26,.14), 0 2px 6px rgba(20,23,26,.08);
  padding: 5px; max-height: 280px; overflow-y: auto;
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top;
  pointer-events: none; transition: opacity .14s, transform .14s;
}
.cselect.open .cselect-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.cselect-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.cselect-opt:hover, .cselect-opt.active { background: var(--bg); }
.cselect-opt.selected { color: var(--accent); font-weight: 600; }
.cselect-opt .tick { opacity: 0; flex: none; }
.cselect-opt.selected .tick { opacity: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.checkline { display: flex; align-items: center; gap: 8px; }
.checkline input { width: auto; }
.checkline label { margin: 0; }

/* ---- Flash ---- */
.flash { padding: 10px 24px; font-size: 13px; font-weight: 600; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-err { background: var(--danger-bg); color: var(--danger); }

.result { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.err { background: var(--danger-bg); color: var(--danger); }
.preview-box { background: #0d1117; color: #c9d1d9; padding: 14px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; margin-top: 10px; line-height: 1.55; }

/* ---- Daily Log ---- */
.log-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.log-filters { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.scope-tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.scope-tab { padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.scope-tab:hover { color: var(--ink); text-decoration: none; }
.scope-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.log-prog { display: flex; align-items: center; gap: 8px; }
.log-input { display: flex; align-items: center; gap: 4px; }
.log-input input[type=number] { width: 72px; text-align: center; }
.lw-all { padding: 5px 8px; }
.log-save { position: sticky; bottom: 0; margin-top: 14px; padding: 12px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: linear-gradient(transparent, var(--bg) 40%); }
.btn-lg { padding: 11px 22px; font-size: 14px; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(20,23,26,.45); padding: 24px; animation: modalFade .15s ease;
}
.modal {
  background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 85vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: modalPop .16s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--ink-soft); padding: 4px 8px; border-radius: 6px; line-height: 1; }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-body .preview-box { margin: 0; max-height: 50vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- Auth ---- */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 18px; margin: 0 0 4px; }
.auth-card .sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 20px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-brand .logo-mark svg { width: 40px; height: 40px; }
.auth-brand .brand-word b { font-size: 18px; }
.auth-brand .brand-word .bw-sub { font-size: 12px; }

/* ---- Footer ---- */
.footer { text-align: center; color: var(--ink-soft); font-size: 12px; padding: 20px; display: flex; gap: 8px; justify-content: center; }

/* ---- Utility ---- */
.row-flex { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.tag-path { color: var(--ink-soft); font-size: 11px; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; }

/* ---- Custom file picker ---- */
.filepick { display: block; }
.filepick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.filepick-box {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px dashed var(--line-strong); border-radius: 12px;
  padding: 16px 18px; background: #fbfcfd; cursor: pointer; transition: .15s;
}
.filepick-box:hover { border-color: var(--accent); background: #f4f8ff; }
.filepick.dragover .filepick-box { border-color: var(--accent); background: #eef4ff; }
.filepick.has-file .filepick-box { border-style: solid; border-color: var(--accent); background: #f4f8ff; }
.filepick-ico {
  width: 42px; height: 42px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-size: 20px;
  background: #e7edf9; color: var(--accent);
}
.filepick-body { min-width: 0; flex: 1; }
.filepick-title { font-weight: 600; font-size: 14px; }
.filepick-sub { color: var(--ink-soft); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filepick-cta { font-size: 12px; font-weight: 600; color: var(--accent); flex: none; }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination .pg {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.pagination a.pg:hover { border-color: var(--ink-soft); text-decoration: none; }
.pagination .pg.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .pg.disabled { opacity: .45; pointer-events: none; }
.pagination .pg.gap { border: none; background: none; pointer-events: none; min-width: 18px; }
.pagination .pg-info { margin-left: auto; color: var(--ink-soft); font-size: 12px; }

/* ---- Settings redesign ---- */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.settings-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a {
  padding: 9px 12px; border-radius: 8px; color: var(--ink-soft); font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 9px;
}
.settings-nav a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.settings-nav a.active { background: var(--ink); color: #fff; }
.sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.sec-head h2 { margin: 0; font-size: 15px; }
.sec-desc { color: var(--ink-soft); font-size: 12.5px; margin: 0 0 16px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.toggle-row:first-of-type { border-top: none; }
.toggle-row .tr-label { font-weight: 600; font-size: 13.5px; }
.toggle-row .tr-desc { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
/* iOS-style switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line-strong); border-radius: 24px; transition: .18s; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .18s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(20px); }
.settings-sticky-save {
  position: sticky; bottom: 0; margin-top: 18px; padding: 14px 0 4px;
  background: linear-gradient(transparent, var(--bg) 30%);
  display: flex; gap: 10px; align-items: center;
}
.chip-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef2f7; padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ===================== Responsive ===================== */
.hide-sm { display: table-cell; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .dash-row.cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  /* Collapsible mobile nav */
  .nav-toggle { display: flex; }
  .nav-panel {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    padding: 8px; z-index: 30;
  }
  .nav-panel.open { display: flex; }
  .mainnav { flex-direction: column; gap: 2px; margin: 0; }
  .mainnav a { padding: 11px 12px; }
  .user { margin: 6px 4px 2px; padding-top: 10px; border-top: 1px solid var(--line); justify-content: space-between; }

  /* Layout & typography */
  .container { padding: 18px 14px; }
  .page-head h1 { font-size: 18px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-n { font-size: 21px; }
  .toolbar { width: 100%; }
  .toolbar .cselect, .toolbar select, .toolbar input[type=text] { flex: 1; min-width: 0; }

  /* Hide lower-priority table columns on phones (they remain on the task page) */
  .hide-sm { display: none; }

  /* Dashboard viz */
  .distrib-legend { grid-template-columns: 1fr; }
  .barchart { height: 150px; gap: 3px; }
  .bc-total { font-size: 10px; }
  .bc-label { font-size: 9px; }
  .donuts { justify-content: space-around; gap: 16px; }

  /* Occurrence cards / settings */
  .occ-actions { flex-direction: column; align-items: stretch; }
  .occ-btns { margin-left: 0; }
  .logwork { flex-wrap: wrap; }
  .settings-sticky-save { position: static; flex-direction: column; align-items: stretch; }
  .modal-overlay { padding: 12px; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .stat .n { font-size: 22px; }
  .page-head { flex-direction: column; align-items: stretch; }
}



