/* =============================================================================
   Zafr Solutions Ltd — Cost Estimator
   styles.css — Clean Light Design System
   ============================================================================= */

/* ── FONTS & RESET ── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500;600&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── CSS VARIABLES — Zafr brand ── */
:root {
  --bg:           #f2f6f8;
  --bg2:          #f8fbfc;
  --bg3:          #eef3f6;
  --card:         #fff;
  --border:       #dce8ed;
  --border2:      #b8d0da;
  --accent:       #00A8CC;
  --accent2:      #007A9E;
  --accent-grad:  linear-gradient(135deg, #00C6E8, #009EBF);
  --accent-light: #e0f7fc;
  --accent-ring:  rgba(0,168,204,.18);
  --teal:         #00A8CC;
  --green:        #16a34a;
  --success:      #16a34a;
  --red:          #dc2626;
  --amber:        #f59e0b;
  --text:         #0d1b2a;
  --text2:        #3d5a6e;
  --text3:        #7a9aaa;
  --font:         'Plus Jakarta Sans', sans-serif;
  --mono:         'DM Mono', monospace;
  --radius:       14px;
  --radius-sm:    9px;
  --radius-xs:    6px;
  --shadow-sm:    0 1px 3px rgba(0,40,60,.06);
  --shadow:       0 2px 10px rgba(0,40,60,.09);
  --shadow-lg:    0 6px 24px rgba(0,40,60,.13);
  --topbar-h:     56px;
  --rail-w:       210px;
  --rail-w-col:   52px;
  --summary-w:    288px;
  --usd-color:    #00A8CC;
  --navy:         #0d1b2a;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

/* ── TOP BAR ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}
.topbar-logo { font-weight: 800; font-size: 15px; color: var(--text); letter-spacing: -.3px; white-space: nowrap; flex-shrink: 0; }
.topbar-logo span { color: var(--accent); }
.topbar-logo-img { height: 28px; width: auto; display: block; flex-shrink: 0; object-fit: contain; }
.topbar-meta { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--text2); align-items: center; justify-content: center; }
.hamburger svg { display: block; }

/* ── TOPBAR USER SECTION ── */
.topbar-user { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: 4px; }
.user-email { font-size: 11px; font-weight: 600; color: var(--text2); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-hamburger { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--text2); font-size: 18px; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── BODY SHELL ── */
.body-shell { display: flex; margin-top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow: hidden; }

/* ── NAV RAIL ── */
.nav-rail {
  width: var(--rail-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  flex-shrink: 0;
  transition: width .2s ease;
}
.nav-section-label {
  font-size: 9px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 14px 14px 5px;
  white-space: nowrap; overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; cursor: pointer;
  color: var(--text2); font-weight: 500; font-size: 12px;
  border-left: 3px solid transparent;
  transition: background .1s, color .1s;
  white-space: nowrap;
}
.nav-item:hover { background: var(--bg2); color: var(--text); }
.nav-item.active { background: #e0f7fc; color: var(--accent); border-left-color: var(--accent); }
.nav-item .nav-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-divider { height: 1px; background: var(--bg); margin: 6px 10px; flex-shrink: 0; }
.nav-quotes-section { flex: 1; overflow-y: auto; min-height: 0; }
.nav-quotes-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 5px; }
.nav-quotes-header span { font-size: 9px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .8px; }
.nav-quote-item { padding: 8px 14px; cursor: pointer; border-left: 3px solid transparent; transition: background .1s; }
.nav-quote-item:hover { background: var(--bg2); }
.nav-quote-item.active-quote { background: #e0f7fc; border-left-color: var(--accent); }
.nq-ref    { font-size: 11px; font-weight: 700; color: var(--text); font-family: var(--mono); }
.nq-client { font-size: 10px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.nq-meta   { font-size: 9px; color: var(--text3); margin-top: 1px; }
.nq-empty  { font-size: 11px; color: var(--text3); padding: 10px 14px; }

/* ── MAIN AREA ── */
.main-area {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 20px 20px 100px;
  display: flex; gap: 18px; align-items: flex-start;
}

/* ── FORM COLUMN ── */
.form-col { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 13px 18px 11px;
  border-bottom: 1px solid #f8fafc;
  display: flex; align-items: center; gap: 10px;
}
.card-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.ci-blue   { background: #e0f7fc; }
.ci-amber  { background: #fffbeb; }
.ci-green  { background: #f0fdf4; }
.ci-purple { background: #faf5ff; }
.ci-red    { background: #fef2f2; }
.ci-teal   { background: #f0fdfa; }
.card-title    { font-weight: 700; font-size: 13px; color: var(--text); }
.card-subtitle { font-size: 11px; color: var(--text3); margin-left: auto; }
.card-header-action { margin-left: auto; }
.card-body { padding: 15px 18px; display: flex; flex-direction: column; gap: 12px; }

/* ── FIELD ROWS ── */
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.col    { flex: 1; min-width: 140px; }
.col-sm { flex: 0 0 120px; min-width: 100px; }
.col-xs { flex: 0 0 90px; min-width: 70px; }
.col-lg { flex: 2; min-width: 160px; }

/* ── FIELD LABEL ── */
.field-label {
  font-size: 10px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 4px;
}

/* ── INPUTS ── */
input[type=text],
input[type=number],
input[type=email],
input[type=password],
select,
textarea {
  width: 100%; height: 34px;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-family: var(--font); font-size: 12px; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
input[type=number] { font-family: var(--mono); font-weight: 500; -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  background: var(--card);
}
input:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 26px; cursor: pointer;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: none; cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: var(--font); font-weight: 600; font-size: 12px;
  padding: 7px 14px; transition: all .15s;
  white-space: nowrap; text-decoration: none;
}
.btn-primary  { background: var(--accent-grad); color: #fff; box-shadow: 0 2px 8px rgba(0,168,204,.3); }
.btn-primary:hover { opacity: .9; }
.btn-ghost    { background: var(--bg2); border: 1px solid var(--border); color: var(--text2); }
.btn-ghost:hover { background: var(--bg); border-color: var(--border2); color: var(--text); }
.btn-success  { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--green); }
.btn-success:hover { background: #dcfce7; }
.btn-danger   { background: #fef2f2; border: 1px solid #fecaca; color: var(--red); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm       { padding: 5px 10px; font-size: 11px; }
.btn-export   { }
.btn-full     { width: 100%; padding: 9px 14px; }

/* ── CURRENCY TOGGLE ── */
.curr-toggle { display: flex; gap: 3px; }
.curr-btn {
  padding: 4px 10px; border-radius: 5px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--border);
  background: var(--bg2); color: var(--text3); transition: all .1s;
}
.curr-btn:hover { border-color: var(--border2); color: var(--text2); }
.curr-btn.active-usd { background: #e0f7fc; border-color: #80deea; color: var(--accent); }
.curr-btn.active-jmd { background: #f0fdf4; border-color: #bbf7d0; color: var(--green); }

/* ── CHIPS ── */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 13px; border-radius: 20px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--border);
  background: var(--bg2); color: var(--text3); transition: all .1s;
}
.chip:hover { border-color: var(--border2); color: var(--text2); }
.chip.active { background: #e0f7fc; border-color: #80deea; color: var(--accent); }

/* ── MODE BUTTONS ── */
.mode-btn {
  padding: 4px 11px; border-radius: 5px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--border);
  background: var(--bg2); color: var(--text3); transition: all .1s;
}
.mode-btn.active { background: #e0f7fc; border-color: #80deea; color: var(--accent); }

/* ── CONVERTED HINT ── */
.converted-hint { font-size: 11px; font-weight: 600; color: var(--accent); margin-top: 4px; min-height: 16px; }

/* ── CALC RESULT ── */
.calc-result {
  font-size: 11px; color: var(--text2);
  background: var(--bg2); border-radius: var(--radius-xs);
  padding: 6px 10px;
}

/* ── TOGGLE (checkbox slider) ── */
.toggle { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.t-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #e2e8f0; border-radius: 9px; transition: .2s;
}
.t-slider::before {
  content: ''; position: absolute; width: 12px; height: 12px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .t-slider { background: #10b981; }
.toggle input:checked + .t-slider::before { transform: translateX(14px); }
.toggle-row {
  display: flex; align-items: center; gap: 10px;
  padding: .5rem .75rem;
  background: rgba(20,184,166,.06);
  border: 1px solid rgba(20,184,166,.2);
  border-radius: var(--radius-xs);
  flex-wrap: wrap;
}
.toggle-label { font-weight: 600; font-size: 12px; }

/* ── FX BADGE ── */
.fx-curr-badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 700; font-family: var(--mono);
}
.fx-curr-usd { background: #e0f7fc; color: var(--accent); }
.fx-curr-jmd { background: #f0fdf4; color: var(--green); }

/* ── DUTIES PANEL ── */
.duties-panel { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.duties-panel-header {
  padding: 9px 14px; background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 11px; color: var(--text); flex-wrap: wrap; gap: 6px;
}
.cif-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 6px;
}
.cif-label { font-size: 10px; color: var(--text3); }
.cif-val   { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.duty-row {
  display: grid; grid-template-columns: 36px 1fr 90px 110px;
  align-items: center; padding: 7px 14px;
  border-bottom: 1px solid var(--bg3); gap: 8px;
  transition: opacity .15s;
}
.duty-row:last-of-type { border-bottom: none; }
.duty-row-disabled { opacity: .45; }
.duty-row-disabled .duty-toggle-wrap,
.duty-row-disabled .duty-rate-wrap { pointer-events: none; }
.duty-toggle-wrap { display: flex; align-items: center; }
.duty-name { }
.duty-label { font-size: 11px; font-weight: 500; color: var(--text); }
.duty-basis { font-size: 9px; color: var(--text3); margin-top: 1px; }
.duty-row-gct { background: #fffbeb; }
.duty-rate-wrap { display: flex; align-items: center; gap: 4px; }
.duty-rate-input {
  width: 60px !important; height: 26px; padding: 0 6px;
  font-size: 11px; font-family: var(--mono); text-align: right;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text);
}
.duty-pct-sign { font-size: 10px; color: var(--text3); }
.duty-amount { font-family: var(--mono); font-size: 11px; font-weight: 500; text-align: right; color: var(--text); }
.duty-amt-usd { font-size: 9px; color: var(--text3); }
.duties-total-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; background: var(--bg); border-top: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--text);
}

/* ── HS CODE ── */
.hs-result { background: #e0f7fc; border: 1px solid #80deea; border-radius: var(--radius-sm); padding: 10px 14px; }
.hs-code   { font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 13px; }
.hs-rates  { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; cursor: pointer; }
.badge-hs   { background: #fef2f2; border: 1px solid #fecaca; color: var(--red); }
.badge-rate { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--green); }

/* ── MATERIAL LINE ── */
.material-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--bg3); }
.material-line:first-child { border-top: none; }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tab {
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--bg2); color: var(--text3); transition: all .1s;
}
.tab.active { background: var(--accent-grad); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(0,168,204,.25); }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.page-title span { color: var(--text3); font-weight: 400; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── QUOTE PAGE (document layout) ── */
.quote-page {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  max-width: 820px; box-shadow: var(--shadow);
  font-size: 12px;
}
.quote-logo-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 22px;
  padding-bottom: 18px; border-bottom: 2px solid var(--accent);
}
.quote-logo-img { height: 40px; width: auto; object-fit: contain; }
.quote-company-name { font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: -.2px; }
.quote-company-sub  { font-size: 10px; color: var(--text3); margin-top: 2px; }
.quote-body-content { }
.quote-meta-bar {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.quote-ref   { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.3px; }
.quote-dates { font-size: 11px; color: var(--text3); line-height: 1.8; text-align: right; }
.quote-client-block { margin-bottom: 18px; }
.quote-client-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text3); margin-bottom: 3px; }
.quote-client-name  { font-size: 15px; font-weight: 700; color: var(--text); }
.quote-equip        { font-size: 11px; color: var(--text2); margin-top: 2px; }
.q-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.q-table th { background: var(--navy); color: #fff; padding: 8px 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.q-table th.r, .q-table td.r { text-align: right; }
.q-table td { padding: 7px 10px; border-bottom: 1px solid var(--bg3); font-family: var(--mono); color: var(--text); }
.q-table tr.q-section td { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); background: var(--accent-light); border-bottom: none; padding: 8px 10px 4px; font-family: var(--font); }
.q-table tr.q-total   td { font-weight: 700; background: var(--bg); border-top: 2px solid var(--border); }
.q-table tr.q-total-alt td { font-size: 10px; color: var(--text3); }
.q-table tr.q-gct td         { color: var(--amber); }
.q-table tr.q-contingency td { color: var(--text2); font-style: italic; }
.q-table tr.q-waiver-note td { background: #f0fdf4; color: var(--green); font-size: 11px; font-weight: 600; font-family: var(--font); padding: 10px 10px; border-bottom: 2px solid #bbf7d0; }
.q-table tr.q-row-alt td { border-bottom: none; padding-top: 1px; padding-bottom: 4px; }
.q-alt { font-size: 10px; color: var(--text3); font-family: var(--mono); }
.q-table td.orig { font-size: 10px; color: var(--text3); }
.q-summary-strip {
  display: flex; gap: 0; margin-top: 18px;
  background: var(--navy); border-radius: var(--radius-sm); overflow: hidden;
}
.q-sum-cell {
  flex: 1; padding: 12px 16px; text-align: center;
  border-right: 1px solid rgba(255,255,255,.1);
}
.q-sum-cell:last-child { border-right: none; }
.q-sum-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: rgba(255,255,255,.55); margin-bottom: 4px; }
.q-sum-val   { font-size: 16px; font-weight: 800; color: #fff; font-family: var(--mono); letter-spacing: -.5px; }
.q-sum-val.amber { color: var(--amber); }
.q-sum-val.green { color: #4ade80; }
.quote-fx-note { font-size: 10px; color: var(--text3); margin-top: 10px; font-style: italic; }
.quote-footer-notes { margin-top: 14px; padding: 12px 14px; background: var(--bg2); border-radius: var(--radius-xs); border: 1px solid var(--border); font-size: 11px; color: var(--text2); }

/* ── QUOTE PRINT BAR ── */
.quote-print-bar {
  display: flex; align-items: center; margin-bottom: 14px;
  padding: 10px 14px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* ── QUOTE PREVIEW ── */
.quote-doc { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; max-width: 780px; box-shadow: var(--shadow); }
.quote-header-block { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.quote-title { font-size: 22px; font-weight: 800; color: var(--text); }
.quote-meta-block { text-align: right; font-size: 11px; color: var(--text2); line-height: 1.8; }
.quote-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 14px; }
.quote-table th { background: var(--bg); padding: 8px 10px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); border-bottom: 2px solid var(--border); }
.quote-table th.r, .quote-table td.r { text-align: right; }
.quote-table td { padding: 7px 10px; border-bottom: 1px solid var(--bg3); font-family: var(--mono); }
.quote-table tr.q-section td { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); background: var(--bg2); border-bottom: none; padding: 10px 10px 4px; font-family: var(--font); }
.quote-table tr.q-total td     { font-weight: 700; background: var(--bg); border-top: 2px solid var(--border); }
.quote-table tr.q-total-alt td { font-size: 10px; color: var(--text3); }
.quote-table tr.q-gct td       { color: var(--amber); }
.quote-table tr.q-contingency td { color: var(--text2); font-style: italic; }
.quote-table tr.q-waiver-note td { background: #f0fdf4; color: var(--green); font-size: 10px; font-family: var(--font); }
.quote-table td.orig { font-size: 10px; color: var(--text3); }
.quote-margin-bar { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 16px; padding: 12px 14px; background: var(--bg2); border-radius: var(--radius-sm); }
.qm-item  { display: flex; flex-direction: column; gap: 2px; }
.qm-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); }
.qm-val   { font-size: 15px; font-weight: 700; font-family: var(--mono); color: var(--text); }
.qm-alt   { font-size: 10px; color: var(--text3); font-family: var(--mono); }

/* ── FX SUMMARY ── */
#fxSummary { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: .55rem .85rem; }

/* ── STICKY SUMMARY PANEL ── */
.summary-col { width: var(--summary-w); position: sticky; top: 0; flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; }
.summary-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.summary-header { padding: 13px 16px 11px; border-bottom: 1px solid #f8fafc; display: flex; align-items: center; gap: 8px; }
.summary-title { font-weight: 700; font-size: 13px; color: var(--text); }
.live-dot { width: 7px; height: 7px; background: #10b981; border-radius: 50%; animation: livepulse 2s infinite; flex-shrink: 0; }
@keyframes livepulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.85)} }
.summary-body { padding: 12px 16px; display: flex; flex-direction: column; }
.summary-line { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--bg3); }
.summary-line:last-child { border-bottom: none; }
.s-label { font-size: 11px; color: var(--text2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.s-dot   { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.s-val   { font-size: 11px; font-family: var(--mono); color: var(--text); font-weight: 600; }
.s-val.zero { color: var(--text3); }
.summary-divider { height: 1px; background: var(--border); margin: 8px 0; }
.summary-subtotal { display: flex; justify-content: space-between; padding: 4px 0; }
.st-label { font-size: 11px; color: var(--text2); font-weight: 600; }
.st-val   { font-size: 12px; font-family: var(--mono); color: var(--text); font-weight: 700; }
.summary-total { background: var(--accent-grad); border-radius: 10px; padding: 14px 16px; margin: 10px 16px; }
.total-label    { font-size: 9px; color: rgba(255,255,255,.7); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px; }
.total-amount   { font-size: 22px; font-weight: 800; color: #fff; font-family: var(--mono); letter-spacing: -1px; }
.total-currency { font-size: 10px; color: rgba(255,255,255,.6); margin-top: 2px; }
.summary-actions { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--bg3); }

/* ── STICKY FOOTER (tablet/mobile) ── */
.sticky-footer {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 10px 16px; z-index: 150;
  box-shadow: 0 -4px 16px rgba(0,0,0,.1);
  cursor: pointer; align-items: center; justify-content: space-between; gap: 12px;
}
.footer-label  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); }
.footer-total  { font-size: 18px; font-weight: 800; color: var(--accent); font-family: var(--mono); }
.footer-expand { font-size: 11px; color: var(--text3); }

/* ── SUMMARY DRAWER ── */
.summary-drawer { display: none; position: fixed; inset: 0; z-index: 300; }
.summary-drawer.open { display: block; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.drawer-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--card); border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px 32px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(0,0,0,.15);
}
.drawer-handle { width: 36px; height: 4px; background: var(--border2); border-radius: 2px; margin: 0 auto 16px; }

/* ── LOGIN SCREEN ── */
#login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #f8fbfc 0%, #e0f7fc 60%, #cdf0f7 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
}
.login-box { width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-mark { width: 48px; height: 48px; background: var(--accent-grad); border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; box-shadow: 0 4px 16px rgba(0,168,204,.3); font-size: 22px; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.login-logo span { font-size: 12px; color: var(--text3); }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-lg); }
.login-card h2 { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
.login-card input { margin-bottom: 12px; height: 40px; }
.login-btn { width: 100%; height: 42px; font-size: 14px; font-weight: 700; border-radius: var(--radius-sm); background: var(--accent-grad); color: #fff; border: none; cursor: pointer; box-shadow: 0 3px 12px rgba(0,168,204,.35); transition: opacity .15s; font-family: var(--font); }
.login-btn:hover { opacity: .9; }
.login-err    { color: var(--red); font-size: 12px; margin-top: 8px; display: none; }
.login-footer { text-align: center; font-size: 11px; color: var(--text3); margin-top: 14px; }

/* ── USER CHIP ── */
.user-chip { display: flex; align-items: center; gap: 7px; background: var(--bg2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px 4px 4px; cursor: pointer; }
.user-avatar { width: 26px; height: 26px; background: var(--accent-grad); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; }
.user-name { font-size: 11px; font-weight: 600; color: var(--text2); }

/* ── AUTOCOMPLETE ── */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown { position: absolute; top: calc(100% + 3px); left: 0; right: 0; background: var(--card); border: 1.5px solid #80deea; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 100; overflow: hidden; max-height: 200px; overflow-y: auto; }
.ac-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--bg3); transition: background .1s; }
.ac-item:hover, .ac-item.ac-active { background: #e0f7fc; }
.ac-item:last-child { border-bottom: none; }
.ac-name { font-size: 12px; font-weight: 600; color: var(--text); }
.ac-meta { font-size: 10px; color: var(--text3); margin-top: 1px; }

/* ── TOAST NOTIFICATION ── */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--navy); color: #fff;
  padding: 9px 20px; border-radius: 24px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.visible { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }

/* ── MISC ── */
.hidden { display: none !important; }
.no-print { }

/* ── PRINT ── */
/* ── PRINT WATERMARK ── */
.print-watermark { display: none; }

@media print {
  .no-print, .topbar, .nav-rail, .summary-col, .tabs, .summary-panel,
  .page-header, .sticky-footer, .summary-drawer, #login-screen,
  #tab-estimator, .header-actions, .footer-bar, .quote-print-bar { display: none !important; }
  .body-shell { display: block; margin-top: 0; height: auto; overflow: visible; }
  .main-area  { display: block; padding: 0; overflow: visible; }
  .form-col   { display: block; }
  #tab-quote  { display: block !important; }
  .card, .quote-doc, .quote-page { box-shadow: none; border: none; }
  .quote-page { padding: 0; max-width: none; }
  body { background: #fff; }
  .print-watermark {
    display: block;
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%,-50%) rotate(-35deg);
    font-size: 54px; font-weight: 900;
    color: rgba(13,27,42,0.18);
    white-space: nowrap; z-index: 9999;
    pointer-events: none; letter-spacing: 5px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-transform: uppercase;
  }
}

/* ── RESPONSIVE: TABLET (600–899px) ── */
@media (max-width: 899px) {
  .nav-rail { width: var(--rail-w-col); }
  .nav-label, .nav-rail .nav-section-label, .nav-rail .nav-quotes-section { display: none; }
  .summary-col { display: none; }
  .right-col { display: none; }
  .right-col .tool-panel { display: none; }
  .sticky-footer { display: flex; }
  .main-area { padding-bottom: 70px; }
}

/* ── RESPONSIVE: MOBILE (<600px) ── */
@media (max-width: 599px) {
  .nav-rail { display: none; }
  .nav-rail.drawer-open {
    display: flex; position: fixed;
    top: var(--topbar-h); left: 0; bottom: 0;
    z-index: 250; width: var(--rail-w);
    box-shadow: var(--shadow-lg);
  }
  .nav-rail.drawer-open .nav-label,
  .nav-rail.drawer-open .nav-section-label,
  .nav-rail.drawer-open .nav-quotes-section { display: block; }
  .hamburger { display: flex !important; }
  .topbar-meta { display: none; }
  .row { flex-direction: column; }
  .col, .col-sm, .col-xs, .col-lg { flex: none; width: 100%; min-width: 0; }
  .main-area { padding: 12px 12px 70px; }
  .card-body { padding: 12px; }
  .topbar-actions .btn-ghost:not(.btn-primary) { display: none; }
  .duty-row { grid-template-columns: 32px 1fr 72px 90px; }
  .duties-total-bar { flex-direction: column; align-items: flex-start; }
  .quote-header-block { flex-direction: column; }
  .quote-margin-bar { gap: 16px; }
}

/* =============================================================================
   BRIDGE — maps HTML/JS class names to the design system above
   ============================================================================= */

/* Login screen */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #f8fbfc 0%, #e0f7fc 60%, #cdf0f7 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
}
.login-logo { display: block; max-width: 110px; margin: 0 auto 14px; border-radius: 10px; }
.login-title { font-size: 22px; font-weight: 800; color: var(--text); text-align: center; margin-bottom: 3px; }
.login-sub   { font-size: 12px; color: var(--text3); text-align: center; margin-bottom: 20px; }
.login-field { margin-bottom: 12px; }
.login-label { display: block; font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.login-input { height: 40px; }
.login-error { color: #b91c1c; font-size: 12px; margin-bottom: 10px; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-sm); padding: 6px 10px; }

/* Nav rail — section links */
.nav-heading {
  font-size: 9px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 14px 14px 5px; white-space: nowrap; overflow: hidden;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; cursor: pointer;
  color: var(--text2); font-weight: 500; font-size: 12px;
  border-left: 3px solid transparent;
  transition: background .1s, color .1s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none;
}
.nav-link:hover { background: var(--bg2); color: var(--text); }
.nav-link.active { background: #e0f7fc; color: var(--accent); border-left-color: var(--accent); }

/* Nav rail — saved quotes list */
.nav-quotes-list { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 16px; }
.nav-quote-row {
  padding: 8px 14px; cursor: pointer;
  border-left: 3px solid transparent; transition: background .1s;
}
.nav-quote-row:hover { background: var(--bg2); }
.nav-quote-row.active-quote { background: #e0f7fc; border-left-color: var(--accent); }
.nav-quotes-empty { font-size: 11px; color: var(--text3); padding: 10px 14px; }

/* Nav drawer overlay (mobile) */
.nav-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 198;
}

/* Summary panel (desktop sticky aside) */
.summary-panel {
  width: var(--summary-w); position: sticky; top: 0;
  flex-shrink: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column; max-height: calc(100vh - var(--topbar-h) - 40px);
}
@media (max-width: 899px) { .summary-panel { display: none; } }

.sp-header { padding: 13px 16px 10px; border-bottom: 1px solid var(--bg3); }
.sp-title  { font-weight: 700; font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 7px; }
.sp-title::before { content: ''; width: 7px; height: 7px; background: #10b981; border-radius: 50%; animation: livepulse 2s infinite; flex-shrink: 0; }
.sp-meta   { font-size: 10px; color: var(--text2); margin-top: 3px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sp-ref    { font-family: var(--mono); font-weight: 600; color: var(--text); }
.sp-meta-sep { color: var(--text3); }
.sp-client { color: var(--text2); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sp-body   { padding: 10px 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.sp-row    { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--bg3); }
.sp-row:last-child { border-bottom: none; }
.sp-row-alt { display: flex; justify-content: flex-end; padding-bottom: 2px; }
.sp-row-highlight { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px 0; margin: 4px 0; }
.sp-label    { font-size: 11px; color: var(--text2); font-weight: 500; }
.sp-label-lg { font-size: 12px; color: var(--text); font-weight: 700; }
.sp-val      { font-size: 11px; font-family: var(--mono); color: var(--text); font-weight: 600; }
.sp-val-lg   { font-size: 17px; font-family: var(--mono); font-weight: 800; letter-spacing: -.5px; }
.sp-val-alt  { font-size: 10px; font-family: var(--mono); color: var(--text3); }
.sp-amber    { color: var(--amber); }
.sp-green    { color: var(--success); }
.sp-accent   { color: var(--accent); }
.sp-divider  { height: 1px; background: var(--border); margin: 6px 0; }
.sp-gct-note { font-size: 10px; color: var(--text3); text-align: right; margin-top: -2px; margin-bottom: 2px; }
.sp-footer   { padding: 12px 16px; border-top: 1px solid var(--bg3); display: flex; flex-direction: column; gap: 6px; }

/* Sticky footer bar (tablet/mobile) */
.footer-bar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 10px 16px; z-index: 150;
  box-shadow: 0 -4px 16px rgba(0,0,0,.1);
  cursor: pointer; align-items: center; justify-content: space-between; gap: 12px;
}
.footer-bar:not(.hidden) { display: flex; }
.footer-bar-label   { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); }
.footer-bar-price   { font-size: 18px; font-weight: 800; color: var(--accent); font-family: var(--mono); flex: 1; text-align: center; }
.footer-bar-chevron { font-size: 11px; color: var(--text3); }

/* Summary drawer (tablet/mobile slide-up) */
.summary-drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 300;
  align-items: flex-end;
}
.summary-drawer-overlay:not(.hidden) { display: flex; }
/* Override base .summary-drawer CSS — in this layout it's the inner panel, not the overlay */
.summary-drawer-overlay .summary-drawer {
  display: block !important; position: relative !important;
  inset: unset !important; z-index: unset !important;
  width: 100%; background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px 32px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(0,0,0,.15);
}
.summary-drawer-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.summary-drawer-header span { font-size: 15px; font-weight: 700; color: var(--text); }
.summary-drawer-close { background: none; border: none; font-size: 16px; color: var(--text2); cursor: pointer; padding: 4px 8px; line-height: 1; }
.summary-drawer-body { display: flex; flex-direction: column; gap: 1px; }

/* Autocomplete — bridge for .autocomplete-drop and .autocomplete-item */
.autocomplete-drop {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0;
  background: var(--card); border: 1.5px solid #80deea;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  z-index: 100; overflow: hidden; max-height: 200px; overflow-y: auto;
}
.autocomplete-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--bg3); transition: background .1s; }
.autocomplete-item:hover { background: #e0f7fc; }
.autocomplete-item:last-child { border-bottom: none; }
.ac-loc { font-size: 10px; color: var(--text3); display: block; margin-top: 1px; }

/* ── RIGHT COLUMN (summary + tool panels) ── */
.right-col {
  width: var(--summary-w);
  position: sticky; top: 0;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overflow-x: hidden;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding-bottom: 20px;
}
/* Remove sticky from summary-panel since right-col handles it */
.summary-panel { position: static !important; }

/* ── TOOL PANELS ── */
.tool-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.tp-header {
  padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--text);
  background: var(--bg2);
}
.tp-header:hover { background: var(--bg3); }
.tp-toggle { color: var(--text3); font-size: 11px; transition: transform .2s; }
.tp-body { padding: 14px; font-size: 12px; }
.tool-panel.collapsed .tp-body { display: none; }
.tool-panel.collapsed .tp-toggle { transform: rotate(-90deg); }
