/* Estimatebd EPS — colour scheme follows estimatebd.com
   (navy #0b2545 / #123a68, gold #d99a00, teal #0f766e, light neutral surfaces). */
:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-dark: #eef1f6;
  --accent: #0f766e;        /* teal — primary actions */
  --accent-dark: #0b2545;   /* navy — headings */
  --navy: #0b2545;
  --navy2: #123a68;
  --gold: #d99a00;
  --text: #101418;
  --muted: #5b6472;
  --line: #e3e7ee;
  --alt: #f4f7fb;          /* alternate row */
  --sel: #fdf3d6;          /* hover / selection (gold tint) */
  --danger: #c0392b;
  --ok: #0f9d58;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 37, 69, .06), 0 10px 30px rgba(11, 37, 69, .07);
  --head: #0b2545;          /* heading / strong text */
  --field: #ffffff;         /* inputs, grids, cards on panel */
  --top-bg: #ffffff; --top-fg: #0b2545; --top-line: #d99a00; --top-btn: #eef1f6; --top-btn-line: #d5dbe6;
  --logo-a: #0b2545; --logo-b: #1d4f8c; --logo-fg: #f3c64b; --logo-accent: #d99a00;
  color-scheme: light;
}
/* Dark theme: explicit choice, or system preference when the user left it on Auto. */
:root[data-theme="dark"] {
  --bg: #0b1320; --panel: #131f30; --panel-dark: #1a2a40; --accent: #19b3a6; --text: #e6ebf2; --muted: #9aa8bb;
  --line: #263a54; --alt: #162539; --sel: #3a3216; --head: #e8eef8; --field: #0f1a2b; --danger: #e5604f;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  --top-bg: #0a1626; --top-fg: #f1f5fb; --top-line: #f3c64b; --top-btn: rgba(255,255,255,.08); --top-btn-line: rgba(255,255,255,.25);
  --logo-a: #f3c64b; --logo-b: #d99a00; --logo-fg: #0b2545; --logo-accent: #ffffff;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1320; --panel: #131f30; --panel-dark: #1a2a40; --accent: #19b3a6; --text: #e6ebf2; --muted: #9aa8bb;
    --line: #263a54; --alt: #162539; --sel: #3a3216; --head: #e8eef8; --field: #0f1a2b; --danger: #e5604f;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
    --top-bg: #0a1626; --top-fg: #f1f5fb; --top-line: #f3c64b; --top-btn: rgba(255,255,255,.08); --top-btn-line: rgba(255,255,255,.25);
    --logo-a: #f3c64b; --logo-b: #d99a00; --logo-fg: #0b2545; --logo-accent: #ffffff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- top bar ---- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--top-bg); color: var(--top-fg); padding: 10px clamp(12px, 2vw, 28px);
  border-bottom: 3px solid var(--top-line);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { display: inline-grid; place-items: center; line-height: 0; filter: drop-shadow(0 2px 5px rgba(11,37,69,.28)); }
.ico { display: inline-grid; place-items: center; line-height: 0; }
.topbar-title strong { font-size: 17px; letter-spacing: .5px; display: block; }
.topbar-sub { font-size: 11px; opacity: .7; }
.pro-badge { background: var(--gold); color: var(--head); font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.lang-sw { display: inline-flex; border: 1px solid var(--top-btn-line); border-radius: 999px; overflow: hidden; }
.lang-btn { font: inherit; font-size: 12px; font-weight: 700; padding: 3px 11px; background: transparent; color: var(--top-fg); border: 0; cursor: pointer; }
.lang-btn.on { background: var(--gold); color: var(--head); }
.topbar-ctx { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }

.screen { flex: 1; padding: clamp(10px, 2vw, 24px); max-width: 1600px; width: 100%; margin: 0 auto; }

/* ---- switchboard ---- */
.switchboard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; max-width: 1100px; margin: 0 auto;
}
.sw-head { background: linear-gradient(135deg, var(--navy), var(--navy2)); color: #fff; padding: 20px 24px; }
.sw-title { font-size: 20px; font-weight: 700; }
.sw-version { font-size: 12px; opacity: .8; margin-top: 4px; }
.sw-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
  padding: 22px;
}
.sw-btn {
  font-family: inherit; font-size: 14px; font-weight: 600; padding: 16px 12px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  text-align: center; color: var(--head); transition: .15s;
}
.sw-btn:hover { background: var(--navy); color: #fff; border-color: var(--head); box-shadow: var(--shadow); }
.sw-btn:active { transform: translateY(1px); }
.sw-note { padding: 10px 24px 18px; font-size: 12px; color: var(--muted); }

/* ---- home (grouped cards) ---- */
.home { max-width: 1100px; margin: 0 auto; }
.home-title { font-size: 22px; font-weight: 700; color: var(--head); }
.home-sub { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.home-grp { margin-top: 18px; }
.home-grp h4 { margin: 0 0 8px; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.home-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.home-card {
  display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  text-align: left; font-family: inherit; cursor: pointer; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; transition: .15s;
}
.home-card:hover { border-color: var(--gold); box-shadow: 0 6px 18px rgba(11,37,69,.12); transform: translateY(-1px); }
.home-ic { grid-row: 1 / 3; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; box-shadow: 0 6px 14px -4px var(--ic-glow, rgba(11,37,69,.35)), inset 0 1px 0 rgba(255,255,255,.35); transition: transform .15s; }
.home-ic svg { width: 24px; height: 24px; stroke-width: 2; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.home-card:hover .home-ic { transform: scale(1.07) rotate(-3deg); }
.home-lbl { font-size: 13px; font-weight: 700; color: var(--head); }
.home-card small { font-size: 11px; color: var(--muted); min-height: 1em; }
.ic-est  { background: linear-gradient(135deg, #1d4ed8, #38bdf8); --ic-glow: rgba(37,99,235,.55); }
.ic-pkg  { background: linear-gradient(135deg, #0d9488, #34d399); --ic-glow: rgba(13,148,136,.55); }
.ic-rate { background: linear-gradient(135deg, #d97706, #fbbf24); --ic-glow: rgba(217,119,6,.55); }
.ic-rep  { background: linear-gradient(135deg, #7c3aed, #c084fc); --ic-glow: rgba(124,58,237,.55); }
.ic-adm  { background: linear-gradient(135deg, #e11d48, #fb923c); --ic-glow: rgba(225,29,72,.5); }
.home-grp h4 { display: flex; align-items: center; gap: 8px; }
.home-grp h4::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--grp, var(--gold)); }
.home-grp:nth-of-type(1) { --grp: #2563eb; } .home-grp:nth-of-type(2) { --grp: #0d9488; } .home-grp:nth-of-type(3) { --grp: #d97706; }
.home-grp:nth-of-type(4) { --grp: #7c3aed; } .home-grp:nth-of-type(5) { --grp: #e11d48; }
.home-card { box-shadow: 0 1px 2px rgba(11,37,69,.05); }
.home-card:hover { border-color: var(--grp, var(--gold)); }

/* ---- sidebar layout ---- */
.layout { flex: 1; display: grid; grid-template-columns: 210px 1fr; min-height: 0; }
.layout > .screen { min-width: 0; }
.side { background: var(--navy); padding: 14px 10px; }
.side-item { display: flex; gap: 10px; align-items: center; color: #c9d6ea; text-decoration: none; padding: 9px 12px; border-radius: 9px; margin-bottom: 3px; font-weight: 600; font-size: 13px; border-left: 3px solid transparent; }
.side-item:hover { background: rgba(255,255,255,.08); }
.side-item.on { background: rgba(217,154,0,.18); color: #fff; border-left-color: var(--gold); }
.side-ic { width: 20px; display: inline-grid; place-items: center; }
.side-ic svg { width: 18px; height: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0 4px; }
.stat { font-family: inherit; text-align: left; cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 12px; padding: 12px 14px; transition: .15s; }
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat b { display: block; font-size: 24px; color: var(--head); }
.stat span { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: flex; overflow-x: auto; padding: 8px; }
  .side-item { white-space: nowrap; margin: 0 4px 0 0; border-left: 0; }
}
@media print { .side { display: none !important; } .layout { display: block; } }

/* tiles layout */
.layout-sw { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0 0; background: var(--panel); }
.layout-sw .lang-btn { color: var(--head); }
.layout-sw .lang-btn.on { background: var(--navy); color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 16px; }
.tile { border-radius: 16px; padding: 16px; color: #fff; box-shadow: 0 4px 14px rgba(11,37,69,.15); }
.tile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 15px; }
.tile-ic { font-size: 26px; }
.tile-items { display: flex; flex-direction: column; gap: 6px; }
.tile-item { font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; padding: 7px 10px; color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 9px; transition: .15s; }
.tile-item:hover { background: #fff; color: var(--head); }
.t1 { background: linear-gradient(135deg,#0b2545,#1d4f8c); } .t2 { background: linear-gradient(135deg,#0f766e,#14a79b); }
.t3 { background: linear-gradient(135deg,#b97b00,#e8b21e); } .t4 { background: linear-gradient(135deg,#5b2a86,#8a4fc0); }
.t6 { background: linear-gradient(135deg,#8a2a20,#c8553d); }

/* ---- panels & forms ---- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px; overflow-x: auto;
}
.panel h2 { margin: 0 0 6px; font-size: 18px; color: var(--head); }
.panel h3 { margin: 14px 0 8px; font-size: 14px; color: var(--head); }
.muted { color: var(--muted); font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; min-width: 160px; max-width: 420px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: 14px; padding: 7px 10px; width: 100%;
  border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus,
td input:focus, td select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; }

.inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---- toolbar & buttons ---- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; align-items: flex-end; }
.toolbar > input[type="text"], .toolbar > input:not([type]) { min-width: 280px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--field); color: var(--text); }
.btn {
  font-family: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; cursor: pointer;
  background: var(--field); border: 1px solid var(--line); border-radius: 8px; color: var(--head);
  transition: .15s;
}
.btn:hover { background: var(--panel-dark); border-color: var(--navy2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #0b5f58; border-color: #0b5f58; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #a02f23; border-color: #a02f23; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.topbar .btn { background: var(--top-btn); color: var(--top-fg); border-color: var(--top-btn-line); }
.topbar .btn:hover { background: var(--gold); border-color: var(--gold); color: #0b2545; }
.theme-btn { display: inline-flex; align-items: center; gap: 6px; }
.topbar .theme-btn .ico svg { width: 16px; height: 16px; }

/* ---- data grid ---- */
table.grid {
  border-collapse: collapse; width: 100%; background: var(--field);
  font-size: 13px; margin-top: 8px;
}
table.grid th {
  background: var(--navy); color: #fff; font-weight: 600;
  padding: 8px 10px; border: 1px solid var(--navy2); text-align: left; font-size: 12px;
  position: sticky; top: 0; white-space: nowrap;
}
table.grid td { padding: 6px 10px; border: 1px solid var(--line); vertical-align: top; }
table.grid tbody tr.alt td { background: var(--alt); }
table.grid tbody tr:hover td { background: var(--sel); }
table.grid tr.empty td { text-align: center; color: var(--muted); padding: 20px; }
table.grid tr.clickable { cursor: pointer; }
td.r, th.r { text-align: right; }
td input, td select { font-family: inherit; font-size: 13px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; width: 100%; background: var(--field); }
td input[type="checkbox"] { width: auto; }

.grid-wrap { max-height: min(60vh, 640px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.totals { display: flex; gap: 22px; margin-top: 10px; font-size: 14px; flex-wrap: wrap; }
.totals b { color: var(--head); }

/* ---- misc ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ok); color: #fff; padding: 10px 20px; border-radius: 10px;
  box-shadow: var(--shadow); font-size: 13px; z-index: 50; max-width: 90vw;
}
.toast-err { background: var(--danger); color: #fff; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  font-family: inherit; font-size: 13px; padding: 7px 16px; cursor: pointer;
  background: var(--panel-dark); border: 1px solid var(--line); border-bottom: none;
  border-radius: 10px 10px 0 0; color: var(--muted);
}
.tab.active { background: var(--panel); font-weight: 700; color: var(--head); border-top: 2px solid var(--gold); }

.section-title {
  background: var(--navy2); color: #fff; font-size: 13px; font-weight: 600;
  padding: 6px 10px; margin-top: 12px; border-radius: 8px 8px 0 0;
}

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-ls { background: #fdf0c8; color: #7a5600; }
.badge-ded { background: #fbdcd8; color: #8a2a20; }
.badge-rev { background: #dbe7f7; color: var(--navy2); }
.badge-off { background: #d5efec; color: #0b5f58; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 4px 12px; font-size: 13px; }
.kv b { color: var(--muted); font-weight: 600; }

.report-meta { display: grid; grid-template-columns: 240px 1fr; gap: 4px 14px; font-size: 13px; margin: 10px 0; }
.report-block { margin-top: 16px; }
.sign-row { display: flex; gap: 40px; margin-top: 30px; flex-wrap: wrap; }
.sign-cell { text-align: center; min-width: 180px; }
.sign-cell .line { border-top: 1px solid #333; margin-top: 34px; padding-top: 3px; font-size: 12px; }

/* ---- modals ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11, 37, 69, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(12px, 4vh, 40px) 12px; z-index: 40; overflow: auto;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(11, 37, 69, .35); padding: 20px; width: min(720px, 96vw);
  max-height: calc(100vh - 24px); overflow: auto;
}
.modal-wide { width: min(1100px, 96vw); }
.modal h3 { margin: 0 0 12px; color: var(--head); font-size: 16px; }

/* ---- small screens ---- */
@media (max-width: 720px) {
  .field { max-width: none; flex-basis: 100%; }
  .kv, .report-meta { grid-template-columns: 1fr; }
  .toolbar > input[type="text"], .toolbar > input:not([type]) { min-width: 0; flex: 1 1 100%; }
  .panel { padding: 14px; }
}

@media print {
  body { background: #fff; color: #000; }
  .topbar, .toolbar, .no-print { display: none !important; }
  .panel { border: none; box-shadow: none; padding: 0; overflow: visible; }
  .screen { padding: 0; max-width: none; }
  table.grid th { background: #eee; color: #000; }
}

/* ---- login / users ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #07182f, var(--navy2)); }
.login-card { width: min(380px, 100%); background: var(--panel); border-radius: 16px; padding: 28px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { margin: 0; color: var(--head); }
.login-card p { margin: 0 0 6px; }
.login-card .field { max-width: none; }
.login-logo { width: 44px; height: 44px; font-size: 22px; }
.login-btn { padding: 10px; font-size: 14px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 1.2em; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; padding-left: 8px; border-left: 1px solid var(--top-btn-line); }
.user-name { font-size: 12px; opacity: .9; }

.login-links{display:flex;justify-content:space-between;gap:12px;margin-top:12px;font-size:13px}
.login-link{color:var(--teal,#0f766e);text-decoration:none;font-weight:600}
.login-link:hover{text-decoration:underline}

/* ---- home hero (search + quick actions) + recent estimates ---- */
.hero { position: relative; border-radius: 20px; padding: 24px clamp(16px, 3vw, 30px) 22px; color: #fff; overflow: visible;
  background: radial-gradient(900px 300px at 88% -30%, rgba(255,255,255,.26), transparent), linear-gradient(120deg, #0b2545, #1d4f8c 58%, #0f766e); box-shadow: var(--shadow); }
:root[data-theme="dark"] .hero { background: radial-gradient(900px 300px at 88% -30%, rgba(255,255,255,.14), transparent), linear-gradient(120deg, #0a1a30, #143a6b 58%, #0c5f58); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: radial-gradient(900px 300px at 88% -30%, rgba(255,255,255,.14), transparent), linear-gradient(120deg, #0a1a30, #143a6b 58%, #0c5f58); } }
.hero-t { font-size: 24px; font-weight: 800; }
.hero-s { opacity: .85; font-size: 13px; margin: 2px 0 14px; }
.hero-search { position: relative; display: flex; align-items: center; gap: 10px; max-width: 620px; padding: 4px 14px; border-radius: 14px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.4); backdrop-filter: blur(8px); }
.hero-search:focus-within { background: rgba(255,255,255,.26); border-color: #fff; }
.hero-q { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; font-size: 15px; padding: 10px 0; }
.hero-q::placeholder { color: rgba(255,255,255,.8); }
.hero-q::-webkit-search-cancel-button { display: none; }
.hero-kbd { flex: none; border: 1px solid rgba(255,255,255,.55); border-radius: 6px; padding: 1px 7px; font-size: 12px; opacity: .9; }
.hero-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.3); padding: 6px; max-height: 360px; overflow: auto; }
.hero-menu[hidden] { display: none; }
.hm-h { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 8px 10px 2px; }
.hm-it { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; color: var(--text); background: transparent; border: 0; border-radius: 9px; padding: 8px 10px; cursor: pointer; }
.hm-it.on, .hm-it:hover { background: var(--panel-dark); }
.hm-ic { color: var(--accent); display: inline-grid; }
.hm-t { font-weight: 600; } .hm-it small { margin-left: auto; color: var(--muted); }
.hm-empty { padding: 14px; color: var(--muted); }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.hero-chip { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; border: 0; border-radius: 12px; padding: 9px 14px;
  background: #fff; color: #0b2545; box-shadow: 0 6px 16px rgba(0,0,0,.22); transition: .15s; }
.hero-chip .ico { color: #0f766e; }
.hero-chip:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.3); }
.recent { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.recent-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: var(--head); }
.recent-h a { font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: none; }
.recent-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text); background: transparent; border: 0; border-top: 1px solid var(--line); padding: 10px 16px; cursor: pointer; }
.recent-row:hover { background: var(--panel-dark); }
.recent-av { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; background: linear-gradient(135deg, #2563eb, #38bdf8); }
.recent-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.recent-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-main small { color: var(--muted); }
.recent-amt { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--head); min-width: 96px; text-align: right; }
.chip-st { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.st-draft { background: #dbeafe; color: #1e40af; } .st-ok { background: #d1fae5; color: #065f46; } .st-rev { background: #fef3c7; color: #92400e; }
:root[data-theme="dark"] .st-draft { background: #1e3a6e; color: #bfdbfe; } :root[data-theme="dark"] .st-ok { background: #064e3b; color: #a7f3d0; } :root[data-theme="dark"] .st-rev { background: #4a3410; color: #fde68a; }
.home .stats { margin-top: 14px; }
@media (max-width: 640px) { .hero-kbd { display: none; } .recent-amt { display: none; } }

/* ================= Estimate editor (.ee) ================= */
.ee { display: block; }
.ee h1 { font-size: 20px; margin: 0; color: var(--head); }
.ee h2 { font-size: 12px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin: 0; }
.ee-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ee-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.ee .pill { display: inline-flex; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--muted); }
.ee .pill b { color: var(--head); }
.ee-top-btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.ee-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.ee-card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.ee-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--panel-dark); color: var(--muted); }
.ee-status.ok { color: #0f766e; background: color-mix(in srgb, #0f766e 14%, transparent); }
.ee-status.warn { color: #b45309; background: color-mix(in srgb, #d99a00 18%, transparent); }
.ee-grid { display: grid; gap: 12px; grid-template-columns: repeat(12, 1fr); }
.ee .f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ee .c2 { grid-column: span 2; } .ee .c4 { grid-column: span 4; } .ee .c3 { grid-column: span 3; } .ee .c6 { grid-column: span 6; } .ee .c12 { grid-column: span 12; }
.ee label, .ee .lbl { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.ee input, .ee select, .ee textarea { font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; min-height: 40px; width: 100%; outline: 0; }
.ee input:focus, .ee select:focus, .ee textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.ee input[readonly], .ee textarea[readonly] { background: var(--panel-dark); }
.ee textarea { resize: vertical; min-height: 56px; }
.ee .num { text-align: right; font-variant-numeric: tabular-nums; }
.ee-seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--panel-dark); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.ee-seg label { margin: 0; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; cursor: pointer; }
.ee-seg input { display: none; }
.ee-seg span { display: block; padding: 7px 11px; border-radius: 9px; color: var(--muted); }
.ee-seg input:checked + span { background: var(--accent); color: #fff; box-shadow: 0 2px 6px rgba(15,118,110,.4); }
.ee .sw { display: flex; align-items: center; gap: 8px; min-height: 40px; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.ee .sw input { width: 40px; height: 22px; min-height: 0; appearance: none; background: var(--line); border: 0; border-radius: 999px; position: relative; cursor: pointer; padding: 0; }
.ee .sw input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.ee .sw input:checked { background: var(--accent); } .ee .sw input:checked::after { left: 21px; }
.ee-total { background: linear-gradient(120deg, #0b2545, #1d4f8c 60%, #0f766e); color: #fff; border-radius: 14px; padding: 10px 16px; display: inline-flex; flex-direction: column; min-width: 260px; }
.ee-total small { opacity: .8; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; }
.ee-total b { font-size: 24px; font-variant-numeric: tabular-nums; }
/* buttons */
.ee-btn { font: inherit; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); color: var(--head); cursor: pointer; transition: .15s; white-space: nowrap; }
.ee-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.ee-btn.p { background: #1d6fd6; border-color: #1d6fd6; color: #fff; }
.ee-btn.g { background: var(--accent); border-color: var(--accent); color: #fff; }
.ee-btn.d { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.ee-btn.s { min-height: 32px; padding: 0 10px; font-size: 12px; } .ee-btn.i { width: 40px; padding: 0; } .ee-btn.s.i { width: 32px; }
.ee-btn:disabled { opacity: .45; pointer-events: none; }
.ee-btn.c-blue { background: linear-gradient(135deg, #2563eb, #38bdf8); color: #fff; border: 0; }
.ee-btn.c-teal { background: linear-gradient(135deg, #0f766e, #2dd4bf); color: #fff; border: 0; }
.ee-btn.c-violet { background: linear-gradient(135deg, #7c3aed, #c084fc); color: #fff; border: 0; }
.ee-btn.c-gold { background: linear-gradient(135deg, #d99a00, #fbbf24); color: #2a1c00; border: 0; }
.ee-btn.c-red { background: linear-gradient(135deg, #dc2626, #fb7185); color: #fff; border: 0; }
/* detail */
.ee-dgrid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; }
.ee-left, .ee-right { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ee-rail { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-dark); padding: 6px; display: flex; flex-direction: column; gap: 3px; max-height: 360px; overflow: auto; }
.ee-it { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.ee-it i { font-style: normal; flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; background: var(--line); color: var(--head); }
.ee-it em { margin-left: auto; font-style: normal; font-size: 10px; font-weight: 800; background: #fdf0c8; color: #7a5600; border-radius: 999px; padding: 1px 7px; }
.ee-it.on { background: var(--sel); box-shadow: inset 3px 0 0 var(--gold); } .ee-it.on i { background: var(--navy); color: #fff; }
.ee-it:hover { background: var(--sel); }
.ee-empty { color: var(--muted); padding: 10px; } .ee-empty.big { padding: 30px; text-align: center; }
.ee-add, .ee-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ee-add input, .ee-tools input { flex: 1; min-width: 110px; min-height: 34px; }
.ee .slw { display: inline-flex; align-items: center; gap: 6px; } .ee .sl { width: 60px; min-height: 32px; padding: 4px 8px; }
.ee-tw { border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 460px; background: var(--field); }
.ee-tw table { width: 100%; border-collapse: collapse; min-width: 940px; }
.ee-tw th { position: sticky; top: 0; z-index: 1; background: #0b2545; color: #fff; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; padding: 9px 8px; text-align: left; white-space: nowrap; }
.ee-tw th.r { text-align: right; }
.ee-tw td { padding: 4px 5px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ee-tw td input { min-height: 32px; padding: 4px 8px; border-radius: 8px; border-color: transparent; background: transparent; text-align: right; min-width: 78px; }
.ee-tw td.loc input, .ee-tw td:nth-child(10) input { text-align: left; }
.ee-tw td.loc input { min-width: 180px; }
.ee-tw td input:hover { border-color: var(--line); } .ee-tw td input:focus { background: var(--field); }
.ee-tw td.q { background: color-mix(in srgb, var(--navy2) 9%, transparent); }
.ee-tw td.sl { text-align: center; color: var(--muted); } .ee-tw .chk { width: 18px; min-width: 0; height: 18px; min-height: 0; accent-color: var(--danger); }
.ee-tw td.calc { text-align: right; font-weight: 700; color: var(--head); } .ee-tw td.calc.neg { color: var(--danger); }
.ee-tw tr.ded td { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.ee-tw tr:hover td { background: color-mix(in srgb, var(--sel) 55%, transparent); }
.ee-tw td.mv { white-space: nowrap; text-align: right; }
.ee-tf { display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 2px solid var(--line); background: var(--panel-dark); position: sticky; left: 0; }
.ee .sp { flex: 1; } .ee-hint { font-size: 11px; color: var(--muted); }
.ee-sum { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ee-sum .kv { display: flex; align-items: center; gap: 8px; background: var(--panel-dark); border: 1px solid var(--line); border-radius: 11px; padding: 6px 12px; }
.ee-sum .kv span { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); } .ee-sum .kv b { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--head); }
.ee-ls { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; align-items: end; }
.ee-desc { display: grid; grid-template-columns: 1fr 110px 140px; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
/* fullscreen: the whole editor (header + detail + action bar) fills the window */
body.ee-lock { overflow: hidden; }
.ee.fs { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; padding: 8px 14px 0; overflow: hidden; }
.ee.fs .ee-top { margin-bottom: 6px; } .ee.fs .ee-top h1 { font-size: 17px; } .ee.fs .ee-top-btns .ee-btn { min-height: 34px; }
.ee.fs .ee-card { margin-bottom: 8px; padding: 10px 14px; }
.ee.fs .ee-grid { gap: 8px; } .ee.fs .ee input, .ee.fs .ee select { min-height: 34px; }
.ee.fs .ee-grid input, .ee.fs .ee-grid select, .ee.fs .ee-grid textarea { min-height: 34px; padding: 5px 10px; }
.ee.fs .ee-grid textarea { min-height: 44px; }
.ee.fs .ee-total { width: 100%; flex-direction: row; align-items: baseline; gap: 12px; padding: 6px 14px; min-width: 0; } .ee.fs .ee-total b { font-size: 18px; }
.ee.fs .ee-detail { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ee.fs .ee-dgrid { flex: 1; min-height: 0; grid-template-columns: 260px minmax(0, 1fr); }
.ee.fs .ee-left, .ee.fs .ee-right { min-height: 0; } .ee.fs .ee-left { overflow-y: auto; } .ee.fs .ee-rail { flex: 1 0 120px; }
.ee.fs .ee-rail { max-height: none; flex: 1; min-height: 80px; } .ee.fs .ee-tw { max-height: none; flex: 1; min-height: 0; }
.ee.fs .ee-desc { margin-top: 8px; padding-top: 8px; } .ee.fs .ee-desc textarea { min-height: 0; height: 52px; resize: none; } .ee.fs .ee-left { gap: 6px; } .ee.fs .ee-tools .ee-btn.s { min-height: 30px; }
.ee.fs .ee-bar { position: static; margin: 0 -14px; }
.cb { position: relative; flex: 1; min-width: 0; }
.cb-menu { position: absolute; z-index: 80; left: 0; right: 0; top: calc(100% + 4px); min-width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 36px rgba(0,0,0,.28); padding: 5px; max-height: 280px; overflow: auto; }
.cb-menu[hidden] { display: none; }
.cb-it { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; font: inherit; color: var(--text); background: transparent; border: 0; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.cb-it small { color: var(--muted); font-size: 11px; line-height: 1.3; } .cb-it.on, .cb-it:hover { background: var(--sel); }
.ee-print { width: min(560px, 96vw); }
/* bottom action bar */
.ee-bar { position: sticky; bottom: 0; z-index: 20; margin: 0 -14px; padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 93%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.ee-bar-in { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ee-nav { display: flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; } .ee-nav .ee-btn { border: 0; border-radius: 0; width: 38px; padding: 0; }
.ee-find { display: flex; gap: 6px; align-items: center; } .ee-find input[type=text], .ee-find input:not([type]) { width: 150px; min-height: 36px; }
.ee-find .rd { display: flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; font-size: 12px; } .ee-find .rd input { width: auto; min-height: 0; }
.ee-more { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .ee .c2, .ee .c3, .ee .c4 { grid-column: span 6; } .ee-dgrid, .ee.fs .ee-dgrid { grid-template-columns: minmax(0, 1fr); }
  .ee-rail { flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; } .ee-it { flex: none; }
  .ee-desc { grid-template-columns: 1fr 1fr; } .ee-desc .dd { grid-column: span 2; } .ee-top-btns { margin-left: 0; }
}
@media (max-width: 700px) {
  .ee .c2, .ee .c3, .ee .c4, .ee .c6 { grid-column: span 12; } .ee-grid { gap: 10px; }
  .ee-tw table { min-width: 0; } .ee-tw thead { display: none; } .ee-tw table, .ee-tw tbody, .ee-tw tr, .ee-tw td { display: block; }
  .ee-tw tbody tr { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 8px; padding: 10px; border-top: 1px solid var(--line); }
  .ee-tw td { border: 0; padding: 0; text-align: left !important; } .ee-tw td::before { content: attr(data-l); display: block; font-size: 10px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
  .ee-tw td input { min-width: 0; width: 100%; border-color: var(--line); background: var(--field); text-align: left !important; }
  .ee-tw td.loc, .ee-tw td:nth-child(10) { grid-column: 1 / -1; }
  .ee-tw td.ck { display: flex; align-items: center; gap: 8px; } .ee-tw td.ck::before { order: 2; }
  .ee-tw td.mv { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; } .ee-tw td.mv::before { display: none; }
  .ee-tw td[data-l="Total qty"] { grid-column: span 3; } .ee-tw tr.ded { box-shadow: inset 4px 0 0 var(--danger); }
  .ee-btn { min-height: 44px; } .ee-btn.s { min-height: 36px; } .ee input, .ee select { min-height: 44px; }
  .ee-more { width: 100%; overflow-x: auto; flex-wrap: nowrap; } .ee-more .ee-btn { flex: none; } .ee-find { width: 100%; flex-wrap: wrap; } .ee-find input { flex: 1; }
  .ee-top-btns { width: 100%; overflow-x: auto; flex-wrap: nowrap; } .ee-top-btns .ee-btn { flex: none; min-height: 40px; }
  .ee-total { width: 100%; } .ee.fs { padding: 8px 10px 0; overflow: auto; } .ee-bar { margin: 0; position: static; } .ee-tw { max-height: none; }
}

/* ================= Estimate editor v3 (Demo A3) ================= */
.ee-head { padding: 8px 12px; } .ee-head .ee-grid { gap: 6px 10px; align-items: end; }
.ee-head input, .ee-head select, .ee-head textarea { min-height: 32px; padding: 4px 9px; border-radius: 8px; }
.ee-head textarea.sn { height: 60px; min-height: 60px; resize: vertical; overflow-y: auto; line-height: 1.4; }
.ee-head .ee-seg { padding: 2px; } .ee-head .ee-seg span { padding: 4px 9px; }
.ee-head .sw { min-height: 32px; }
.ee-total { background: var(--panel-dark); color: var(--head); border: 1.5px solid var(--tot); border-radius: 10px; padding: 3px 12px; display: flex; flex-direction: column; min-width: 0; width: 100%; text-align: right; }
.ee-total small { color: var(--muted); opacity: 1; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: none; }
.ee-total b { color: var(--tot); font-size: 19px; }
:root { --tot: #c81e3a; } [data-theme="dark"] { --tot: #ff8da1; }
.ee input[readonly], .ee textarea[readonly] { background: var(--panel-dark); color: var(--text); }
/* detail: equal-height Item Code box and measurement box */
.ee-detail { padding: 8px 10px; }
.ee-dgrid { grid-template-columns: 300px minmax(0, 1fr); align-items: stretch; height: clamp(380px, 52vh, 600px); }
.ee-lbox, .ee-rbox { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.ee-bh { padding: 6px 10px; font-size: 12px; font-weight: 700; background: var(--panel-dark); border-bottom: 1px solid var(--line); color: var(--head); }
.ee-lbox .ee-rail { flex: 1; min-height: 60px; max-height: none; border: 0; border-radius: 0; background: transparent; overflow-y: auto; }
.ee-it { font-size: 14px; }
.ee-lctl { display: flex; flex-direction: column; gap: 6px; padding: 7px; border-top: 1px solid var(--line); background: var(--panel-dark); }
.ee-lctl .ee-btn.s { min-height: 30px; } .ee-get { width: 100%; min-height: 36px; }
.ee-rbox .ee-tw { flex: 1; min-height: 0; max-height: none; border: 0; border-radius: 0; }
.ee-rbox .ee-sum { margin: 0; padding: 8px 12px; background: #0b2545; justify-content: flex-end; flex: none; }
.ee-rbox .ee-sum .kv { background: transparent; border: 0; } .ee-rbox .ee-sum .kv span { color: #cfe0f7; } .ee-rbox .ee-sum .kv b { color: #fff; background: rgba(255,255,255,.12); border-radius: 8px; padding: 4px 12px; min-width: 110px; text-align: right; }
.ee-tw td.loc textarea { min-width: 180px; height: 30px; max-height: 84px; resize: none; overflow-y: auto; padding: 5px 8px; min-height: 30px; border-radius: 8px; border-color: transparent; background: transparent; line-height: 1.3; }
.ee-tw td.loc textarea:hover { border-color: var(--line); } .ee-tw td.loc textarea:focus { background: var(--field); }
.ee-desc { grid-template-columns: 1fr 120px 130px; margin-top: 8px; padding-top: 8px; }
.ee-desc textarea { height: 84px; min-height: 84px; overflow-y: auto; resize: vertical; background: var(--panel-dark); color: var(--text); line-height: 1.4; }
.ee-rail, .ee-desc textarea, .ee-head textarea { scrollbar-width: thin; }
.ee.fs .ee-dgrid { height: auto; flex: 1; min-height: 0; grid-template-columns: 300px minmax(0, 1fr); }
.ee.fs .ee-head { padding: 6px 10px; } .ee.fs .ee-desc textarea { height: 64px; min-height: 64px; resize: none; }
.ee.fs .ee-lbox .ee-rail { flex: 1; }
/* footer buttons: icon above label, lower and wider */
.ee-bar-in { gap: 6px; align-items: stretch; } .ee-bar .sep { width: 1px; background: var(--line); margin: 0 2px; } .ee-bar .sp { flex: 1; }
.ee-fb { font: inherit; font-size: 11.5px; font-weight: 700; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 96px; min-height: 40px; padding: 3px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-dark); color: var(--text); cursor: pointer; transition: .15s; white-space: nowrap; }
.ee-fb:hover { border-color: var(--accent); transform: translateY(-1px); } .ee-fb:disabled { opacity: .45; pointer-events: none; }
.ee-fb svg { stroke: currentColor; } .ee-fb.k-blue svg { color: #2f7ff0; } .ee-fb.k-teal svg { color: #0f9488; } .ee-fb.k-gold svg { color: #d99a00; } .ee-fb.k-violet svg { color: #8b5cf6; } .ee-fb.k-red svg { color: #e0405a; }
.ee-fb.qc { border-color: #8b5cf6; }
.ee-fb.nv { min-width: 42px; padding: 3px 8px; } .ee-fb.row { flex-direction: row; min-width: 0; gap: 5px; padding: 4px 10px; }
.ee-nav { border: 0; display: flex; gap: 4px; overflow: visible; } .ee-nav .ee-fb { width: auto; border: 1px solid var(--line); border-radius: 9px; }
.ee-find .ee-fb.row { min-height: 34px; }
/* print form */
.ep-top { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 14px; margin-bottom: 10px; }
.ep-btns { display: flex; flex-direction: column; gap: 8px; } .ep-btns .ee-btn.v { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.ep-fs { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0 0 10px; min-width: 0; } .ep-fs legend { font-size: 12px; font-weight: 700; color: var(--head); padding: 0 6px; }
.ep .rd { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--text); margin: 3px 0; } .ep .rd input { width: auto; min-height: 0; }
.ep-sigw { overflow-x: auto; margin-bottom: 8px; } .ep-sig { width: 100%; border-collapse: separate; border-spacing: 4px; min-width: 700px; }
.ep-sig th { font-size: 12px; color: var(--muted); } .ep-sig th.l { text-align: left; width: 90px; } .ep-sig input { min-height: 34px; }
.ep-bottom { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; }
.ep-tabs { display: flex; gap: 2px; } .ep-tab { font: inherit; font-weight: 700; font-size: 12px; padding: 6px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--panel-dark); color: var(--muted); cursor: pointer; } .ep-tab.on { background: var(--panel); color: var(--head); }
.ep-tabbody { border: 1px solid var(--line); border-radius: 0 10px 10px 10px; padding: 12px; min-height: 120px; }
.report-head.no-hdr { display: none; } .report-foot { margin-top: 14px; font-size: .85em; color: #555; text-align: center; border-top: 1px solid #999; padding-top: 4px; }
@media (max-width: 900px) {
  .ee-dgrid, .ee.fs .ee-dgrid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .ee-lbox .ee-rail { flex-direction: column; max-height: 200px; overflow-y: auto; overflow-x: hidden; } .ee-it { flex: initial; }
  .ee-rbox { min-height: 300px; } .ee-desc { grid-template-columns: 1fr 1fr; }
  .ep-top, .ep-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 700px) { .ee-fb { flex: 1 1 30%; min-width: 0; } .ee-fb.nv { flex: 1 1 20%; } .ee-bar .sep { display: none; } .ee-tw td.loc textarea { min-height: 44px; border-color: var(--line); background: var(--field); } }
@media print { .ee, .ee-bar { display: none !important; } }

.ee-fb { min-width: 80px; padding: 3px 10px; } .ee-fb.nv { min-width: 40px; padding: 3px 7px; }
.ee-find input[type=text], .ee-find input:not([type]) { width: 130px; }
.ee-lctl .slw { font-size: 11px; } .ee-lctl .sl { width: 54px; } .ee-lctl .ee-tools { flex-wrap: nowrap; } .ee-lctl .ee-tools .ee-btn.s { padding: 0 8px; flex: none; }
.ee-lbox .ee-rail { min-height: 90px; } .ee-lctl { flex: none; }
.ee .ee-tools .rd input, .ep .rd input { flex: none; width: auto; min-width: 0; }
.ep .ee-tools { gap: 14px; }
.ee-lctl .ee-tools { flex-wrap: wrap; } .ee-lctl .sl { width: 46px; }

/* v3.1 fullscreen: keep "Get Item from List" visible (rail shrinks, controls stay pinned) */
.ee.fs .ee-dgrid { grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.ee.fs .ee-lbox, .ee.fs .ee-rbox { height: 100%; min-height: 0; }
.ee.fs .ee-lbox .ee-rail { min-height: 0; flex: 1 1 0; overflow-y: auto; }
.ee.fs .ee-lctl { flex: none; max-height: 62%; overflow-y: auto; }
.ee.fs .ee-get { flex: none; position: sticky; bottom: 0; }

/* QC test schedule */
.qc-tw { max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.qc-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.qc-t th, .qc-t td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.qc-t th { color: var(--text); font-size: 12px; position: sticky; top: 0; background: var(--panel-dark); z-index: 1; }
.qc-t tfoot td { position: sticky; bottom: 0; background: var(--panel-dark); font-weight: 600; }
.qc-n { text-align: right !important; font-variant-numeric: tabular-nums; } .qc-x { width: 40px; text-align: center !important; }
.qc-in { width: 70px; text-align: right; min-height: 30px; }
.qc-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; } .qc-add select { max-width: 360px; min-height: 34px; }
.qc-btns { display: flex; gap: 8px; margin-top: 12px; align-items: center; } .qc-btns .sp { flex: 1; }

/* Detailed Estimate sheet (matches the desktop printout) */
.sheet { font: 7.6pt/1.25 Tahoma, Verdana, 'DejaVu Sans', sans-serif; color: #000; background: #fff; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.sheet h1, .sheet h2 { text-align: center; font-size: calc(1em + 5pt); margin: 0; font-weight: 700; line-height: 1.3; } .sheet h2 { margin-bottom: 18px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.sh-meta { display: flex; gap: 20px; margin: 6px 0 10px; } .sh-l { flex: 0 0 64%; } .sh-r { flex: 1; }
.sh-l > div { display: grid; grid-template-columns: 108px 12px 1fr; align-items: start; }
.sh-r > div { display: grid; grid-template-columns: auto auto auto; column-gap: 4px; justify-content: end; }
.sh-kv { display: contents; } .sh-kv > span { padding: 1.5px 0; }
.sh-r .sh-kv .k { text-align: right; } .sh-l .sh-kv .v { display: block; }
.sh-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.sh-tbl thead th { border: 1px solid #000; padding: 2px 3px; background: #fff; text-align: center; font-weight: 400; line-height: 1.25; }
.sh-tbl thead { display: table-header-group; } .sh-tbl tr.num th { padding: 0 3px; }
.sh-tbl td { vertical-align: top; padding: 3px 4px; }
.sh-tbl td.dsc { text-align: left; } .sh-tbl td.c { text-align: center; }
.sh-tbl tbody.g, .sh-tbl tbody.g > tr.sh-item { break-inside: avoid; page-break-inside: avoid; }
.sh-tbl tbody.g > tr.sh-item > td:nth-child(1), .sh-tbl tbody.g > tr.sh-item > td:nth-child(2) { text-align: left; }
.sh-tbl tr.sp td { height: 6px; padding: 0; }
.sh-m { padding: 0 !important; } .sh-mt { width: 100%; border-collapse: collapse; table-layout: fixed; border: 1px solid #000; break-inside: avoid; }
.sh-mt td { padding: 4px 5px; border: 0; } .sh-mt tr + tr > td { border-top: 1px solid #000; } .sh-mt td:nth-child(1) { text-align: left; word-break: break-word; } .sh-mt td.n { text-align: right; font-variant-numeric: tabular-nums; } .sh-mt td.b { font-weight: 700; }
.sh-mt td:nth-child(6) { white-space: nowrap; overflow: visible; }
.sh-mt tr.tot td { border-top: 1px solid #000; padding-top: 7px; padding-bottom: 7px; }
.sh-mt td:nth-child(1) { width: 16.3%; } .sh-mt td:nth-child(2), .sh-mt td:nth-child(3), .sh-mt td:nth-child(5) { width: 9.8%; } .sh-mt td:nth-child(4) { width: 8.1%; } .sh-mt td:nth-child(6) { width: 5.7%; } .sh-mt td:nth-child(7) { width: 12.2%; } .sh-mt td:nth-child(8) { width: 11.4%; } .sh-mt td:nth-child(9) { width: 17.1%; }
.sh-end { margin-top: 14px; line-height: 1.7; display: flex; flex-direction: column; } .sh-end > .sh-signs { order: 2; } .sh-end > .sh-note { order: 1; }
.sh-end .sh-tot, .sh-end > div:nth-child(2), .sh-end > div:nth-child(3) { width: 38%; margin-left: auto; }
.sh-tot { font-size: 1.1em; display: flex; justify-content: space-between; border-bottom: 1px solid #bbb; } .sh-tot u { text-decoration: none; font-weight: 700; }
.sh-end > div:nth-child(2) { display: flex; justify-content: space-between; border-bottom: 1px solid #bbb; font-weight: 700; } .sh-end > div:nth-child(2) b { margin-right: auto; }
.sh-end > div:nth-child(3) { width: auto; text-align: right; }
.sh-signs { display: flex; justify-content: space-between; gap: 22px; margin-top: 70px; text-align: center; break-inside: avoid; } .sh-sign { flex: 1; border-top: 1px solid #cfd3da; padding-top: 6px; }
.sh-sign .sh-sn { font-weight: 400; }
.sh-note { margin-top: 14px; font-size: 1em; font-weight: 700; }
@media print { .sheet { border: 0; padding: 0; } }

/* report preview: paper-sized sheet with live page setup */
.pv-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; position: sticky; top: 0; z-index: 5; background: var(--bg, #fff); padding: 6px 0; }
.pv-z { margin-left: auto; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.pv-panel { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: var(--panel, #fff); }
.pv-stage { background: #8a8f98; padding: 14px; overflow: auto; border-radius: 8px; zoom: var(--z, 1); }
.pv-paper { background: #fff; margin: 0 auto; box-sizing: border-box; box-shadow: 0 2px 10px rgba(0,0,0,.35); color: #000;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--pg-h, 800px) - 1px), rgba(220, 40, 40, .55) calc(var(--pg-h, 800px) - 1px), rgba(220, 40, 40, .55) var(--pg-h, 800px)); background-origin: content-box; background-clip: border-box; background-repeat: no-repeat; }
.pv-paper .sheet, .pv-paper .sheet.lg { border: 0; padding: 0; border-radius: 0; }
@media print {
  html, body { background: #fff !important; }
  .pv-tools, .pv-panel { display: none !important; }
  .pv-stage { background: none; padding: 0; zoom: 1 !important; overflow: visible; border-radius: 0; }
  .pv-paper { width: auto !important; min-height: 0 !important; padding: 0 !important; box-shadow: none; background: none; }
}

/* legacy grouped table (Scheme Summary etc.) */
.lg h1{font-size:12pt}.lg h2{font-size:11pt}
.lg-head{display:flex;justify-content:space-between;font-weight:bold;margin:10px 0 2px}
.lg-tbl{width:100%;border-collapse:collapse;table-layout:fixed;font:8pt Tahoma,Verdana,sans-serif}
.lg-tbl th{border:1px solid #000;padding:2px 3px;text-align:left;font-weight:bold}
.lg-tbl td{border:1px solid #000;padding:1px 3px;vertical-align:top;word-wrap:break-word}
.lg-tbl .r{text-align:right}
.lg-grp td,.lg-upsub td{color:#00008b;font-weight:bold}.lg-wt td{font-weight:bold;padding-left:24px}.lg-sub td{font-weight:bold}
@media print{.lg-tbl tr{page-break-inside:avoid}}

.lg-tbl .c{text-align:center}.lg-kv{display:flex;justify-content:space-between;margin:6px 0 0;font:8pt Tahoma,sans-serif}.lg-kv b{font-weight:bold}.lg-note{margin-top:8px;font:7.5pt Tahoma,sans-serif}
.lg-sub td.r,.lg-upsub td.r{color:#00008b}

.boq-tbl td{border:1px solid #000;padding:1px 3px;vertical-align:top;font:8pt Tahoma,sans-serif}.boq-tbl td.n{text-align:right}.boq-tbl td.c{text-align:center}.boq-tbl td.dsc{text-align:left}
.boq-tbl tr.num th{font-weight:normal;text-align:center}

.boq-top{display:flex;justify-content:space-between;align-items:baseline}.boq-top h1{flex:1;text-align:center;margin:0}.boq-mode{font:bold 10pt Tahoma,sans-serif}
.boq-kv{font:8pt Tahoma,sans-serif;margin:18px 0 6px}.boq-kv div{margin:2px 0}.boq-sign{margin-top:26px;font:bold 8pt Tahoma,sans-serif}
.boq-tbl thead th{border:1px solid #000;font:8pt Tahoma,sans-serif;text-align:center;font-weight:normal}
.boq-tbl td.n{white-space:nowrap}

.lg h1.u{text-decoration:underline}.lg-sub{font:bold 8pt Tahoma,sans-serif;text-decoration:underline;margin:10px 0 4px}
.lg-chap td{color:#00008b;font-weight:bold;text-decoration:underline}.lg-num th{font-weight:normal!important;text-align:center!important}

.lg h1.lg-st{font-size:11pt;margin-top:2px}

.boq-part td{font-weight:bold;border:1px solid #000}.boq-sub td{border:1px solid #000}.boq-tot td{border:1px solid #000;padding:6px}
.boq-wk{display:flex}.boq-wk ol{margin:0;padding-left:22px}.boq-wk b{min-width:100px}
.boq-tender{border:1px solid #000;margin:24px 8% 0 6%;padding:6px 8px;font:8pt Tahoma,sans-serif;min-height:60px}.boq-tv{display:flex;gap:90px;margin:18px 0 0 16px}
.boq-salv{width:100%;border-collapse:collapse;margin-top:20px;font:8pt Tahoma,sans-serif}.boq-salv td{border:1px solid #000;padding:2px 4px}.boq-sn{margin-top:6px}
.boq-sign{display:flex;gap:20px;margin-top:40px;font:8pt Tahoma,sans-serif}.boq-sg{flex:1;text-align:center}.boq-st{width:100px;text-align:center}.boq-corr{margin-top:18px;font:9pt Tahoma,sans-serif}
.boq .b,.boq td.b{font-weight:bold}
.pg-break{break-before:page;page-break-before:always}
.lg tr.lg-tot td{font-weight:700;color:#000;text-decoration:none}
.lg tr.lg-tot td.r{text-align:right}
/* package estimate (Part pages) */
.pk .u{text-decoration:underline;text-underline-offset:4px}
.pk-box{border:1px solid #000;margin-top:48px;padding:0 0 6px}
.pk-box h3{text-align:center;text-decoration:underline;font-size:14pt;margin:4px 0 14px}
.pk-kv{display:flex;justify-content:space-between;padding:0 4px;margin-bottom:12px}
.pk-tbl{width:100%;border-collapse:collapse}
.pk-tbl th{text-align:left;font-size:8.5pt;border-bottom:1px solid #999;padding:2px 4px}
.pk-tbl th.r,.pk-tbl td.r{text-align:right}
.pk-tbl td{padding:5px 4px;vertical-align:top;font-size:9pt}.pk-tbl td.c{text-align:center}
.pk-ptot td{border-top:1px solid #999;border-bottom:1px solid #999;font-weight:700}
.pk-part{margin-top:14px}
.pk-ph{color:#1230c8;font-weight:700;font-size:12pt;border-top:1px solid #ccd;padding-top:2px;width:200px;margin-bottom:8px}
.pk-nti td,.cs-nti td{font-weight:700;color:#1230c8;text-decoration:underline;border:0!important;padding-top:8px}
.pk-pt{display:flex;justify-content:flex-end;gap:36px;color:#1230c8;font-weight:700;border-top:1px solid #ccd;border-bottom:1px solid #ccd;margin:10px 0 10px auto;width:300px;padding:4px 0}
.pk-end{text-align:right}.pk-gt{display:flex;justify-content:flex-end;gap:36px;border-bottom:1px solid #ccc;width:300px;margin:6px 0 6px auto}.pk-w{margin-top:8px}
.pk .sh-signs{display:flex;justify-content:space-between;margin-top:36px;text-align:center}
.cs h1{text-align:center;font-size:14pt;margin:8px 0}.cs-kv{display:flex;justify-content:space-between;font-size:9pt;margin:8px 0}
.cs-tbl{width:100%;border-collapse:collapse;font-size:8pt}.cs-tbl th,.cs-tbl td{border:1px solid #000;padding:1px 3px}
.cs-tbl td.r{text-align:right}.cs-tbl td.c{text-align:center}.cs-ph td{font-weight:700;color:#1230c8}.cs-t td{font-weight:700}
.lg .lg-kv{margin-bottom:2px}.lg .lg-tbl{margin-top:8px}
