/* Sổ Lớp & Học Phí: tenant-wide styles for app/tenants/mrphu/.
   Tokens come from docs/mrphu/mockups/tokens.css (DESIGN_SYSTEM.json) and the shared components from
   docs/mrphu/mockups/_src/base.css, minus the mockup-only chrome. Nothing here is shared with any other tenant.
   Screen styles live in a CSS file inside each screen folder. */

/* ==========================================================================
   mrphu · Sổ Lớp & Học Phí — design tokens (light theme only, like voicoi)
   Identity: "bảng xanh + vở ô li" — board green, cool exercise-book paper,
   lavender ô-li rules, a red notebook margin line on record surfaces.
   Fonts: Calibri / Carlito system stack (Excel look).
   ========================================================================== */
:root {
  /* ---- Colour: surfaces ---- */
  --paper: #f3f5f1;          /* app background, cool off-white exercise-book paper */
  --paper2: #eaeee8;         /* sidebar, recessed bands */
  --surface: #ffffff;        /* panels, cards, inputs */
  --surface2: #f8faf7;       /* table head, panel foot */
  --sunk: #e4e9e3;           /* pressed / disabled fields, skeleton */

  /* ---- Colour: ink ---- */
  --ink: #15201b;            /* body text 16.9:1 on paper */
  --ink2: #3a4641;           /* secondary text 9.4:1 */
  --ink3: #56625d;           /* meta text 6.1:1 on paper, 6.7:1 on white */
  --inkInv: #ffffff;

  /* ---- Colour: lines ---- */
  --line: #d6ddd6;           /* hairlines, table rules */
  --lineStrong: #aab5ae;     /* input borders, strong dividers */
  --oli: #cfd6ea;            /* ô-li ruling (lavender-blue, like Vietnamese school notebooks) */
  --oliFaint: #e6e9f4;       /* the 3 minor lines inside each ô-li square */
  --margin: #d9776f;         /* red notebook margin line, decorative only */

  /* ---- Colour: brand (bảng xanh) ---- */
  --board: #217346;          /* primary: actions, active nav, teacher header. 9.9:1 on white */
  --board700: #1a5c38;       /* hover/pressed */
  --board500: #2f6b58;       /* icons on light */
  --board100: #e8f3ec;       /* selected rows, active nav bg */
  --board50: #eff6f2;        /* hover rows */
  --chalk: #f1cf4b;          /* chalk-yellow: today marker, focus halo, active tab rule */
  --chalk100: #fbf2c8;
  --chalkInk: #5c4700;

  /* ---- Colour: money states ---- */
  --debt: #b42318;           /* Nợ: always with "Nợ" word + minus sign */
  --debtBg: #fdecea;
  --debtLine: #f2b8b2;
  --credit: #1d6b45;         /* dư / thu vào */
  --creditBg: #e3f2e9;
  --creditLine: #b5d9c3;
  --warn: #8a5300;           /* sắp hết buổi, cảnh báo */
  --warnBg: #fdf0d7;
  --warnLine: #eccf94;
  --info: #22508f;
  --infoBg: #e6eefa;
  --infoLine: #bfd0ec;
  --lock: #4a4f57;           /* tháng đã chốt, chỉ xem */
  --lockBg: #eceef0;
  --lockLine: #cdd2d8;
  --void: #7a8580;           /* chứng từ đã hủy (strike-through + label) */

  /* ---- Colour: attendance marks (text + shape, never colour alone) ---- */
  --markX: #1f4d3f;          /* x  Có mặt   — filled square, white glyph */
  --markP: #9a4d00;          /* p  Nghỉ     — ring with slash hatch */
  --markPBg: #fdeedd;
  --markB: #22508f;          /* b  Học bù   — square with inner corner notch */
  --markBBg: #e6eefa;
  --markN: #6b7570;          /* —  Không tính — dashed outline */

  /* ---- Colour: subject stripes on group labels (nhãn vở) ---- */
  --subjToan: #2d5fa0;       /* T  Toán */
  --subjLy: #7a4fa0;         /* VL Vật lý */
  --subjHoa: #b0572b;        /* H  Hóa học */
  --subjVan: #a0314a;        /* V  Ngữ văn */
  --subjAnh: #1f7a78;        /* TA Tiếng Anh */
  --subjSinh: #4d7a2a;       /* S  Sinh học */
  --subjTV: #9a6b12;         /* TV Tiếng Việt */
  --subjKhac: #6b7570;       /* TTH & chưa xác nhận, Nhóm 0 */

  /* ---- Type ---- */
  --fontUi: Calibri, Carlito, 'Segoe UI', Arial, sans-serif;
  --fontRecord: var(--fontUi);
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-base: 15px;
  --fs-lg: 17px;
  --fs-xl: 21px;
  --fs-2xl: 27px;
  --fs-3xl: 34px;
  --fs-4xl: 44px;
  --lh-tight: 1.2;
  --lh-body: 1.5;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* ---- Space (4px unit) ---- */
  --space-unit: 4px;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
  --s12: 48px;

  /* ---- Radius (hierarchy: chips < controls < panels < sheets) ---- */
  --r-xs: 2px;               /* marks in month grid, kbd */
  --r-sm: 3px;               /* buttons, inputs, group labels */
  --r-md: 4px;              /* panels, cards */
  --r-lg: 4px;              /* mobile bottom sheet, login card */
  --r-pill: 999px;

  /* ---- Elevation (borders do most of the work) ---- */
  --shadow-1: 0 1px 0 rgba(21, 32, 27, 0.05);
  --shadow-2: 0 12px 32px rgba(21, 32, 27, 0.18), 0 2px 6px rgba(21, 32, 27, 0.08);
  --shadow-bar: 0 -8px 20px rgba(21, 32, 27, 0.08);
  --focus: 0 0 0 2px #ffffff, 0 0 0 4px var(--board), 0 0 0 7px rgba(241, 207, 75, 0.6);

  /* ---- Sizes ---- */
  --tap: 44px;               /* minimum touch target */
  --tapTeacher: 56px;        /* teacher roster row / primary buttons */
  --sideW: 236px;
  --topH: 60px;
  --motion: 160ms cubic-bezier(.2, .7, .2, 1);
}

