/* ==========================================================================
   ValveQuote Pro — styles.css
   Premium industrial B2B ERP look: navy/charcoal primary, blue accent, green WhatsApp.
   ========================================================================== */

:root {
  --navy: #0f1b33;
  --navy-2: #16233f;
  --charcoal: #1e2430;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-light: #eaf1ff;
  --success: #15803d;
  --success-light: #e7f6ec;
  --danger: #dc2626;
  --danger-light: #fdecec;
  --warning: #b45309;
  --warning-light: #fef3e0;
  --purple: #7c3aed;
  --purple-light: #f1eafe;
  --whatsapp: #25d366;
  --whatsapp-dark: #1da851;
  --bg: #f4f6fa;
  --card-bg: #ffffff;
  --border: #e2e6ee;
  --text: #1b2233;
  --text-muted: #6b7385;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15, 27, 51, 0.06), 0 1px 2px rgba(15, 27, 51, 0.08);
  --shadow-md: 0 4px 14px rgba(15, 27, 51, 0.10);
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 8px; color: var(--navy); font-weight: 700; }
h1 { font-size: 22px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
p { margin: 0 0 8px; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.link { color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- App shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #dbe3f5;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform .25s ease;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 8px; background: var(--accent); overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 14px;
  flex-shrink: 0;
}
.brand-mark.has-logo { background: #fff; padding: 4px; }
.brand-logo-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-name { font-weight: 700; color: #fff; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.brand-sub { font-size: 10.5px; color: #9fb0d4; }

.side-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: #c3cee8; font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s;
}
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--accent); color: #fff; }

.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #8494ba; }
.sidebar-overlay { display: none; }

.main-col { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 62px; background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 20px; position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  height: calc(62px + env(safe-area-inset-top));
}
.hamburger { display: none; background: none; border: none; font-size: 20px; color: var(--navy); padding: 6px; }
.topbar-search { position: relative; flex: 1; max-width: 480px; }
.topbar-search input {
  width: 100%; padding: 9px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg);
  font-size: 13px;
}
.topbar-search input:focus { border-color: var(--accent); background: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn-lg { background: none; border: none; font-size: 18px; position: relative; padding: 6px; border-radius: 8px; }
.icon-btn-lg:hover { background: var(--bg); }
.notif-count {
  position: absolute; top: 0; right: 0; background: var(--danger); color: #fff; font-size: 9.5px;
  border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
}

.view-root { padding: 22px 26px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-size: 13px; font-weight: 600; white-space: nowrap; transition: filter .12s, background .12s;
  text-align: center;
}
.btn:active { filter: brightness(.92); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-success { background: var(--success); color: #fff; }
.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-whatsapp:hover { background: var(--whatsapp-dark); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.file-btn { position: relative; display: inline-flex; }

/* ---------------- Layout helpers ---------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-bottom: 2px; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.qa-btn {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px;
  font-weight: 600; font-size: 12.5px; color: var(--navy); box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
}
.qa-btn:hover { border-color: var(--accent); color: var(--accent); }

.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.filters-card { padding: 14px 16px; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: center; }
.filters-grid input, .filters-grid select { padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 12.5px; }

/* ---------------- Stat cards ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 10px; background: var(--accent-light); display: flex;
  align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0;
}
.stat-value { font-size: 20px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* ---------------- Alert banner ---------------- */
.alert-banner {
  background: var(--warning-light); border: 1px solid #f3d9a8; color: #7c4a05; border-radius: var(--radius);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.8px; min-width: 640px; }
.data-table th {
  text-align: left; padding: 10px 12px; background: var(--bg); color: var(--text-muted);
  font-weight: 700; text-transform: uppercase; font-size: 10.5px; letter-spacing: .03em; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: #fafbfe; }
.row-actions { display: flex; gap: 4px; white-space: nowrap; }

.icon-btn {
  background: #fff; border: 1px solid var(--border); border-radius: 6px; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: var(--navy);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn.wa:hover { border-color: var(--whatsapp); color: var(--whatsapp-dark); }

/* ---------------- Badges ---------------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.badge-gray { background: #eef0f4; color: #4b5468; }
.badge-blue { background: var(--accent-light); color: var(--accent-dark); }
.badge-amber { background: var(--warning-light); color: var(--warning); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-overdue { background: var(--danger-light); color: var(--danger); }
.badge-today { background: var(--warning-light); color: var(--warning); }
.badge-tomorrow, .badge-upcoming { background: var(--accent-light); color: var(--accent-dark); }

/* ---------------- Empty states ---------------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state h3 { color: var(--navy); }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span-2 { grid-column: span 2; }
.form-group label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; }
.form-group input, .form-group select, .form-group textarea {
  padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px;
  font-family: inherit; background: #fff; color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group input[readonly] { background: var(--bg); color: var(--text-muted); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
textarea { resize: vertical; }

/* ---------------- Typeahead / suggestions ---------------- */
.typeahead { position: relative; }
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md); z-index: 50; max-height: 280px; overflow-y: auto; margin-top: 4px;
}
.sugg-group { padding: 6px 12px; font-size: 10.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; background: var(--bg); }
.sugg-item { padding: 9px 12px; font-size: 12.5px; border-bottom: 1px solid var(--border); cursor: pointer; }
.sugg-item:last-child { border-bottom: none; }
.sugg-item:hover { background: var(--accent-light); }
.sugg-add { color: var(--accent); font-weight: 700; }
.client-selected-info { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------------- Quotation item cards ---------------- */
.item-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; background: #fbfcfe; }
.item-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.item-num { font-weight: 700; color: var(--accent-dark); font-size: 12.5px; }
.item-card-actions { display: flex; gap: 6px; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item-amount-group .item-amount {
  padding: 9px 11px; border-radius: var(--radius-sm); background: var(--accent-light); color: var(--accent-dark);
  font-weight: 700; font-size: 13px;
}

/* ---------------- Totals panel ---------------- */
.totals-panel { display: flex; flex-direction: column; gap: 6px; }
.totals-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.totals-row span:last-child { font-weight: 600; }
.totals-grand { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-size: 16px; font-weight: 800; color: var(--navy); }
.amount-words { margin-top: 10px; font-style: italic; font-size: 12px; color: var(--text-muted); }

/* ---------------- WhatsApp action card ---------------- */
.whatsapp-card { background: #f4fdf7; border-color: #bdeccf; }
.wa-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.status-quick-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------------- Timeline ---------------- */
.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { border-left: 2px solid var(--accent); padding-left: 12px; }
.timeline-date { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }

/* ---------------- Modals ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 20, 35, .55); display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 22px 24px; width: 100%; max-width: 460px;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------------- List manager (Settings) ---------------- */
.list-manager { margin-bottom: 6px; }
.list-manager-add { display: flex; gap: 8px; margin-bottom: 10px; }
.list-manager-add .lm-input { flex: 1; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.list-manager-items { display: flex; flex-wrap: wrap; gap: 8px; }
.lm-item {
  display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 6px 5px 12px; font-size: 12.5px;
}
.lm-item .icon-btn { width: 22px; height: 22px; border: none; background: transparent; }

/* ---------------- Settings layout ---------------- */
.settings-layout { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: start; }
.settings-tabs { display: flex; flex-direction: column; gap: 2px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; position: sticky; top: 78px; }
.settings-tab { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.settings-tab:hover { background: var(--bg); }
.settings-tab.active { background: var(--accent); color: #fff; }
.settings-body { min-height: 300px; }
.privacy-note { background: var(--accent-light); color: var(--accent-dark); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; margin-bottom: 14px; }
.danger-heading { color: var(--danger); }
.import-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.storage-status { font-size: 12px; color: var(--text-muted); margin-top: 14px; }
.logo-preview { max-width: 160px; max-height: 90px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; margin-bottom: 8px; display: block; background: #fff; }
.sig-preview { max-width: 180px; max-height: 70px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; margin-bottom: 8px; display: block; background: #fff; }

/* ---------------- Bar charts (CSS-based, no dependency) ---------------- */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg); border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--accent); transition: width .3s; }
.bar-value { font-size: 12px; font-weight: 700; text-align: right; color: var(--navy); }

/* ---------------- Toasts ---------------- */
.toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: 320px; }
.toast {
  background: var(--navy); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px;
  box-shadow: var(--shadow-md); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--navy); }

/* ---------------- Print ---------------- */
.print-only { display: none; }
@media print {
  /* Brand blue sampled from the RTVC Industries logo — used for the
     document title, section headings, table header/subtotal text and the
     grand total, so the printed page matches the logo's palette. */
  :root { --print-brand-blue: #1a3a8a; }
  body { font-family: Arial, Helvetica, sans-serif; }
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area {
    display: block !important; position: absolute; top: 0; left: 0; width: 100%; padding: 20px; color: #141414;
  }
  .print-body { position: relative; z-index: 1; font-size: 12px; }
  .print-watermark {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 58%; z-index: 0; opacity: 0.08; pointer-events: none;
  }
  .print-watermark img { width: 100%; display: block; }
  .print-watermark-text {
    font-size: 90px; font-weight: 800; color: var(--print-brand-blue);
    white-space: nowrap; transform: translate(-50%, -50%) rotate(-32deg);
  }

  .print-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
  .print-header-left { display: flex; gap: 12px; }
  .print-header-left img.print-logo { max-width: 90px; max-height: 55px; object-fit: contain; }
  .print-header-left h2 { margin: 0 0 4px; font-size: 15px; color: var(--print-brand-blue); }
  .print-header-right { text-align: left; min-width: 220px; margin-top: -6px; }
  .print-header-right h1 { margin: 0 0 8px; font-size: 14px; letter-spacing: .03em; color: var(--print-brand-blue); }
  .print-meta-row { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; padding: 2px 0; }

  .print-addr { margin: 0 0 4px; font-size: 11px; color: #444; max-width: 260px; }
  .print-kv { display: flex; font-size: 11px; margin: 1px 0; color: #444; }
  .print-kv b { color: #141414; font-weight: 700; display: inline-block; min-width: 82px; flex-shrink: 0; }

  .print-disclaimer { font-size: 10px; font-style: italic; color: #8a5a10; margin: 10px 0; }

  .print-parties { display: flex; gap: 20px; margin: 16px 0 10px; }
  .print-party { flex: 1; }
  .print-pill { display: inline-block; background: #ebebeb; color: var(--print-brand-blue); font-weight: 700; font-size: 10.5px; padding: 4px 10px; margin-bottom: 8px; }
  .print-party-name { font-weight: 700; font-size: 12px; margin-bottom: 3px; }

  /* Header row and SUBTOTAL row share the same light-blue "suitable"
     background + bold blue text; body rows stay plain white. Header text is
     centered across every column; body/footer keep sensible per-column
     alignment (HSN/Make/Qty centered via .center, Rate/Tax/Amount right via
     .num — description column stays left for readability). */
  .print-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 10.5px; background: transparent; }
  .print-table th, .print-table td { border: 1px solid #ccc; padding: 6px 7px; text-align: left; vertical-align: middle; background: transparent; }
  .print-table th { color: var(--print-brand-blue); font-weight: 700; text-align: center; background: #e6ecfa; }
  .print-table td.num { text-align: right; }
  .print-table td.center { text-align: center; }
  .print-table thead { display: table-header-group; }
  .print-tax-pct { color: #777; font-size: 9px; }
  .print-subtotal-row td { color: var(--print-brand-blue); font-weight: 700; border-top: 2px solid #999; background: #e6ecfa; }

  .print-bottom { display: flex; gap: 20px; margin-top: 16px; }
  .print-terms { flex: 1; font-size: 10.5px; color: #444; }
  .print-terms h3 { margin: 0 0 6px; font-size: 11.5px; color: var(--print-brand-blue); }
  .print-terms ol { margin: 0; padding-left: 16px; }
  .print-terms li { margin-bottom: 3px; }
  .print-thanks { margin-top: 10px; font-weight: 600; color: #141414; }

  .print-totalsbox { width: 240px; font-size: 11.5px; }
  .print-totalsbox > div { display: flex; justify-content: space-between; padding: 3px 0; }
  .print-grand { font-weight: 800; font-size: 14px; color: var(--print-brand-blue); border-top: 1.5px solid #141414; margin-top: 6px; padding-top: 6px !important; }
  .print-payment-rows { border-top: 1px dashed #ccc; margin-top: 6px; padding-top: 6px; }
  .print-words-label { font-weight: 700; font-size: 10.5px; text-align: right; margin-top: 14px; }
  .print-words { font-size: 10.5px; text-align: right; color: #444; margin-top: 3px; }

  /* Pushed down and kept together so it reads as a page footer rather than
     trailing right after the totals — browsers don't let print CSS pin a
     block to "the bottom of whichever page it lands on", so this is the
     closest reliable approximation (the PDF download positions it exactly). */
  .print-footer-row { display: flex; justify-content: space-between; gap: 20px; margin-top: 70px; break-inside: avoid; }
  .print-bank h3 { margin: 0 0 6px; font-size: 11.5px; color: var(--print-brand-blue); }
  .print-bank .print-kv { font-size: 10.5px; }
  .print-signature { text-align: right; }
  .print-signature p { font-weight: 700; font-size: 10.5px; margin: 4px 0 0; }
  .print-sig-img { max-width: 130px; max-height: 55px; display: block; margin-left: auto; }

  @page { size: A4; margin: 14mm; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1080px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { position: static; flex-direction: row; overflow-x: auto; }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
  .sidebar.open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .hamburger { display: block; }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
  .topbar-search { max-width: none; }
}
@media (max-width: 640px) {
  .view-root { padding: 16px 14px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head-actions { justify-content: flex-start; }
  .topbar-actions .btn span { display: none; }
  .bar-row { grid-template-columns: 80px 1fr 70px; }
  .item-grid { grid-template-columns: 1fr 1fr; }

  /* Touch-friendly sizing: 16px inputs stop iOS Safari's auto-zoom-on-focus,
     and taller tap targets make buttons easier to hit with a thumb. */
  .form-group input, .form-group select, .form-group textarea,
  #global-search, .modal input, .modal select, .modal textarea {
    font-size: 16px;
  }
  .btn { min-height: 42px; padding: 10px 14px; }
  .btn-sm { min-height: 36px; }
  .nav-link { padding: 12px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .modal-lg, .modal-sm { max-width: 100%; }
  .brand-name { max-width: 110px; }
}
