/* ============================================================
   TinkerSpace EMS — design system
   PCB teal + LED amber on lab paper. IBM Plex Sans.
   ============================================================ */

:root {
  --teal:      #0D6E6E;
  --teal-dk:   #0A5656;
  --teal-lt:   #E3F1EF;
  --amber:     #F2A900;
  --amber-lt:  #FFF4D6;
  --paper:     #F3F5F4;
  --surface:   #FFFFFF;
  --ink:       #16211F;
  --ink-2:     #3B4846;
  --muted:     #5E6B68;
  --line:      #DDE3E1;
  --line-2:    #EBEFEE;
  --ok:        #1F8A4C;  --ok-lt:   #E4F4EA;
  --warn:      #9A6700;  --warn-lt: #FFF1CF;
  --bad:       #C2410C;  --bad-lt:  #FDE8DE;
  --info:      #2D5DA8;  --info-lt: #E6EEFA;
  --side:      #10302F;  /* sidebar */
  --radius:    10px;
  --radius-sm: 7px;
  --tabs-h:    64px;
  --top-h:     56px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p  { margin: 0; }
b, strong { font-weight: 600; }
small { font-size: 13px; }
.ic { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.stack-s > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── App shell ─────────────────────────────────────────────── */
.app { min-height: 100vh; display: flex; }
.side {
  width: 248px; flex: none; background: var(--side); color: #C9D6D4;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 16px; }
.brand-text small { font-size: 12px; color: #8FA6A3; }
/* Mark: a chip outline with a lit LED */
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; border: 2px solid #5FB3AC;
  position: relative; flex: none; background: rgba(95,179,172,.08);
}
.brand-mark span {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: var(--amber); right: 6px; top: 6px; box-shadow: 0 0 0 3px rgba(242,169,0,.25);
}
.brand-mark::before, .brand-mark::after {
  content: ''; position: absolute; left: 6px; height: 2px; background: #5FB3AC; border-radius: 1px;
}
.brand-mark::before { top: 14px; width: 14px; }
.brand-mark::after  { top: 20px; width: 9px; }
.brand-mark.sm { width: 30px; height: 30px; border-color: var(--teal); background: var(--teal-lt); }
.brand-mark.sm::before, .brand-mark.sm::after { background: var(--teal); }

.side-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.side-group { font-size: 12px; color: #7F9693; padding: 18px 10px 6px; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px;
  color: #C9D6D4; font-size: 14px; font-weight: 500; text-decoration: none; position: relative;
}
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.side-link.is-active { background: rgba(95,179,172,.16); color: #fff; }
.side-link.is-active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--amber);
}
.side-link .ic { width: 18px; height: 18px; opacity: .9; }
.count {
  margin-left: auto; font-style: normal; font-size: 12px; font-weight: 600; min-width: 22px; height: 20px;
  padding: 0 6px; border-radius: 10px; background: var(--amber); color: #3A2A00;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.side-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.side-user-text b { color: #fff; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text small { color: #8FA6A3; font-size: 12px; }
.side-user .icon-btn { color: #C9D6D4; }
.side-user .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--teal-lt); color: var(--teal-dk);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none;
}
.side .avatar { background: #1E4A48; color: #CFE7E4; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 10px;
  padding: 0 24px; background: rgba(243,245,244,.92); backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid transparent;
}
.top-title { flex: 1; font-weight: 600; font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-mark, .top-back { display: none; }
@media (min-width: 1024px) { .top-title { visibility: hidden; } .top { border-bottom: 0; } }
.bell { position: relative; }
.bell .dot {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--paper);
}

.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); background: transparent; border: 0; cursor: pointer; text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--line-2); text-decoration: none; }
.icon-btn.is-active { color: var(--teal); background: var(--teal-lt); }