/* Fonts: system Calibri (Carlito on Linux), no webfont. */

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 16px; }
body {
  margin: 0; font-family: var(--fontUi); font-size: var(--fs-md); line-height: var(--lh-body);
  color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); color: var(--ink); }
h1 { font-family: var(--fontRecord); font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.005em; }
h3 { font-size: var(--fs-base); font-weight: 700; }
h4 { font-size: var(--fs-md); font-weight: 700; }
p { margin: 0; }
a { color: var(--board); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--board700); }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---- Utilities ---- */
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--ink3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.record { font-family: var(--fontRecord); }
.row { display: flex; align-items: center; gap: var(--s2); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: var(--s3); }
.stack-lg > * + * { margin-top: var(--s5); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: var(--s1); } .mt-2 { margin-top: var(--s2); } .mt-3 { margin-top: var(--s3); } .mt-4 { margin-top: var(--s4); } .mt-6 { margin-top: var(--s6); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Icons (inline SVG sprite, Lucide-style strokes) ---- */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.i-sm { width: 15px; height: 15px; vertical-align: -2px; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 28px; height: 28px; }

/* ---- Ô-li ruled paper (signature surface: login, attendance sheet, receipts) ---- */
.oli {
  background-color: var(--surface);
  background-image:
    linear-gradient(90deg, var(--oli) 1px, transparent 1px),
    linear-gradient(var(--oli) 1px, transparent 1px),
    linear-gradient(var(--oliFaint) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 24px 6px;
}
.margin-rule { position: relative; }
.margin-rule::before { content: ""; position: absolute; top: 0; bottom: 0; left: 36px; width: 0; border-left: 1.5px solid var(--margin); opacity: .75; pointer-events: none; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 38px; padding: 0 var(--s4); border-radius: var(--r-sm);
  font-weight: 600; font-size: var(--fs-md); line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--ink); background: var(--surface); border: 1px solid var(--lineStrong);
  cursor: pointer; transition: background var(--motion), border-color var(--motion), color var(--motion);
}
.btn:hover { background: var(--board50); border-color: var(--board500); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--board); border-color: var(--board); color: #fff; }
.btn-primary:hover { background: var(--board700); border-color: var(--board700); color: #fff; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink2); }
.btn-quiet:hover { background: var(--sunk); border-color: transparent; }
.btn-danger { color: var(--debt); border-color: var(--debtLine); }
.btn-danger:hover { background: var(--debtBg); border-color: var(--debt); color: var(--debt); }
.btn-danger-solid { background: var(--debt); border-color: var(--debt); color: #fff; }
.btn-danger-solid:hover { background: #8f1c13; border-color: #8f1c13; color: #fff; }
.btn-link { min-height: 0; padding: 0; border: 0; background: none; color: var(--board); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.btn-link:hover { background: none; color: var(--board700); }
.btn-sm { min-height: 32px; padding: 0 var(--s3); font-size: var(--fs-sm); }
.btn-lg { min-height: 48px; padding: 0 var(--s5); font-size: var(--fs-base); }
.btn-xl { min-height: var(--tapTeacher); padding: 0 var(--s6); font-size: var(--fs-lg); border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn .count { font-variant-numeric: tabular-nums; opacity: .85; font-weight: 500; }
.kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--lineStrong); border-bottom-width: 2px; border-radius: var(--r-xs); font-size: 11px; font-weight: 600; color: var(--ink3); text-align: center; line-height: 17px; background: var(--surface); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink2); }
.req::after { content: " *"; color: var(--debt); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; font: inherit; font-size: var(--fs-md); color: var(--ink);
  background: var(--surface); border: 1px solid var(--lineStrong); border-radius: var(--r-sm);
  transition: border-color var(--motion);
}
.textarea { min-height: 76px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%233a4641' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--board); box-shadow: var(--focus); }
.input[readonly], .input:disabled, .select:disabled, .textarea:disabled { background: var(--sunk); color: var(--ink2); cursor: not-allowed; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--debt); background: #fffafa; }
.hint { font-size: var(--fs-xs); color: var(--ink3); }
.field-error { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-sm); font-weight: 500; color: var(--debt); }
.field-error .i { margin-top: 2px; width: 15px; height: 15px; }
.money { position: relative; }
.money .input { text-align: right; padding-right: 30px; font-variant-numeric: tabular-nums; font-weight: 600; }
.money::after { content: "đ"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink3); font-size: var(--fs-sm); pointer-events: none; }
.search { position: relative; }
.search > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink3); pointer-events: none; }
.search .input { padding-left: 38px; }
.check { display: inline-flex; align-items: center; gap: var(--s2); min-height: 32px; cursor: pointer; font-size: var(--fs-md); }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--board); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.form-grid .span-2 { grid-column: 1 / -1; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink2); margin-bottom: 6px; }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunk); border-radius: var(--r-sm); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 var(--s3); border: 0; border-radius: 4px; background: none; font-size: var(--fs-sm); font-weight: 600; color: var(--ink2); cursor: pointer; white-space: nowrap; }
.seg input:checked + span, .seg .is-active { background: var(--surface); color: var(--board); font-weight: 700; box-shadow: 0 1px 2px rgba(21, 32, 27, .14); }
.seg input:focus-visible + span { box-shadow: var(--focus); }

