/* 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; }
}