/* Page */
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 4px 32px 48px; }
.page-wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Bottom tabs + sheet (mobile only) */
.tabs { display: none; }
.sheet { display: none; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: 9px; border: 1px solid transparent; font: 600 14px/1 var(--font); cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.btn:hover { text-decoration: none; border-color: #C3CDCA; background: #FAFBFB; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dk); border-color: var(--teal-dk); color: #fff; }
.btn-ok      { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover{ background: #187040; border-color: #187040; color: #fff; }
.btn-danger  { background: var(--surface); border-color: #F0C7B5; color: var(--bad); }
.btn-danger:hover { background: var(--bad-lt); border-color: var(--bad); color: var(--bad); }
.btn-solid-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-solid-danger:hover { background: #A23609; color: #fff; }
.btn-ghost   { background: transparent; border-color: transparent; color: var(--teal); padding: 0 10px; }
.btn-ghost:hover { background: var(--teal-lt); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-xs { min-height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-xs .ic { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ── Forms ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .field-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.req { color: var(--bad); }
.field-hint { font-size: 13px; color: var(--muted); }
input:not([type]), input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password],
input[type=date], input[type=month], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #CFD8D5; border-radius: 9px;
  font: 15px/1.4 var(--font); color: var(--ink); background: #fff; appearance: none; -webkit-appearance: none;
}
select {
  padding-right: 34px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235E6B68' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,110,110,.15); }
input[readonly] { background: var(--line-2); color: var(--muted); }
input::placeholder, textarea::placeholder { color: #98A4A1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); flex: none; }

/* Segmented choice (radio buttons that look like a toggle group) */
.seg { display: flex; background: var(--line-2); border-radius: 10px; padding: 4px; gap: 4px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 10px;
  border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; text-align: center;
}
.seg input:checked + span { background: #fff; color: var(--teal-dk); box-shadow: 0 1px 2px rgba(22,33,31,.12); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--amber); }

/* Toggle switch */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; min-height: 40px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 13px; background: #C7D1CE; position: relative; flex: none; transition: background .2s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--amber); outline-offset: 2px; }

/* Filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.filters .field { margin: 0; min-width: 160px; flex: 1 1 160px; max-width: 260px; }
.filters .field > label { font-size: 13px; color: var(--muted); }
.filters .search { flex: 2 1 220px; max-width: 360px; }
.search-wrap { position: relative; }
.search-wrap .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search-wrap input { padding-left: 38px; }

/* ── Panels ────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; }
.panel-head .muted { font-size: 13px; }
.panel-body { padding: 20px; }
.panel-body.tight { padding: 8px 0; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); }
.split { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 20px; align-items: start; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.collapse-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.collapse-toggle .ic { transition: transform .2s; color: var(--muted); }
.collapse-toggle[aria-expanded="true"] .ic { transform: rotate(180deg); }

/* Notices */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.notice .ic { width: 18px; height: 18px; margin-top: 1px; }
.notice-success { background: var(--ok-lt); border-color: #BFE3CC; color: #14582F; }
.notice-error   { background: var(--bad-lt); border-color: #F4C8B4; color: #8A2E07; }
.notice-info    { background: var(--info-lt); border-color: #C9D8F0; color: #1F4278; }
.notice-warn    { background: var(--warn-lt); border-color: #F1D998; color: #6B4A00; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.chip-ok   { background: var(--ok-lt);   color: #166B39; }
.chip-warn { background: var(--warn-lt); color: #7A5300; }
.chip-bad  { background: var(--bad-lt);  color: #A2380A; }
.chip-info { background: var(--info-lt); color: #2A538F; }
.chip-mute { background: var(--line-2);  color: var(--muted); }
.chip-teal { background: var(--teal-lt); color: var(--teal-dk); }

/* Metrics strip: one panel, values separated by rules */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.metric { padding: 16px 20px; border-left: 1px solid var(--line-2); text-decoration: none; color: inherit; display: block; }
.metric:first-child { border-left: 0; }
a.metric:hover { background: #FAFBFB; text-decoration: none; }
.metric b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.metric span { font-size: 13px; color: var(--muted); }
.metric.is-alert b { color: var(--bad); }
.metric.is-warn b { color: var(--warn); }

/* ── Tables ────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: #FAFBFB; white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FAFCFB; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 600; background: #FAFBFB; border-top: 1px solid var(--line); }
.tbl .sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl tr.is-dim td { opacity: .55; }
.t-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* List rows */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.rows > li:last-child { border-bottom: 0; }
.rows .grow b { display: block; }
.rows .grow small { color: var(--muted); }

/* Empty state */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty p { max-width: 380px; margin: 0 auto 14px; font-size: 14px; }
.empty-mark { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 10px; border: 2px dashed #B9C6C2; }

/* ── Dialog & toast ────────────────────────────────────────── */
.dialog { position: fixed; inset: 0; z-index: 100; background: rgba(16,48,47,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog-panel { background: #fff; border-radius: 14px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(16,48,47,.25); animation: pop .18s ease-out; }
.dialog-panel.lg { max-width: 640px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--line-2); }
.dialog-head h2 { font-size: 17px; }
.dialog-body { padding: 20px; overflow-y: auto; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 24px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); display: flex; gap: 10px; align-items: center; animation: pop .18s ease-out; width: 100%; }
.toast .ic { width: 18px; height: 18px; color: #7EE2A8; }
.toast.is-error .ic { color: #FFB59A; }

.kv { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.kv-section { font-weight: 600; margin: 18px 0 10px; color: var(--teal-dk); }
.kv-section:first-child { margin-top: 0; }

/* ── Today block (employee home) ───────────────────────────── */
.today {
  background: var(--teal); color: #fff; border-radius: 14px; padding: 22px 24px; margin-bottom: 20px;
  display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; position: relative; overflow: hidden;
}
.today::after { /* faint trace lines, like a circuit board */
  content: ''; position: absolute; right: -40px; top: -30px; width: 240px; height: 240px; pointer-events: none;
  border: 2px solid rgba(255,255,255,.07); border-radius: 50%; box-shadow: 0 0 0 26px rgba(255,255,255,.03);
}
.today-date { font-size: 14px; color: #BFE2DE; display: flex; align-items: center; gap: 8px; }
.led { width: 10px; height: 10px; border-radius: 50%; background: #6B8A87; flex: none; }
.led.on  { background: #7EE2A8; box-shadow: 0 0 0 4px rgba(126,226,168,.22); }
.led.due { background: var(--amber); box-shadow: 0 0 0 4px rgba(242,169,0,.28); }
.today h2 { font-size: 22px; margin: 6px 0 4px; font-weight: 600; }
.today p { color: #D6ECE9; font-size: 14px; }
.today .btn { background: var(--amber); border-color: var(--amber); color: #2B1F00; min-height: 46px; padding: 0 22px; font-size: 15px; position: relative; z-index: 1; }
.today .btn:hover { background: #FFBC1F; }
.today .btn-line { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.today .btn-line:hover { background: rgba(255,255,255,.1); }

/* Day list (month view) */
.days { list-style: none; margin: 0; padding: 0; }
.day { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); align-items: start; position: relative; }
.day:last-child { border-bottom: 0; }
.day::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.day-date { line-height: 1.15; }
.day-date b { font-size: 20px; font-variant-numeric: tabular-nums; display: block; }
.day-date small { color: var(--muted); font-size: 12px; }
.day-main { min-width: 0; }
.day-main .t { font-weight: 600; }
.day-main .d { font-size: 14px; color: var(--muted); margin-top: 2px; }
.day-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.day-meta span { display: inline-flex; align-items: center; gap: 4px; }
.day-meta .ic { width: 15px; height: 15px; color: var(--muted); }
.day.is-missed::before { background: var(--bad); }
.day.is-missed .day-main .t { color: var(--bad); font-weight: 500; }
.day.is-sunday { background: #F7FAF9; }
.day.is-sunday .day-main .t { color: var(--muted); font-weight: 500; }
.day.is-leave::before { background: var(--amber); }
.day.is-leave .day-main .t { color: var(--warn); font-weight: 500; }
.day.is-today::before { background: var(--teal); }
.day.is-future { opacity: .5; }
.totals { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 14px 20px; border-top: 1px solid var(--line); background: #FAFBFB; font-size: 14px; border-radius: 0 0 var(--radius) var(--radius); }
.totals b { font-variant-numeric: tabular-nums; }

/* Quick calendar grid */
.qcal-wrap { overflow: auto; max-height: calc(100vh - 230px); border-top: 1px solid var(--line-2); }
.qcal { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.qcal th, .qcal td { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 0; white-space: nowrap; }
.qcal thead th { position: sticky; top: 0; z-index: 3; background: #FAFBFB; font-weight: 600; font-size: 12px; padding: 10px 8px; text-align: center; min-width: 116px; max-width: 116px; overflow: hidden; text-overflow: ellipsis; }
.qcal th.qd, .qcal td.qd { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 70px; text-align: left; padding: 8px 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.qcal thead th.qd { z-index: 4; background: #FAFBFB; }
.qcal td.qd small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.qcell { display: block; width: 116px; padding: 8px; text-align: center; overflow: hidden; text-overflow: ellipsis; font-size: 12px; border: 0; background: none; font-family: inherit; color: inherit; }
button.qcell { cursor: pointer; }
button.qcell:hover { background: var(--teal-lt); }
.q-done  { color: var(--ink); }
.q-miss  { background: var(--bad-lt); color: var(--bad); font-weight: 500; }
.q-leave { background: var(--warn-lt); color: var(--warn); font-weight: 500; }
.q-sun   { background: #F1F6F5; }
.q-fut   { background: #FBFCFC; }
.qcal tr.is-sunday td.qd { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); padding: 12px 20px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--line); }

/* Option cards (radio list) */
.options { display: grid; gap: 10px; margin-bottom: 16px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; position: relative; }
.option input { position: absolute; opacity: 0; }
.option .ic { color: var(--teal); margin-top: 1px; }
.option b { display: block; font-size: 14px; }
.option small { color: var(--muted); }
.option:has(input:checked), .option.is-checked { border-color: var(--teal); background: var(--teal-lt); box-shadow: inset 0 0 0 1px var(--teal); }
.option.is-disabled { cursor: default; background: #FAFBFB; }
.option.is-disabled .ic { color: var(--muted); }

/* ── School report slots ───────────────────────────────────── */
.rcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.rcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 10px; flex-wrap: wrap; }
.rcard-head h2 { font-size: 17px; }
.rcard-owner { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.rcard-owner b { color: var(--ink); }
.rcard-owner.is-me b { color: var(--teal-dk); }
.rcard-body { padding: 0 20px 18px; }
.rsec { font-size: 13px; color: var(--muted); margin: 10px 0 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.rsec b { color: var(--ink-2); font-weight: 600; }
.slots { display: grid; gap: 10px; }
.slots-4 { grid-template-columns: repeat(4, 1fr); }
.slots-6 { grid-template-columns: repeat(6, 1fr); }
.slot { border: 1.5px dashed #C6D1CE; border-radius: 10px; background: #FAFBFB; display: flex; flex-direction: column; align-items: center; padding: 8px 6px; min-height: 112px; text-align: center; position: relative; }
.slot.can-act { cursor: pointer; }
.slot.can-act:hover { border-color: var(--teal); background: var(--teal-lt); }
.slot.is-empty { justify-content: center; color: #A3AFAC; }
.slot.is-empty .ic { width: 26px; height: 26px; }
.slot.is-empty .slot-cap { margin-top: 6px; }
.slot.has-file { border-style: solid; border-color: #B8C4C1; background: #fff; }
.slot.st-approved    { border-color: var(--ok);   background: #F5FBF7; }
.slot.st-need_change { border-color: #E0A82E;     background: #FFFBEF; }
.slot-cap { font-size: 12px; color: var(--muted); }
.slot-thumb { width: 100%; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #F1F4F3; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.slot-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.slot-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 0 6px; color: var(--teal-dk); }
.slot-file .ic { width: 30px; height: 30px; }
.slot-status { font-size: 12px; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.slot-status.s-pending { color: var(--muted); }
.slot-status.s-approved { color: var(--ok); }
.slot-status.s-need_change { color: var(--warn); }
.slot-btns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.sbtn { font: 600 11px/1 var(--font); padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.sbtn:hover { border-color: var(--teal); color: var(--teal-dk); }
.sbtn.on-ok   { background: var(--ok); border-color: var(--ok); color: #fff; }
.sbtn.on-warn { background: #E0A82E; border-color: #E0A82E; color: #2B1F00; }
.sbtn-del:hover { border-color: var(--bad); color: var(--bad); }
.stars { display: inline-flex; gap: 2px; }
.star { background: none; border: 0; padding: 2px; cursor: default; color: #CBD5D2; line-height: 0; }
.star .ic { width: 20px; height: 20px; fill: currentColor; stroke: #8A9894; stroke-width: 1.2; }
.star.on { color: var(--amber); }
.star.on .ic { stroke: #A06F00; }
button.star { cursor: pointer; }
button.star:hover { color: #FFC94D; }
.stars.sm .star .ic { width: 17px; height: 17px; }
.slot .stars { margin-bottom: 4px; }
.comment-box { border-top: 1px solid var(--line-2); padding: 14px 20px 18px; }
.comment-box textarea { min-height: 64px; }
.comment-read { font-size: 14px; color: var(--ink-2); white-space: pre-wrap; }

/* Media viewer */
.viewer img, .viewer video { width: 100%; border-radius: 8px; display: block; background: #000; max-height: 70vh; object-fit: contain; }

/* ── Login ─────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); }
.login-art { background: var(--side); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { font-size: 34px; line-height: 1.15; max-width: 420px; margin-top: 40px; }
.login-art p { color: #A9C2BF; max-width: 380px; margin-top: 14px; font-size: 16px; }
.login-art .traces { position: absolute; right: -60px; bottom: -60px; width: 420px; height: 420px; opacity: .5; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; margin-bottom: 6px; }
.login-card .muted { margin-bottom: 24px; }
.pin { letter-spacing: .5em; font-size: 20px !important; text-align: center; font-variant-numeric: tabular-nums; }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  body { font-size: 15px; }
  .side { display: none; }
  .top { padding: 0 8px 0 12px; border-bottom-color: var(--line); background: rgba(255,255,255,.94); }
  .top-mark, .top-back { display: inline-flex; }
  .top-mark { padding: 4px; }
  .page { padding: 16px 16px calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { display: none; }       /* title already in the top bar */
  .page-head:not(:has(.page-sub)):not(:has(.page-actions)) { display: none; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  .split, .split-even { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; }
  .rows > li { padding: 12px 16px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { border-left: 0; border-top: 1px solid var(--line-2); padding: 14px 16px; }
  .metric:nth-child(-n+2) { border-top: 0; }
  .metric:nth-child(even) { border-left: 1px solid var(--line-2); }
  .metric b { font-size: 22px; }
  .filters { gap: 10px; }
  .filters .field { min-width: calc(50% - 5px); max-width: none; flex: 1 1 calc(50% - 5px); }
  .filters .search { flex-basis: 100%; max-width: none; }
  .day { grid-template-columns: 40px 1fr auto; padding: 12px 14px; gap: 10px; }
  .today { padding: 20px; }
  .today .btn { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .slots-4 { grid-template-columns: repeat(2, 1fr); }
  .slots-6 { grid-template-columns: repeat(2, 1fr); }
  .rcard-head, .rcard-body { padding-left: 14px; padding-right: 14px; }
  .comment-box { padding: 12px 14px 14px; }
  .toasts { bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); }

  /* Tables that turn into stacked rows on phones */
  .tbl-stack thead { display: none; }
  .tbl-stack, .tbl-stack tbody, .tbl-stack tr, .tbl-stack td, .tbl-stack tfoot { display: block; width: 100%; }
  .tbl-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
  .tbl-stack tbody tr:hover td { background: none; }
  .tbl-stack td { border: 0; padding: 3px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  .tbl-stack td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: none; max-width: 45%; }
  .tbl-stack td[data-label=""]::before, .tbl-stack td:not([data-label])::before { display: none; }
  .tbl-stack td.lead { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  .tbl-stack td.lead::before { display: none; }
  .tbl-stack td.actions { justify-content: flex-start; padding-top: 10px; flex-wrap: wrap; }
  .tbl-stack td.actions::before { display: none; }
  .tbl-stack td.block { display: block; text-align: left; }
  .tbl-stack td.block::before { display: block; margin-bottom: 2px; max-width: none; }
  .tbl-stack .num { text-align: right; }
  .tbl-stack tfoot tr { background: #FAFBFB; }
  .tbl-stack tfoot td::before { content: attr(data-label); }

  /* Bottom tabs */
  .tabs {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(16,48,47,.05);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted);
    font: 500 11px/1.1 var(--font); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; position: relative;
  }
  .tab:hover { text-decoration: none; }
  .tab .ic { width: 23px; height: 23px; }
  .tab.is-active { color: var(--teal); }
  .tab.is-active::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
  .tab-center { color: var(--teal-dk); font-weight: 600; }
  .tab-center::before { display: none; }
  .tab-fab {
    width: 52px; height: 52px; margin-top: -26px; border-radius: 16px; background: var(--teal); color: #fff;
    display: flex; align-items: center; justify-content: center; border: 4px solid #fff;
    box-shadow: 0 6px 16px rgba(13,110,110,.35); position: relative;
  }
  .tab-fab::after { content: ''; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
  .tab-fab .ic { width: 24px; height: 24px; stroke-width: 2.4; }
  .tab-center.is-active .tab-fab { background: var(--teal-dk); }

  /* More sheet */
  .sheet { display: block; position: fixed; inset: 0; z-index: 90; background: rgba(16,48,47,.4); }
  .sheet[hidden] { display: none !important; }
  .sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow-y: auto; background: #fff;
    border-radius: 18px 18px 0 0; padding: 6px 16px calc(20px + env(safe-area-inset-bottom)); animation: rise .22s ease-out;
  }
  @keyframes rise { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
  .sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: #CDD6D3; margin: 6px auto 14px; cursor: pointer; }
  .sheet-user { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--line-2); }
  .sheet-user span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
  .sheet-user small { color: var(--muted); }
  .sheet-group { font-size: 13px; color: var(--muted); padding: 16px 4px 8px; }
  .sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .sheet-grid:first-of-type { margin-top: 12px; }
  .sheet-link {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 78px; padding: 10px 6px;
    border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 500; text-align: center; text-decoration: none; position: relative; line-height: 1.2;
  }
  .sheet-link:hover { text-decoration: none; }
  .sheet-link .ic { color: var(--teal); width: 22px; height: 22px; }
  .sheet-link.is-active { background: var(--teal-lt); box-shadow: inset 0 0 0 1.5px var(--teal); }
  .sheet-link .count { position: absolute; top: 6px; right: 6px; margin: 0; }
  .sheet-signout { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); color: var(--bad); font-weight: 600; text-decoration: none; }
  .sheet-signout .ic { width: 18px; height: 18px; }

  .dialog { align-items: flex-end; padding: 0; }
  .dialog-panel, .dialog-panel.lg { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; animation: rise .22s ease-out; }
  .dialog-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .dialog-actions .btn { flex: 1; }

  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px 32px; }
  .login-art h1 { font-size: 24px; margin-top: 24px; }
  .login-art p { font-size: 14px; }
  .login-art .traces { width: 260px; height: 260px; right: -70px; bottom: -90px; }

  .hide-sm { display: none !important; }
}
@media (min-width: 1024px) {
  .show-sm { display: none !important; }
}
@media (max-width: 420px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2.keep { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Form extras ── */
.field.has-error input:not([type=checkbox]), .field.has-error select, .field.has-error textarea { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-lt); }
.field-error { font-size: 13px; color: var(--bad); font-weight: 500; }
.link-toggle { width: auto; justify-content: flex-start; color: var(--teal-dk); font-weight: 600; font-size: 14px; min-height: 40px; margin-top: 4px; }
.link-toggle .ic { color: var(--teal); width: 18px; height: 18px; }
.link-toggle[aria-expanded="true"] .ic { transform: rotate(45deg); }
.form-bar { margin: 4px 0 24px; }
.form-bar .btn { min-height: 50px; font-size: 16px; }
@media (min-width: 1024px) { .form-bar .btn-block { width: auto; min-width: 260px; } }
@media (max-width: 1023px) {
  .form-bar { position: sticky; bottom: calc(var(--tabs-h, 64px) + env(safe-area-inset-bottom, 0px) + 8px); z-index: 5; margin: 0 0 16px; }
  .form-bar .btn { box-shadow: 0 6px 18px rgba(13,110,110,.28); }
}

/* Segmented links (day picker, page switchers) */
.seg-links { margin-bottom: 16px; max-width: 420px; }
.seg-links a { flex: 1; text-align: center; padding: 9px 10px; border-radius: 7px; font-weight: 500; font-size: 14px; color: var(--ink-2); text-decoration: none; min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg-links a small { color: var(--muted); font-weight: 400; }
.seg-links a.is-on { background: #fff; color: var(--teal-dk); font-weight: 600; box-shadow: 0 1px 2px rgba(22,33,31,.12); }
.grid-2.tight-sm { gap: 0 16px; margin-bottom: 4px; }
@media (max-width: 1023px) { .grid-2.tight-sm { grid-template-columns: 1fr 1fr; } }

/* Leave */
.metrics.metrics-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1023px) {
  .metrics.metrics-3 { grid-template-columns: repeat(3, 1fr); }
  .metrics.metrics-3 .metric { border-top: 0; border-left: 1px solid var(--line-2); padding: 14px 12px; }
  .metrics.metrics-3 .metric:first-child { border-left: 0; }
  .metrics.metrics-3 .metric span { font-size: 12px; }
}
.leave-list > li { align-items: flex-start; }
.leave-reason { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.leave-reply { margin: 8px 0 0; font-size: 13px; display: flex; gap: 6px; align-items: flex-start; background: var(--paper); border-radius: 8px; padding: 8px 10px; }
.leave-reply .ic { width: 16px; height: 16px; color: var(--muted); flex: none; margin-top: 2px; }
.leave-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.leave-preview { background: var(--teal-lt); color: var(--teal-dk); border-radius: 9px; padding: 10px 12px; font-size: 14px; margin: 4px 0 16px; }
.leave-preview:empty { display: none; }

/* Notifications */
.list-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 4px 4px 8px; }
.notes > li { align-items: flex-start; }
.notes .grow small { display: block; margin-top: 2px; font-size: 12px; }
.note-msg { font-size: 14px; }
.notes li.is-new { background: #F5FBFA; }
.notes li.is-new .note-msg { font-weight: 600; }
.note-ic { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--line-2); color: var(--ink-2); }
.note-ic .ic { width: 18px; height: 18px; }
.note-ic.t-leave { background: var(--warn-lt); color: var(--warn); }
.note-ic.t-expense { background: var(--ok-lt); color: var(--ok); }
.note-ic.t-worksheet { background: var(--teal-lt); color: var(--teal-dk); }

/* Session list (work reports) */
.entries { list-style: none; margin: 0; padding: 0; }
.entries > li { display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.entries > li:last-child { border-bottom: 0; }
.entry-date { line-height: 1.1; text-align: center; background: var(--paper); border-radius: 9px; padding: 7px 0; align-self: start; }
.entry-date b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.entry-date small { color: var(--muted); font-size: 12px; }
.entry-top { font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 2px; }
.entry-who { font-weight: 600; color: var(--ink-2); }
.entry-who.is-me { color: var(--teal-dk); }
.entry-title { display: block; font-size: 15px; }
.entry-desc { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
details.entry-desc summary { list-style: none; cursor: pointer; }
details.entry-desc summary::-webkit-details-marker { display: none; }
details.entry-desc summary em { font-style: normal; color: var(--teal-dk); font-weight: 600; font-size: 13px; }
details.entry-desc[open] summary { display: none; }
details.entry-desc p { margin: 0; }
@media (max-width: 1023px) { .entries > li { padding: 12px 14px; grid-template-columns: 44px 1fr; gap: 12px; } }
.panel > .rows:first-child > li:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.panel > .rows:last-child > li:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }

/* Admin home */
.todo > li { padding: 0; }
.todo-link { display: flex; align-items: center; gap: 12px; padding: 12px 20px; width: 100%; color: inherit; text-decoration: none; min-height: 60px; }
.todo-link:hover { background: var(--paper); }
.todo-link .count { position: static; }
.todo-link .ic.muted { width: 18px; height: 18px; }
.note-ic.is-hot { background: var(--warn-lt); color: var(--warn); }
.avatar.is-ok { background: var(--ok-lt); color: var(--ok); }
.metrics.flat { border: 0; border-radius: 0 0 var(--radius) var(--radius); margin: 0; grid-template-columns: 1fr 1fr; }
.metrics.flat .metric { border-left: 0; border-top: 1px solid var(--line-2); }
.metrics.flat .metric:nth-child(-n+2) { border-top: 0; }
.metrics.flat .metric:nth-child(even) { border-left: 1px solid var(--line-2); }
.team small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .grow { min-width: 0; }
.dash { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "a b" "c b"; gap: 0 20px; align-items: start; }
.dash-a { grid-area: a; } .dash-b { grid-area: b; } .dash-c { grid-area: c; }
@media (max-width: 1023px) { .dash { grid-template-columns: 1fr; grid-template-areas: "a" "b" "c"; } }

/* Lists with actions */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex: none; }
.text-bad { color: var(--bad); }
.text-ok { color: var(--ok); }
.people > li { align-items: flex-start; }
.people .grow { min-width: 0; }
.people .grow b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.people-meta { display: flex !important; flex-wrap: wrap; gap: 2px 14px; margin-top: 3px; font-size: 13px; }
.people-meta a { color: var(--teal-dk); }
.pin-reveal { border: 0; background: var(--line-2); border-radius: 5px; padding: 0 6px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); min-width: 46px; }
.dlg-sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.danger-zone b { display: block; font-size: 14px; color: var(--bad); }
.danger-zone small { color: var(--muted); font-size: 13px; }
@media (max-width: 1023px) { .row-actions .btn { min-width: 40px; padding: 0 10px; } }
.km-edit { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex: none; }
.km-edit input { width: 84px; min-height: 38px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.links .grow { min-width: 0; }
.entry-click { cursor: pointer; }
.entry-click:hover { background: #FAFCFB; }
.entry-click:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.entry-chip { margin-left: auto; }
.text-warn { color: var(--warn); }
.ink { color: var(--ink); }
@media (max-width: 1023px) { .tbl-stack td.is-empty { display: none; } }
@media (max-width: 1023px) {
  .leave-list > li { flex-wrap: wrap; }
  .leave-list .grow { flex: 1 1 calc(100% - 60px); }
  .leave-side { flex-direction: row-reverse; justify-content: space-between; align-items: center; width: 100%; }
  .leave-list > li > .avatar ~ .leave-side { padding-left: 46px; }
  .links .note-ic { display: none; }
  .links > li { padding: 10px 14px; }
}

/* Monthly calendar */
.split-wide { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.split-wide .calc { position: sticky; top: calc(var(--top-h) + 12px); }
@media (max-width: 1023px) { .split-wide { grid-template-columns: 1fr; } .split-wide .calc { position: static; order: -1; } }
.calc-list { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; margin: 0; font-size: 14px; align-items: center; }
.calc-list dt { color: var(--ink-2); }
.calc-list dd { margin: 0; text-align: right; }
.calc-list input { width: 110px; text-align: right; min-height: 38px; padding: 6px 10px; }
.calc-list .sep { border-top: 1px solid var(--line-2); padding-top: 10px; }
.calc-list .total { font-size: 18px; font-weight: 700; color: var(--teal-dk); }
.qcal thead th { white-space: normal; line-height: 1.3; }
.qh-sub { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }
.qcal tr.is-today td.qd { color: var(--teal-dk); box-shadow: inset 3px 0 0 var(--amber); }
.qcal tr.is-today td { background-color: #F3FAF9; }
@media (max-width: 1023px) {
  .qcal-wrap { max-height: calc(100vh - 260px); }
  .qcal thead th { min-width: 88px; max-width: 88px; padding: 8px 4px; }
  .qcell { width: 88px; padding: 9px 4px; font-size: 11px; }
  .qcal th.qd, .qcal td.qd { min-width: 54px; padding: 8px 6px; }
  .qcal td.qd small { display: block; margin: 0; }
}

/* Stock lists */
.stock-list { list-style: none; margin: 0; padding: 0; }
.stock-cat { padding: 10px 20px 6px; font-size: 12px; font-weight: 600; color: var(--muted); background: #FAFBFB; border-bottom: 1px solid var(--line-2); }
.stock-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line-2); padding-right: 16px; }
.stock-row:last-child { border-bottom: 0; }
.stock-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 12px 8px 12px 20px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 56px; }
.stock-main:hover .stock-name { color: var(--teal-dk); text-decoration: underline; text-underline-offset: 3px; }
.stock-name { flex: 1; min-width: 0; font-weight: 500; }
.stock-qty { display: inline-flex; align-items: baseline; gap: 4px; min-width: 64px; justify-content: flex-end; }
.stock-qty b { font-size: 18px; }
.stock-qty small { color: var(--muted); font-size: 12px; }
.stock-qty.is-zero b { color: var(--bad); }
.stock-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 1023px) {
  .stock-row { flex-wrap: wrap; padding: 0 14px 10px; }
  .stock-main { padding: 12px 0 4px; width: 100%; flex-basis: 100%; min-height: 0; }
  .stock-row:not(:has(.stock-actions)) { padding-bottom: 0; }
  .stock-row:not(:has(.stock-actions)) .stock-main { padding-bottom: 12px; }
  .stock-actions { width: 100%; }
  .stock-actions .btn { flex: 1; }
  .stock-cat { padding: 10px 14px 6px; }
}
.stepper { display: flex; gap: 8px; }
.stepper input { text-align: center; font-size: 18px; font-weight: 600; }
.stepper .btn { min-width: 48px; font-size: 20px; padding: 0; }
.holders > li { padding: 10px 0; gap: 12px; }
.holders .grow small { display: block; }
.holders b.num { font-size: 17px; min-width: 32px; text-align: right; }
.btn-xs-space { display: inline-block; width: 52px; }
.txns > li { align-items: flex-start; }
.txns .grow { min-width: 0; }
.txns .grow small { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.txns .ic.inline { width: 14px; height: 14px; }
.txn-note { color: var(--ink-2) !important; font-style: italic; }
.txn-qty { min-width: 44px; height: 36px; border-radius: 9px; background: var(--teal-lt); color: var(--teal-dk); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; flex: none; }
.txn-qty.is-neg { background: var(--bad-lt); color: var(--bad); }
.txn-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.txn-side small { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rows > li.stock-cat { display: block; padding: 10px 20px 6px; }
@media (max-width: 1023px) { .rows > li.stock-cat { padding: 10px 14px 6px; } }
.rows > li.is-dim .grow { opacity: .6; }

/* Reports extras */
.slot-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 6px 0 8px; }
.slots + .slot-label { margin-top: 16px; }
.slot.is-empty.can-act { color: var(--teal); border-color: #9CC9C5; }
.school-stars .star .ic { width: 24px; height: 24px; }
.comment-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.comment-text { margin: 4px 0 0; font-size: 14px; white-space: pre-wrap; }
.comment-box .field-label { display: block; margin-bottom: 6px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed #9CC9C5; background: var(--teal-lt); color: var(--teal-dk); border-radius: 12px; padding: 26px 16px; cursor: pointer; text-align: center; font-weight: 500; position: relative; margin-bottom: 14px; word-break: break-all; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .ic { width: 28px; height: 28px; }
.drop:focus-within { outline: 2px solid var(--amber); outline-offset: 2px; }
.progress { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.progress span { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s; }
@media (max-width: 1023px) { .slots-6 { grid-template-columns: repeat(3, 1fr); } .slot .sbtn { padding: 7px 6px; } .slot-btns { gap: 3px; } }
@media (max-width: 420px) { .slots-6 { grid-template-columns: repeat(2, 1fr); } }
.owners .grow { min-width: 0; }
.owner-form select { min-width: 190px; }
@media (max-width: 1023px) {
  .owners > li { flex-wrap: wrap; }
  .owners .grow { flex: 1 1 calc(100% - 50px); }
  .owner-form { width: 100%; padding-left: 46px; }
  .owner-form select { width: 100%; }
}
.sheet-signout { text-decoration: none; }