/* ==========================================================================
   Panels, sections
   ========================================================================== */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 54px; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: var(--fs-base); }
.panel-head .sub { font-size: var(--fs-sm); color: var(--ink3); margin-top: 2px; }
.panel-body { padding: var(--s4); }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); background: var(--surface2); border-radius: 0 0 var(--r-md) var(--r-md); font-size: var(--fs-sm); color: var(--ink3); }
.panel-flush > .panel-body { padding: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin: var(--s6) 0 var(--s3); }
.section-title h2 { font-size: var(--fs-base); }
.section-title .sub { font-size: var(--fs-sm); color: var(--ink3); }

/* Definition list */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: var(--s2) var(--s4); margin: 0; }
.dl dt { color: var(--ink3); font-size: var(--fs-sm); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--surface2); font-size: var(--fs-xs); font-weight: 700; color: var(--ink3); border-bottom: 1px solid var(--lineStrong); white-space: nowrap; }
.tbl tbody tr:hover > td { background: var(--board50); }
.tbl tr.is-selected > td { background: var(--board100); }
.tbl tr.is-void > td { color: var(--void); }
.tbl tr.is-void .void-strike { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.tbl tr.group-row > td { background: var(--paper2); font-weight: 700; font-size: var(--fs-sm); }
.tbl tr.total > td { font-weight: 700; background: var(--surface2); border-top: 2px solid var(--ink); border-bottom: 0; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl th.center, .tbl td.center { text-align: center; }
.tbl-compact th, .tbl-compact td { padding: 7px 10px; }
.tbl td.actions { text-align: right; white-space: nowrap; }
.tbl .row-link { color: inherit; text-decoration: none; font-weight: 600; }
.tbl .row-link:hover { color: var(--board); text-decoration: underline; }
.clickable { cursor: pointer; }

/* ==========================================================================
   Group label (nhãn vở), tags, money
   ========================================================================== */
.ma { position: relative; display: inline-flex; align-items: stretch; border: 1px solid var(--lineStrong); border-radius: var(--r-xs); background: var(--surface); font-weight: 700; font-size: var(--fs-sm); line-height: 20px; white-space: nowrap; color: var(--ink); text-decoration: none; vertical-align: middle; }
.ma::before { content: ""; width: 4px; background: var(--subj, var(--subjKhac)); border-radius: 3px 0 0 3px; margin: -1px 0 -1px -1px; }
a.ma:hover { border-color: var(--board500); background: var(--board50); }
a.ma::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 44px; transform: translateY(-50%); } /* 44px touch hit area */
.ma > span { padding: 0 7px; }
.ma-lg { font-size: var(--fs-base); line-height: 26px; }
.ma-lg::before { width: 5px; }
.s-toan { --subj: var(--subjToan); } .s-ly { --subj: var(--subjLy); } .s-hoa { --subj: var(--subjHoa); } .s-van { --subj: var(--subjVan); }
.s-anh { --subj: var(--subjAnh); } .s-sinh { --subj: var(--subjSinh); } .s-tv { --subj: var(--subjTV); } .s-khac { --subj: var(--subjKhac); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: var(--r-pill); border: 1px solid transparent; font-size: var(--fs-xs); font-weight: 600; line-height: 20px; white-space: nowrap; }
.tag .i { width: 13px; height: 13px; vertical-align: 0; }
.tag-ok { color: var(--credit); background: var(--creditBg); border-color: var(--creditLine); }
.tag-warn { color: var(--warn); background: var(--warnBg); border-color: var(--warnLine); }
.tag-debt { color: var(--debt); background: var(--debtBg); border-color: var(--debtLine); }
.tag-info { color: var(--info); background: var(--infoBg); border-color: var(--infoLine); }
.tag-lock { color: var(--lock); background: var(--lockBg); border-color: var(--lockLine); }
.tag-muted { color: var(--ink3); background: var(--sunk); border-color: var(--line); }
.tag-board { color: #fff; background: var(--board); }
.tag-void { color: var(--void); background: var(--surface); border-color: var(--void); border-style: dashed; }

/* Money: sign + word, never colour alone */
.tien { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.tien-no { color: var(--debt); }
.tien-no::before { content: "Nợ "; font-size: .78em; font-weight: 700; letter-spacing: .01em; }
.tien-du { color: var(--credit); }
.tien-big { font-family: var(--fontRecord); font-weight: 600; font-size: var(--fs-2xl); letter-spacing: -0.01em; line-height: 1.1; }
.buoi { font-weight: 600; white-space: nowrap; }

/* Progress (tiến độ khóa) */
.progress { position: relative; height: 6px; border-radius: var(--r-pill); background: var(--sunk); overflow: hidden; }
.progress > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--board500); border-radius: var(--r-pill); }
.ticks { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; }
.ticks i { display: block; height: 8px; border-radius: 1px; background: var(--sunk); }
.ticks i.on { background: var(--board500); }

/* ==========================================================================
   Attendance marks — each mark differs in glyph AND shape
   ========================================================================== */
.dau { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; font-family: var(--fontRecord); font-weight: 700; font-size: 17px; line-height: 1; border-radius: 7px; user-select: none; }
.dau-x { background: var(--board100); color: var(--markX); }                        /* filled square (quiet: most marks are x) */
.dau-p { background: var(--markPBg); color: var(--markP); border: 2.5px solid var(--markP); border-radius: 50%;   /* ring (loud: exceptions stand out) */
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(154, 77, 0, .12) 5px 7px); }
.dau-b { background: var(--markBBg); color: var(--markB); border: 2px solid var(--markB); position: relative; } /* square w/ notch */
.dau-b::after { content: ""; position: absolute; right: -2px; top: -2px; border-style: solid; border-width: 0 9px 9px 0; border-color: transparent var(--markB) transparent transparent; border-top-right-radius: 5px; }
.dau-n { background: transparent; color: var(--markN); border: 2px dashed var(--markN); font-family: var(--fontUi); font-weight: 600; } /* dashed */
.dau-lg { width: 44px; height: 44px; font-size: 23px; border-radius: 10px; }
.dau-lg.dau-p { border-radius: 50%; }
.dau-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--fs-sm); color: var(--ink2); }
.dau-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.dau-legend .dau { width: 22px; height: 22px; font-size: 13px; border-radius: 5px; }
.dau-legend .dau-p { border-radius: 50%; }

