/* ==========================================================================
   myEP — mobile-first PWA stylesheet
   1. Tokens (light / dark)   2. Base   3. App shell   4. Components
   5. Tender module           6. Pages  7. Breakpoints  8. Utilities
   ========================================================================== */

/* 1. Tokens --------------------------------------------------------------- */
:root {
  --primary: #0d655b;
  --primary-strong: #0a5249;
  --primary-soft: #e6f2ec;
  --on-primary: #ffffff;
  --hero: #104d47;
  --background: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #f1f5f3;
  --surface-glass: rgba(255, 255, 255, .88);
  --text: #18312f;
  --muted: #62736f;
  --border: #e2e9e6;
  --border-strong: #cfdcd6;
  --focus: #3d9d88;
  --danger: #b24736;   --danger-soft: #fbefeb;
  --warning: #87601f;  --warning-soft: #fcf2e3;
  --success: #25644c;  --success-soft: #e6f2ec;
  --info: #3c5f8a;     --info-soft: #eaf1fa;
  --urgent: #b35a30;   --urgent-soft: #fff0e7;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(24, 49, 47, .04), 0 6px 18px rgba(24, 49, 47, .045);
  --shadow-float: 0 10px 40px rgba(24, 49, 47, .16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 60px;
  --nav-h: 66px;
  --sidebar-w: 252px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --primary: #4fb6a3; --primary-strong: #72cbb9; --primary-soft: #173a33; --on-primary: #05201b; --hero: #133d37;
  --background: #0e1614; --surface: #151f1d; --surface-2: #1b2826; --surface-glass: rgba(21, 31, 29, .9);
  --text: #e2ece9; --muted: #95a8a3; --border: #25332f; --border-strong: #34463f; --focus: #6fcab6;
  --danger: #f08a78; --danger-soft: #3a201b; --warning: #e3b46c; --warning-soft: #33281a;
  --success: #7fd0b0; --success-soft: #16332a; --info: #93b7e8; --info-soft: #1a2635;
  --urgent: #f0a070; --urgent-soft: #3a2518;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-float: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --primary: #4fb6a3; --primary-strong: #72cbb9; --primary-soft: #173a33; --on-primary: #05201b; --hero: #133d37;
    --background: #0e1614; --surface: #151f1d; --surface-2: #1b2826; --surface-glass: rgba(21, 31, 29, .9);
    --text: #e2ece9; --muted: #95a8a3; --border: #25332f; --border-strong: #34463f; --focus: #6fcab6;
    --danger: #f08a78; --danger-soft: #3a201b; --warning: #e3b46c; --warning-soft: #33281a;
    --success: #7fd0b0; --success-soft: #16332a; --info: #93b7e8; --info-soft: #1a2635;
    --urgent: #f0a070; --urgent-soft: #3a2518;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-float: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

@supports (color: color-mix(in srgb, red, blue)) {
  :root:not([data-theme="dark"]) {
    --primary-strong: color-mix(in srgb, var(--primary) 82%, black);
    --primary-soft: color-mix(in srgb, var(--primary) 10%, white);
    --hero: color-mix(in srgb, var(--primary) 78%, #0b2522);
  }
}

/* 2. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 64px); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--background); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.02em; }
h1 { font-size: 23px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .55; }
a, button, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.icon { width: 22px; height: 22px; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 12px 16px; border-radius: 10px; }
.skip-link:focus { top: calc(10px + var(--safe-top)); }
[lang="ms"] { hyphens: auto; }

/* 3. App shell ------------------------------------------------------------ */
.shell { min-height: 100vh; min-height: 100dvh; }
.shell-main { min-width: 0; }
.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-top);
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  height: var(--topbar-h); max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 0 max(14px, var(--safe-right)) 0 max(14px, var(--safe-left));
}
.topbar-title { font-weight: 650; font-size: 16px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title-desktop { display: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 800; font-size: 19px; letter-spacing: -.04em; min-width: 0; }
.brand img { border-radius: 10px; flex: none; }
.brand > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content {
  max-width: 1180px; margin: 0 auto;
  padding: 18px max(16px, var(--safe-right)) calc(var(--nav-h) + 40px + var(--safe-bottom)) max(16px, var(--safe-left));
}
.content:focus { outline: none; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 750; letter-spacing: .02em;
  border: 1px solid var(--border);
}
.avatar-lg { width: 64px; height: 64px; font-size: 20px; }

/* Bottom navigation (mobile) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  padding: 6px max(8px, var(--safe-right)) calc(6px + var(--safe-bottom)) max(8px, var(--safe-left));
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--border);
}
.bottom-nav.cols-3 { grid-template-columns: repeat(3, 1fr); }
.bottom-nav.cols-4 { grid-template-columns: repeat(4, 1fr); }
.bottom-nav.cols-6 { grid-template-columns: repeat(6, 1fr); }
.bottom-nav a, .bottom-nav button {
  min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 550; border-radius: 12px;
}
.nav-icon { display: flex; align-items: center; justify-content: center; width: 52px; height: 30px; border-radius: 15px; transition: background-color .2s; }
.nav-icon .icon { width: 22px; height: 22px; }
.bottom-nav [aria-current="page"] { color: var(--primary); font-weight: 700; }
.bottom-nav [aria-current="page"] .nav-icon { background: var(--primary-soft); }
.bottom-nav [aria-current="page"] .icon { stroke-width: 2.1; }

/* Floating action button */
.fab {
  position: fixed; z-index: 35;
  right: max(16px, var(--safe-right)); bottom: calc(var(--nav-h) + 16px + var(--safe-bottom));
  display: inline-flex; align-items: center; gap: 8px; height: 54px; padding: 0 20px 0 16px;
  border-radius: 18px; background: var(--primary); color: var(--on-primary); font-weight: 650;
  box-shadow: 0 8px 24px rgba(13, 101, 91, .32);
}
.fab:active { transform: scale(.97); }

/* Action bar (detail pages replace bottom nav on mobile) */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px max(14px, var(--safe-right)) calc(10px + var(--safe-bottom)) max(14px, var(--safe-left));
  background: var(--surface-glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.action-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--muted); font-size: 14px; }
.action-buttons { display: flex; gap: 8px; align-items: center; }
.action-buttons .save-form .btn { min-width: 108px; }
.bottom-nav.is-hidden-mobile { display: none; }
.has-action-bar .fab { display: none; }

/* Loading bar */
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; overflow: hidden; background: transparent; }
.loading-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--primary); animation: loading 1s ease-in-out infinite; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* 4. Components ----------------------------------------------------------- */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-size: 15px; font-weight: 650; line-height: 1.2; white-space: nowrap; text-align: center;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn .icon { width: 19px; height: 19px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { background: var(--primary-soft); color: var(--primary); }
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { color: var(--danger); border-color: var(--border); background: var(--surface); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative; width: 44px; height: 44px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); width: 50px; height: 50px; }
.icon-btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn-quiet:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: #f3b54a; border: 2px solid var(--primary); }
.text-link { color: var(--primary); font-weight: 600; font-size: 14px; text-underline-offset: 3px; }
.text-link:hover { text-decoration: underline; }

