/* HRS Clean shared styles (DESIGN.md). One stylesheet for every page.
   B8.2: toasts and the "TC uploads" list. B9.3: plain pages (/admin/audit).
   Phase C (C1): all DESIGN.md tokens, Inter (self-hosted), and the components as plain classes.
   Tokens keep the -- prefix until C5 removes the old pages' styles. */

/* --- Inter, self-hosted (Phase C decision 5). latin + latin-ext (₹ is in latin-ext) --- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/inter-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/inter-latin-500-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/inter-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/static/fonts/inter-latin-700-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/inter-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/inter-latin-ext-500-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/inter-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/static/fonts/inter-latin-ext-700-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* surfaces */
  --bg: #F7F8FA; --surface: #FFFFFF; --surface-sub: #F9FAFB; --head: #FCFCFD;
  --border: #E4E7EC; --border-strong: #D0D5DD; --row-line: #F2F4F7; --track: #EEF0F3;
  /* text */
  --text: #101828; --text-2: #344054; --text-3: #475467; --text-4: #667085; --disabled: #98A2B3;
  /* brand: the only accent */
  --brand: #0E5A43; --brand-hover: #0B4A37; --brand-tint: #E7F3EE; --brand-tint-2: #F1F8F5; --brand-line: #B7D9CA;
  /* meaning only */
  --warn-bg: #FFFAEB; --warn: #B54708;
  --danger-bg: #FEF3F2; --danger: #B42318;
  --ok-bg: #ECFDF3; --ok: #067647;
  --info-bg: #EFF8FF; --info: #175CD3;
  --toast: #101828; --toast-accent: #6CE9A6;
  --r-sm: 5px; --r: 8px; --r-lg: 12px; --r-pill: 999px;
  --shadow-pop: 0 12px 32px -8px rgba(16, 24, 40, .12);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* layout */
  --gutter: 28px; --header: 60px; --tabbar: 0px;
}
@media (max-width: 759.98px) { :root { --gutter: 16px; --tabbar: 64px; } }

/* ===================================================================================== */
/* Base (only pages on base.html: body.hrs-app)                                           */
/* ===================================================================================== */
.hrs-app, .hrs-app *, .hrs-app *::before, .hrs-app *::after { box-sizing: border-box; }
html:has(body.hrs-app) { -webkit-text-size-adjust: 100%; scrollbar-color: var(--border-strong) transparent; }
body.hrs-app {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--font); font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px));
}
.hrs-app ::selection { background: #CDE8DC; color: var(--text); }
.hrs-app :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
:where(.hrs-app a) { color: inherit; text-underline-offset: 3px; }
:where(.hrs-app button, .hrs-app input, .hrs-app select, .hrs-app textarea) { font: inherit; color: inherit; }
:where(.hrs-app h1, .hrs-app h2, .hrs-app h3) { margin: 0; font-weight: 600; text-wrap: balance; }
.hrs-app [hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-4); }
.nowrap { white-space: nowrap; }
.inline-form { display: inline; margin: 0; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 3000; background: var(--brand); color: #fff; padding: 8px 12px;
  border-radius: var(--r); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 12px; }

/* --- header --- */
.app-header { position: sticky; top: 0; z-index: 900; height: var(--header); background: var(--surface);
  border-bottom: 1px solid var(--border); }
.app-header-inner { max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none; }
.brand img { height: 26px; width: auto; display: block; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.main-nav { display: flex; align-self: stretch; gap: 4px; min-width: 0; }
.main-nav a { display: flex; align-items: center; padding: 0 10px; text-decoration: none; color: var(--text-3);
  font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.main-nav a:hover { color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.header-title { display: none; font-weight: 600; font-size: 16px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0;
  border-radius: var(--r); background: transparent; color: var(--text-3); cursor: pointer; }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-sub); color: var(--text); } }
.icon-btn .hrs-badge { position: absolute; top: 0; right: -2px; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--track); color: var(--text-2);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 50%; cursor: pointer; }

/* --- phone: header shrinks, bottom tab bar --- */
.tabbar { display: none; }
@media (max-width: 759.98px) {
  .app-header-inner { gap: 12px; }
  .brand-name, .main-nav, .header-tools .user-menu { display: none; }
  .header-title { display: block; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface); border-top: 1px solid var(--border); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 44px; text-decoration: none; color: var(--text-3); font-size: 12px; font-weight: 500; background: none; border: 0; cursor: pointer; }
  .tabbar .ico { width: 22px; height: 22px; }
  .tabbar [aria-current="page"] { color: var(--brand); }
}

/* --- page frame --- */
.page { max-width: 1440px; margin: 0 auto; padding: 24px var(--gutter) 40px; }
.page-narrow { max-width: 880px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; letter-spacing: -.015em; line-height: 1.25; }
.page-head .sub { color: var(--text-3); margin: 2px 0 0; width: 100%; }
.page-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); text-decoration: none; font-weight: 500; font-size: 13px; margin-bottom: 8px; }
.crumb:hover { color: var(--text); }
@media (max-width: 759.98px) {
  .page { padding-top: 16px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 20px; }
  .page-actions { margin-left: 0; width: 100%; flex-wrap: nowrap; gap: 6px; }
  .page-actions .btn { flex: 1 1 auto; padding: 0 8px; min-width: 0; }
  .page-actions .btn .ico { display: none; }
}

/* --- buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid transparent; font-size: 14px; font-weight: 500; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap; user-select: none; }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .55; }
.btn-primary { background: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-sub); color: var(--text); }
.btn-quiet { height: 30px; padding: 0 12px; font-size: 13px; background: var(--surface); color: var(--brand); border-color: var(--brand-line); }
.btn-quiet:hover:not(:disabled) { background: var(--brand-tint-2); }
.btn-danger { background: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: #912018; }
.btn-ghost { background: transparent; color: var(--text-3); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sub); color: var(--text); }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-dot { display: inline-grid; place-items: center; box-sizing: border-box; width: 30px; height: 30px; padding: 0; margin: 0;
  color: var(--text-3); background: transparent; border: 0; border-radius: var(--r); vertical-align: middle; line-height: 0; }
.btn-dot .ico { display: block; margin: 0; }
details[open] > summary.btn-dot { background: var(--track); color: var(--text); }
@media (hover: hover) { .btn-dot:hover { background: var(--track); color: var(--text); } }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 759.98px) { .btn-lg { height: 52px; font-size: 16px; } .btn { min-height: 40px; } .btn-quiet { min-height: 36px; } }

/* --- batch tag, coil no. --- */
.batch { display: inline-block; border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 0 6px;
  font-weight: 600; letter-spacing: .02em; color: var(--text); font-variant-numeric: tabular-nums; line-height: 20px;
  background: var(--surface); white-space: nowrap; }