/* Month grid (lưới tháng, read-only) */
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.mgrid { border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.mgrid th, .mgrid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--oliFaint); padding: 0; text-align: center; height: 34px; min-width: 30px; }
.mgrid thead th { background: var(--surface2); font-size: 11px; font-weight: 700; color: var(--ink3); line-height: 1.15; padding: 4px 2px; position: sticky; top: 0; z-index: 2; }
.mgrid thead th.wk { color: var(--ink2); }
.mgrid thead th.today { background: var(--chalk100); color: var(--chalkInk); }
.mgrid .name { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: 0 12px; min-width: 190px; font-weight: 500; white-space: nowrap; border-right: 1px solid var(--lineStrong); }
.mgrid thead .name { z-index: 3; background: var(--surface2); }
.mgrid .tot { font-weight: 700; min-width: 38px; background: var(--surface2); }
.mgrid .off { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--oliFaint) 4px 5px); }
.mgrid .c { font-family: var(--fontRecord); font-weight: 700; font-size: 14px; }
.mgrid .cx { color: var(--markX); }
.mgrid .cp { color: var(--markP); background: var(--markPBg); }
.mgrid .cb { color: var(--markB); background: var(--markBBg); }
.mgrid .cn { color: var(--markN); }
.mgrid .cd { color: var(--lineStrong); }

/* ==========================================================================
   Notices (alerts)
   ========================================================================== */
