/* ================================================================
   SHIPBOOK — modern navy & white theme
   ================================================================ */

:root {
  --navy: #0b1b3f;
  --navy-2: #13294f;
  --navy-3: #1c3470;
  --blue: #3d6bff;
  --blue-dark: #2750d8;
  --blue-soft: #e8eeff;
  --bg: #eef2f9;
  --card: #ffffff;
  --field: #f5f7fc;
  --line: #e3e8f3;
  --text: #0b1b3f;
  --muted: #5b6784;
  --green: #10b981;
  --red: #ef4444;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card: 0 1px 2px rgba(11, 27, 63, 0.04), 0 12px 32px rgba(11, 27, 63, 0.06);
  --shadow-lift: 0 2px 4px rgba(11, 27, 63, 0.05), 0 22px 48px rgba(11, 27, 63, 0.12);
}

/* ── RESET & GLOBAL ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  overscroll-behavior-y: none;
}

input, select, textarea, button {
  font-family: inherit;
}

::selection {
  background: rgba(61, 107, 255, 0.25);
}

/* Smooth scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #c4cde3 transparent;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c4cde3; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a9b6d6; }

.is-hidden { display: none !important; }

/* ── TOP BAR ── */
.topbar {
  background: var(--navy);
  border-radius: 28px;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 18px 40px rgba(11, 27, 63, 0.25);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 12px;
  color: #8fa3d1;
  font-weight: 500;
}

/* status pill (text is set by script.js) */
#sbar {
  background: rgba(255, 255, 255, 0.09);
  color: #dce5fa;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
}

/* ── LAYOUT ── */
.layout {
  display: grid;
  grid-template-columns: minmax(440px, 520px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

#FP { min-width: 0; }

#FS {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── CARDS ── */
.card {
  background: var(--card);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), opacity 0.6s var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-lift);
}

/* scroll reveal (class "js" is added by script.js) */
.js .card {
  opacity: 0;
  transform: translateY(22px);
}
.js .card.in {
  opacity: 1;
  transform: none;
}

/* Section headers */
.sec {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}

.sec .num {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sub-sec {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.divider {
  height: 1px;
  background: #eef1f8;
  margin: 4px 0;
}

/* ── FORM GRID ── */
.fr {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.fg {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 170px;
}

.fg label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.fg-btn { justify-content: flex-end; }

/* Inputs, selects, textareas */
.fg input,
.fg select,
.fg textarea {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  width: 100%;
  transition: all 0.25s var(--ease);
}

.fg textarea { resize: vertical; line-height: 1.5; }

.fg input::placeholder,
.fg textarea::placeholder { color: #9aa6c0; }

.fg input:hover,
.fg select:hover,
.fg textarea:hover { border-color: #cdd6ec; }

.fg input:focus,
.fg select:focus,
.fg textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(61, 107, 255, 0.14);
}

.fg select { cursor: pointer; }

/* exporter list box */
#eSel {
  padding: 8px;
  border-radius: 18px;
}
#eSel option {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 2px;
}
#eSel option:checked {
  background: var(--navy) linear-gradient(0deg, var(--navy), var(--navy));
  color: #fff;
}

/* read-only highlighted value */
.fg input.readonly-highlight {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 700;
}

/* ── INVOICE TYPE (segmented) ── */
.inv-type-selector {
  display: flex;
  gap: 6px;
  background: #f1f4fa;
  border-radius: 18px;
  padding: 6px;
}

.inv-type-selector label {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.inv-type-selector input[type='radio'] {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.inv-type-selector label span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.3s var(--ease);
}

.inv-type-selector label:hover span { color: var(--text); }

.inv-type-selector input[type='radio']:checked + span {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 27, 63, 0.25);
}

.inv-type-selector input[type='radio']:focus-visible + span {
  outline: 3px solid rgba(61, 107, 255, 0.4);
}

/* ── EXPORTER INFO BOX ── */
.ibox {
  background: var(--navy);
  border-radius: 22px;
  padding: 20px;
  display: none;
  color: #fff;
  animation: pop 0.4s var(--ease);
}

.ibox .ibn {
  font-weight: 800;
  color: #fff;
  font-size: 16px;
}

.ibox .iba {
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.5;
  color: #8fa3d1;
}

.ib-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
  font-size: 12px;
}

.ib-grid > div {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ibox .ibs {
  display: block;
  color: #8fa3d1;
  font-weight: 600;
  margin-bottom: 2px;
}

.ib-grid span:not(.ibs) { font-weight: 700; }

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ── CONSIGNEE SEARCH DROPDOWN ── */
.search-container { position: relative; }

#cDrop {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin-top: 6px;
}

#cList {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(11, 27, 63, 0.16);
  padding: 6px;
}

#cList div {
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.2s var(--ease);
}

#cList div:hover { background: var(--blue-soft); color: var(--blue-dark); }

/* ── GOODS TABLE ── */
.table-container {
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow-x: auto;
  background: #fff;
}

.gt {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
}

.gt th {
  background: #f1f4fa;
  color: var(--muted);
  padding: 14px 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.gt td {
  border-top: 1px solid #eef1f8;
  padding: 8px 6px;
}

.gt input,
.gt select {
  background: var(--field);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  width: 100%;
  border-radius: 12px;
  outline: none;
  transition: all 0.25s var(--ease);
}

.gt input:focus,
.gt select:focus {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(61, 107, 255, 0.14);
}

.gt input.amt,
.gt input[readonly] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 700;
}