.coil-no { display: block; font-size: 12px; color: var(--text-4); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* --- pills --- */
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-pill); padding: 1px 8px; font-size: 12px;
  font-weight: 500; line-height: 18px; white-space: nowrap; background: var(--track); color: var(--text-2); }
.pill[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.pill[data-tone="warn"] { background: var(--warn-bg); color: var(--warn); }
.pill[data-tone="danger"], .pill[data-tone="error"] { background: var(--danger-bg); color: var(--danger); }
.pill[data-tone="info"], .pill[data-tone="wait"] { background: var(--info-bg); color: var(--info); }
.age { color: var(--text-3); white-space: nowrap; }

/* --- segmented switch (Coils/Sheets, Book/Hold, Holds/Booked/Finished) --- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--track); border-radius: var(--r); }
.seg > a, .seg > button, .seg > label { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 0 12px;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.seg > a:hover, .seg > button:hover, .seg > label:hover { color: var(--text); }
.seg > [aria-current="page"], .seg > [aria-pressed="true"], .seg > label:has(input:checked) {
  background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.seg > label input { position: absolute; opacity: 0; pointer-events: none; }
.seg > label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 1px; }
.seg-block { display: flex; }
.seg-block > * { flex: 1; }
@media (max-width: 759.98px) { .seg > a, .seg > button, .seg > label { min-height: 38px; } }

/* --- summary strip --- */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 20px; }
.summary > div { padding: 14px 20px; border-left: 1px solid var(--border); min-width: 0; }
.summary > div:first-child { border-left: 0; }
.summary dt { font-size: 12px; font-weight: 500; color: var(--text-3); }
.summary dd { margin: 2px 0 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.summary .fig { font-size: 24px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.summary .unit { font-size: 13px; color: var(--text-3); font-weight: 500; }
.summary .meta { font-size: 12px; color: var(--text-4); width: 100%; }
.summary-note { margin: -12px 0 16px; font-size: 12px; color: var(--text-3); }
@media (max-width: 1099.98px) { .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary > div:nth-child(3) { border-left: 0; } .summary > div:nth-child(n+3) { border-top: 1px solid var(--border); } }
@media (max-width: 759.98px) { .summary > div { padding: 10px 14px; } .summary .fig { font-size: 20px; } }

/* --- cards, table card --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 16px; }
@media (max-width: 759.98px) { .card-pad { padding: 16px; } }

.views { display: flex; gap: 20px; padding: 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.views::-webkit-scrollbar { display: none; }
.views a { display: inline-flex; align-items: center; gap: 8px; padding: 14px 0 12px; margin-bottom: -1px; color: var(--text-3);
  font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.views a:hover { color: var(--text); }
.views a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }
.views .count { min-width: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--track); color: var(--text-3);
  font-size: 12px; font-weight: 500; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.views a[aria-current="page"] .count { background: var(--brand-tint); color: var(--brand); }
@media (max-width: 759.98px) {
  .views { gap: 8px; padding: 12px 16px; border-bottom: 0; }
  .views a { padding: 0 12px; min-height: 36px; border: 1px solid var(--border-strong); border-radius: var(--r-pill); margin: 0; gap: 6px; }
  .views a[aria-current="page"] { background: var(--brand-tint); border-color: var(--brand-line); }
  .views .count { background: transparent; padding: 0; min-width: 0; }
}

.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.toolbar-row .grow { flex: 1 1 auto; }
.result-meta { color: var(--text-3); font-size: 13px; white-space: nowrap; }
@media (max-width: 759.98px) { .toolbar-row { padding: 0 16px 12px; border-bottom: 1px solid var(--border); } .toolbar-row .grow { display: none; } }

/* --- search --- */
.search { position: relative; flex: 1 1 320px; max-width: 460px; min-width: 0; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-4); pointer-events: none; }
.search input { width: 100%; height: 36px; padding: 0 36px 0 36px; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); font-size: 14px; color: var(--text); }
.search input::placeholder { color: var(--text-4); }
.search input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-width: 20px; height: 20px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 4px; font: 500 12px var(--font); color: var(--text-4); background: var(--surface-sub); }
.search input:focus ~ kbd { display: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
@media (max-width: 759.98px) { .search { flex-basis: 100%; max-width: none; } .search input { height: 46px; font-size: 16px; } .search kbd { display: none; } }

/* --- filter chips --- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 10px; border-radius: var(--r-pill);
  background: var(--brand-tint); color: var(--brand); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip a { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--brand); text-decoration: none; }
.chip a:hover { background: rgba(14, 90, 67, .12); }
.chip-add { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px dashed var(--border-strong);
  border-radius: var(--r-pill); background: var(--surface); color: var(--text-3); font-size: 13px; font-weight: 500; cursor: pointer; list-style: none; }
.chip-add::-webkit-details-marker { display: none; }
.chip-add:hover { color: var(--text); border-color: var(--text-4); }
.chip-clear { font-size: 13px; color: var(--text-3); font-weight: 500; }

/* --- table --- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { position: sticky; top: 0; background: var(--head); color: var(--text-3); font-size: 12px; font-weight: 500; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.tbl td { padding: 8px 12px; height: 48px; border-bottom: 1px solid var(--row-line); color: var(--text-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl .r, .tbl th.r { text-align: right; }
.tbl .bal { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tbl tr.is-selected td { background: var(--brand-tint-2); }
.inv-table tbody tr { cursor: pointer; }
.inv-table tbody tr:hover td { background: var(--surface-sub); }
.inv-table tbody tr.is-selected:hover td { background: var(--brand-tint-2); }
.tbl .actions { white-space: nowrap; text-align: right; width: 1%; }
.tbl .actions > * { vertical-align: middle; }
.tbl .actions > * + * { margin-left: 4px; }
.tbl .check { width: 1%; padding-right: 0; }
.tbl input[type="checkbox"], .check-lg { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; margin: 0; vertical-align: middle; }
.tbl .sub-row td { background: var(--surface-sub); }

/* optional columns (Columns menu): hidden unless the table has show-<key> */
.tbl [data-col] { display: none; }
.tbl.show-c [data-col="c"], .tbl.show-mn [data-col="mn"], .tbl.show-s [data-col="s"], .tbl.show-p [data-col="p"], .tbl.show-si [data-col="si"],
.tbl.show-al [data-col="al"], .tbl.show-n [data-col="n"], .tbl.show-el [data-col="el"], .tbl.show-length [data-col="length"],
.tbl.show-brand [data-col="brand"], .tbl.show-item [data-col="item"], .tbl.show-date [data-col="date"], .tbl.show-ca_wt [data-col="ca_wt"],
.tbl.show-kt_wt [data-col="kt_wt"], .tbl.show-remark [data-col="remark"] { display: table-cell; }

/* --- pager --- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 20px;
  border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
.pager-links { display: flex; gap: 8px; }
.pager-links .btn { height: 32px; font-size: 13px; }
@media (max-width: 759.98px) { .pager { padding: 12px 16px; } .pager-links .btn { height: 40px; } }

/* --- empty state --- */
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty strong { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty p { margin: 0 0 12px; }

/* --- menus (⋯, Columns, avatar, + Add filter): <details> pop-overs --- */
.menu { position: relative; display: inline-block; vertical-align: middle; line-height: 0; }
.menu > .menu-pop { line-height: 1.5; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 950; min-width: 200px; max-width: min(320px, calc(100vw - 32px));
  padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop);
  text-align: left; white-space: normal; }
.menu-pop.is-fixed { position: fixed; right: auto; top: auto; }
.menu-left .menu-pop { left: 0; right: auto; }
.menu-pop a, .menu-pop button, .menu-pop .menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 10px;
  border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none; text-align: left; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-sub); color: var(--text); }