.note { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid; border-radius: var(--r-sm); font-size: var(--fs-md); line-height: 1.45; }
.note > .i { margin-top: 1px; }
.note strong { font-weight: 700; }
.note .note-actions { margin-top: var(--s2); display: flex; flex-wrap: wrap; gap: var(--s2); }
.note-info { background: var(--infoBg); border-color: var(--infoLine); color: #173d6f; }
.note-warn { background: var(--warnBg); border-color: var(--warnLine); color: #5a3600; }
.note-debt { background: var(--debtBg); border-color: var(--debtLine); color: #7c1810; }
.note-ok { background: var(--creditBg); border-color: var(--creditLine); color: #134b30; }
.note-lock { background: var(--lockBg); border-color: var(--lockLine); color: var(--ink2); }
.asof { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--chalk100); color: var(--chalkInk); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; border: 1px solid #ead98e; }

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs [role="tab"], .tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--s3); margin-bottom: -1px; border: 0; border-bottom: 3px solid transparent; background: none; font-size: var(--fs-md); font-weight: 600; color: var(--ink3); text-decoration: none; white-space: nowrap; cursor: pointer; }
.tabs [role="tab"]:hover, .tabs a:hover { color: var(--ink); }
.tabs [aria-selected="true"], .tabs a.is-active { color: var(--ink); border-bottom-color: var(--board); }
.tabs .count { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: var(--r-pill); background: var(--sunk); color: var(--ink2); line-height: 18px; }

/* ==========================================================================
   Overlays: drawer, modal, bottom sheet, toast, popover
   ========================================================================== */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(21, 32, 27, .42); opacity: 0; pointer-events: none; transition: opacity var(--motion); }
.scrim.is-open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 90; width: min(560px, 100vw); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--lineStrong); box-shadow: var(--shadow-2); transform: translateX(104%); transition: transform 220ms cubic-bezier(.2, .7, .2, 1); }
.drawer.is-open { transform: none; }
.drawer-wide { width: min(760px, 100vw); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: var(--fs-lg); }
.drawer-head .sub { font-size: var(--fs-sm); color: var(--ink3); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s5); }
.drawer-foot { display: flex; justify-content: flex-end; align-items: center; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--line); background: var(--surface2); flex-wrap: wrap; }
.modal { position: fixed; left: 50%; top: 50%; z-index: 95; width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transform: translate(-50%, -46%); transition: opacity var(--motion), transform var(--motion); }
.modal.is-open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.modal-head { padding: var(--s5) var(--s5) var(--s2); }
.modal-head h2 { font-size: var(--fs-lg); }
.modal-body { padding: var(--s2) var(--s5) var(--s4); color: var(--ink2); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--line); background: var(--surface2); flex-wrap: wrap; }
.bsheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; max-height: 86vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-2); transform: translateY(104%); transition: transform 220ms cubic-bezier(.2, .7, .2, 1); max-width: 520px; margin: 0 auto; }
.bsheet.is-open { transform: none; }
.bsheet-head { padding: 10px var(--s5) var(--s3); border-bottom: 1px solid var(--line); }
.bsheet-head::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: var(--lineStrong); }
.bsheet-head h2 { font-size: var(--fs-lg); }
.bsheet-body { overflow-y: auto; padding: var(--s2) 0 calc(var(--s4) + env(safe-area-inset-bottom)); }
.toast-host { position: fixed; left: 50%; bottom: 24px; z-index: 120; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: var(--s3); padding: 12px 16px; border-radius: var(--r-sm); background: var(--ink); color: #fff; box-shadow: var(--shadow-2); font-weight: 500; animation: toastIn .2s ease; pointer-events: auto; }
.toast .i { color: var(--chalk); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.popover { position: absolute; z-index: 60; min-width: 240px; background: var(--surface); border: 1px solid var(--lineStrong); border-radius: var(--r-sm); box-shadow: var(--shadow-2); padding: var(--s1); }
.menu-item { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 40px; padding: 0 var(--s3); border: 0; border-radius: 4px; background: none; text-align: left; font-size: var(--fs-md); color: var(--ink); text-decoration: none; cursor: pointer; }
.menu-item:hover, .menu-item.is-active { background: var(--board50); }
.menu-item.is-active { font-weight: 700; }

/* ==========================================================================
   Empty / error / skeleton
   ========================================================================== */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s2); padding: var(--s10) var(--s5); color: var(--ink3); }