/* Cards & panels */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.panel { padding: 18px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-title { display: flex; align-items: center; gap: 9px; font-size: 17px; margin-bottom: 14px; }
.panel-title .icon { width: 20px; height: 20px; color: var(--primary); }
.panel-sub { font-size: 13px; color: var(--muted); margin: -8px 0 12px; }
.panel-empty { font-size: 14px; padding: 6px 0 4px; }
.panel-foot { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.panel-foot .icon { width: 16px; height: 16px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stack { display: grid; gap: 16px; align-content: start; }

/* Page heading */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head p { margin-top: 3px; font-size: 14px; }
.date-pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; color: var(--muted); padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.date-pill .icon { width: 14px; height: 14px; }

/* Badges & tags */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 2px 8px; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tag .icon { width: 14px; height: 14px; }
.tag-link { color: var(--primary); font-weight: 600; min-height: 32px; }

/* Forms */
.field { margin-top: 16px; min-width: 0; }
.field:first-child { margin-top: 0; }
.field > label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 600; }
.req { color: var(--danger); }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field select, .field textarea, .search-box {
  width: 100%; min-height: 48px; padding: 11px 13px;
  font-size: 16px; /* 16px keeps iOS from zooming on focus */
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2362736f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
.field input[type="color"] { padding: 6px; height: 48px; cursor: pointer; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-hint { margin-top: 6px; font-size: 13px; color: var(--muted); }
.field-error { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--danger); font-weight: 550; }
.field-error .icon { width: 16px; height: 16px; margin-top: 1px; }
.input-action { position: relative; }
.input-action input { padding-right: 52px !important; }
.input-action-btn { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 10px; }
.input-action-btn[aria-pressed="true"] { color: var(--primary); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 550; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }
.form-card { padding: 18px; }
.form-card > h2 { margin-bottom: 14px; }
.form-subhead { margin: 26px 0 14px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 16px; }
.form-section { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }
.form-section legend { padding: 0; margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.form-grid { display: grid; gap: 0 14px; }
.form-grid > .field { margin-top: 16px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.danger-zone { margin-top: 16px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.danger-zone p { font-size: 13px; margin-top: 2px; }
.narrow { max-width: 620px; }

/* Search */
.search-row { display: flex; gap: 10px; margin-bottom: 4px; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-width: 0; flex: 1; }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-box .icon { width: 19px; height: 19px; color: var(--muted); }
.search-box input { flex: 1; min-width: 0; min-height: 46px; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); }
.search-box input::placeholder { color: var(--muted); font-size: 14px; }
.search-row .btn { flex: none; }

/* Chips (filters) */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 6px; margin: 0 -2px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; scroll-snap-align: start;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip small { font: inherit; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); }
.chip[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip[aria-current="true"] small { background: rgba(255, 255, 255, .2); }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip-removable { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.chip-removable .icon { width: 15px; height: 15px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.list > li + li { border-top: 1px solid var(--border); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px; cursor: pointer; }
.list-row:hover { background: var(--surface-2); }
.list-row > .icon { width: 18px; height: 18px; color: var(--muted); }
.list-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list-main strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Facts (definition list) */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts > div { padding: 11px 10px 11px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.facts > div.wide { grid-column: 1 / -1; }
.facts dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.facts dd { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.facts .tag-row { margin-top: 2px; }
.facts-compact > div { padding: 9px 8px 9px 0; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.table .num { text-align: right; padding-right: 0; white-space: nowrap; }

/* Tabs (anchor tabs) */
.tabs { position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: 10; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 14px -2px 14px; padding: 8px 2px; background: var(--background); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 10px; font-size: 14px; color: var(--muted); border: 1px solid transparent; }
.tabs a[aria-current="true"] { background: var(--surface); color: var(--primary); border-color: var(--border); font-weight: 650; }
.tabs small { font: inherit; opacity: .7; }

/* Empty state */
.empty-state { text-align: center; padding: 38px 22px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.empty-state > .icon { width: 38px; height: 38px; color: var(--primary); opacity: .6; margin-bottom: 12px; }
.empty-state h2 { font-size: 17px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); font-size: 14px; max-width: 340px; margin: 0 auto 16px; }

/* Skeleton */
.skeleton-list { display: grid; gap: 12px; }
.skeleton-card { display: grid; gap: 10px; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.skeleton { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skeleton-chip { width: 90px; height: 22px; }
.skeleton-line.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Notices */
.notice { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; margin: 14px 0; border-radius: 12px; font-size: 14px; background: var(--info-soft); color: var(--info); }
.notice .icon { width: 18px; height: 18px; margin-top: 1px; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-warning { background: var(--warning-soft); color: var(--warning); }
.notice-success { background: var(--success-soft); color: var(--success); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.page-numbers { display: none; gap: 4px; }
.page-link { min-width: 44px; height: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 14px; }
.page-link .icon { width: 19px; height: 19px; }
.page-link.is-current { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.page-link.is-disabled { opacity: .4; }
.page-gap { align-self: center; color: var(--muted); padding: 0 4px; }
.page-summary { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Sheets (bottom sheet on mobile, dialog on larger screens) */
.sheet, .modal { border: 0; padding: 0; color: var(--text); background: var(--surface); }
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 560px;
  max-height: 90dvh; overflow: auto; overscroll-behavior: contain;
  border-radius: 24px 24px 0 0; padding: 10px 20px calc(22px + var(--safe-bottom));
  box-shadow: var(--shadow-float);
}
.sheet[open] { animation: sheet-in .24s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-in { from { transform: translateY(40px); opacity: .4; } }
.sheet::backdrop, .modal::backdrop { background: rgba(8, 24, 21, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet-handle { width: 36px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 0 auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.sheet-close { border: 0; background: var(--surface-2); border-radius: 50%; width: 38px; height: 38px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.sheet-actions .btn { flex: 1; }
.sheet-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; }
body.dialog-open { overflow: hidden; }

.account-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.account-text { flex: 1; min-width: 0; display: grid; }
.account-text strong { font-size: 15px; }
.account-text small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-list { display: grid; margin: 10px 0; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 4px; font-size: 15px; width: 100%; text-align: left; border-bottom: 1px solid var(--border); }
.menu-list a > .icon:first-child, .menu-list button > .icon:first-child { color: var(--primary); }
.menu-list [aria-current="page"] { color: var(--primary); font-weight: 650; }
.menu-chevron { margin-left: auto; width: 17px !important; height: 17px !important; color: var(--muted); }
.menu-signout { display: flex; align-items: center; gap: 12px; min-height: 52px; width: 100%; padding: 0 4px; color: var(--danger); font-size: 15px; font-weight: 600; }
.theme-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.theme-switch-label { font-size: 15px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); }
.segmented button { display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 0 10px; border-radius: 9px; font-size: 13px; color: var(--muted); }
.segmented .icon { width: 16px; height: 16px; }
.segmented [aria-pressed="true"] { background: var(--surface); color: var(--primary); font-weight: 650; box-shadow: var(--shadow); }

.modal { width: calc(100% - 32px); max-width: 420px; border-radius: 20px; padding: 22px; box-shadow: var(--shadow-float); }
.modal[open] { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { transform: scale(.96); opacity: 0; } }
.modal h2 { margin-bottom: 8px; }
.modal p { font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Toasts */
.toast-region {
  position: fixed; z-index: 80; left: 12px; right: 12px;
  bottom: calc(var(--nav-h) + 14px + var(--safe-bottom));
  display: grid; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 550;
  background: #173430; color: #eaf5f1; box-shadow: var(--shadow-float);
  animation: toast-in .25s cubic-bezier(.2, .8, .2, 1);
}
.toast > .icon { width: 19px; height: 19px; color: #8fe0c3; }
.toast[data-type="error"] > .icon { color: #ffab9c; }
.toast[data-type="warning"] > .icon { color: #f5cf88; }
.toast[data-type="info"] > .icon { color: #a9c8f2; }
.toast span { flex: 1; }
.toast-close { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; color: inherit; opacity: .75; }
.toast-close .icon { width: 17px; height: 17px; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
.has-action-bar .toast-region { bottom: calc(76px + var(--safe-bottom)); }

/* Install banner */
.install-banner {
  position: fixed; z-index: 45; left: 12px; right: 12px;
  bottom: calc(var(--nav-h) + 12px + var(--safe-bottom));
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-float);
}
.install-banner img { border-radius: 10px; flex: none; }
.install-text { flex: 1; min-width: 0; display: grid; font-size: 13px; color: var(--muted); }
.install-text strong { color: var(--text); font-size: 15px; }
.inline-icon { width: 16px !important; height: 16px !important; vertical-align: -3px; color: var(--primary); }
.install-actions { display: flex; align-items: center; gap: 4px; }
.install-actions .icon-btn { border: 0; }
.auth-page .install-banner { bottom: calc(14px + var(--safe-bottom)); }

/* Debug toolbar (development only) */
.debugbar { position: fixed; z-index: 95; left: 8px; bottom: calc(var(--nav-h) + 14px + var(--safe-bottom)); max-width: min(560px, calc(100vw - 16px)); font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: #dce8e4; background: rgba(20, 30, 28, .94); border-radius: 10px; box-shadow: var(--shadow-float); }
.debugbar summary { cursor: pointer; padding: 5px 9px; list-style: none; white-space: nowrap; opacity: .85; }
.auth-page .debugbar, .error-page .debugbar, .has-action-bar .debugbar { bottom: calc(8px + var(--safe-bottom)); top: auto; }
.has-action-bar .debugbar { bottom: calc(78px + var(--safe-bottom)); }
.debugbar summary::-webkit-details-marker { display: none; }
.debugbar summary b { color: #f5cf88; text-transform: uppercase; margin-right: 4px; }
.debugbar dl { display: grid; gap: 4px; padding: 4px 10px 8px; }
.debugbar dl div { display: flex; gap: 8px; }
.debugbar dt { color: #8aa29c; min-width: 76px; }
.debugbar ol { margin: 0; padding: 6px 10px 10px 28px; max-height: 40vh; overflow: auto; border-top: 1px solid #2c3b38; }
.debugbar li { padding: 3px 0; }
.debugbar li span { color: #8fe0c3; margin-right: 8px; }
.debugbar code { color: #dce8e4; overflow-wrap: anywhere; }

/* 5. Tender module --------------------------------------------------------- */
.overview { display: grid; gap: 12px; margin-bottom: 18px; }
.hero {
  position: relative; isolation: isolate; overflow: hidden; display: grid; gap: 10px;
  min-height: 176px; padding: 20px; border-radius: 22px; background: var(--hero); color: #fff;
}
.hero::before, .hero::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .08); width: 240px; height: 240px; right: -100px; top: -70px; }
.hero::after { width: 340px; height: 340px; right: -150px; top: -120px; }
.hero-label { font-size: 13px; color: rgba(255, 255, 255, .72); }
.hero-count { font-size: 17px; font-weight: 550; line-height: 1.2; }
.hero-count strong { display: block; font-size: 52px; font-weight: 700; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: rgba(255, 255, 255, .8); margin-top: auto; padding-right: 56px; }
.hero-go { position: absolute; right: 18px; bottom: 18px; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-card { display: block; padding: 14px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 0; }
.stat-icon { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 10px; }
.stat-icon .icon { width: 17px; height: 17px; }
.stat-urgent .stat-icon { background: var(--urgent-soft); color: var(--urgent); }
.stat-saved .stat-icon { background: var(--info-soft); color: var(--info); }
.stat-card strong { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.home-grid { display: grid; gap: 14px; }

.deadline-list { list-style: none; margin: 0; padding: 0; }
.deadline-list li + li { border-top: 1px solid var(--border); }
.deadline-list a { display: flex; align-items: center; gap: 12px; padding: 11px 0; min-height: 64px; }
.deadline-date { flex: none; width: 48px; height: 52px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); line-height: 1.05; }
.deadline-date strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.deadline-date small { font-size: 11px; font-weight: 650; }
.deadline-date[data-level="critical"] { background: var(--urgent-soft); color: var(--urgent); }
.deadline-date[data-level="soon"] { background: var(--warning-soft); color: var(--warning); }
.deadline-text { min-width: 0; display: grid; gap: 2px; }
.deadline-text strong { font-size: 14px; font-weight: 650; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.deadline-text small { font-size: 12px; color: var(--muted); }

.pipeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pipeline-item { display: grid; gap: 2px; padding: 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.pipeline-item strong { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pipeline-item span { font-size: 12px; color: var(--muted); line-height: 1.25; }
.pipeline-item[data-status="preparing"] strong { color: var(--urgent); }
.pipeline-item[data-status="submitted"] strong { color: var(--info); }
.pipeline-item[data-status="won"] strong { color: var(--success); }

.tender-grid { display: grid; gap: 12px; align-items: start; }
.tender-card { position: relative; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; }
.tender-card.is-saved { border-color: var(--border-strong); }
.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.deadline { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 8px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--primary-soft); color: var(--primary); }
.deadline .icon { width: 14px; height: 14px; }
.deadline[data-level="critical"] { background: var(--urgent-soft); color: var(--urgent); }
.deadline[data-level="soon"] { background: var(--warning-soft); color: var(--warning); }
.deadline[data-level="closed"], .deadline[data-level="none"] { background: var(--surface-2); color: var(--muted); }
.new-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; color: var(--primary); }
.new-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge { margin-left: auto; font-size: 12px; font-weight: 650; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.status-badge[data-status="preparing"] { background: var(--urgent-soft); color: var(--urgent); }
.status-badge[data-status="submitted"] { background: var(--info-soft); color: var(--info); }
.status-badge[data-status="won"] { background: var(--success-soft); color: var(--success); }
.status-badge[data-status="lost"], .status-badge[data-status="skipped"] { text-decoration: none; }
.card-ref { font-size: 12px; color: var(--muted); letter-spacing: .02em; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.tender-card h3 { font-size: 15px; line-height: 1.45; font-weight: 700; letter-spacing: -.01em; }
.card-link { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* whole card is tappable */
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.tender-card .tag-link, .tender-card details, .tender-card .save-form { position: relative; z-index: 1; }
.meta-line { display: flex; gap: 7px; align-items: flex-start; margin-top: 7px; font-size: 13px; color: var(--muted); }
.meta-line .icon { width: 15px; height: 15px; margin-top: 2px; }
.meta-line b { font-weight: 600; color: var(--text); }
.card-note { margin-top: 10px; font-size: 13px; color: var(--muted); }
.card-note summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; color: var(--primary); font-weight: 600; }
.card-note p { padding: 4px 0 2px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.price-label { display: block; font-size: 11px; color: var(--muted); }
.price { font-size: 19px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.save-form { margin: 0; flex: none; }
.save-button { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 14px; font-weight: 650; }
.save-button .icon, .save-form .btn .icon { width: 18px; height: 18px; }
.save-button.is-saved { background: var(--primary-soft); color: var(--primary); }
.save-button.is-saved .icon, .save-form .btn.is-saved .icon { fill: currentColor; }
.save-form .btn.is-saved { background: var(--primary-soft); color: var(--primary); }

/* Detail */
.detail-intro { padding: 18px; }
.detail-intro .card-ref { margin-top: 2px; }
.detail-intro h1 { font-size: 20px; line-height: 1.4; font-weight: 720; letter-spacing: -.02em; overflow-wrap: anywhere; }
.detail-value { display: flex; flex-wrap: wrap; gap: 14px 28px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.detail-value small { display: block; font-size: 12px; color: var(--muted); }
.detail-value strong { display: block; font-size: 22px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.detail-grid { display: grid; gap: 14px; }
.detail-grid .panel { scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 70px); }
.note-block { margin-top: 16px; }
.note-block h3 { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.note-block p { font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.status-form { display: flex; align-items: flex-end; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.status-form .field { flex: 1; margin: 0; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list > li { display: flex; align-items: center; gap: 4px; }
.file-list > li + li { border-top: 1px solid var(--border); }
.file-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 68px; }
.file-row > .icon { width: 18px; height: 18px; color: var(--muted); }
.file-type { flex: none; width: 42px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; letter-spacing: .02em; background: var(--surface-2); color: var(--muted); }
.file-type[data-ext="pdf"] { background: var(--urgent-soft); color: var(--urgent); }
.file-type[data-ext="doc"], .file-type[data-ext="docx"], .file-type[data-ext="rtf"] { background: var(--info-soft); color: var(--info); }
.file-type[data-ext="xls"], .file-type[data-ext="xlsx"], .file-type[data-ext="csv"] { background: var(--success-soft); color: var(--success); }
.file-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.file-info strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.file-info small { font-size: 12px; color: var(--muted); }
.library > li { display: block; padding: 0 16px; }
.file-tender { display: flex; align-items: center; gap: 6px; margin: -6px 0 12px 54px; font-size: 12px; color: var(--primary); }
.file-tender .icon { width: 14px; height: 14px; }
.file-tender span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.dropzone { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px; border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); cursor: pointer; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--primary); background: var(--primary-soft); }
.dropzone > .icon { color: var(--primary); }
.dropzone span { display: grid; font-size: 13px; color: var(--muted); }
.dropzone strong { color: var(--text); font-size: 15px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-picked { font-size: 13px; }
.upload-form .btn { justify-self: start; }

.narrative { font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.analysis-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.analysis-block h3 { font-size: 14px; margin-bottom: 8px; }
.analysis-block ul { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.65; }
.analysis-block li + li { margin-top: 6px; }
.risk-list { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.risk-list li { margin: 0 !important; padding: 12px 14px; border-radius: 12px; background: var(--urgent-soft); }
.risk-list strong { display: block; color: var(--urgent); }
.risk-list span { display: block; margin-top: 2px; color: var(--text); opacity: .8; }
.analysis-source { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }

.data-footer { margin: 28px 0 8px; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.8; }

/* 6. Pages ---------------------------------------------------------------- */
.profile-card { display: flex; align-items: center; gap: 16px; padding: 18px; margin-bottom: 14px; }
.profile-card strong { font-size: 18px; }
.profile-card .badge { margin-top: 6px; }
.two-col { display: grid; gap: 14px; margin-bottom: 14px; align-items: start; }
.app-card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.code-hint { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; }
.audit-list details > summary { list-style: none; }
.audit-list details > summary::-webkit-details-marker { display: none; }
.audit-list details[open] .rotate { transform: rotate(90deg); }
.audit-diff { display: grid; gap: 10px; padding: 0 16px 14px; }
.audit-diff h3 { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.audit-diff pre { margin: 0; padding: 10px; border-radius: 10px; background: var(--surface-2); font-size: 12px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Sign in */
.auth-page { background: var(--background); }
.auth-shell { min-height: 100vh; min-height: 100dvh; max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; padding: calc(20px + var(--safe-top)) max(20px, var(--safe-right)) calc(20px + var(--safe-bottom)) max(20px, var(--safe-left)); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.private-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.private-label .icon { width: 14px; height: 14px; }
.auth-content { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 28px 0; }
.auth-art { width: 78px; height: 78px; margin-bottom: 20px; border-radius: 24px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); transform: rotate(-5deg); }
.auth-art .icon { width: 38px; height: 38px; transform: rotate(5deg); }
.auth-welcome h1 { font-size: 31px; line-height: 1.12; font-weight: 750; letter-spacing: -.035em; max-width: 13ch; }
.auth-welcome p { margin-top: 12px; color: var(--muted); max-width: 34ch; }
.auth-panel { margin-top: 28px; }
.auth-panel > p.muted { margin: 4px 0 18px; font-size: 14px; }
.auth-panel form { margin-top: 18px; }
.auth-submit { margin-top: 22px; justify-content: space-between; min-height: 52px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--muted); }
.auth-foot .icon { width: 14px; height: 14px; }

/* Errors */
.error-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px max(20px, var(--safe-right)) calc(24px + var(--safe-bottom)) max(20px, var(--safe-left)); }
.error-card { max-width: 440px; text-align: center; }
.error-icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); }
.error-icon .icon { width: 30px; height: 30px; }
.error-code { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.error-card h1 { margin: 6px 0 10px; }
.error-card p { color: var(--muted); }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.error-ref { margin-top: 18px; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }

/* 7. Breakpoints ----------------------------------------------------------- */
@media (max-width: 359px) {
  .content { padding-left: 12px; padding-right: 12px; }
  h1 { font-size: 21px; }
  .stat-card { padding: 12px 9px; }
  .stat-card strong { font-size: 22px; }
  .hero-count strong { font-size: 44px; }
  .fab span { display: none; }
  .fab { padding: 0 16px; }
  .tender-card { padding: 14px; }
  .segmented span { display: none; }
  .action-back span { display: none; }
}

@media (min-width: 600px) {
  .content { padding: 26px 28px 130px; }
  .topbar-inner { padding: 0 24px; }
  h1 { font-size: 26px; }
  .overview { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-card, .panel, .detail-intro { padding: 22px; }
  .tender-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .pipeline { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .page-numbers { display: flex; }
  .page-summary { display: none; }
  .bottom-nav { left: 50%; right: auto; transform: translateX(-50%); width: calc(100% - 40px); max-width: 520px; bottom: calc(14px + var(--safe-bottom)); border: 1px solid var(--border); border-radius: 22px; padding: 6px 10px; box-shadow: var(--shadow-float); }
  .fab { bottom: calc(var(--nav-h) + 30px + var(--safe-bottom)); right: 28px; }
  .toast-region { left: auto; right: 20px; width: 380px; bottom: calc(var(--nav-h) + 32px + var(--safe-bottom)); }
  .install-banner { left: 50%; right: auto; transform: translateX(-50%); width: min(520px, calc(100% - 40px)); bottom: calc(var(--nav-h) + 30px + var(--safe-bottom)); }
  .sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: calc(100% - 40px); max-width: 480px; border-radius: 24px; padding: 22px; max-height: 86dvh; }
  .sheet[open] { animation: modal-in .18s ease-out; }
  .sheet-handle { display: none; }
  .detail-intro h1 { font-size: 24px; }
  .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-diff { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-content { max-width: 420px; width: 100%; margin: 0 auto; }
}

@media (min-width: 900px) {
  .overview { grid-template-columns: 1.25fr 1fr; align-items: stretch; }
  .hero { min-height: 220px; padding: 26px; }
  .hero-count strong { font-size: 64px; }
  .stat-grid { gap: 12px; }
  .stat-card { padding: 20px 16px; display: flex; flex-direction: column; justify-content: flex-end; }
  .stat-card strong { font-size: 32px; }
  .stat-card small { font-size: 13px; }
  .home-grid { grid-template-columns: 1.3fr 1fr; align-items: start; }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
  .detail-grid .analysis { grid-column: 1 / -1; }
  .search-row { max-width: 680px; }
  .two-col-wide { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .auth-content { max-width: none; display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center; }
  .auth-welcome h1 { font-size: 46px; }
  .auth-panel { margin: 0; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); }
}

@media (min-width: 1024px) {
  :root { --topbar-h: 64px; }
  .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
    padding: calc(18px + var(--safe-top)) 14px 16px; background: var(--surface); border-right: 1px solid var(--border);
  }
  .sidebar-brand { padding: 4px 8px 18px; font-size: 20px; }
  .sidebar-brand small { display: block; font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-top: 2px; }
  .sidebar-nav { display: grid; gap: 2px; }
  .sidebar-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--muted); font-weight: 550; font-size: 15px; }
  .sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }
  .sidebar-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
  .sidebar-nav .icon { width: 20px; height: 20px; }
  .sidebar-secondary { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
  .sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--border); }
  .sidebar-user-text { flex: 1; min-width: 0; display: grid; }
  .sidebar-user-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-user-text small { font-size: 12px; color: var(--muted); }
  .sidebar-user .icon-btn { border: 0; color: var(--muted); }
  .topbar-inner { max-width: none; padding: 0 32px; }
  .topbar-brand { display: none; }
  .topbar-title-desktop { display: block; font-size: 15px; color: var(--muted); font-weight: 600; }
  .topbar .avatar { display: none; }
  .content { max-width: 1180px; padding: 28px 32px 56px; }
  .bottom-nav, .bottom-nav.is-hidden-mobile { display: none; }
  .fab { display: none; }
  .toast-region { bottom: 24px; }
  .install-banner { bottom: 24px; left: auto; right: 24px; transform: none; }
  .debugbar { bottom: 12px; left: calc(var(--sidebar-w) + 12px); }
}

@media (min-width: 1400px) {
  .tender-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Desktop action bar sits inside the main column */
@media (min-width: 1024px) {
  .has-action-bar .action-bar { position: fixed; left: var(--sidebar-w); right: 0; margin: 0; }
  .has-action-bar .content { padding-bottom: 96px; }
}

@media (hover: hover) {
  .tender-card:hover { border-color: var(--border-strong); }
  .stat-card:hover, .pipeline-item:hover { border-color: var(--border-strong); }
  .save-button:hover { color: var(--primary); }
  .file-row:hover .file-info strong { text-decoration: underline; }
  .chip:hover:not([aria-current="true"]) { border-color: var(--border-strong); color: var(--text); }
}

/* Installed app (standalone) */
.is-standalone .install-banner, .is-standalone [data-install] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 8. Utilities ------------------------------------------------------------ */
@media (max-width: 1023px) { .hide-mobile { display: none !important; } }