.menu-pop .danger { color: var(--danger); }
.menu-pop .danger:hover { background: var(--danger-bg); color: var(--danger); }
.menu-pop hr { border: 0; border-top: 1px solid var(--row-line); margin: 4px 0; }
.menu-pop form { display: block; margin: 0; }
.menu-pop .menu-label { padding: 6px 10px 2px; font-size: 12px; color: var(--text-4); font-weight: 500; }
.menu-pop label.menu-item { cursor: pointer; }
.menu-pop label.menu-item input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.menu-pop.menu-static { position: static; box-shadow: none; border: 0; max-width: none; padding: 0 12px 20px; }
.confirm-body { padding-top: 20px; }
.menu-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 4px; min-width: 260px; }
.menu-cols .menu-item { white-space: nowrap; }
@media (max-width: 759.98px) { .menu-pop a, .menu-pop button, .menu-pop .menu-item { min-height: 44px; font-size: 15px; } }

/* --- forms --- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .hint strong { color: var(--text-2); font-weight: 600; }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); font-size: 14px; color: var(--text); }
.textarea { height: auto; min-height: 80px; padding: 10px 12px; }
.input::placeholder { color: var(--text-4); }
.input:focus, .input:focus-within, .select:focus, .textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.input.num { text-align: right; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 52px; }
.input-suffix .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-4); pointer-events: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section { font-size: 14px; font-weight: 600; margin: 8px 0 -2px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.form-error { padding: 10px 12px; border-radius: var(--r); background: var(--danger-bg); color: var(--danger); font-size: 13px; font-weight: 500; }
.form-warn { padding: 10px 12px; border-radius: var(--r); background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 500; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
@media (max-width: 759.98px) {
  .input, .select { height: 46px; font-size: 16px; }
  .textarea { font-size: 16px; }
  .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* --- dialogs and drawers (<dialog>: Escape closes, focus stays inside) --- */