.empty .empty-ico { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--paper2); color: var(--board500); margin-bottom: var(--s2); }
.empty .empty-ico .i { width: 26px; height: 26px; }
.empty strong { font-size: var(--fs-base); color: var(--ink); }
.empty p { max-width: 42ch; }
.block-error { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4); color: var(--ink2); background: repeating-linear-gradient(135deg, var(--surface) 0 10px, var(--surface2) 10px 20px); border-radius: var(--r-sm); }
.sk { display: inline-block; height: 1em; min-width: 80px; border-radius: 3px; background: linear-gradient(90deg, var(--sunk) 0%, var(--surface2) 50%, var(--sunk) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ==========================================================================
   OFFICE SHELL (desktop-first; light sidebar with a board-green binding spine)
   ========================================================================== */
.o-brand-mark { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--board); color: #fff; font-family: var(--fontRecord); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; position: relative; }
.o-brand-mark::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 7px; height: 2px; border-radius: 1px; background: var(--chalk); }
.o-filter { display: flex; align-items: center; gap: 0; border: 1px solid var(--lineStrong); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.o-filter .fchip { display: flex; flex-direction: column; justify-content: center; gap: 0; min-height: 42px; padding: 3px 32px 3px 12px; border: 0; border-right: 1px solid var(--line); background: transparent 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='%2356625d' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; text-align: left; cursor: pointer; white-space: nowrap; }
.o-filter .fchip:last-child { border-right: 0; }
.o-filter .fchip:hover { background-color: var(--board50); }
.o-filter .fchip small { font-size: 11px; color: var(--ink3); font-weight: 500; line-height: 1.2; }
.o-filter .fchip b { font-size: var(--fs-md); font-weight: 700; line-height: 1.25; }
.o-top-search { flex: 1; max-width: 440px; margin-left: auto; position: relative; }
.o-top-search .input { min-height: 42px; background: var(--surface); padding-right: 40px; }
.o-top-search .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.o-search-btn { display: none; }

.page { width: 100%; max-width: 1440px; padding: 24px 28px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head .crumb { font-size: var(--fs-sm); color: var(--ink3); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.page-head .crumb a { color: var(--ink3); }
.page-head .sub { margin-top: 6px; color: var(--ink3); font-size: var(--fs-md); max-width: 70ch; }
.page-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s4); }
.toolbar .field { min-width: 160px; }
.toolbar .field.wide { flex: 1; min-width: 240px; }

/* Office responsive: tablet → phone */
@media (max-width: 1180px) {
  .page { padding: 20px 20px 64px; }
}
@media (max-width: 640px) {
  .page { padding: 16px 16px 72px; }
  .page-head { margin-bottom: var(--s4); }
  h1 { font-size: 23px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: 120px minmax(0, 1fr); }
  .btn { min-height: var(--tap); }
  .btn-sm { min-height: var(--tap); }
  .btn-icon.btn-sm { width: var(--tap); }
  .o-top-search .input { min-height: var(--tap); }
  .menu-item { min-height: var(--tap); }
  .panel-foot a, .section-title a { display: inline-flex; align-items: center; min-height: var(--tap); }
  .check { min-height: var(--tap); }
  .btn-link { min-height: var(--tap); display: inline-flex; align-items: center; }
  /* Inline text links in tables, crumbs and definition lists keep their look but get a 44px touch area */
  .tbl a:not(.btn):not(.ma), .crumb a, .dl a, .page a:not([class]), .page a.nowrap, .hitslop { position: relative; }
  .tbl a:not(.btn):not(.ma)::after, .crumb a::after, .dl a::after, .page a:not([class])::after, .page a.nowrap::after, .hitslop::after { content: ""; position: absolute; left: -4px; right: -4px; top: 50%; height: 44px; transform: translateY(-50%); }
  .popover { max-width: calc(100vw - 16px); }
  .input, .select { min-height: var(--tap); font-size: 16px; }
  .tabs [role="tab"], .tabs a { min-height: var(--tap); }
  .drawer-body { padding: var(--s4); }
  .drawer-head, .drawer-foot { padding-left: var(--s4); padding-right: var(--s4); }
  .panel-head { flex-wrap: wrap; }
  .page-actions { width: 100%; }
  .toolbar .field, .toolbar .field.wide { min-width: 0; flex: 1 1 100%; }
  .hide-sm { display: none !important; }
}
@media (min-width: 641px) { .show-sm { display: none !important; } }

/* ==========================================================================
   TEACHER SHELL (phone-first, one thumb)
   ========================================================================== */
.teacher-wrap { font-size: 16px; background: var(--paper2); }
.t-app { max-width: 480px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.t-head { position: sticky; top: 0; z-index: 30; background: var(--board); color: #fff; padding: 10px 16px 14px; }
.t-head-row { display: flex; align-items: center; gap: var(--s2); min-height: 48px; }
.t-head h1 { color: #fff; font-size: 22px; flex: 1; min-width: 0; }
.t-head .t-sub { font-size: 15px; color: #cfe2d9; margin-top: 2px; }
.t-back { width: 48px; height: 48px; margin-left: -10px; display: grid; place-items: center; border-radius: 10px; color: #fff; text-decoration: none; flex: none; }
.t-back:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.t-back .i { width: 26px; height: 26px; }
.t-head .t-icon-btn { width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; flex: none; }
.t-head .t-icon-btn:hover { background: rgba(255, 255, 255, .1); }
.t-head .t-icon-btn .i { width: 24px; height: 24px; }
.t-body { flex: 1; padding: 16px 16px 24px; }
.t-body.has-bar { padding-bottom: 150px; }
.t-nav { position: sticky; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--lineStrong); padding-bottom: env(safe-area-inset-bottom); }
.t-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 64px; font-size: 13px; font-weight: 600; color: var(--ink3); text-decoration: none; position: relative; }
.t-nav a .i { width: 24px; height: 24px; }
.t-nav a.is-active { color: var(--board); }
.t-nav a.is-active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--board); }
.teacher .btn { min-height: 48px; font-size: 16px; }
.teacher .btn-sm { min-height: 44px; font-size: 15px; }
.teacher .note { font-size: 15px; }
.teacher .tag { font-size: 13px; line-height: 22px; }
.teacher .ma { font-size: 15px; line-height: 24px; }
.t-section { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin: 24px 0 10px; }
.t-section h2 { font-size: 17px; }
.t-section .sub { font-size: 14px; color: var(--ink3); }
.t-card { display: block; background: var(--surface); border: 1px solid var(--lineStrong); border-radius: 14px; padding: 16px; color: inherit; text-decoration: none; }
.t-card + .t-card { margin-top: 12px; }
a.t-card:hover { border-color: var(--board500); background: var(--board50); }
a.t-card:active { transform: translateY(1px); }
.t-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--lineStrong); border-radius: 14px; overflow: hidden; }
.t-list > li + li { border-top: 1px solid var(--line); }
.t-item { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; color: inherit; text-decoration: none; }
a.t-item:hover { background: var(--board50); }
.t-item .grow strong { display: block; font-size: 16px; }
.t-item .grow small { display: block; font-size: 14px; color: var(--ink3); }
.t-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-width: 480px; margin: 0 auto; background: var(--surface); border-top: 1px solid var(--lineStrong); box-shadow: var(--shadow-bar); padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); }