/* ── BUTTONS ── */
.btn {
  padding: 14px 22px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(11, 27, 63, 0.2);
}

.btn:active { transform: translateY(0); box-shadow: none; }

.btn:focus-visible { outline: 3px solid rgba(61, 107, 255, 0.45); outline-offset: 2px; }

.badd {
  background: #f5f8ff;
  color: var(--blue);
  border: 2px dashed #bfccf0;
  width: 100%;
}
.badd:hover { background: var(--blue-soft); box-shadow: none; }

.bdel {
  background: #fee9ea;
  color: #dc2f3c;
  padding: 8px 11px;
  font-size: 12px;
  border-radius: 12px;
}
.bdel:hover { background: var(--red); color: #fff; box-shadow: none; }

.calc-btn {
  background: var(--navy);
  color: #fff;
  height: 48px;
  width: 100%;
}

/* Action buttons */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.bgen {
  grid-column: 1 / -1;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  padding: 18px;
  box-shadow: 0 14px 28px rgba(61, 107, 255, 0.35);
}
.bgen:hover { background: var(--blue-dark); box-shadow: 0 18px 34px rgba(61, 107, 255, 0.45); }

.bpdf { background: var(--blue); color: #fff; }
.bpdf:hover { background: var(--blue-dark); }
.bgst { background: #fff; color: var(--navy); }
.bgst:hover { background: var(--blue-soft); }
/* Save Data on DSR: full width, deep navy (like Generate Invoices Preview, but darker) */
.bsave {
  grid-column: 1 / -1;
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  padding: 18px;
  box-shadow: 0 14px 28px rgba(11, 27, 63, 0.35);
}
.bsave:hover { background: #050d24; box-shadow: 0 18px 34px rgba(11, 27, 63, 0.5); }

/* previews on the right: each one has its own download button underneath */
.pv-block { flex: none; margin-bottom: 26px; }
.pv-label {
  color: #c9d4f5; font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 10px;
}
.pv-dl { width: 100%; margin-top: 14px; padding: 16px; font-size: 14px; font-weight: 800; }
.logout-btn { background: #eef1f8; color: var(--muted); }
.logout-btn:hover { background: #e1e7f4; color: var(--text); }

/* Signature drop */
.sdrop {
  border: 2px dashed #bfccf0;
  border-radius: 22px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  transition: all 0.3s var(--ease);
  background: #f5f8ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.sdrop:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateY(-2px);
}

.sprev {
  max-width: 160px;
  max-height: 80px;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(11, 27, 63, 0.15);
  background: #fff;
}

/* ── RIGHT PANEL: PREVIEW ── */
#PP {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--navy);
  border-radius: 32px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-shadow: 0 24px 56px rgba(11, 27, 63, 0.28);
  scroll-behavior: smooth;
}

/* Fit-to-width wrapper: script.js scales #PVS so the 765px invoices
   always fit the panel. Scaling happens here, never on #INV / #GST_INV,
   so the PDF export keeps its exact size. */
#PV, #PV2 {
  width: 100%;
  flex: none;          /* never let the flex column squeeze the previews */
  overflow: hidden;
}
#PVS, #PVS2 {
  width: 765px;
  transform-origin: top left;
}

#PP::-webkit-scrollbar-thumb { background: #34457a; }
#PP { scrollbar-color: #34457a transparent; }

.ptitle2 {
  align-self: flex-start;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 18px;
  letter-spacing: -0.3px;
}

.phint {
  color: #b9c7ea;
  font-size: 14px;
  margin: 12vh 0;
  background: rgba(255, 255, 255, 0.07);
  padding: 18px 32px;
  border-radius: 22px;
  font-weight: 600;
  text-align: center;
}

/* ── CALENDAR POPUP ── */
#cOv {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}

#cBox {
  position: absolute;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(11, 27, 63, 0.25);
  width: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  animation: pop 0.25s var(--ease);
}

.chdr {
  background: var(--navy);
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cnav {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.cnav:hover { background: rgba(255, 255, 255, 0.22); transform: scale(1.1); }

.cmy { font-weight: 700; font-size: 14px; }

.cdow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.cdow div {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 8px 0;
}

#cGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px;
  gap: 4px;
}

.cd {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  background: transparent;
  color: #334155;
  font-weight: 600;
  transition: all 0.2s var(--ease);
}

.cd:hover { background: #e8eeff; }

.cd.tod { font-weight: 800; color: var(--blue); background: var(--blue-soft); }

.cd.sel {
  background: var(--blue) !important;
  color: #fff !important;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(61, 107, 255, 0.35);
}

.ctbtn {
  text-align: center;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.ctbtn button {
  background: #f1f4fa;
  color: var(--navy);
  border: none;
  border-radius: 12px;
  padding: 9px 26px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s var(--ease);
}
.ctbtn button:hover { background: #e1e7f4; }

/* ── FOB MODAL ── */
.fob-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 27, 63, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.fob-content {
  background: #fff;
  border-radius: 28px;
  padding: 32px;
  width: 420px;
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: pop 0.35s var(--ease);
}

.fob-header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
}

.fob-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--blue-soft);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}

.fob-divider { border-top: 1px solid #eef1f8; margin: 4px 0; }

.fg input.highlight-text {
  background: #fff4db;
  border-color: #fde7b0;
  color: #8a5a00;
  font-size: 16px;
  font-weight: 800;
}
.fg input.success-text {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.fob-close-btn { background: var(--blue); color: #fff; width: 100%; margin-top: 6px; height: 52px; }
.fob-close-btn:hover { background: var(--blue-dark); }

/* ── LOGIN OVERLAY (created by script.js on logout) ── */
#loginOverlay {
  position: fixed;
  inset: 0;
  background: var(--navy);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  transition: opacity 0.4s var(--ease);
  padding: 20px;
}

#loginOverlay.hide {
  opacity: 0;
  pointer-events: none;
}

.login-card {
  background: #fff;
  color: var(--text);
  border-radius: 32px;
  padding: 44px 40px;
  width: 420px;
  max-width: 100%;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  animation: pop 0.5s var(--ease);
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

.login-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.login-card input {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  padding: 15px 18px;
  font-size: 14px;
  outline: none;
  margin-bottom: 18px;
  width: 100%;
  transition: all 0.25s var(--ease);
}

.login-card input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(61, 107, 255, 0.14);
}

#loginBtn {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 16px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  margin-top: 6px;
  box-shadow: 0 14px 28px rgba(61, 107, 255, 0.35);
}

#loginBtn:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-2px);
}

#loginBtn:disabled { opacity: 0.7; cursor: wait; }

.login-err {
  color: #dc2f3c;
  font-size: 13px;
  margin-top: 16px;
  text-align: center;
  font-weight: 600;
  min-height: 18px;
}

/* ── INVOICE RENDER (KEEP AS IS FOR PRINT ACCURACY) ── */
#INV {
  width: 765px;
  flex-shrink: 0;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8px;
  color: #000;
  border: 1.5px solid #000;
  line-height: 1.3;
}
#INV table { width: 800px; border-collapse: collapse; }
#INV td, #INV th { border: 1px solid #000; vertical-align: top; }
#GST_INV { flex-shrink: 0; }
.L { font-size: 9px; font-weight: bold; display: block; text-transform: uppercase; margin-bottom: 1px; }
.SL { font-size: 7px; font-weight: bold; display: block; }
.SV { font-size: 8px; font-weight: bold; display: block; }
.GH { background: #e8e8e8; font-weight: bold; font-size: 7.5px; text-align: center; vertical-align: middle; padding: 4px 3px; }

/* ── RESPONSIVE ── */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  #PP { position: relative; top: 0; max-height: none; }
}

@media (max-width: 560px) {
  body { padding: 12px; gap: 16px; }
  .card { padding: 20px; border-radius: 24px; }
  .action-buttons { grid-template-columns: 1fr; }
  .fg { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html, #PP { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .js .card { opacity: 1; transform: none; }
}


/* ================================================================
   ADDITIONS (v2) — menu, toast, dashboard, customers, invoice search
   Same navy & white theme as above.
   ================================================================ */

/* ── 3-DOT MENU (top-left of the top bar) ── */
.brand { position: relative; }
.menu-wrap { position: relative; }

.menu-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.menu-btn:hover { background: rgba(255, 255, 255, 0.18); }
.menu-btn:focus-visible { outline: 3px solid rgba(61, 107, 255, 0.6); outline-offset: 2px; }
.menu-btn[aria-expanded='true'] { background: var(--blue); }

.menu-pop {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 1000;
  min-width: 232px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 8px;
  box-shadow: 0 24px 56px rgba(11, 27, 63, 0.28);
  display: none;
  flex-direction: column;
  gap: 2px;
}
.menu-pop.open { display: flex; animation: pop 0.25s var(--ease); }

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.menu-item:hover { background: var(--blue-soft); color: var(--blue-dark); }
.menu-item.active { background: var(--navy); color: #fff; }
.menu-item.danger { color: #dc2f3c; }
.menu-item.danger:hover { background: #fee9ea; color: #dc2f3c; }
.menu-sep { height: 1px; background: #eef1f8; margin: 6px 4px; }

/* ── LOGIN PAGE ── */
body.login-page { padding: 0; display: block; max-width: none; }
.login-card .login-err { min-height: 22px; }

/* ── TOASTS ── */
#toastBox {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
}
.toast {
  background: var(--navy);
  color: #fff;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 18px 40px rgba(11, 27, 63, 0.3);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s var(--ease);
  border-left: 5px solid var(--blue);
}
.toast.show { opacity: 1; transform: none; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

/* ── INVOICE SEARCH (Home) ── */
.inv-search-row { display: flex; gap: 10px; }
.inv-search-row input { flex: 1; min-width: 0; }
.inv-search-row .btn { width: auto; height: 48px; padding: 0 22px; flex-shrink: 0; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 8px; font-weight: 500; line-height: 1.5; }

#invDrop {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin-top: 6px;
}
#invList {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(11, 27, 63, 0.16);
  padding: 6px;
}
#invList div {
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.2s var(--ease);
}
#invList div small { color: var(--muted); font-weight: 500; font-size: 12px; }
#invList div:hover { background: var(--blue-soft); color: var(--blue-dark); }

/* ── GENERIC PAGE (Dashboard / Customers) ── */
.page { display: flex; flex-direction: column; gap: 24px; }
.stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.page-sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 2px; }

.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 10px 22px rgba(61, 107, 255, 0.3); }
.btn.primary:hover { background: var(--blue-dark); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.ghost { background: #eef1f8; color: var(--muted); }
.btn.ghost:hover { background: #e1e7f4; color: var(--text); }
.btn.sm { padding: 10px 16px; font-size: 13px; border-radius: 14px; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; box-shadow: none; }

/* ── DASHBOARD ── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.stat {
  background: var(--card);
  border-radius: 28px;
  padding: 26px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat .stat-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.stat .stat-num { font-size: 42px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; color: var(--text); }
.stat .stat-note { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat.accent { background: var(--navy); }
.stat.accent .stat-label, .stat.accent .stat-note { color: #8fa3d1; }
.stat.accent .stat-num { color: #fff; }

.line-list { display: flex; flex-direction: column; }
.inv-line {
  display: grid;
  grid-template-columns: 74px minmax(0, 1.6fr) minmax(0, 1fr) 130px 22px;
  align-items: center;
  gap: 16px;
  padding: 16px 12px;
  border-top: 1px solid #eef1f8;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.inv-line:first-child { border-top: none; }
.inv-line:hover { background: #f5f8ff; }
.inv-line .tag {
  justify-self: start;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 999px;
}
.inv-line .tag.FOB { background: #e7f8f1; color: #0b8a62; }
.inv-line .tag.LUT { background: #fff4db; color: #8a5a00; }
.inv-line .il-no { font-weight: 800; font-size: 14px; overflow-wrap: anywhere; }
.inv-line .il-sub { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; overflow-wrap: anywhere; }
.inv-line .il-mid { font-size: 12px; font-weight: 600; color: var(--muted); }
.inv-line .il-amt { text-align: right; font-weight: 800; font-size: 14px; }
.inv-line .il-amt small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; margin-top: 2px; }
.inv-line .il-go { color: #9aa6c0; font-size: 20px; text-align: right; }

.empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 40px 16px;
  background: #f5f8ff;
  border-radius: 22px;
}

/* ── CUSTOMERS PAGE ── */
.cust-list { position: sticky; top: 24px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; gap: 14px; }
.cust-list .list-scroll { overflow-y: auto; min-height: 120px; margin: 0 -8px; padding: 0 8px; }
.cust-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
}
.cust-item:hover { background: #f5f8ff; }
.cust-item.sel { background: var(--blue-soft); border-color: #c9d6ff; }
.cust-item .ci-main { flex: 1; min-width: 0; }
.cust-item .ci-name { font-weight: 800; font-size: 14px; overflow-wrap: anywhere; }
.cust-item .ci-sub { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; overflow-wrap: anywhere; }
.cust-item .ci-del {
  border: none;
  background: transparent;
  color: #9aa6c0;
  font-size: 15px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.cust-item .ci-del:hover { background: #fee9ea; color: var(--red); }
.count-pill { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--blue); background: var(--blue-soft); padding: 5px 12px; border-radius: 999px; }

.edit-banner {
  display: none;
  background: #fff4db;
  color: #8a5a00;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
}
.edit-banner.on { display: block; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.form-actions .btn { flex: 1; min-width: 140px; }

.import-help { font-size: 12px; color: var(--muted); line-height: 1.65; font-weight: 500; }
.import-help code { background: #f1f4fa; padding: 1px 6px; border-radius: 6px; font-size: 11px; }
.file-input {
  background: var(--field);
  border: 2px dashed #bfccf0;
  border-radius: 18px;
  padding: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  width: 100%;
}
.import-result {
  display: none;
  background: #e7f8f1;
  color: #0b6b4d;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
}
.import-result.on { display: block; }
.import-result.err { background: #fee9ea; color: #b4232f; }

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cust-list { position: relative; top: 0; max-height: none; }
}
@media (max-width: 720px) {
  .inv-line { grid-template-columns: 64px minmax(0, 1fr) 22px; }
  .inv-line .il-mid, .inv-line .il-amt { display: none; }
  .brand-sub { display: none; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; gap: 16px; }
  .stat .stat-num { font-size: 36px; }
  .inv-search-row { flex-direction: column; }
  .inv-search-row .btn { width: 100%; }
}


/* ================================================================
   ADDITIONS (v3) — logo, sign-up tabs, user chip, optional boxes,
   tables (DSR / Logs)
   ================================================================ */

/* logo on the login / sign-up card */
.login-logo { width: 84px; height: 84px; border-radius: 22px; align-self: center; margin-bottom: 14px; object-fit: contain; background: #fff; box-shadow: 0 10px 28px rgba(11, 27, 63, 0.14); }
.login-card .login-title { text-align: center; margin-bottom: 18px; }
.auth-tabs { display: flex; gap: 6px; background: #f1f4fa; border-radius: 16px; padding: 5px; margin-bottom: 22px; }
.auth-tabs button { flex: 1; border: none; background: transparent; border-radius: 12px; padding: 11px 0; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; transition: all 0.25s var(--ease); }
.auth-tabs button.on { background: var(--navy); color: #fff; box-shadow: 0 8px 18px rgba(11, 27, 63, 0.25); }
.login-card form { display: flex; flex-direction: column; }
.auth-btn { background: var(--blue); color: #fff; border: none; border-radius: 18px; padding: 16px; font-size: 15px; font-weight: 800; cursor: pointer; transition: all 0.3s var(--ease); margin-top: 6px; box-shadow: 0 14px 28px rgba(61, 107, 255, 0.35); }
.auth-btn:hover:not(:disabled) { background: var(--blue-dark); transform: translateY(-2px); }
.auth-btn:disabled { opacity: 0.7; cursor: wait; }

/* logo inside the top bar: show it as-is on white */
.logo-mark { background: #fff; border: 2px solid rgba(255, 255, 255, 0.9); }
.logo-mark svg { display: none; }
.logo-mark img { padding: 2px; }

/* top-right: status pill + who is logged in */
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--blue); color: #fff; border-radius: 999px; padding: 10px 16px; font-size: 13px; font-weight: 700; max-width: 220px; }
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* small buttons + rows */
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mini-btn { border: 1.5px dashed #bfccf0; background: #f5f8ff; color: var(--blue); border-radius: 12px; padding: 7px 14px; font-size: 12px; font-weight: 800; cursor: pointer; transition: all 0.2s var(--ease); }
.mini-btn:hover { background: var(--blue-soft); border-color: var(--blue); }
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; width: auto; }
.field-hint a { color: var(--blue); font-weight: 700; text-decoration: none; }
.field-hint a:hover { text-decoration: underline; }

/* dashboard: creator next to invoice date */
.inv-line .il-by { display: block; margin-top: 4px; color: var(--navy); font-weight: 700; }

/* tables */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tool-input { background: var(--field); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--text); outline: none; min-width: 200px; }
.tool-input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(61, 107, 255, 0.14); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 20px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.data-table th { background: #f1f4fa; color: var(--muted); text-align: left; padding: 14px 12px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.7px; position: sticky; top: 0; white-space: nowrap; }
.data-table td { padding: 12px; border-top: 1px solid #eef1f8; vertical-align: top; overflow-wrap: anywhere; }
.data-table tr:hover td { background: #f8faff; }
.data-table .nowrap { white-space: nowrap; }
.data-table small { color: var(--muted); }
.data-table .empty-state { margin: 8px; }
.badge { display: inline-block; padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; background: #eef1f8; color: var(--muted); }
.badge.ok { background: #e7f8f1; color: #0b8a62; }
.badge.bad { background: #fee9ea; color: #b4232f; }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

@media (max-width: 560px) {
  .btn-row { flex-direction: column; }
  .user-chip { max-width: 160px; }
  .tool-input { min-width: 0; width: 100%; }
  .toolbar { width: 100%; }
}


/* ================================================================
   ADDITIONS (v4) — AI Preview button + scanner, AI options, misc
   ================================================================ */

/* header: brand | AI Preview | (search/status + user) */
.topbar > .ai-btn { margin-right: auto; }
.topbar > #sbar, .topbar > .top-right { margin-left: auto; }
.topbar > .ai-btn + .top-right, .topbar > .ai-btn + #sbar { margin-left: 0; }

/* gradient pill, like the supplied "Write with AI" button */
.ai-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 26px 0 20px;
  border: 0; border-radius: 999px; cursor: pointer;
  color: #fff; font: 600 16px/1 'Manrope', system-ui, sans-serif; letter-spacing: 0.1px;
  background: linear-gradient(90deg, #14b8f4 0%, #3b3ff0 38%, #b01ff0 70%, #ee1a6c 100%);
  box-shadow: 0 10px 18px -8px rgba(80, 60, 240, 0.65), 0 14px 22px -10px rgba(238, 26, 108, 0.55);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s;
}
.ai-btn:hover { transform: translateY(-2px); filter: brightness(1.07); }
.ai-btn:active { transform: translateY(0); }
.ai-btn:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.7); outline-offset: 3px; }
.ai-btn svg { flex: none; }

/* modal */
body.ai-lock { overflow: hidden; }
.ai-overlay {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: flex-start; justify-content: center; padding: 4vh 14px;
  background: rgba(7, 15, 40, 0.62); backdrop-filter: blur(3px); overflow-y: auto;
}
.ai-overlay.open { display: flex; }
.ai-modal {
  width: min(900px, 100%); background: #fff; border-radius: 28px;
  box-shadow: 0 30px 80px rgba(7, 15, 40, 0.45); overflow: hidden;
}
.ai-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; color: #fff;
  background: linear-gradient(90deg, #14b8f4 0%, #3b3ff0 38%, #b01ff0 70%, #ee1a6c 100%);
}
.ai-title { font-size: 18px; font-weight: 800; }
.ai-spark { margin-right: 6px; }
.ai-x { background: rgba(255,255,255,.2); color: #fff; border: 0; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; }
.ai-x:hover { background: rgba(255,255,255,.35); }
.ai-body { padding: 22px 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.ai-intro { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.ai-drop {
  border: 2px dashed #bfccf0; background: #f5f8ff; color: var(--blue);
  border-radius: 20px; padding: 26px 18px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px;
  transition: all 0.2s var(--ease);
}
.ai-drop span { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.ai-drop:hover, .ai-drop.over, .ai-drop:focus-visible { border-color: var(--blue); background: var(--blue-soft); outline: none; }

.ai-files { display: flex; flex-direction: column; gap: 8px; }
.ai-file { display: flex; align-items: center; gap: 10px; background: #f1f4fb; border-radius: 12px; padding: 8px 12px; font-size: 13px; }
.ai-fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.ai-file small { color: var(--muted); }
.ai-file button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 14px; }
.ai-file button:hover { color: #d33; }

.ai-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
.ai-check small { color: var(--muted); font-weight: 500; }
.ai-check input { width: 17px; height: 17px; accent-color: var(--blue); }
.ai-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ai-link { color: var(--blue); font-weight: 700; font-size: 13px; text-decoration: none; }
.ai-link:hover { text-decoration: underline; }
.ai-status { font-size: 14px; font-weight: 600; color: var(--muted); }
.ai-status.busy::before { content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid #c8d3f2; border-top-color: var(--blue); border-radius: 50%; animation: aispin 0.8s linear infinite; }
.ai-status.err { color: #c62828; }
@keyframes aispin { to { transform: rotate(360deg); } }

.ai-summary { display: flex; align-items: center; gap: 18px; border: 2px solid; border-radius: 20px; padding: 16px 20px; background: #fafbff; }
.ai-big { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1; min-width: 110px; }
.ai-sum-txt { font-size: 14px; line-height: 1.5; color: var(--text); }

.ai-doc { border: 1.5px solid #e1e7f4; border-radius: 20px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.ai-doc.err { border-color: #f1b8b8; background: #fff6f6; }
.ai-doc-err { color: #c62828; font-size: 14px; }
.ai-doc-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ai-doc-h b { word-break: break-all; }
.ai-doc-h small { color: var(--muted); }
.ai-meter-bar { height: 12px; background: #e9edf7; border-radius: 99px; overflow: hidden; }
.ai-meter-bar i { display: block; height: 100%; border-radius: 99px; transition: width 0.5s var(--ease); }
.ai-meter-txt { margin-top: 6px; font-size: 13px; font-weight: 800; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-chip { border: 1.5px solid #f3c1c1; background: #fff3f3; color: #b71c1c; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ai-chip:hover { background: #ffe3e3; }
.ai-none { color: #2e7d32; font-weight: 700; font-size: 14px; }
.ai-note { font-size: 12.5px; color: var(--muted); }
.ai-legend { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.ai-text {
  max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: #fbfcff; border: 1px solid #e6ebf6; border-radius: 14px; padding: 14px 16px;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #1b2440; position: relative;
}
.ai-text mark, .ai-legend mark { border-radius: 4px; padding: 1px 2px; color: inherit; }
mark.exact { background: #ffc9c9; box-shadow: 0 0 0 1px #e57373 inset; }
mark.similar { background: #ffe2a8; box-shadow: 0 0 0 1px #f0a830 inset; }
.ai-text mark.cur { outline: 3px solid #3b3ff0; }

@media (max-width: 720px) {
  .ai-btn { height: 42px; padding: 0 18px 0 14px; font-size: 14px; }
  .ai-summary { flex-direction: column; align-items: flex-start; }
  .ai-body { padding: 18px 16px 24px; }
}


/* ================================================================
   ADDITIONS (v5) — roles, customer pages, approvals, Google button
   ================================================================ */
.narrow { max-width: 860px; width: 100%; margin: 0 auto; }
.fg input:disabled, .fg textarea:disabled, .fg select:disabled { background: #eef1f8; color: #6b7794; cursor: not-allowed; }
.btn.danger { background: #fee9ea; color: #dc2f3c; }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.good { background: var(--green); color: #fff; }
.btn.good:hover { background: #0c9a6c; }

.status-banner { border-radius: 18px; padding: 16px 18px; font-size: 14px; font-weight: 600; line-height: 1.55; }
.status-banner.pending { background: #fff4db; color: #8a5a00; }
.status-banner.rejected { background: #fee9ea; color: #b4232f; }
.status-banner.approved { background: #e7f8f1; color: #0b6b4d; }
.id-chip { display: inline-block; background: var(--navy); color: #fff; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 800; letter-spacing: 0.5px; }

.inv-line.static { cursor: default; }
.inv-line.static:hover { background: transparent; }

.login-card .inv-type-selector { margin-bottom: 18px; }
.login-card .inv-type-selector input { margin: 0; padding: 0; border: 0; width: auto; }
.g-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 18px; }
.g-or { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--muted); font-size: 12px; font-weight: 700; }
.g-or::before, .g-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-ok { color: #0b6b4d; }

.req-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 13px; }
.req-meta div { min-width: 0; overflow-wrap: anywhere; }
.req-meta span { display: block; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.req-meta .wide { grid-column: 1 / -1; }
.fob-content.wide { width: 560px; }


/* ================================================================
   ADDITIONS (v6) — app shell (sticky sidebar), jobs, dashboard boxes
   ================================================================ */

/* numbers are typed, never scrolled: hide the little up/down arrows */
input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* pages shown inside the app (frame): no header, tighter padding */
html.embed body { padding: 18px; min-height: 0; background: var(--bg); }
html.embed #PP { top: 12px; max-height: calc(100vh - 24px); }
html.embed .cust-list { top: 12px; max-height: calc(100vh - 28px); }

/* job box on the Create Invoice page */
.job-chip { display: none; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--blue-soft); color: var(--blue-dark); border-radius: 14px; padding: 10px 14px; font-size: 13px; font-weight: 800; }
#jobDrop { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 100; margin-top: 6px; }
#jobList { background: #fff; border: 1px solid var(--line); border-radius: 18px; max-height: 260px; overflow-y: auto; box-shadow: 0 18px 40px rgba(11, 27, 63, 0.16); padding: 6px; }
#jobList div { padding: 11px 14px; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 12px; }
#jobList div small { color: var(--muted); font-weight: 500; font-size: 12px; }
#jobList div:hover { background: var(--blue-soft); color: var(--blue-dark); }

/* ── APP SHELL ── */
body.app-body { padding: 0; display: block; max-width: none; gap: 0; }
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 270px; flex: none; z-index: 60;
  background: linear-gradient(180deg, #0b1b3f 0%, #0e2250 100%); color: #aebbe0;
  display: flex; flex-direction: column; padding: 22px 14px 12px; overflow: hidden;
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; color: #fff; font-size: 20px; font-weight: 800; letter-spacing: -0.4px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 14px; }
.sb-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; }
.sb-ver { text-align: center; font-size: 11px; font-weight: 600; color: #6f7fae; padding-top: 8px; }
.logo-mark.fallback { background: var(--blue); }
.logo-mark.fallback svg { display: block; }
.sb-link, .sb-group > button {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border: 0; border-radius: 14px;
  background: transparent; color: #aebbe0; font: 700 14px/1.2 'Manrope', system-ui, sans-serif; text-align: left; text-decoration: none; cursor: pointer;
  position: relative; transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.sb-link:hover, .sb-group > button:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sb-link.on { background: rgba(61, 107, 255, 0.28); color: #fff; }
.sb-link.on::before, .sb-group.has-on > button::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: #8aa4ff; }
.sb-group.has-on > button { color: #fff; }
.sb-ic { flex: none; }
.sb-chev { margin-left: auto; transition: transform 0.25s var(--ease); }
.sb-group.open .sb-chev { transform: rotate(180deg); }
.sb-sub { display: none; flex-direction: column; gap: 2px; margin: 2px 0 6px 18px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, 0.1); }
.sb-group.open .sb-sub { display: flex; }
.sb-sub .sb-link { padding: 10px 12px; font-size: 13.5px; font-weight: 600; }
.sb-logout { margin-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); border-radius: 0 0 14px 14px; padding-top: 16px; }
.sb-logout:hover { color: #ff9aa2; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.app-head { flex: none; height: 76px; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); }
.app-title { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; margin-right: auto; }
.app-head .top-right { gap: 14px; flex-wrap: nowrap; }
.hamb { display: none; border: 0; background: var(--field); width: 42px; height: 42px; border-radius: 12px; font-size: 20px; cursor: pointer; }
.app-content { flex: 1; overflow: auto; padding: 24px 28px 40px; }
.app-content.framed { padding: 0; overflow: hidden; }
.frame { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.scrim { display: none; }
.muted { color: var(--muted); }

/* dashboard boxes you can click */
.stats.eight { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat.click { cursor: pointer; transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); border: 0; text-align: left; font-family: inherit; }
.stat.click:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.stat.click:focus-visible { outline: 3px solid rgba(61, 107, 255, 0.5); outline-offset: 2px; }
.stat.sel { box-shadow: 0 0 0 3px var(--blue), var(--shadow-lift); }

/* home: today's jobs */
.today-box { background: var(--navy); color: #fff; border-radius: 28px; padding: 26px 28px; box-shadow: var(--shadow-card); display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
.today-box .tb-left { min-width: 220px; }
.today-box .stat-label { font-size: 12px; font-weight: 800; color: #8fa3d1; text-transform: uppercase; letter-spacing: 0.8px; }
.today-box .stat-num { font-size: 52px; font-weight: 800; letter-spacing: -2px; line-height: 1.1; }
.today-box .stat-note { font-size: 12px; color: #8fa3d1; font-weight: 500; }
.stage-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.stage-chip { background: rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 800; color: #dce5fa; }
.today-list { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 8px; }
.today-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(255, 255, 255, 0.07); border-radius: 14px; padding: 10px 14px; font-size: 13px; font-weight: 700; }
.today-row small { display: block; color: #8fa3d1; font-weight: 500; }
.today-empty { color: #8fa3d1; font-size: 14px; font-weight: 600; padding: 12px 0; }

/* job status badges */
.badge.s-documentation { background: var(--blue-soft); color: var(--blue); }
.badge.s-operation { background: #fff4db; color: #8a5a00; }
.badge.s-finance { background: #f1e8ff; color: #7a2fc7; }
.badge.s-completed { background: #e7f8f1; color: #0b8a62; }
.tab-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-row button { border: 0; background: #eef1f8; color: var(--muted); border-radius: 999px; padding: 9px 16px; font: 800 13px 'Manrope', sans-serif; cursor: pointer; }
.tab-row button.on { background: var(--navy); color: #fff; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 1180px) { .stats.eight { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-102%); transition: transform 0.3s var(--ease); }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.4); }
  .scrim.on { display: block; position: fixed; inset: 0; background: rgba(7, 15, 40, 0.5); z-index: 55; }
  .hamb { display: inline-flex; align-items: center; justify-content: center; }
  .app-head { padding: 0 16px; }
  .app-content { padding: 16px 14px 32px; }
}
@media (max-width: 560px) { .stats.eight { grid-template-columns: 1fr; } .user-chip { display: none; } }


/* ================================================================
   ADDITIONS (v7) — OTP step, booking boxes, Maersk tracking view
   ================================================================ */
.otp-note { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 16px; }
.login-card input.otp-input { text-align: center; font-size: 26px; font-weight: 800; letter-spacing: 10px; }
.otp-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
.link-btn { border: 0; background: transparent; color: var(--blue); font: 700 13px 'Manrope', sans-serif; cursor: pointer; padding: 4px 0; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.link-btn:not(:disabled):hover { text-decoration: underline; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); font-weight: 800; font-size: 13px; text-decoration: none; margin-bottom: 4px; }
.back-link:hover { text-decoration: underline; }
.job-head { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: flex-start; }
.job-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; }
.job-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.job-meta div { background: var(--field); border-radius: 16px; padding: 12px 16px; font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.job-meta span { display: block; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 4px; }
.box-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 900px) { .box-grid { grid-template-columns: 1fr; } }
.stepper { display: flex; gap: 8px; flex-wrap: wrap; }
.stepper .st { flex: 1; min-width: 120px; text-align: center; padding: 12px 8px; border-radius: 14px; background: #eef1f8; color: var(--muted); font-weight: 800; font-size: 13px; }
.stepper .st.done { background: #e7f8f1; color: #0b8a62; }
.stepper .st.now { background: var(--navy); color: #fff; }
.row-click { cursor: pointer; }
.row-click:hover td { background: #f5f8ff !important; }
.tbl-link { color: var(--blue); font-weight: 800; text-decoration: none; }
.tbl-link:hover { text-decoration: underline; }

/* tracking (Maersk) */
.trk { display: flex; flex-direction: column; gap: 18px; }
.trk-demo { background: #fff4db; color: #8a5a00; border-radius: 12px; padding: 8px 14px; font-size: 12px; font-weight: 800; }
.trk-head { background: #f3f4f6; border-radius: 20px; padding: 20px 24px; display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: flex-start; }
.trk-head .lbl { font-size: 14px; color: var(--muted); font-weight: 600; }
.trk-head .bl { font-size: 34px; font-weight: 500; letter-spacing: -1px; line-height: 1.15; }
.trk-route { font-weight: 800; font-size: 15px; margin-top: 4px; }
.pill { display: inline-block; background: #e6f1f8; color: #0b3f66; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 5px 12px; margin-top: 10px; }
.trk-cont { border: 1px solid var(--line); border-radius: 20px; padding: 18px 22px; display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.2fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .trk-cont { grid-template-columns: 1fr; } }
.trk-cont .num { font-size: 20px; font-weight: 800; }
.trk-cont .typ { color: var(--muted); font-weight: 600; margin-top: 2px; }
.trk-pt .place { font-weight: 800; font-size: 15px; }
.trk-pt .fac { color: #334; font-size: 14px; margin: 4px 0 8px; }
.trk-time { display: inline-block; background: #fdf0c8; border-radius: 12px; padding: 8px 14px; font-weight: 800; font-size: 14px; }
.trk-time small { display: block; font-weight: 500; color: #5b5030; margin-top: 2px; }
.trk-time.act { background: #dff3e7; }
.trk-note { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); font-weight: 600; }
.tl { position: relative; display: flex; flex-direction: column; gap: 0; padding-left: 44px; }
.tl::before { content: ''; position: absolute; left: 14px; top: 8px; bottom: 8px; border-left: 2px dashed #cdd5e6; }
.tl-item { position: relative; padding: 14px 0; border-bottom: 1px solid #eef1f8; }
.tl-item:last-child { border-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: -37px; top: 20px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--navy); }
.tl-item.plan::before { border-color: #aab4cf; }
.tl-item.latest { background: #e1f1fa; border-radius: 16px; padding: 14px 16px; margin: 6px 0; border-bottom: 0; }
.tl-loc { font-weight: 800; font-size: 18px; text-transform: uppercase; }
.tl-fac { font-weight: 800; font-size: 13px; margin: 2px 0 6px; }
.tl-ev { font-size: 15px; }
.tl-item.latest .tl-ev { background: #fff; border-radius: 12px; padding: 10px 14px; margin-top: 8px; }
.tl-time { color: #334; font-size: 14px; margin-top: 2px; }
.tl-item.plan .tl-ev, .tl-item.plan .tl-time { color: var(--muted); }
.tag-latest { display: inline-block; background: #eceff4; border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 700; margin-left: 8px; }
.tag-est { display: inline-block; background: #fff4db; color: #8a5a00; border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 800; margin-left: 8px; }