dialog.dlg, dialog.drawer { padding: 0; border: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow-pop); font: 400 14px/1.5 var(--font); }
dialog.dlg::backdrop, dialog.drawer::backdrop { background: rgba(16, 24, 40, .32); }
dialog.dlg { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border-radius: var(--r-lg); overflow: auto; }
dialog.dlg-lg { width: min(960px, calc(100vw - 32px)); }
dialog.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: none; width: min(480px, 100vw); border-radius: 0; display: none; flex-direction: column; }
dialog.drawer[open] { display: flex; animation: hrs-slide-in 200ms ease-out; }
dialog.dlg[open] { animation: hrs-fade-in 160ms ease-out; }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 12px; }
.drawer .dlg-head { border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.dlg-head h2 { font-size: 16px; line-height: 1.4; }
.dlg-head p { margin: 2px 0 0; font-size: 13px; color: var(--text-3); }
.dlg-body { padding: 4px 20px 20px; }
.drawer .dlg-body { flex: 1; overflow-y: auto; padding-top: 16px; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px 20px; }
.drawer .dlg-foot { border-top: 1px solid var(--border); padding-top: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.dlg-close { flex: none; }
.confirm-text { margin: 0; font-size: 15px; color: var(--text); overflow-wrap: anywhere; }
@keyframes hrs-slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes hrs-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes hrs-sheet-in { from { transform: translateY(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 759.98px) {
  dialog.drawer, dialog.dlg-lg, dialog.dlg-sheet { inset: auto 0 0 0; margin: 0; width: 100vw; max-width: 100vw; height: auto; max-height: 92dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0; }
  dialog.dlg-lg[open], dialog.drawer[open], dialog.dlg-sheet[open] { display: flex; flex-direction: column; animation: hrs-sheet-in 200ms ease-out; }
  dialog.dlg-lg .dlg-body { flex: 1; overflow-y: auto; }
}

/* --- side panel (booking) and phone bottom sheet --- */
.with-panel { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.side-panel { position: sticky; top: calc(var(--header) + 16px); max-height: calc(100vh - var(--header) - 32px); overflow-y: auto; }
.panel-empty { padding: 32px 20px; text-align: center; color: var(--text-3); }
.panel-empty .ico { width: 28px; height: 28px; color: var(--text-4); margin-bottom: 8px; }
.sheet-backdrop { display: none; }
@media (max-width: 1099.98px) {
  .with-panel { grid-template-columns: minmax(0, 1fr); }
  .side-panel { position: static; max-height: none; }
}
@media (max-width: 759.98px) {
  .side-panel:not(.is-open) { display: none; }
  .side-panel.is-open { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1600; max-height: 92dvh; border-radius: var(--r-lg) var(--r-lg) 0 0;
    border: 0; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; animation: hrs-sheet-in 200ms ease-out; }
  .sheet-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 1599; background: rgba(16, 24, 40, .32); }
  body.sheet-open { overflow: hidden; }
}

.book { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.book-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.book-page .card { max-width: 520px; }
/* without JavaScript the Add stock / Upload TC dialogs are plain sections at the end of the page */
html:not(.js) dialog.page-dialog { display: block; position: static; width: auto; height: auto; max-width: 1440px; margin: 20px auto; box-shadow: none;
  border: 1px solid var(--border); border-radius: var(--r-lg); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.tab-pane { margin-top: 16px; }
.js .tab-pane[data-tab-hidden] { display: none; }
.js-only { display: none; }
.js .js-only { display: flex; }
.menu-form { width: 300px; padding: 12px; }
.menu-form form { display: flex; flex-direction: column; gap: 10px; }
.menu-form .menu-label { padding: 0; }
.menu-form .input, .menu-form .select { height: 36px; }
@media (max-width: 759.98px) { .menu-form .input, .menu-form .select { height: 46px; } }
.book-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.book-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.menu-pop.is-fixed { z-index: 1700; }
.book-desc { margin: 6px 0 0; font-size: 13px; color: var(--text-3); }
.book-body { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.book-free { font-size: 28px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.book-free > span + span { font-size: 15px; color: var(--text-3); font-weight: 500; }
.bar { height: 8px; border-radius: var(--r-pill); background: var(--track); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: inherit; transition: width 120ms ease-out; }
.bar.is-over > i { background: var(--danger); }
.bar-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.bar-legend strong { color: var(--text); font-weight: 600; }
.calc { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-sub); padding: 10px 14px; font-size: 13px; }
.calc div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; color: var(--text-2); font-variant-numeric: tabular-nums; }
.calc div span:last-child { text-align: right; }
.calc .total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 7px; color: var(--text); font-weight: 600; font-size: 14px; }
.book-foot { padding: 0 20px 20px; }
.book-foot .btn { white-space: normal; text-align: center; line-height: 1.25; height: auto; min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
.use-full { font-size: 12px; align-self: flex-start; }
@media (max-width: 759.98px) {
  .book-body { padding: 12px 16px 16px; }
  .book-head { padding: 16px 16px 0; }
  .book-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); background: var(--surface); }
  .book-foot .btn { min-height: 52px; font-size: 16px; }
  .book-free { font-size: 26px; }
}

/* --- phone list rows (Inventory) --- */
.m-list { display: none; list-style: none; margin: 0; padding: 0; }
@media (max-width: 759.98px) {
  .m-list { display: block; }
  .desk-only { display: none !important; }
  .m-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--row-line);
    color: inherit; text-decoration: none; min-height: 64px; }
  .m-row:active { background: var(--surface-sub); }
  .m-row.is-selected { background: var(--brand-tint-2); }
  .m-row .bal { font-size: 16px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
  .m-row .bal small { font-size: 12px; color: var(--text-4); font-weight: 500; }
  .m-row .line { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--text-3); }
  .m-row .top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
  .m-row .coil-no { display: inline; margin: 0; }
}
@media (min-width: 760px) { .phone-only { display: none !important; } }
/* phones: list tables fit the screen (no sideways scrolling inside the card) */
@media (max-width: 759.98px) {
  .tbl th, .tbl td { padding-left: 8px; padding-right: 8px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
  .tbl th:last-child, .tbl td:last-child { padding-right: 12px; }
  .tbl .check { padding-right: 0; }
  .inv-cell { white-space: normal; }
  .inv-cell .inv-no { overflow-wrap: anywhere; }
  .role-form { flex-wrap: wrap; gap: 6px; }
  .role-form .btn { padding: 0 10px; }
  .tbl td.actions .muted { white-space: normal; display: inline-block; max-width: 96px; text-align: right; font-size: 12px; }
  .wrap-name, .orders-table .order-cell { min-width: 120px; }
}

/* --- small pages (C5): Manage users, Audit log, Edit stock, Edit sale --- */
.section-title { font-size: 16px; margin-bottom: 14px; }
.span-all { grid-column: 1 / -1; }
.card + .card { margin-top: 20px; }
.role-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.role-form .select { width: auto; height: 36px; }
.btn-quiet.danger-quiet { color: var(--danger); border-color: #FECDCA; }
.btn-quiet.danger-quiet:hover:not(:disabled) { background: var(--danger-bg); }
.audit-table { min-width: 960px; }
.audit-table td { vertical-align: top; height: auto; padding-top: 10px; padding-bottom: 10px; }
.audit-table td:nth-child(5) { min-width: 320px; }
.changes { margin: 0; display: grid; gap: 2px; }
.changes div { display: grid; grid-template-columns: minmax(90px, max-content) 1fr; gap: 10px; }
.changes dt { color: var(--text-4); }
.changes dd { margin: 0; overflow-wrap: anywhere; }
.old { color: var(--text-4); text-decoration: line-through; }
.note { color: var(--text-3); min-width: 160px; }
.audit-filters .select { height: 36px; width: auto; max-width: 220px; }
.toolbar-row [data-active] { border-color: var(--brand); background: var(--brand-tint); }
.page-head h1 .batch { font-size: 20px; line-height: 30px; vertical-align: 2px; }
@media (max-width: 759.98px) { .audit-filters .select { height: 46px; width: 100%; max-width: none; } .role-form .select { height: 40px; } }

/* Phase G: Manage users, WhatsApp and web login. A switch = a checkbox with role="switch" (no JavaScript). */
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.switch-row { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.switch-row input[role="switch"] { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: var(--r-pill);
  background: var(--border-strong); position: relative; cursor: pointer; transition: background 120ms ease-out; }
.switch-row input[role="switch"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, .2); transition: transform 120ms ease-out; }
.switch-row input[role="switch"]:checked { background: var(--brand); }
.switch-row input[role="switch"]:checked::after { transform: translateX(16px); }
.switch-row input[role="switch"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.form-grid-3 .span-wide { grid-column: span 2; }
.wa-access .seg > label { white-space: nowrap; }
.wa-sub { color: var(--text-3); margin: -6px 0 14px; font-size: 13px; }
.wa-list { list-style: none; margin: 0; padding: 0; }
.wa-list > li { padding: 14px 0; border-top: 1px solid var(--row-line); }
.wa-list > li:first-child { border-top: 0; padding-top: 4px; }
.wa-form { display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) max-content; gap: 10px 16px; align-items: end; }
.wa-form .form-error, .wa-who { grid-column: 1 / -1; }
.wa-form .field:has(input[type="password"]) { grid-column: 1 / 2; }
.wa-who { display: flex; align-items: baseline; gap: 8px; }
.wa-who .coil-no { margin: 0; }
.wa-save { grid-column: -2 / -1; justify-self: end; }
.wa-own { min-height: 36px; display: flex; align-items: center; }
.wa-cell .coil-no { display: block; }
.form-warn + .wa-list { margin-top: 14px; }
@media (max-width: 759.98px) { .wa-form { grid-template-columns: minmax(0, 1fr); } .wa-form > * { grid-column: 1 / -1 !important; }
  .wa-save { justify-self: stretch; } .wa-save .btn { width: 100%; } .switch-row { min-height: 44px; } .form-grid-3 .span-wide { grid-column: auto; }
  .wa-access .seg > label { white-space: normal; text-align: center; line-height: 1.2; padding: 4px 8px; } }
@media (prefers-reduced-motion: reduce) { .switch-row input[role="switch"], .switch-row input[role="switch"]::after { transition: none; } }

/* --- invoices / customers (C4) --- */
.inv-no { font-weight: 600; color: var(--text); }
.inv-buyer { white-space: normal; overflow-wrap: break-word; max-width: 46vw; color: var(--text-2); }
.wrap-name { min-width: 160px; overflow-wrap: break-word; }
.cust-name { font-weight: 600; color: var(--text); display: block; }
.input[readonly] { background: var(--surface-sub); color: var(--text-3); }

/* --- orders (C3) --- */
.orders-filters .search { flex-basis: 280px; }
.date-field { display: flex; align-items: center; gap: 8px; }
.date-field label { font-size: 13px; font-weight: 500; color: var(--text-3); }
.date-field .input { height: 36px; width: auto; }
/* iPhone Safari gives date fields a fixed minimum width (so width: 100% was ignored and they overflowed their box) */
input.input[type="date"] { min-width: 0; max-width: 100%; display: block; -webkit-appearance: none; appearance: none; text-align: left; }
input.input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.orders-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.orders-meta .hint { font-size: 12px; color: var(--text-3); }
.js .order-group:not(.is-open) .line-row { display: none; }
.order-row td { background: var(--surface); font-weight: 500; }
.order-group + .order-group .order-row td { border-top: 1px solid var(--border); }
.line-row td { background: var(--surface-sub); height: 44px; }
.line-batch { padding-left: 46px !important; }
.order-sub { padding-left: 24px; }
.js-only-inline { display: none; }
.js .js-only-inline { display: inline-flex; }
.action-bar-btns { display: flex; gap: 8px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.inv-lines .input { height: 34px; width: 112px; display: inline-block; }
.inv-lines .tbl td { height: 52px; }
@media (max-width: 759.98px) {
  .hide-sm { display: none !important; }
  .date-field { flex: 1 1 calc(50% - 6px); min-width: 0; flex-direction: column; align-items: stretch; gap: 4px; }
  .orders-table .order-cell { min-width: 160px; }
  .page-actions:has(> :nth-child(3)) { flex-wrap: wrap; }
  .date-field .input { height: 46px; width: 100%; }
  .orders-filters .btn { flex: 1 1 100%; }
  .orders-meta { padding: 10px 16px; }
  .line-batch { padding-left: 20px !important; }
  .order-sub { padding-left: 0; }
  .inv-lines .input { height: 46px; width: 96px; }
}
.order-row td { cursor: default; }
.order-toggle { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer; color: var(--text); font-weight: 600; text-align: left; }
.order-toggle .ico { transition: transform 120ms ease-out; color: var(--text-4); }
.order-toggle[aria-expanded="true"] .ico { transform: rotate(90deg); }
.order-cust { overflow-wrap: break-word; }
.lines td { padding-top: 6px; padding-bottom: 6px; height: 44px; }
.lines td:first-child { padding-left: 52px; }
.action-bar { position: sticky; bottom: calc(16px + var(--tabbar)); z-index: 800; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 12px auto 0; max-width: 720px; padding: 10px 10px 10px 18px; background: var(--toast); color: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.action-bar .btn-primary { background: #fff; color: var(--text); }
.action-bar .btn-primary:hover { background: var(--track); }
.action-bar .btn-ghost { color: #D0D5DD; }
.action-bar .btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* --- details list (history drawer) --- */
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; }
.kv > div { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; }
.kv dt { font-size: 12px; color: var(--text-3); font-weight: 500; }
.kv dd { margin: 2px 0 0; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.hist-line { padding: 12px 0; border-bottom: 1px solid var(--row-line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.hist-line:last-child { border-bottom: 0; }
.hist-line .who { font-weight: 600; overflow-wrap: anywhere; }
.hist-line .w { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hist-line .meta { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }

/* --- auth pages (login, page expired, admin only): centred card without the nav --- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.app-header ~ main .auth-wrap { min-height: calc(100vh - var(--header) - var(--tabbar)); align-items: start; padding-top: 48px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; }
.auth-card .brand { margin-bottom: 20px; }
.auth-card .brand img { height: 32px; }
.auth-card h1 { font-size: 24px; letter-spacing: -.015em; margin-bottom: 6px; }
.auth-card p { color: var(--text-3); margin: 0 0 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .input { height: 44px; }
@media (max-width: 759.98px) { .auth-card { padding: 22px; } .auth-card .input { height: 46px; } }

@media (max-width: 759.98px) {
  .btn-dot, .icon-btn { width: 44px; height: 44px; }
  .chip a { width: 36px; height: 36px; margin-right: -6px; }
  .chip { height: 36px; }
  .chip-add { height: 36px; }
  .hrs-toast button.hrs-link, .hrs-toast a.hrs-link { min-height: 44px; padding: 0 4px; display: inline-flex; align-items: center; }
  .hrs-toast button.hrs-close { width: 44px; height: 44px; }
  .btn { min-height: 44px; }
  .btn-quiet { min-height: 44px; }
  .menu-form { width: min(300px, calc(100vw - 32px)); }
}

@media (prefers-reduced-motion: reduce) {
  dialog.drawer[open], dialog.dlg[open], dialog.dlg-lg[open], .side-panel.is-open, .hrs-toast, .hrs-panel { animation: none !important; }
  .bar > i, .order-toggle .ico { transition: none; }
}

/* ===================================================================================== */
/* Toasts (B8.2, Phase C: every flash() is a toast; Undo for Book and Hold)              */
/* ===================================================================================== */
.hrs-toasts {
  position: fixed; left: 24px; bottom: 24px; z-index: 2000;
  display: flex; flex-direction: column-reverse; gap: 8px;
  width: min(420px, calc(100vw - 32px)); pointer-events: none;
  font-family: var(--font);
}
.hrs-toast {
  pointer-events: auto; display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: start;
  background: var(--toast); color: #fff; border-radius: var(--r-lg); padding: 12px 12px 12px 14px;
  box-shadow: var(--shadow-pop); font-size: 14px; line-height: 1.45; text-align: left;
  animation: hrs-toast-in 200ms ease-out;
}
.hrs-toast.is-leaving { opacity: 0; transition: opacity 160ms ease-out; }
.hrs-toast svg { width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.hrs-toast[data-tone="ok"] .hrs-toast-icon { color: var(--toast-accent); }
.hrs-toast[data-tone="warn"] .hrs-toast-icon { color: #FEC84B; }
.hrs-toast[data-tone="error"] .hrs-toast-icon { color: #FDA29B; }
.hrs-toast[data-tone="wait"] .hrs-toast-icon { color: #D0D5DD; }
.hrs-toast-text { overflow-wrap: anywhere; }
.hrs-toast-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.hrs-toast-actions form { margin: 0; display: inline; }
.hrs-toast button.hrs-link, .hrs-toast a.hrs-link {
  background: none; border: 0; padding: 0; margin: 0; width: auto; font: inherit; font-weight: 600;
  color: var(--toast-accent); cursor: pointer; min-height: 24px; text-decoration: none;
}
.hrs-toast a.hrs-link:hover, .hrs-toast button.hrs-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.hrs-toast button.hrs-close {
  background: none; border: 0; padding: 0; margin: 0; width: 28px; height: 28px; border-radius: var(--r);
  color: #D0D5DD; cursor: pointer; display: grid; place-items: center;
}
.hrs-toast button.hrs-close:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.hrs-toast button:focus-visible, .hrs-toast a:focus-visible { outline: 2px solid var(--toast-accent); outline-offset: 2px; }
.hrs-toast-batches { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.hrs-toast-batches li {
  border: 1px solid #475467; border-radius: var(--r-sm); padding: 1px 6px; font-weight: 600;
  letter-spacing: .02em; font-variant-numeric: tabular-nums; font-size: 13px;
}
@keyframes hrs-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 759.98px) {
  .hrs-toasts { left: 16px; right: 16px; width: auto; bottom: calc(16px + var(--tabbar) + env(safe-area-inset-bottom, 0px)); }
  body.sheet-open .hrs-toasts { top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .hrs-toast { animation: none; } .hrs-toast.is-leaving { transition: none; } }

/* --- "TC uploads" badge and list (B8.2) --- */
.hrs-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand-tint);
  color: var(--brand); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }

.hrs-panel-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .3); z-index: 1500; }
.hrs-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 1501;
  background: var(--surface); box-shadow: var(--shadow-pop); font-family: var(--font);
  color: var(--text); display: flex; flex-direction: column; animation: hrs-panel-in 200ms ease-out;
}
@keyframes hrs-panel-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hrs-panel { animation: none; } }
.hrs-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border); }
.hrs-panel-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.hrs-panel-head p { margin: 2px 0 0; font-size: 12px; color: var(--text-3); }
.hrs-panel-head button { background: none; border: 0; width: 36px; height: 36px; border-radius: var(--r);
  color: var(--text-3); cursor: pointer; display: grid; place-items: center; padding: 0; }
.hrs-panel-head button:hover { background: var(--surface-sub); }
.hrs-panel-head svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hrs-panel-body { overflow-y: auto; padding: 4px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
.hrs-job { padding: 12px 0; border-bottom: 1px solid var(--row-line); font-size: 13px; }
.hrs-job-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.hrs-job-file { font-weight: 600; font-size: 14px; color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.hrs-job-meta { color: var(--text-4); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hrs-job-msg { color: var(--text-2); margin-top: 4px; overflow-wrap: anywhere; }
.hrs-pill { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 500; margin-right: 6px; }
.hrs-pill[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.hrs-pill[data-tone="warn"] { background: var(--warn-bg); color: var(--warn); }
.hrs-pill[data-tone="error"] { background: var(--danger-bg); color: var(--danger); }
.hrs-pill[data-tone="wait"] { background: var(--info-bg); color: var(--info); }
.hrs-job button.hrs-quiet {
  margin-top: 6px; height: 30px; padding: 0 12px; width: auto; border-radius: var(--r);
  border: 1px solid var(--brand-line); background: var(--surface); color: var(--brand); font: 500 13px var(--font); cursor: pointer;
}
.hrs-job button.hrs-quiet:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hrs-empty { color: var(--text-3); font-size: 14px; padding: 24px 0; }
@media (max-width: 759.98px) { .hrs-panel { top: auto; height: 85dvh; width: 100vw; border-radius: var(--r-lg) var(--r-lg) 0 0; } .hrs-job button.hrs-quiet { height: 40px; } }

/* --- E4b: the coil picker (choose which coils of a TC to add) and the amber "needs a choice" count --- */
.hrs-badge[data-tone="warn"] { background: var(--warn); color: #fff; }
.menu-pop button .hrs-badge { margin-left: auto; }
.hrs-choose-banner { margin: 12px 0 0; padding: 8px 12px; border-radius: var(--r); background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 500; }
.hrs-job-by { margin-top: 4px; font-size: 12px; color: var(--text-4); }
.hrs-job-coils { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.hrs-job-coils a.batch { text-decoration: none; }
.hrs-job-coils a.batch:hover { border-color: var(--brand); color: var(--brand); }
.hrs-job-open { text-decoration: none; }
.hrs-job-open:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.hrs-job-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hrs-job-ask { margin-top: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
@media (min-width: 760px) { dialog.coil-picker { width: min(620px, calc(100vw - 32px)); } }
dialog.coil-picker .dlg-body { display: flex; flex-direction: column; overflow: hidden; }
.picker-tools { display: flex; gap: 16px; margin-bottom: 8px; font-size: 13px; flex: none; }
.picker-tools .link-btn:disabled { color: var(--disabled); cursor: not-allowed; text-decoration: none; }
.picker-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; flex: 1 1 auto; max-height: 52dvh;
  border: 1px solid var(--border); border-radius: var(--r); }
.picker-list li + li { border-top: 1px solid var(--row-line); }
.picker-row { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; min-height: 44px; padding: 10px 12px; cursor: pointer; }
.picker-row:hover { background: var(--surface-sub); }
.picker-row:has(input:checked) { background: var(--brand-tint-2); }
.picker-row.is-off { cursor: not-allowed; }
.picker-row.is-off .batch, .picker-row.is-off .picker-mt { color: var(--disabled); }
.picker-row input { margin-top: 1px; }
.picker-main { min-width: 0; }
.picker-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.picker-mt { font-weight: 600; white-space: nowrap; }
.picker-weight { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-3); }
.picker-weight .input { width: 96px; height: 34px; }
@media (max-width: 759.98px) { .picker-weight .input { height: 44px; } }
.picker-sub, .picker-note { display: block; font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.picker-sub { color: var(--text-4); }
.picker-note { color: var(--text-3); }
.picker-note[data-tone="warn"] { color: var(--warn); font-weight: 500; }
.picker-already { margin: 10px 0 0; overflow-wrap: anywhere; }
.picker-total { margin: 12px 0 0; font-size: 14px; font-weight: 600; flex: none; }
.picker-body .hint, .picker-body .form-warn { flex: none; }
.picker-body .hint { margin: 4px 0 0; }
.picker-msg { margin: 10px 0 0; }
.picker-foot { justify-content: space-between; align-items: center; }
.picker-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.picker-ask { font-weight: 500; margin-right: 4px; }
@media (max-width: 759.98px) {
  .picker-row { padding: 12px; }
  .picker-foot { flex-direction: column-reverse; align-items: stretch; }
  .picker-actions { justify-content: stretch; }
  .picker-actions .btn { flex: 1 1 0; }
  .picker-later { text-align: center; }
  .picker-list { max-height: 46dvh; }
}

/* Phase D (D3a): invoice drafts */
.draft-lines td { vertical-align: top; }
.draft-lines .input { height: 34px; }
.draft-lines td[data-label="Description on invoice"] { min-width: 220px; }
.draft-lines td[data-label="Description on invoice"] [data-cut-only] .input { margin-top: 6px; width: 120px; }
.draft-lines td[data-label="Description on invoice"] > .input { width: 100%; min-width: 200px; }
.draft-lines td[data-label="HSN / SAC"] .input { width: 96px; }
.draft-lines td[data-label="Quantity MT"] .input, .draft-lines td[data-label="Quantity"] .input { width: 96px; }
.draft-lines td[data-label="Quantity"] .select { margin-top: 6px; width: 96px; }
.draft-lines td[data-label="Item"] .seg { margin-top: 6px; }
.draft-lines td .coil-no { display: block; }
.add-extra { margin-top: 12px; }
.add-extra summary { list-style: none; cursor: pointer; display: inline-flex; }
.add-extra summary::-webkit-details-marker { display: none; }
.draft-row .inv-no { font-weight: 600; }
@media (max-width: 759.98px) {
  .seg-stack { flex-direction: column; }
  .draft-lines thead { display: none; }
  .draft-lines, .draft-lines tbody, .draft-lines tr, .draft-lines td { display: block; width: 100%; }
  .draft-lines tr { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px; position: relative; }
  .draft-lines td { padding: 6px 0; border: 0; text-align: left; height: auto; }
  .draft-lines td.r { text-align: left; }
  .draft-lines td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
  .draft-lines td[data-label="Item"]::before { display: none; }
  .draft-lines td.actions { position: absolute; top: 6px; right: 6px; width: auto; padding: 0; }
  .draft-lines .input, .draft-lines td[data-label="Description on invoice"] .input { width: 100%; height: 46px; }
  .draft-lines td[data-label="Quantity"] .select { width: 100%; height: 46px; }
  .draft-lines td[data-label="Description on invoice"] { min-width: 0; }
}

/* Phase D (D3b): cancel an invoice. Radio cards = a fieldset of label.radio-card > input + strong + span.hint */
.radio-cards { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.radio-cards legend { font-size: 13px; font-weight: 600; color: var(--text); padding: 0; margin-bottom: 6px; }
.radio-card { display: grid; grid-template-columns: 18px 1fr; column-gap: 10px; align-items: start; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; background: var(--surface); }
.radio-card input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); grid-row: span 2; }
.radio-card strong { font-size: 13px; font-weight: 600; color: var(--text); }
.radio-card .hint { grid-column: 2; margin: 2px 0 0; font-size: 12px; color: var(--text-3); }
[data-cancel-dialog] .dlg-body > .hint { font-size: 12px; color: var(--text-3); margin: 0; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-tint-2); }
.radio-card:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--brand-tint); }
.check-row:has(input:disabled) { opacity: .55; cursor: default; }
.cancel-facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.cancel-facts dt { color: var(--text-3); }
.cancel-facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 759.98px) { .radio-card { padding: 12px; } }

/* Phase D (D4): job work challans */
.challan-coil { border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 12px; background: var(--surface-sub); }
.challan-coil-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.challan-foot-hint { margin-right: auto; align-self: center; font-size: 12px; color: var(--text-3); }
@media (max-width: 759.98px) { .challan-foot-hint { flex-basis: 100%; margin-bottom: 4px; } }
@media (min-width: 760px) and (max-width: 1199.98px) { .hide-md { display: none !important; } }
.md-only { display: none; }
@media (min-width: 760px) and (max-width: 1199.98px) { .md-only { display: block; } }

/* Phase D (D5): credit / debit notes, purchase debit notes, goods back */
.note-lines td { vertical-align: top; }
.note-lines .input { height: 34px; }
.note-lines td[data-label="HSN"] .input { width: 96px; }
.note-lines td[data-label="Weight MT"] .input, .note-lines td[data-label="Difference ₹/MT"] .input { width: 104px; }
.note-lines td .coil-no { display: block; }
.note-lines .input[readonly] { background: var(--surface-sub); }
.note-foot-hint { margin-right: auto; align-self: center; font-size: 12px; color: var(--text-3); }
@media (max-width: 759.98px) {
  .note-foot-hint { flex-basis: 100%; margin-bottom: 4px; }
  .note-lines thead { display: none; }
  .note-lines, .note-lines tbody, .note-lines tr, .note-lines td { display: block; width: 100%; }
  .note-lines tr { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px; position: relative; }
  .note-lines td { padding: 6px 0; border: 0; text-align: left; height: auto; }
  .note-lines td.r { text-align: left; }
  .note-lines td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
  .note-lines td.check { position: absolute; top: 8px; right: 8px; width: auto; padding: 0; }
  .note-lines td.check::before, .note-lines td[data-label="Batch"]::before { display: none; }
  .note-lines .input { width: 100%; height: 46px; }
}

/* D8 */
/* Phase D review fixes R4, R6, R7, R18, R19 */
/* R18: head / body / foot sit in a wrapper (#draft-body, <form>); the wrappers are flex columns so only .dlg-body scrolls and the footer stays visible */
dialog.dlg-lg[open] { display: flex; flex-direction: column; overflow: hidden; }
dialog.drawer > form, dialog.dlg-lg > div, dialog.dlg-lg form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
dialog.dlg-lg .dlg-body, dialog.drawer .dlg-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
dialog.dlg-lg .dlg-head, dialog.dlg-lg .dlg-foot, dialog.drawer .dlg-head, dialog.drawer .dlg-foot { flex: none; }
dialog.dlg-lg .dlg-foot { border-top: 1px solid var(--border); padding-top: 14px; }
/* R19c: an empty hint (no supplier / invoice chosen yet) takes no row */
.hint:empty { display: none; }
/* R6: the page version of Create invoice has no JS to show the Cut length box: CSS shows it when Cut is ticked */
.draft-lines tr:not(:has(input[value="cut"]:checked)) [data-cut-only] { display: none; }
/* R19d: the lines table of the Create invoice page needs ~900 px; the card may be wider than the other narrow pages */
.page-draft { max-width: 1040px; }
/* R19b: a note number never breaks inside the token */
.note-no { white-space: nowrap; }
.inv-cell .inv-no .note-no { overflow-wrap: normal; }
.inv-finalise { margin-top: 6px; }
.inv-finalise .btn { height: 32px; padding: 0 14px; }
@media (max-width: 759.98px) {
  /* R4: the Booked action bar wraps: the count on its own line, then Clear + the two actions in a grid */
  .action-bar { flex-wrap: wrap; max-width: 100%; padding: 12px; }
  .action-bar > .num { flex: 1 1 100%; min-width: 0; }
  .action-bar-btns { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .action-bar-btns .btn { padding: 0 10px; min-width: 0; white-space: nowrap; }
  /* R7: on a phone the actions cell of the Invoices list is only the ⋯ menu; Finalise sits under the invoice number */
  .tbl td.actions { white-space: nowrap; width: 1%; }
  .inv-finalise .btn { width: 100%; }
  /* the Remove button of a "not from stock" line stays inside its card (its cell was 1% wide, so the button stuck out to the right) */
  .draft-lines td.actions { width: max-content; }
}

/* D8 (B check): the small dialogs (purchase debit note, goods back, cancel, finalise) scroll as one sheet on a phone; keep their footer in view */
dialog.dlg:not(.dlg-lg) .dlg-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding-top: 14px; }

/* --- Phase F: kept signed in (login tick box, My devices dialog), install help --- */
.keep-row { align-items: flex-start; line-height: 1.4; }
.keep-row input { margin-top: 1px; flex: none; }
@media (max-width: 759.98px) { .keep-row { min-height: 44px; align-items: center; font-size: 15px; } .keep-row input { margin-top: 0; } }
.device-list { list-style: none; margin: 0; padding: 0; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--row-line); }
.device-row:last-child { border-bottom: 0; }
.device-info { min-width: 0; }
.device-label { font-weight: 600; overflow-wrap: anywhere; }
.device-info .pill { margin-left: 6px; vertical-align: 1px; }
.device-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.device-row .inline-form { flex: none; }
.empty.empty-sm { padding: 20px 8px 8px; }
.devices-card .dlg-head { padding-top: 20px; }
.install-help { margin: 0; color: var(--text-2); }

/* --- app notifications (17 Nov 2026): My devices › Notifications --- */
.push-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.push-title { font-size: 14px; margin-bottom: 8px; }
.push-msg { margin: 0 0 10px; color: var(--text-3); font-size: 13px; line-height: 1.45; text-wrap: pretty; }
.push-msg .pill { margin-right: 4px; vertical-align: 1px; }
.js .push-nojs { display: none; }
.push-stopped { display: flex; align-items: center; gap: 6px; color: var(--warn); font-weight: 500; }
.push-stopped .ico { flex: none; }
.push-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.push-kind { min-height: 32px; }
.push-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.push-others { margin-top: 12px; }
.push-subhead { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-4); }
@media (max-width: 759.98px) {
  .push-kinds { grid-template-columns: minmax(0, 1fr); }
  .push-kind { min-height: 44px; font-size: 15px; }
  .push-kind input { width: 18px; height: 18px; }
  .push-actions .btn { min-height: 44px; }
}

/* --- phone document viewer (23 Nov 2026, /view): Back · title · Share, then the PDF pages / image / a card --- */
body.hrs-app.viewer-app { padding-bottom: env(safe-area-inset-bottom, 0px); }
.viewer-bar { position: sticky; top: 0; z-index: 900; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 12px; min-height: calc(56px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
  background: var(--surface); border-bottom: 1px solid var(--border); }
.viewer-title { margin: 0; font-size: 15px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-body { max-width: 960px; margin: 0 auto; padding: 12px; }
.viewer-pages { display: flex; flex-direction: column; gap: 12px; }
.viewer-page, .viewer-img { display: block; width: 100%; height: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); }
.viewer-card { margin-top: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.viewer-card > .ico { width: 28px; height: 28px; margin-bottom: 8px; color: var(--text-4); }
.viewer-card p { text-wrap: pretty; }
@media (max-width: 759.98px) {
  .viewer-bar { gap: 8px; }
  .viewer-title { font-size: 14px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; display: -webkit-box;
    -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .viewer-bar .btn { min-height: 44px; padding: 0 12px; }
  .viewer-body { padding: 8px; }
  .viewer-pages { gap: 8px; }
}