/* ==========================================================================
   Print (A5 receipts, reports)
   ========================================================================== */
@media print {
  body { background: #fff; }
  .xl-titlebar, .xl-ribbon, .xl-filterbar, .xl-sheettabs, .no-print, .page-actions, .t-nav, .t-bar { display: none !important; }
  body { padding-bottom: 0 !important; }
  .page { padding: 0; max-width: none; }
}

/* ==========================================================================
   Tenant shell additions (WI-01): skip link, site bar, spinner, refresh bar, pager, pickers, S2 search
   ========================================================================== */
.skip-link { position: absolute; left: 8px; top: 0; z-index: 300; transform: translateY(-120%); padding: 10px 14px; border-radius: var(--r-sm); background: var(--board); color: #fff; font-weight: 600; text-decoration: none; }
.skip-link:focus { transform: none; color: #fff; }
.site-bar { display: flex; align-items: center; min-height: var(--topH); padding: 8px clamp(1rem, 4vw, 2rem); background: var(--surface); border-bottom: 1px solid var(--line); }
.site-bar__brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); font-family: var(--fontRecord); font-weight: 600; color: var(--ink); text-decoration: none; }
.o-brand-mark--lg { width: 52px; height: 52px; font-size: 22px; border-radius: 12px; }
.o-brand-mark--lg::after { left: 10px; right: 10px; bottom: 9px; height: 3px; border-radius: 2px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.refresh-bar { display: flex; align-items: center; justify-content: flex-end; gap: var(--s3); margin-bottom: var(--s3); font-size: var(--fs-sm); color: var(--ink3); }
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s3); padding: var(--s3) 0; font-size: var(--fs-sm); color: var(--ink3); }
.pager .btn.is-disabled { pointer-events: none; }

.tien-no.is-text::before { content: none; }

/* Top bar (S2): the filter is three native selects styled as the mockup's chips */
.o-filter .fchip { position: relative; padding-right: 0; background-image: none; cursor: default; }
.o-filter .fchip select { appearance: none; border: 0; background: transparent 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='%2356625d' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; padding: 0 30px 0 0; margin: 0; font: inherit; font-size: var(--fs-md); font-weight: 700; line-height: 1.25; color: var(--ink); cursor: pointer; min-height: 24px; max-width: 200px; }
.o-filter .fchip select:focus-visible { outline: none; box-shadow: var(--focus); }
.o-filter .fchip { padding-right: 12px; }

/* Global search dropdown (S2) */
.gs { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; background: var(--surface); border: 1px solid var(--lineStrong); border-radius: var(--r-sm); box-shadow: var(--shadow-2); padding: 6px; max-height: 70vh; overflow: auto; min-width: 320px; }
.gs h3 { font-size: 12px; font-weight: 600; color: var(--ink3); padding: 8px 10px 4px; }
.gs a { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 10px; min-height: var(--tap); border-radius: 4px; color: inherit; text-decoration: none; }
.gs a:hover, .gs a.is-hl { background: var(--board50); }
.gs .ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--paper2); color: var(--board500); }
.gs b { font-weight: 700; }
.gs small { display: block; color: var(--ink3); font-size: var(--fs-sm); }
.gs .foot { padding: 8px 10px 4px; font-size: var(--fs-xs); color: var(--ink3); border-top: 1px solid var(--line); margin-top: 4px; }
.gs .empty { padding: 24px 12px; }
@media (max-width: 640px) { .gs { min-width: 0; } }

