/* ============================================================
   Khan Enterprises Billing App - Mobile-first design system
   ============================================================ */
:root {
  --primary: #2b4bd7;
  --primary-dark: #2440bd;
  --primary-light: #e8ecff;
  --primary-grad: linear-gradient(135deg, #2b4bd7 0%, #4f6ef0 100%);
  --accent: #f59e0b;
  --danger: #dc2626;
  --success: #16a34a;
  --info: #2b4bd7;
  --bg: #f1f5fb;
  --card: #ffffff;
  --text: #16213a;
  --text-2: #46536e;
  --text-3: #8b96ad;
  --line: #e3e8f1;
  --line-2: #c9d2e3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(22, 33, 58, .08), 0 4px 16px rgba(22, 33, 58, .06);
  --shadow-lg: 0 10px 30px rgba(22, 33, 58, .16);
  --topbar-h: 56px;
  --bottomnav-h: 62px;
  --sidebar-w: 250px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--text); }

::placeholder { color: var(--text-3); }
a { color: var(--primary); text-decoration: none; }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; background: var(--primary-grad);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  z-index: 999;
}
.splash-logo {
  width: 76px; height: 76px; border-radius: 20px; background: #fff; color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; letter-spacing: -1px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  object-fit: cover;
}
.splash-title { color: #fff; font-size: 18px; font-weight: 700; letter-spacing: .3px; }
.spinner {
  width: 26px; height: 26px; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 40;
  background: var(--primary-grad); color: #fff;
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px;
  box-shadow: 0 2px 10px rgba(15,23,42,.18);
  padding-top: env(safe-area-inset-top);
}
.topbar-btn {
  background: transparent; border: 0; color: #fff; width: 40px; height: 40px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
}
.topbar-btn:active { background: rgba(255,255,255,.18); }
.topbar-title { flex: 1; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; }
.topbar-actions { display: flex; gap: 2px; }

.mainarea { padding: calc(var(--topbar-h) + 12px) 14px calc(var(--bottomnav-h) + 16px); transition: padding .2s; }

/* ---------- Sidebar (desktop/tablet) ---------- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); z-index: 50;
  background: #ffffff; border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .25s ease;
  display: flex; flex-direction: column; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: translateX(0); }
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 18px 20px;
  background: var(--primary-grad); color: #fff;
}
.sidebar-brand .brand-box {
  width: 40px; height: 40px; border-radius: 11px; background: #fff; color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
}
.sidebar-brand .brand-box img { width: 100%; height: 100%; object-fit: cover; border-radius: 11px; display: block; }
.sidebar-brand .brand-name { font-weight: 700; font-size: 16px; }
.sidebar-brand .brand-sub { font-size: 11px; opacity: .85; }
.sidebar-nav { display: flex; flex-direction: column; padding: 10px 10px 20px; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; font-size: 14px; border: 0; background: transparent;
  width: 100%; text-align: left;
}
svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); }
.nav-item:active { background: var(--bg); }
.nav-sep { margin: 8px 14px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); font-weight: 700; }
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 45; opacity: 0; visibility: hidden;
  transition: opacity .2s;
}
.sidebar-overlay.show { opacity: 1; visibility: visible; }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  z-index: 40; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 11px; font-weight: 600; border: 0; background: transparent;
  padding-top: 8px;
}
.bottomnav-item svg { width: 23px; height: 23px; }
.bottomnav-item.active { color: var(--primary); }
.bottomnav-item:active { background: var(--bg); }

/* ---------- Responsive ---------- */
@media (min-width: 900px) {
  .topbar { display: none; }
  .bottomnav { display: none; }
  .sidebar { transform: translateX(0); box-shadow: none; border-right: 1px solid var(--line); }
  .mainarea { padding: 24px 28px; margin-left: var(--sidebar-w); }
}

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 14px; overflow: hidden;
}
.card-pad { padding: 16px; }
.card-title { font-size: 15px; font-weight: 700; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title small { font-weight: 500; color: var(--text-3); font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat-card .stat-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat-card .stat-value { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -.5px; }
.stat-card .stat-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--primary-grad); }
.stat-card.green { color: var(--primary-dark); }
.stat-card.green .stat-bar { background: linear-gradient(90deg, #4f6ef0, #2b4bd7); }
.stat-card.amber .stat-bar { background: linear-gradient(90deg, #f59e0b, #f97316); }
.stat-card.blue .stat-bar { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.stat-card.red .stat-bar { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px;
  font-size: 15px; font-weight: 700; color: #fff; background: var(--primary);
  min-height: 46px; transition: transform .06s, box-shadow .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary-grad); box-shadow: 0 6px 14px rgba(43, 75, 215,.3); }
.btn-ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--line-2); }
.btn-soft { background: var(--primary-light); color: var(--primary-dark); }
.btn-danger { background: var(--danger); }
.btn-amber { background: var(--accent); }
.btn-sm { padding: 7px 12px; min-height: 40px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 38px; height: 38px; padding: 0; border-radius: 11px; min-height: 0;
}
.btn-fab.tl { position: fixed; right: 16px; bottom: calc(var(--bottomnav-h) + 16px); height: 56px; width: 56px; border-radius: 18px; box-shadow: var(--shadow-lg); z-index: 30; }
@media (min-width: 900px) { .btn-fab.tl { bottom: 30px; right: 30px; } }
.btn-fab svg { width: 24px; height: 24px; }

.segmented { display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button {
  flex: 1; border: 0; background: transparent; padding: 9px 8px; border-radius: 10px;
  font-weight: 700; font-size: 13px; color: var(--text-2);
}
.segmented button.on { background: #fff; color: var(--primary-dark); box-shadow: var(--shadow); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field-label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--line-2); border-radius: 12px;
  padding: 12px 14px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43, 75, 215,.14);
}
.select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
.input-num { text-align: left; }
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 46px; }
.input-eye {
  position: absolute; top: 0; right: 4px; bottom: 0; width: 42px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; padding: 0; cursor: pointer; color: #8a94a6;
}
.input-eye:hover { color: #2b4bd7; }
.input-eye svg { width: 20px; height: 20px; }
.field-hint { font-size: 12px; color: var(--text-3); }
.field-inline { flex-direction: row; align-items: center; gap: 10px; }
.field-inline .field-label { white-space: nowrap; }
.field-inline .select, .field-inline .input { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.error-text { color: var(--danger); font-size: 12.5px; font-weight: 600; margin-top: 4px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch-row .lbl b { display: block; font-size: 14px; }
.switch-row .lbl span { font-size: 12px; color: var(--text-3); }
.switch { position: relative; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line-2); border-radius: 30px; transition: background .2s; }
.switch .track::before {
  content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px;
  background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(22px); }

/* ---------- Search ---------- */
.searchbar { position: relative; }
.searchbar svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); }
.searchbar .input { padding-left: 40px; }

/* ---------- List items ---------- */
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-bottom: 1px solid var(--line); background: #fff;
}
.list-item:last-child { border-bottom: 0; }
.list-item.ripple:active { background: var(--bg); }
.list-avatar {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.list-body { flex: 1; min-width: 0; }
.list-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: 12.5px; color: var(--text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-right { text-align: right; flex-shrink: 0; }
.list-value { font-weight: 800; }
.list-chip { font-size: 11.5px; padding: 3px 9px; border-radius: 30px; font-weight: 700; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 30px; font-size: 12.5px; font-weight: 700; }
.chip-green { background: #ecfdf5; color: #047857; }
.chip-red { background: #fef2f2; color: #b91c1c; }
.chip-amber { background: #fffbeb; color: #b45309; }
.chip-blue { background: #eff6ff; color: #1d4ed8; }
.chip-gray { background: #f1f5f9; color: #475569; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty .empty-ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.empty .empty-ic svg { width: 32px; height: 32px; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 11px 14px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-3); background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .tbody-row:active { background: #f8fafc; cursor: pointer; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; border: 0; background: #fff; padding: 10px 16px; border-radius: 30px;
  font-weight: 700; font-size: 13.5px; color: var(--text-2); box-shadow: var(--shadow);
}
.tab.on { background: var(--primary-grad); color: #fff; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .2s;
}
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal {
  background: #fff; width: 100%; max-width: 900px; max-height: 90vh;
  border-radius: 20px 20px 0 0; overflow: hidden; display: flex; flex-direction: column;
  transform: translateY(40px); transition: transform .22s ease;
}
.modal-backdrop.show .modal { transform: translateY(0); }
.modal-head {
  padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-weight: 800; font-size: 16px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 20px; max-height: 88vh; }
}

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: calc(var(--topbar-h) + 10px); left: 0; right: 0; z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px; max-width: 100%;
  animation: toastIn .25s ease;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes toastIn { from { transform: translateY(-14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; display: flex;
  background: #f5f7fa;
}
.login-brand {
  flex: 1 1 50%; min-height: 100vh;
  background: linear-gradient(160deg, #2b4bd7 0%, #1f3bb0 55%, #162e91 100%);
  color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 44px 52px;
  position: relative; overflow: hidden;
}
.login-brand::before {
  content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255,255,255,.08); top: -140px; right: -140px;
}
.login-brand::after {
  content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,.05); bottom: -120px; left: -90px;
}
.login-brand-inner { position: relative; z-index: 1; max-width: 560px; margin-top: 6vh; }
.login-brand-logo {
  display: block; width: 512px; height: auto; aspect-ratio: 1 / 1;
  max-width: 100%; object-fit: cover;
  border-radius: 40px; margin-bottom: 30px;
  box-shadow: 0 14px 40px rgba(0,0,0,.3);
}
.login-brand-title {
  font-size: 64px; line-height: 1.08; font-weight: 800; letter-spacing: -1px;
  white-space: pre-line; margin-bottom: 18px;
}
.login-brand-sub { font-size: 15px; line-height: 1.6; color: rgba(255,255,255,.82); max-width: 420px; }
.login-brand-foot { position: relative; z-index: 1; font-size: 13px; color: rgba(255,255,255,.7); }
.login-panel {
  flex: 1 1 50%; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff;
  border-radius: 20px; padding: 34px 32px;
  box-shadow: 0 18px 50px rgba(30, 45, 90, .10);
  border: 1px solid #eef1f6;
}
.login-card-head { font-size: 24px; font-weight: 800; color: #16213a; letter-spacing: -.3px; }
.login-card-sub { font-size: 14px; color: #67738c; margin: 6px 0 24px; }
.login-card .btn-primary { background: #2b4bd7; box-shadow: 0 8px 18px rgba(43,75,215,.28); border-radius: 12px; }
.login-card .btn-primary:hover { background: #2440bd; }
.login-card .btn-primary:active { transform: scale(.99); }
.login-server {
  margin-top: 20px; padding-top: 16px; border-top: 1px dashed #e3e8f0;
}
.login-server summary { cursor: pointer; font-size: 13px; color: #67738c; font-weight: 700; text-align: center; list-style: none; }
.login-server summary::after { content: " â–¾"; }
.login-server[open] summary::after { content: " â–´"; }
.login-card .error-text { margin-top: -6px; }
@media (max-width: 820px) {
  .login-screen { flex-direction: column; }
  .login-brand { min-height: auto; padding: 28px 24px; }
  .login-brand-inner { margin-top: 0; }
  .login-brand-logo { width: 200px; height: auto; border-radius: 30px; margin-bottom: 18px; }
  .login-brand-title { font-size: 36px; }
  .login-brand-sub { font-size: 14px; }
  .login-brand-foot { display: none; }
  .login-panel { min-height: auto; padding: 28px 18px calc(28px + env(safe-area-inset-bottom)); }
}

/* ---------- Invoice / document ---------- */
.doc { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.doc-head { background: var(--primary-grad); color: #fff; padding: 18px 18px 14px; }
.doc-head .doc-type { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; opacity: .85; font-weight: 700; }
.doc-head .doc-company { font-size: 20px; font-weight: 800; margin-top: 2px; }
.doc-head .doc-meta { font-size: 12px; opacity: .95; margin-top: 6px; line-height: 1.6; }
.doc-body { padding: 18px; }
.doc-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 4px 0; }
.doc-row b { font-weight: 700; }
.doc-section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin: 16px 0 8px; }
.doc-total { background: var(--primary-light); border-radius: 12px; padding: 12px 16px; margin-top: 12px; }
.doc-line { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 3px 0; }
.doc-line.grand { font-size: 17px; font-weight: 800; color: var(--primary-dark); border-top: 1.5px solid var(--primary); margin-top: 6px; padding-top: 8px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.doc-table th { background: #f8fafc; text-align: left; padding: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); border-bottom: 1px solid var(--line); }
.doc-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.doc-actions { display: flex; gap: 10px; margin-top: 14px; }
.note-box { font-size: 12px; color: var(--text-3); background: #f8fafc; border-radius: 10px; padding: 12px; margin-top: 12px; white-space: pre-wrap; word-break: break-word; }

/* ---------- Product line editor ---------- */
.line-card { border: 1.5px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; background: #fff; overflow: hidden; }
.line-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.line-num { font-weight: 800; font-size: 13px; color: var(--text-2); }
.line-del { border: 0; background: #fee2e2; color: var(--danger); width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.line-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.line-calc { background: var(--primary-light); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--primary-dark); display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.line-calc b { float: right; font-variant-numeric: tabular-nums; }

/* ---------- Skeleton ---------- */
.skel { border-radius: 10px; background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Misc ---------- */
.section-gap { height: 14px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.flex-col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.text-bold { font-weight: 700; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }

/* ---------- Quotation (A4 print layout) ---------- */
/* v63: quotation company logo enlarged 104x82 -> 150x118 */
.quote-doc { background: #fff; }
.qr-page { width: 210mm; min-height: 297mm; background: #fff; margin: 12px auto; padding: 10mm 10mm 14mm; position: relative; box-shadow: 0 0 6px rgba(0,0,0,.3); color: #000; font-size: 11px; font-family: Arial, Helvetica, sans-serif; page-break-after: always; break-after: page; }
.qr-page:last-child { page-break-after: auto; break-after: auto; margin-bottom: 0; }
.qr-page.qr-letterpage { padding-bottom: 36mm; }
.qr-hdr { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.qr-logo { width: 320px; height: 190px; background: none; color: #0b4a8f; display: flex; align-items: flex-end; justify-content: flex-start; font: bold 52px Georgia, serif; padding-bottom: 2px; overflow: hidden; }
.qr-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.qr-brand-r { font: bold 24px Arial, sans-serif; color: #0b4a8f; letter-spacing: 1px; text-align: right; }
.qr-brand-r small { display: block; font-size: 8px; color: #666; letter-spacing: 1.5px; }
.qr-brand-r.multi { font-size: 15px; letter-spacing: .5px; line-height: 1.3; }
.qr-brand-r.multi .bn { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-brand-r.has-img .bn { display: none; }
.qr-brand-img { display: block; max-height: 180px; max-width: 380px; width: auto; height: auto; margin-left: auto; object-fit: contain; }
.qr-co { font-family: "Times New Roman", Times, serif; font-size: 12.5px; line-height: 1.25; margin-top: 6px; }
.qr-co b { font-size: 16px; }
.qr-foot { position: absolute; left: 10mm; right: 10mm; bottom: 6mm; display: flex; justify-content: space-between; font-size: 9px; font-weight: bold; }
.qr-certs { position: absolute; left: 10mm; right: 10mm; bottom: 18mm; display: flex; gap: 6px; }
.qr-certs.top { position: static; margin-top: 10px; }
.qr-certs span { flex: 1; height: 46px; min-width: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #888; text-align: center; }
.qr-certs span img { max-width: 96%; max-height: 44px; object-fit: contain; display: block; }
.qr-certs span.has-img { padding: 1px; }
.qr-certs span.is-txt::before { content: attr(data-label); }
.qr-letter { margin-top: 150px; font-size: 11px; line-height: 1.35; }
.qr-letter p { margin: 0 0 22px; }
.qr-letter ul { list-style: none; margin: -8px 0 14px 40px; padding: 0; }
.qr-meta { margin-top: 38px; border: 1px solid #999; border-collapse: collapse; width: 100%; font-family: "Times New Roman", Times, serif; font-size: 13px; }
.qr-meta th { background: #7a7a7a; color: #fff; text-align: left; padding: 4px; border: 1px solid #999; }
.qr-meta td { padding: 4px; border: 1px solid #999; }
.qr-meta .big { height: 60px; }
.qr-meta .big .qr-meta-sub { margin-top: 4px; font-weight: 600; height: auto; }
.qr-items { width: 100%; border-collapse: collapse; margin-top: 4px; font-family: "Times New Roman", Times, serif; font-size: 11px; table-layout: fixed; }
.qr-items th { background: #7a7a7a; color: #fff; padding: 5px 4px; font-size: 13px; }
.qr-items td { border: 1px solid #777; vertical-align: top; padding: 2px 4px; }
.qr-sl { width: 38px; } .qr-dsg { width: 250px; } .qr-qty { width: 50px; text-align: center; } .qr-rate { width: 82px; text-align: center; } .qr-amt { width: 82px; text-align: right; }
.qr-spec { font-size: 11px; line-height: 1.2; }
.qr-spec .code { margin: 1px 0 6px; }
.qr-spec .ser { margin-bottom: 0; }
.qr-spec table { border-collapse: collapse; }
.qr-spec td { border: 0; padding: 0; font-size: 10.5px; vertical-align: top; }
.qr-spec td:first-child { width: 78px; }
.qr-rate small { display: block; margin-top: 8px; }
.qr-rate, .qr-amt { padding-top: 6px; }
.qr-num { text-align: right; padding-top: 6px; }
.qr-dwg svg { display: block; margin: 8px auto; max-width: 100%; width: 100%; height: auto; }
.qr-dwg img.qr-prod-img { display: block; margin: 6px auto; max-width: 100%; max-height: 120px; object-fit: contain; }
.qr-tot { display: flex; justify-content: space-between; margin-top: 4px; font-family: "Times New Roman", Times, serif; }
.qr-tot .l { font-weight: bold; font-size: 11px; line-height: 1.25; width: 40%; }
.qr-tot table { width: 58%; border-collapse: collapse; font-size: 13px; }
.qr-tot td { border: 1px solid #777; padding: 4px 6px; }
.qr-tot tr.b td { font-weight: bold; }
.qr-tot td.c { width: 14px; border-right: 0; text-align: center; font-weight: bold; }
.qr-tot td.r { text-align: right; width: 90px; }
.qr-tc { margin-top: 28px; line-height: 1.3; font-size: 10px; }
.qr-tc h4 { margin: 8px 0 2px; font-size: 10.5px; }
.qr-tc h3 { text-decoration: underline; margin: 0 0 4px; font-size: 12px; }
.qr-tc p { margin: 3px 0 3px 40px; }
.qr-tc p.s { margin-left: 60px; }
.qr-bank { margin: 28px 0 0 62px; line-height: 1.7; font-size: 10.5px; }
.qr-bank td:first-child { width: 90px; }
.qr-sign { display: flex; justify-content: space-between; margin-top: 50px; font-size: 10.5px; }

/* ---------- Invoice (GST classic format — shared with Purchase doc) ---------- */
.invoice-doc { background: #fff; padding: 14px 18px; font-size: 12px; color: #111; }
.inv-title { text-align: center; font-size: 20px; font-weight: 800; color: #111; letter-spacing: 2px; text-transform: uppercase; margin: 4px 0 6px; }
.inv-irn { text-align: center; font-size: 11.5px; color: #111; margin-bottom: 10px; }
.inv-irn span { display: inline-block; margin: 0 10px; }
.inv-irn b { font-weight: 700; }
.inv-top2 { display: flex; align-items: stretch; gap: 10px; margin-bottom: 10px; }
.inv-left { flex: 0 0 40%; display: flex; flex-direction: column; gap: 10px; }
.inv-left > .inv-party:last-child { flex: 1; }
.inv-right { flex: 1 1 60%; min-width: 0; }
.inv-party { border: 1px solid #333; padding: 8px 10px; line-height: 1.55; font-size: 11.5px; }
.inv-party .inv-block-title { margin-bottom: 3px; }
.inv-supplier-box { display: flex; align-items: flex-start; gap: 10px; }
.inv-name { font-weight: 800; font-size: 14px; color: #111; }
.inv-logo { margin-bottom: 6px; }
.inv-logo img { max-height: 76px; max-width: 260px; object-fit: contain; }
.inv-table { border-collapse: collapse; width: 100%; margin: 0; }
.inv-meta { width: 100%; border-collapse: collapse; border: 1px solid #333; }
.inv-meta td { padding: 4px 6px; border: 1px solid #555; font-size: 10.5px; line-height: 1.4; }
.inv-meta td.k { font-weight: 700; background: #f1f1f1; white-space: normal; overflow-wrap: anywhere; width: 34%; }
.inv-terms { margin-top: 8px; margin-bottom: 0; }
.inv-details-title { border: 1px solid #333; padding: 6px 10px; margin-bottom: 0; background: #f1f1f1; }
.inv-details-title .inv-block-title { margin-bottom: 0; color: #111; }
.inv-totfoot { background: #f8f8f8; }
.inv-tot-grid { display: flex; }
.inv-tot-grid .it { flex: 1 1 0; border-left: 1px solid #333; padding: 5px 4px; text-align: center; line-height: 1.3; }
.inv-tot-grid .it:first-child { border-left: none; }
.inv-tot-grid .it span { display: block; font-size: 10.5px; font-weight: 700; }
.inv-tot-grid .it b { display: block; font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .2px; }
.inv-tot-grid .it.total { background: #e8e8e8; color: #111; }
.inv-block { border: 1px solid #333; padding: 8px 12px; margin-bottom: 8px; font-size: 12px; line-height: 1.6; }
.inv-block-title { font-weight: 700; text-transform: uppercase; letter-spacing: .5px; font-size: 10.5px; color: #111; margin-bottom: 4px; }
.inv-table-wrap { margin: 0; overflow-x: auto; border: 1px solid #333; }
.inv-table th { background: #f1f1f1; color: #111; padding: 5px 6px; text-align: center; font-size: 9.5px; border: 1px solid #333; text-transform: uppercase; letter-spacing: .2px; }
.inv-table td { padding: 5px 6px; border: 1px solid #333; vertical-align: top; font-size: 10.5px; }
.inv-table td small { font-size: 9px; color: #444; }
.inv-table .l { text-align: left; }
.inv-table .r { text-align: right; }
.inv-table .c { text-align: center; }
.inv-table .b { font-weight: 700; background: #f8f8f8; }
.inv-words { border: 1px solid #333; padding: 8px 12px; margin: 10px 0 8px; font-size: 11.5px; }
.inv-words b { text-transform: capitalize; }
.inv-row { display: flex; gap: 10px; align-items: stretch; margin-bottom: 8px; }
.inv-row > .inv-box { margin-bottom: 0; flex: 1 1 auto; }
.inv-row > .inv-sign-box { flex: 0 0 40%; text-align: right; }
.inv-box { border: 1px solid #333; padding: 10px 12px; margin-bottom: 8px; font-size: 12px; line-height: 1.6; }
.inv-box pre { margin: 0; white-space: pre-wrap; font-family: inherit; font-size: 12px; line-height: 1.6; }
.inv-decl { font-size: 12px; line-height: 1.6; }
.inv-sign-box { font-size: 13px; line-height: 1.8; }

/* ---------- Invoice classic (invoice view — matches invoice.html reference) ---------- */
.iv-invoice.invoice-doc { margin: 0 auto; font-family: Arial, Helvetica, sans-serif; }
.iv-invoice .inv-title { font-size: 15px; font-weight: 700; letter-spacing: 0; text-transform: none; margin: 0 0 8px; }
.iv-invoice .inv-table-wrap { overflow: visible; border: none; }
.iv-invoice .inv-table { table-layout: fixed; }
.iv-invoice .inv-table th { background: none; color: #000; padding: 3px 2px; vertical-align: middle; font-size: 7.5px; border: 1px solid #000; text-transform: none; letter-spacing: 0; }
.iv-invoice .inv-table td { padding: 4px 3px; vertical-align: middle; font-size: 8px; border: 1px solid #000; color: #000; }
.iv-invoice .inv-table td small { display: block; font-size: 6.5px; color: #444; }
.iv-invoice .inv-words { border: none; padding: 0; margin: 6px 0 0; font-size: 9px; color: #000; }
.iv-invoice .inv-words b { display: block; text-transform: none; font-size: 9px; }
.iv-invoice.invoice-doc { background: #fff; padding: 10mm 8mm; font-size: 8.5px; line-height: 1.35; color: #000; }
@media (min-width: 701px) {
  .iv-invoice.invoice-doc { max-width: 210mm; }
}
.iv-head { width: 100%; border: 1.5px solid #000; border-collapse: collapse; table-layout: fixed; }
.iv-head td { border: 1px solid #000; padding: 3px 5px; vertical-align: top; font-size: 8.5px; color: #000; }
.iv-head td.iv-c { height: 22px; }
.iv-head td.iv-big { height: 62px; }
.iv-sup-flex { display: flex; gap: 10px; }
.iv-logo { width: 94px; flex: none; text-align: center; padding-top: 6px; }
.iv-logo img { width: 86px; height: 86px; max-width: 100%; object-fit: contain; }
.iv-logo .iv-mark { font-size: 44px; line-height: 86px; height: 86px; color: #999; }
.iv-sup-company { font-size: 11px; font-weight: 700; margin: 2px 0 4px; }
.sec { font-weight: 700; margin: 6px 0 2px; font-size: 8.5px; }
.iv-tot { margin-top: 6px; width: 100%; border-collapse: collapse; table-layout: fixed; }
.iv-tot th { font-size: 7.5px; text-align: center; padding: 3px 2px; border: 1px solid #000; color: #000; background: none; font-weight: 700; }
.iv-tot td { text-align: center; font-size: 8px; padding: 3px 2px; border: 1px solid #000; color: #000; }
.iv-bank { margin-top: 8px; width: 100%; border: 1.5px solid #000; border-collapse: collapse; table-layout: fixed; }
.iv-bank td { border: none; font-size: 8px; padding: 6px; vertical-align: top; color: #000; line-height: 1.5; }
.iv-bank td.iv-sig { border: 1px solid #000; width: 47%; position: relative; padding: 6px 8px; }
.iv-sig-for { text-align: right; font-weight: 700; }
.iv-sig-auth { position: absolute; right: 8px; bottom: 26px; }
.decl { margin-top: 7px; }

/* ---------- Invoice responsive ---------- */
@media (max-width: 700px) {
  .invoice-doc { padding: 10px 8px; }
  .inv-title { font-size: 18px; margin-bottom: 8px; }
  .inv-top2 { flex-direction: column; gap: 8px; }
  .inv-left, .inv-right { flex: 1 1 100%; width: 100%; }
  .inv-row { flex-direction: column; }
  .inv-row > .inv-sign-box { flex: 1 1 auto; }
  .inv-tot-grid { flex-wrap: wrap; }
  .inv-tot-grid .it { flex: 1 1 45%; border-left: none; border-top: 1px solid #333; padding: 4px 3px; }
  .inv-tot-grid .it:first-child { border-left: none; }
  .inv-tot-grid .it.total { flex: 1 1 100%; }
  .inv-table th { font-size: 8px; padding: 4px 3px; }
  .inv-table td { font-size: 9px; padding: 4px 3px; }
  .iv-invoice.invoice-doc { padding: 8px 6px; }
  .iv-sup-flex { gap: 6px; }
  .iv-head td { font-size: 8px; }
  .iv-invoice .inv-table th { font-size: 7px; padding: 3px 2px; }
  .iv-invoice .inv-table td { font-size: 7.5px; padding: 3px 2px; }
  .iv-tot th { font-size: 7px; }
  .iv-tot td { font-size: 7.5px; }
}

/* ---------- Settings logo picker ---------- */
.logo-pick { border: 1.5px dashed var(--primary); border-radius: 10px; padding: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; text-align: center; min-height: 80px; color: var(--text-2); background: #f8fafc; }
.logo-pick img { max-height: 64px; max-width: 220px; object-fit: contain; }
.logo-pick:hover { border-color: var(--primary); background: #f0fdfa; }

/* ---------- Certification logo picker ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.cert-slot { position: relative; border: 1.5px dashed var(--line, #c3cad9); border-radius: 10px; padding: 8px 4px 6px; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; text-align: center; background: #f8fafc; color: var(--text-2, #475569); }
.cert-slot.on { border-style: solid; }
.cert-slot.busy { opacity: .55; pointer-events: none; }
.cert-slot img { max-width: 88%; max-height: 42px; object-fit: contain; }
.cert-slot .cs-ph { font-size: 12px; font-weight: 600; }
.cert-slot .cs-label { font-size: 9px; color: var(--text-3, #94a3b8); line-height: 1.15; }
.cert-slot.on .cs-label { color: var(--success, #16a34a); }
.cert-slot:hover { border-color: var(--primary); background: #f0fdfa; }


/* ---------- Print ---------- */
@media print {
  @page { size: A4 portrait; margin: 0; }
  .topbar, .bottomnav, .sidebar, .sidebar-overlay, .page-header, .page-actions,
  .btn, .doc-actions, .tabs, .searchbar, .fab, .btn-fab, .modal-backdrop { display: none !important; }
  body { background: #fff; }
  .mainarea { padding: 0; margin: 0; }
  .doc { box-shadow: none; border-radius: 0; }
  .doc-head { background: #2b4bd7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-total { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table tr, .doc-table tr { break-inside: avoid; }
  .no-print { display: none !important; }
  .card, .quote-doc { box-shadow: none; border-radius: 0; }
  .quote-doc, .qr-page { overflow: visible; }
  html, body { height: auto; overflow: visible; }
  .qr-page { margin: 0; box-shadow: none; width: auto; min-height: 0; page-break-after: always; break-after: page; }
  .qr-page:last-child { page-break-after: auto; break-after: auto; }
  .qr-items tr { break-inside: avoid; }
  .qr-tot, .qr-sign { break-inside: avoid; }
  .qr-hdr { break-inside: avoid; page-break-inside: avoid; }
  .qr-logo img, .qr-brand-img { max-width: 100%; }
  .qr-page, .qr-meta th, .qr-meta td, .qr-items th, .qr-items td, .qr-tot td, .qr-logo, .qr-brand-r, .qr-brand-img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.invoice-doc { padding: 10px 12px; }
  .inv-table th, .inv-table td { font-size: 9px; padding: 4px 4px; }
  .inv-table-wrap { overflow: visible; }
  .inv-meta td.k, .inv-table th, .inv-details-title, .inv-totfoot, .inv-tot-grid .it.total { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .iv-invoice.invoice-doc { width: 210mm; min-height: 296mm; padding: 10mm 8mm; margin: 0 auto; }
  .iv-invoice .inv-table th, .iv-invoice .inv-table td { font-size: 8px; padding: 3px 2px; }
  .iv-head, .iv-head td, .iv-tot th, .iv-tot td, .iv-bank, .iv-bank td, .iv-invoice .inv-table th, .iv-invoice .inv-table td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Standalone print slips (advance slip etc.) ---------- */
#print-slip { display: none; }
.adv-slip-doc { max-width: 100%; margin: 0 auto; padding: 12px 20px; color: #1e293b; font-size: 12px; line-height: 1.35; font-family: 'DejaVu Sans', Arial, sans-serif; }
.as-title { text-align: center; font-size: 19px; font-weight: 800; letter-spacing: 3px; padding: 8px 0 6px; border-bottom: 2px solid #2b4bd7; }
.as-co { text-align: center; margin-top: 10px; font-size: 13px; font-weight: 700; }
.as-sub { text-align: center; font-size: 10px; color: #475569; }
.as-emp { margin-top: 16px; width: 100%; border-collapse: collapse; }
.as-emp td { padding: 5px 8px; border: 1px solid #cbd5e1; font-size: 11.5px; }
.as-emp td.k { background: #f1f5f9; font-weight: 700; width: 42%; }
.as-amount { margin-top: 18px; text-align: center; }
.as-lbl { font-size: 11px; color: #475569; }
.as-big { font-size: 26px; font-weight: 800; color: #2b4bd7; }
.as-words { margin-top: 14px; font-size: 11.5px; }
.as-cmt { margin-top: 14px; font-size: 11.5px; border-top: 1px solid #e2e8f0; padding-top: 10px; }
.as-sign { margin-top: 42px; text-align: right; }
.as-sigline { border-top: 1px solid #cbd5e1; padding-top: 4px; width: 46%; margin-left: auto; text-align: center; font-size: 11px; }
.as-fnote { margin-top: 16px; text-align: center; font-size: 9.5px; color: #64748b; }
.adv-slip-preview { background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 2px 6px; max-height: 56vh; overflow: auto; }

/* ---------- Worker cutting sheet / job slip ---------- */
.cut-sheet { max-width: 100%; margin: 0 auto; padding: 12px 16px; color: #111; font-family: 'DejaVu Sans', Arial, sans-serif; }
.cs-title { text-align: center; font-size: 18px; font-weight: 800; letter-spacing: 1.5px; padding: 6px 0; }
.cs-co { text-align: center; font-size: 12px; margin-bottom: 8px; }
.cs-head { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.cs-head td { border: 1px solid #333; padding: 6px 8px; font-size: 12px; vertical-align: top; }
.cs-head td.k { background: #f1f1f1; font-weight: 700; white-space: nowrap; width: 19%; }
.cs-grid { width: 100%; border-collapse: collapse; }
.cs-grid th, .cs-grid td { border: 1px solid #333; padding: 7px 8px; font-size: 12px; vertical-align: top; }
.cs-grid th { background: #f1f1f1; font-weight: 700; text-align: center; }
.cs-grid td.c { text-align: center; white-space: nowrap; }
.cs-grid .cs-sno { width: 6%; }
.cs-grid .cs-w { width: 11%; }
.cs-grid .cs-h { width: 11%; }
.cs-grid .cs-qty { width: 10%; }
.cs-grid tbody tr { height: 26px; }
.cs-grid small { color: #555; font-size: 10px; display: block; }
.cs-sign { width: 100%; margin-top: 34px; border-collapse: collapse; }
.cs-sign td { font-size: 12px; padding-top: 6px; }
.cs-sign td:last-child { text-align: right; }
@media print {
  .cut-sheet { padding: 10mm 12mm; }
  .cs-title { font-size: 17px; }
  .cs-grid tbody tr { height: 30px; }
}
@media print {
  body.eb-print-slip .topbar, body.eb-print-slip .bottomnav, body.eb-print-slip .sidebar,
  body.eb-print-slip .sidebar-overlay, body.eb-print-slip .mainarea,
  body.eb-print-slip .modal-backdrop, body.eb-print-slip .toast-root { display: none !important; }
  body.eb-print-slip #print-slip { display: block !important; }
  .adv-slip-preview { max-height: none; overflow: visible; }
}

/* ---------- New version update banner ---------- */
.eb-update { position: fixed; bottom: 76px; left: 12px; right: 12px; z-index: 999; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #2b4bd7; color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; }
.eb-update .btn { background: #fff; color: #2b4bd7; margin: 0; }

/* ---------- Animations ---------- */
.fade-in { animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Feature additions
   ============================================================ */
.btn-warn { background: var(--accent); color: #fff; }
.btn-warn:hover { filter: brightness(1.05); }

/* pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager-info { font-size: 12.5px; color: var(--text-3); }
.pager-btns { display: flex; gap: 6px; }
.pager-size { display: inline-flex; align-items: center; gap: 6px; }
.pager-lbl { font-size: 12px; color: var(--text-3); }
.pager-size .pgs { min-width: 40px; justify-content: center; padding: 5px 10px; }
.pager-size .pgs.active { background: var(--primary); color: #fff; pointer-events: none; }
@media (max-width: 640px) {
  .pager { flex-wrap: wrap; justify-content: center; gap: 10px; row-gap: 8px; }
  .pager-info { width: 100%; text-align: center; }
  .pager-size { order: 3; }
  .pager-btns { order: 2; }
}

/* bar chart (dashboard) */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 0 16px 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-track { width: 100%; max-width: 34px; height: 100%; display: flex; align-items: flex-end; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar-fill { width: 100%; background: var(--primary-grad); border-radius: 6px; min-height: 3px; transition: height .4s ease; }
.bar-label { font-size: 10px; color: var(--text-3); white-space: nowrap; }

/* product grid */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 12px 16px; }
.prod-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; text-align: center; background: var(--card); }
.prod-card:hover { box-shadow: var(--shadow); }
.prod-img { width: 100%; height: 150px; border-radius: 8px; overflow: hidden; background: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; position: relative; }
.prod-brand { position: absolute; top: 6px; left: 6px; background: rgba(255,255,255,.92); border-radius: 6px; padding: 2px 5px; max-width: 70%; }
.prod-brand img { max-height: 22px; max-width: 60px; display: block; object-fit: contain; }
.prod-img img { width: 100%; height: 100%; object-fit: contain; }
.prod-img-ph { color: var(--text-3); }
.prod-img-ph svg { width: 34px; height: 34px; }
.prod-name { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.25; }
.prod-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; word-break: break-all; }
.prod-meta { display: flex; justify-content: center; gap: 4px; margin-top: 6px; flex-wrap: wrap; }

/* ---------- Product view (card grid, mirrors legacy app) ---------- */
.pv-wrap { display: flex; flex-wrap: wrap; align-items: flex-start; padding: 6px 8px; }
.pv-card {
  position: relative; width: 31%; min-width: 250px; background: #fff;
  box-shadow: 2px 2px 6px rgba(128,128,128,.42); border: 1px solid rgba(25,118,210,.25);
  margin: 10px; border-radius: 8px; overflow: hidden; cursor: pointer;
}
.pv-card:active { transform: scale(.995); }
.pv-pic { display: block; width: 100%; height: 225px; padding: 30px; box-sizing: border-box; object-fit: contain; background: #fff; }
.pv-noimg { display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.pv-noimg svg { width: 46px; height: 46px; }
.pv-writeup { writing-mode: vertical-lr; text-orientation: upright; position: absolute; top: 78px; left: 5px; margin: 0; font-size: 13px; color: #444; }
.pv-high { position: absolute; top: 200px; left: 120px; letter-spacing: 3px; margin: 0; font-size: 13px; color: #444; }
.pv-arrow { position: absolute; top: 19px; width: 32px; height: 65px; }
.pv-arrow1 { position: absolute; top: 147px; width: 32px; height: 59px; transform: rotate(180deg); }
.pv-arrow2 { position: absolute; top: 182px; width: 32px; height: 60px; left: 35px; transform: rotate(270deg); }
.pv-arrow3 { position: absolute; top: 182px; width: 32px; height: 60px; left: 245px; transform: rotate(90deg); }
.pv-body { position: relative; z-index: 2; padding: 4px 14px 12px; }
.pv-body > p { margin: 0 0 2px; font-size: 14px; line-height: 1.35; color: var(--text); }
.pv-label { color: #1976d2; }
.pv-actions { display: flex; gap: 8px; margin-top: 8px; }
.pv-actions .pv-btn { flex: 1; justify-content: center; }

/* product details modal */
.pv-dwrap { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.pv-dspecs { flex: 1 1 240px; min-width: 220px; }
.pv-dextra { flex: 1 1 220px; min-width: 200px; }
.pv-drow { margin: 0 0 8px; font-size: 14px; line-height: 1.4; color: var(--text); }
.pv-ddiagram { position: relative; flex: 0 0 260px; height: 300px; }
.pv-demo { display: block; margin-left: 30px; height: 220px; width: 220px; object-fit: contain; }
.pv-dwriteup { writing-mode: vertical-lr; text-orientation: upright; position: absolute; top: 93px; left: 16px; margin: 0; font-size: 13px; color: #444; }
.pv-dhigh { position: absolute; top: 236px; left: 130px; letter-spacing: 3px; margin: 0; font-size: 13px; color: #444; }
.pv-darrow { position: absolute; top: 6px; left: 11px; width: 32px; height: 65px; }
.pv-darrow1 { position: absolute; top: 186px; left: 11px; width: 32px; height: 59px; transform: rotate(180deg); }
.pv-darrow2 { position: absolute; top: 215px; left: 51px; width: 32px; height: 60px; transform: rotate(270deg); }
.pv-darrow3 { position: absolute; top: 215px; left: 230px; width: 32px; height: 60px; transform: rotate(90deg); }
.pv-ddesc { border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 13.5px; color: var(--text-2); word-break: break-all; }
@media (max-width: 700px) {
  .pv-card { width: calc(100% - 20px); min-width: 0; }
}

/* barcode (Code39) */
.bc-wrap { display: flex; flex-direction: column; align-items: center; padding: 10px 0 4px; }
.bc-bars { display: flex; height: 42px; overflow: hidden; }
.bc-bar { width: 1px; background: #000; }
.bc-w { width: 3px; }
.bc-gap { width: 1px; background: transparent; }
.bc-gw { width: 3px; background: transparent; }
.bc-text { font-family: "Courier New", monospace; font-size: 11px; letter-spacing: 3px; color: #000; margin-top: 3px; }

/* salary slips */
.slip-list { display: flex; flex-direction: column; gap: 8px; }
.slip-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; align-items: center; }
.slip-name { font-size: 14px; font-weight: 700; }
.slip-sub { font-size: 12px; color: var(--text-2); grid-column: 1 / 2; }
.slip-actions { grid-column: 2 / 3; grid-row: 1 / 3; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.slip-net { font-weight: 800; font-size: 14px; color: var(--primary-dark); }

/* checkbox (bulk) */
.check { display: inline-flex; align-items: center; margin-right: 10px; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check span { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-2); background: var(--card); display: inline-flex; align-items: center; justify-content: center; transition: all .15s; }
.check input:checked + span { background: var(--primary); border-color: var(--primary); }
.check input:checked + span::after { content: ""; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); }

/* list avatar image thumbnails */
.list-avatar img { display: block; }

/* ============================================================
   Dark mode
   ============================================================ */
[data-theme="dark"] {
  --primary: #6a86f5;
  --primary-dark: #9db2ff;
  --primary-light: #22356e;
  --accent: #f59e0b;
  --danger: #f87171;
  --success: #4ade80;
  --info: #6a86f5;
  --bg: #0b1120;
  --card: #111a2e;
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --line: #1e293b;
  --line-2: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .6);
}
[data-theme="dark"] body { color: var(--text); }
[data-theme="dark"] .segmented button.on { background: var(--card); color: var(--primary-dark); }
[data-theme="dark"] .chip-blue { background: #172554; color: #93c5fd; }
[data-theme="dark"] .chip-green { background: #052e1b; color: #86efac; }
[data-theme="dark"] .chip-red { background: #3f0d12; color: #fca5a5; }
[data-theme="dark"] .topbar, [data-theme="dark"] .bottomnav, [data-theme="dark"] .sidebar { background: var(--card); }
[data-theme="dark"] .doc, [data-theme="dark"] .doc-head, [data-theme="dark"] .doc-total, [data-theme="dark"] .inv-box, [data-theme="dark"] .inv-title, [data-theme="dark"] .inv-table th {
  background: var(--card); color: var(--text);
}
[data-theme="dark"] .bc-bar { background: #e2e8f0; }
[data-theme="dark"] .bc-text { color: #e2e8f0; }
[data-theme="dark"] .prod-card, [data-theme="dark"] .slip-item { background: var(--card); }
[data-theme="dark"] .logo-pick:hover { background: #22356e; }
[data-theme="dark"] .cert-slot { background: #16203a; border-color: #2a3550; }
[data-theme="dark"] .cert-slot:hover { border-color: var(--primary); background: #22356e; }
[data-theme="dark"] .input, [data-theme="dark"] .select, [data-theme="dark"] .textarea { color: var(--text); }
[data-theme="dark"] .modal { background: var(--card); color: var(--text); }
[data-theme="dark"] .toast { background: var(--text); color: var(--bg); }
[data-theme="dark"] .stat-card.green { color: var(--primary-dark); }
[data-theme="dark"] .slip-net { color: var(--primary-dark); }

/* ============================================================
   QR + Purchase + expanded dark coverage
   ============================================================ */
.qr-wrap { display: flex; justify-content: center; padding: 8px 0 2px; }
.qr-img { width: 96px; height: 96px; border-radius: 8px; border: 1px solid var(--line); background: #fff; padding: 4px; }
[data-theme="dark"] .qr-img { border-color: var(--line-2); }
.img-ph-text { font-size: 11px; color: var(--text-3); }

.pur-head { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.3fr) 66px 60px 54px 58px 72px 50px 72px 28px; gap: 6px; font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; margin-bottom: 6px; }
.pur-item { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.3fr) 66px 60px 54px 58px 72px 50px 72px 28px; gap: 6px; margin-bottom: 8px; align-items: center; }
.pur-item .select { min-width: 0; }
.pur-amt { font-weight: 700; font-size: 13px; text-align: right; }
.pur-total { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-2); font-size: 15px; }
.pur-total b { color: var(--primary-dark); }
.cat-pager { border-top: 1px solid var(--line); }
.chip-amber { background: #fef3c7; color: #b45309; }

/* ---------- Inventory / BOM / Movements ---------- */
.bom-head { display: grid; grid-template-columns: minmax(0,1fr) 90px 70px 40px; gap: 8px; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; margin-bottom: 6px; }
.bom-item { display: grid; grid-template-columns: minmax(0,1fr) 90px 70px 40px; gap: 8px; margin-bottom: 8px; align-items: center; }
.bom-item .select { min-width: 0; }
.mv-table { width: 100%; }
.mv-row { display: grid; grid-template-columns: 108px minmax(0,1fr) 110px 110px 88px 88px 110px; gap: 6px; padding: 8px 10px; font-size: 12px; border-bottom: 1px solid var(--line); align-items: center; }
.mv-row.mv-head { font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--text-3); background: var(--bg); }
.mv-row .r { text-align: right; }

[data-theme="dark"] .card,
[data-theme="dark"] .searchbar .input,
[data-theme="dark"] .modal { background: var(--card); }
[data-theme="dark"] .list-item { border-bottom-color: var(--line); }
[data-theme="dark"] .list-avatar { background: var(--primary-light); color: var(--primary-dark); }
[data-theme="dark"] .list-item.ripple:active { background: var(--line); }
[data-theme="dark"] .table th { background: var(--line); color: var(--text-2); }
[data-theme="dark"] .table tbody tr:active { background: var(--line); }
[data-theme="dark"] .table td { border-bottom-color: var(--line); }
[data-theme="dark"] .card-title { border-bottom-color: var(--line); }
[data-theme="dark"] .segmented { background: var(--line); }
[data-theme="dark"] .empty .empty-ic { background: var(--line); }
[data-theme="dark"] .prod-img { background: var(--line); }
[data-theme="dark"] .doc-line, [data-theme="dark"] .line-calc { color: var(--text-2); }
[data-theme="dark"] .line-calc { background: var(--primary-light); color: var(--primary-dark); }
[data-theme="dark"] .inv-box { background: var(--line); border-color: var(--line-2); }
[data-theme="dark"] .doc { box-shadow: none; }
[data-theme="dark"] .bar-fill { background: var(--primary-grad); }
[data-theme="dark"] .pager { border-top-color: var(--line); }
[data-theme="dark"] .chip-gray { background: var(--line); color: var(--text-2); }
[data-theme="dark"] .chip-amber { background: #422006; color: #fcd34d; }
[data-theme="dark"] .btn-soft { background: var(--primary-light); color: var(--primary-dark); }
[data-theme="dark"] .btn-ghost { color: var(--text-2); }
[data-theme="dark"] .nav-item.active { background: var(--primary-light); color: var(--primary-dark); }
[data-theme="dark"] .nav-item:active { background: var(--line); }
[data-theme="dark"] .field-label { color: var(--text-2); }
[data-theme="dark"] .tab { background: var(--line); color: var(--text-2); }
[data-theme="dark"] .tab.on { background: var(--primary-grad); color: #fff; }
[data-theme="dark"] .slip-list { border-color: var(--line); }
[data-theme="dark"] .sidebar { background: var(--card); border-right-color: var(--line); }
[data-theme="dark"] .qr-img { background: #fff; }
[data-theme="dark"] .pur-total b { color: var(--primary-dark); }

.adv-box { background: var(--bg); border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px; }
.adv-basic { font-size: 13px; }
.adv-basic b { color: var(--primary-dark); }
.adv-rows { display: flex; flex-direction: column; gap: 6px; }
.adv-row { display: grid; grid-template-columns: 24px 90px 92px 1fr auto; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; }
.adv-slip { font-weight: 700; }
.adv-dt { color: var(--text-3); }
.adv-cmt { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adv-amt { font-weight: 700; }
.adv-net { font-size: 13.5px; }
.adv-net b { color: var(--primary-dark); }
[data-theme="dark"] .adv-box { background: var(--line); }
[data-theme="dark"] .adv-row { background: var(--bg); border-color: var(--line-2); }

.wa-rows { display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow: auto; padding-right: 2px; }
.wa-row { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.wa-info { flex: 1; min-width: 0; }
.wa-name { font-weight: 700; font-size: 14px; }
.wa-sub { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.wa-msg { width: 100%; min-height: 72px; font-size: 12.5px; }
.wa-actions { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 520px) {
  .wa-row { flex-direction: column; }
  .wa-actions { flex-direction: row; width: 100%; }
  .wa-actions .btn { flex: 1; }
}
[data-theme="dark"] .wa-row { background: var(--line); border-color: var(--line-2); }

.pay-slip { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pay-org { background: var(--primary-grad); color: #fff; font-weight: 800; font-size: 15px; padding: 14px 16px; }
.pay-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); padding: 10px 16px 4px; }
.pay-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; font-size: 13.5px; border-top: 1px solid var(--line); }
.pay-row span { color: var(--text-2); }
.pay-row b { font-weight: 700; text-align: right; }
.pay-total { background: var(--primary-light); font-size: 15px; }
.pay-total b { color: var(--primary-dark); }
[data-theme="dark"] .pay-total { background: var(--line); }

/* ============================================================
   Mobile UX polish (touch targets, responsive forms, safe areas)
   ============================================================ */
button, a { -webkit-tap-highlight-color: transparent; }
.list-item, .nav-item, .bottomnav-item, .tab { -webkit-tap-highlight-color: transparent; }

.btn:focus-visible, .tab:focus-visible, .nav-item:focus-visible,
.bottomnav-item:focus-visible, .segmented button:focus-visible,
.line-del:focus-visible, .topbar-btn:focus-visible, .switch-row:focus-within {
  outline: 3px solid rgba(43, 75, 215,.35); outline-offset: 1px;
}

.mainarea {
  padding: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px) 14px calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 16px);
}
.btn-fab.tl { bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 16px); }
.card-title { flex-wrap: wrap; }
.pur-qty, .pur-rate { width: 100%; }

/* Add to Home Screen helper */
.inst-hero {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 18px;
  background: var(--primary-grad); color: #fff; display: flex; align-items: center; justify-content: center;
}
.inst-hero svg { width: 30px; height: 30px; }
.inst-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.inst-step { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; }
.inst-n {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark); font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

/* enlarge tap areas on touch devices */
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
  .btn-icon { width: 44px; height: 44px; }
  .line-del { width: 40px; height: 40px; }
  .segmented button { padding: 11px 8px; }
  .topbar-btn { width: 44px; height: 44px; }
}

/* purchase items: stack rows on small screens */
@media (max-width: 560px) {
  .pur-head { display: none; }
  .pur-item {
    grid-template-columns: 1fr 1fr 1fr 40px;
    grid-template-areas:
      "mat mat mat rm"
      "desc desc desc desc"
      "hsn hsn alt alt"
      "qty qty len len"
      "rate rate tax tax"
      "amt amt amt amt";
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
  }
  .pur-mat { grid-area: mat; }
  .pur-unit { grid-area: unit; display: none; }
  .pur-desc { grid-area: desc; }
  .pur-hsn { grid-area: hsn; }
  .pur-alt { grid-area: alt; }
  .pur-qty { grid-area: qty; }
  .pur-len { grid-area: len; }
  .pur-rate { grid-area: rate; }
  .pur-tax { grid-area: tax; }
  .pur-disc { grid-area: disc; }
  .pur-amt { grid-area: amt; height: auto; }
  .pur-rm { grid-area: rm; }
  .bom-head { display: none; }
  .bom-item {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-areas:
      "mat mat mat rm"
      "qty qty unit unit";
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
  }
  .bom-mat { grid-area: mat; }
  .bom-qty { grid-area: qty; }
  .bom-unit { grid-area: unit; max-width: 100% !important; }
  .bom-rm { grid-area: rm; }
  .mv-row { grid-template-columns: 1fr 1fr; gap: 3px 10px; }
  .mv-row.mv-head { display: none; }
}

/* ============================================================
   Dark mode polish (documents + purchase rows)
   ============================================================ */
[data-theme="dark"] .login-card,
[data-theme="dark"] .invoice-doc,
[data-theme="dark"] .quote-doc,
[data-theme="dark"] .line-card { background: var(--card); color: var(--text); }
[data-theme="dark"] .line-head { background: var(--line); color: var(--text-2); }
[data-theme="dark"] .doc-head { background: var(--primary-grad); color: #fff; }
[data-theme="dark"] .doc-head .doc-type,
[data-theme="dark"] .doc-head .doc-meta,
[data-theme="dark"] .doc-company { color: #fff; }
[data-theme="dark"] .inv-meta td.k,
[data-theme="dark"] .inv-totfoot { background: var(--line); color: var(--text-2); }
[data-theme="dark"] .inv-table td,
[data-theme="dark"] .inv-meta td { border-color: var(--line-2); }
[data-theme="dark"] .pur-item { background: var(--bg); border-color: var(--line-2); }

/* A4 quotation pages always render on white, in both themes */
[data-theme="dark"] .qr-page { background: #fff; color: #000; }

/* ============================================================
   Prepare Quotation (quotation/create) - reference layout
   ============================================================ */
.pq-heading { font-size: 17px; font-weight: 800; text-align: center; padding: 16px 16px 2px; color: var(--text); }
.pq-hint { text-align: center; font-size: 12.5px; color: var(--text-3); padding: 0 16px 10px; }
.pq-sep { border: 0; height: 1px; background: var(--line); margin: 6px 0; }

.bf-row { display: flex; flex-wrap: wrap; gap: 12px; }
.bf-row .field { width: 100%; }
.bf-12 { flex: 1 1 100%; }
.bf-8 { flex: 1 1 calc(66.666% - 8px); }
.bf-6 { flex: 1 1 calc(50% - 6px); }
.bf-4 { flex: 1 1 calc(33.333% - 8px); }
.bf-3 { flex: 1 1 calc(25% - 9px); }
.pq-docno { padding: 10px 16px 2px; font-size: 15px; color: var(--text); }
.pq-docno b { font-weight: 800; }

.pq-client-row { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(220px, 1.6fr); gap: 14px; padding: 6px 16px 10px; align-items: start; }
.pq-client-num { display: flex; flex-direction: column; gap: 10px; }
.pq-client-info { min-height: 44px; }
.product_p.pq-info-p, .pq-info-p { font-size: 14px; line-height: 1.75; margin: 0; color: var(--text); }
.product_label { font-weight: 800; color: var(--text); }
.pq-muted { color: var(--text-3); font-size: 13px; }
.pq-newbuyer { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 12px; background: var(--bg); }
.pq-newbuyer-title { font-size: 15px; font-weight: 800; text-align: center; margin-bottom: 10px; }

.pq-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 8px 4px; }
.pq-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 13px; }
.pq-table th { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--text-2); background: var(--bg); padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.pq-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pq-table tr.line-card.pq-row { border: 0; border-radius: 0; margin: 0; overflow: visible; box-shadow: none; }
[data-theme="dark"] .pq-table tr.line-card.pq-row { background: transparent; color: var(--text); }
.pq-table .input, .pq-table .select { min-height: 40px; padding: 8px 10px; font-size: 13px; border-radius: 10px; }
.pq-table .select { background-position: right 8px center; padding-right: 28px; }
.pq-col-product { min-width: 150px; }
.pq-col-mm { min-width: 92px; }
.pq-col-price { min-width: 100px; }
.pq-col-qty { min-width: 78px; }
.pq-col-act { text-align: center; }
.pq-wh { display: flex; gap: 6px; }
.pq-wh .input { width: 50%; min-width: 0; }
.pq-wh-x { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.pq-wh-x .input { width: 100%; }
.pq-x { font-weight: 800; color: var(--text-3); }
.pq-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; color: var(--text-2); }
.pq-del { border: 0; background: rgba(220, 38, 38, .12); color: var(--danger); width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.pq-del svg { width: 16px; height: 16px; }
.pq-err { border-color: var(--danger) !important; }

.pq-actions { padding: 12px 16px 4px; }
.pq-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.pq-summary { padding: 4px 16px 6px; }
.pq-sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.pq-sum-item { font-size: 14px; padding: 4px 0; color: var(--text-2); }
.pq-sum-item b { font-weight: 700; color: var(--text); }
.pq-sum-totals { border-top: 1.5px solid var(--primary); margin-top: 6px; padding-top: 6px; }
.pq-sum-totals .pq-sum-item { font-size: 16px; }
.pq-sum-totals .pq-sum-item, .pq-sum-totals .pq-sum-item b { color: var(--primary-dark); font-weight: 800; }
.pq-sum-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; padding: 5px 0; }
.pq-sum-row b { font-weight: 700; color: var(--text); }
.pq-sum-row span { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.pq-sum-row.grand { border-top: 1.5px solid var(--primary); margin-top: 6px; padding-top: 9px; font-size: 16px; }
.pq-sum-row.grand b, .pq-sum-row.grand span { color: var(--primary-dark); font-weight: 800; }
.pq-actions-center { text-align: center; padding: 10px 16px 18px; }
.pq-actions-center .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 230px; }

@media (max-width: 640px) {
  .pq-client-row { grid-template-columns: 1fr; }
  .bf-8, .bf-6, .bf-4, .bf-3 { flex: 1 1 100%; }
  .pq-heading { font-size: 16px; }
  .pq-actions-center .btn { min-width: 0; width: 100%; }
}

/* ============================================================
   Quotation list (quotation) - reference table layout
   ============================================================ */
.qt-toolbar { padding: 0 0 12px; }
.qt-toolbar .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.qt-card { overflow: hidden; }
.qt-search { padding: 12px 14px; }
.qt-search .input { padding-left: 40px; }
.qt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.qt-table { width: 100%; min-width: 1000px; border-collapse: collapse; font-size: 13px; }
.qt-table th { background: var(--bg); color: var(--text-2); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; padding: 10px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.qt-table td { padding: 9px 10px; text-align: center; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; white-space: nowrap; }
.qt-table tbody tr:last-child td { border-bottom: 0; }
.qt-table tbody tr:hover { background: var(--bg); }
.qt-table tbody tr { white-space: nowrap; }
.qt-sno { font-weight: 700; color: var(--text-2); }
.qt-n { font-variant-numeric: tabular-nums; }
.qt-strong { font-weight: 800; }
.qt-name { font-weight: 700; }
.qt-c-sno { width: 1%; }
.qt-c-act { width: 1%; }
.qt-actions { display: flex; flex-wrap: nowrap; gap: 5px; justify-content: center; align-items: center; }
.qt-actions .btn { white-space: nowrap; padding: 5px 9px; font-size: 11.5px; border-radius: 7px; min-height: 0; line-height: 1.35; }
.qt-b-blue { background: #2563eb; color: #fff; }
.qt-b-green { background: #16a34a; color: #fff; }
.qt-b-orange { background: #ea580c; color: #fff; }
.qt-b-red { background: var(--danger); color: #fff; }
.qt-chip { margin-left: 6px; padding: 2px 8px; font-size: 10.5px; vertical-align: middle; }
.qt-empty { padding: 34px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-3); white-space: normal; }
.qt-empty svg { width: 26px; height: 26px; }
[data-theme="dark"] .qt-table td { color: var(--text); }
@media (max-width: 640px) {
  .qt-toolbar .btn { width: 100%; }
  .qt-table { min-width: 940px; }
  .qt-search { padding: 10px 12px; }
}

/* A4 previews are scaled to fit on screen via inline zoom (app.js);
   keep them full size when printing / generating the PDF. */
@media print {
  #print-area { zoom: 1 !important; }
}