/* Pickers */
.picker__box { position: relative; }
.picker__list { left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow: auto; list-style: none; margin: 0; padding: var(--s1); }
.picker__list .menu-item { min-height: var(--tap); }
.picker__sub { display: block; color: var(--ink3); font-size: var(--fs-sm); }
.picker__empty { padding: 12px; color: var(--ink3); font-size: var(--fs-sm); }
.sodu-card .panel-body { padding: var(--s4); }

/* ==========================================================================
   Excel-style office shell: title bar, ribbon, filter bar, sheet tabs
   ========================================================================== */
body:has(.xl-sheettabs) { padding-bottom: 40px; }
.xl-titlebar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 36px; padding: 4px 16px; background: #217346; color: #fff; position: sticky; top: 0; z-index: 50; }
.xl-titlebar__name { font-size: var(--fs-base); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xl-titlebar__name a { color: inherit; text-decoration: none; }
.xl-titlebar__name span { font-weight: 400; }
.xl-titlebar__user { display: flex; align-items: center; gap: var(--s3); flex: none; font-size: var(--fs-sm); }
.xl-titlebar__user form { margin: 0; }
.xl-titlebar .btn { min-height: 28px; padding: 0 var(--s3); background: #1a5c38; border-color: #14502f; color: #fff; }
.xl-titlebar .btn:hover { background: #14502f; color: #fff; }
.xl-ribbon { display: flex; align-items: stretch; gap: 0; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--lineStrong); padding: 4px 8px 0; scrollbar-width: thin; }
.xl-ribbon__group { display: flex; flex-direction: column; flex: none; padding: 0 6px; border-right: 1px solid var(--line); }
.xl-ribbon__group:last-child { border-right: 0; }
.xl-ribbon__items { display: flex; flex: 1; gap: 2px; }
.xl-ribbon__cap { text-align: center; font-size: 12px; color: var(--ink3); padding: 2px 0 3px; white-space: nowrap; }
.xl-ribbon a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 64px; min-height: 44px; padding: 4px 6px; border: 1px solid transparent; border-bottom: 3px solid transparent; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: 13px; line-height: 1.15; text-align: center; }
.xl-ribbon a .i { width: 24px; height: 24px; color: #217346; }
.xl-ribbon a:hover { background: #e8f3ec; border-color: #b7d6c4; border-bottom-color: transparent; }
.xl-ribbon a.is-active { font-weight: 700; border-bottom-color: #217346; background: #f4faf6; }
.xl-filterbar { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); padding: 6px 16px; background: #f3f3f3; border-bottom: 1px solid var(--lineStrong); }
.xl-filterbar .o-filter { border-radius: var(--r-xs); }
.xl-filterbar .o-top-search { margin-left: auto; }
.xl-filterbar .o-top-search .input { min-height: 36px; border-radius: var(--r-xs); }
.xl-sheettabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: stretch; height: 36px; background: #f3f3f3; border-top: 1px solid #c6c6c6; }
.xl-sheettabs__scroll { flex: none; width: 28px; border: 0; background: transparent; color: var(--ink2); font-size: 14px; cursor: pointer; }
.xl-sheettabs__scroll:hover { background: #e3e3e3; }
.xl-sheettabs__list { flex: 1; display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.xl-sheettabs__list::-webkit-scrollbar { display: none; }
.xl-sheettabs a { flex: none; display: flex; align-items: center; padding: 0 14px; font-size: 14px; color: var(--ink2); text-decoration: none; white-space: nowrap; border-right: 1px solid #d4d4d4; border-bottom: 3px solid transparent; }
.xl-sheettabs a:hover { background: #e3e3e3; }
.xl-sheettabs a.is-active { background: #fff; color: #217346; font-weight: 700; border-bottom-color: #217346; }
.xl-zoom { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 12px; border-left: 1px solid #d4d4d4; font-size: 13px; }
.xl-zoom button { width: 26px; height: 26px; border: 1px solid #c6c6c6; background: #fff; border-radius: var(--r-xs); cursor: pointer; font-weight: 700; }
.xl-zoom button:disabled { opacity: .4; cursor: default; }
.xl-zoom output { min-width: 40px; text-align: center; }
@media (max-width: 640px) {
  .xl-titlebar { padding: 4px 16px; }
  .xl-titlebar__user .xl-titlebar__who { display: none; }
  .xl-filterbar { padding: 6px 16px; }
  .xl-filterbar .o-filter { max-width: 100%; overflow-x: auto; }
  .xl-filterbar .o-top-search { flex-basis: 100%; max-width: none; margin-left: 0; }
  .xl-zoom { display: none; }
}
