/* ============================================================
   CargoClear Collaboration Platform
   Design language: "Bonded Ledger" — customs manifest + wax-seal
   Display: Zilla Slab (official-document character)
   Body/UI:  Inter
   Data/Mono: JetBrains Mono (waybill/BL/IDF numbers, timestamps)
   ============================================================ */

:root {
  /* Color tokens — deep maritime navy + brass seal accent */
  --ink:        #0E1420;
  --panel:      #161F30;
  --panel-2:    #1C273B;
  --panel-3:    #212D45;
  --line:       #2B3A55;
  --line-soft:  #212C42;
  --fog:        #93A1BD;
  --fog-dim:    #5F6E8C;
  --bone:       #EDF1F8;
  --white:      #FFFFFF;

  --brass:      #D4AF37;   /* primary accent — customs seal / official action */
  --brass-dim:  #3a3012;
  --teal:       #2BB596;   /* cleared / delivered / success */
  --teal-dim:   #103029;
  --red:        #E1615F;   /* compliance alert / demurrage risk */
  --red-dim:    #3a2020;
  --blue:       #5590E8;   /* lodged / in-transit / info */
  --blue-dim:   #1c2c47;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-panel: 0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.32);
  --shadow-pop: 0 16px 40px rgba(0,0,0,0.5);

  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(212,175,55,0.055), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(43,181,150,0.05), transparent 60%),
    var(--ink);
  color: var(--bone);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14.5px;
  min-height: 100vh;
}

h1, h2, h3, h4, .display-font {
  font-family: 'Zilla Slab', 'Georgia', serif;
  font-weight: 600;
  letter-spacing: 0.002em;
  color: var(--white);
}

.mono, .waybill, td.mono, .money { font-family: 'JetBrains Mono', 'SFMono-Regular', monospace; }

a { color: var(--brass); text-decoration: none; }
a:hover { color: #e6c862; }
::selection { background: var(--brass); color: #1a1408; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.eyebrow {
  font-family: 'Zilla Slab', serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fog-dim);
}

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #131b2a, #0e1420 65%);
  border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; border-bottom: 1px solid var(--line-soft); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0d67a, var(--brass) 60%, #9c7d1e);
  display: flex; align-items: center; justify-content: center;
  color: #1a1408; font-weight: 800; font-family: 'Zilla Slab', serif; font-size: 17px;
  box-shadow: 0 4px 14px rgba(212,175,55,0.3), inset 0 0 0 2px rgba(255,255,255,.25);
  border: 2px solid #7a611a;
}
.brand-name { font-family: 'Zilla Slab', serif; font-weight: 700; font-size: 19px; color: var(--white); line-height: 1; }
.brand-sub { font-size: 10.5px; color: var(--fog-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.side-nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.side-section { padding: 10px 10px 4px; }
.side-nav a.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--fog); font-size: 13.5px; font-weight: 500; margin-bottom: 2px;
  transition: background .12s ease, color .12s ease; border-left: 2px solid transparent;
}
.side-nav a.nav-item i { width: 17px; text-align: center; font-size: 15px; flex-shrink: 0; opacity: .85; }
.side-nav a.nav-item:hover { background: var(--panel-2); color: var(--bone); }
.side-nav a.nav-item.active {
  background: linear-gradient(90deg, rgba(212,175,55,0.16), rgba(212,175,55,0.02));
  color: var(--brass); border-left-color: var(--brass); font-weight: 600;
}

.side-foot { padding: 14px 16px 18px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.avatar-chip {
  width: 32px; height: 32px; border-radius: 50%; background: var(--panel-3);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Zilla Slab', serif; font-weight: 700; color: var(--brass);
  border: 1px solid var(--line); font-size: 13px;
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px; border-bottom: 1px solid var(--line); background: rgba(14,20,32,0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 16px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 21px; margin: 0; }
.topbar .breadcrumb-mini { font-size: 12px; color: var(--fog-dim); }

.search-mini {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px;
  display: flex; align-items: center; gap: 8px; color: var(--fog-dim); font-size: 13px; min-width: 230px;
}
.search-mini input { background: transparent; border: 0; outline: 0; color: var(--bone); font-size: 13px; width: 100%; }
.search-mini input::placeholder { color: var(--fog-dim); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; color: var(--fog);
}
.icon-btn:hover { color: var(--brass); border-color: var(--brass); }

.content { padding: 26px 28px 60px; flex: 1; }

.sidebar-toggle { display: none; }
@media (max-width: 991px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .content { padding: 18px 16px 50px; }
  .search-mini { display: none; }
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 35; }
.scrim.show { display: block; }

/* ============================================================
   Panels / cards
   ============================================================ */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); }
.panel-header { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-body { padding: 20px; }
.panel-title { font-size: 17px; margin: 0; }

.kpi-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; position: relative; overflow: hidden; }
.kpi-card::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent, var(--brass)) 0%, transparent 70%); opacity: .13;
}
.kpi-value { font-family: 'Zilla Slab', serif; font-size: 33px; font-weight: 700; color: var(--white); line-height: 1; }
.kpi-label { color: var(--fog); font-size: 12.5px; margin-top: 6px; }
.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.up { color: var(--teal); }
.kpi-delta.down { color: var(--red); }

/* ============================================================
   Status pills
   ============================================================ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; border: 1px solid transparent; white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-brass { background: var(--brass-dim); color: var(--brass); border-color: rgba(212,175,55,.28); }
.pill-brass .dot { background: var(--brass); }
.pill-teal { background: var(--teal-dim); color: var(--teal); border-color: rgba(43,181,150,.28); }
.pill-teal .dot { background: var(--teal); }
.pill-blue { background: var(--blue-dim); color: var(--blue); border-color: rgba(85,144,232,.28); }
.pill-blue .dot { background: var(--blue); }
.pill-red { background: var(--red-dim); color: var(--red); border-color: rgba(225,97,95,.28); }
.pill-red .dot { background: var(--red); }
.pill-fog { background: var(--panel-2); color: var(--fog); border-color: var(--line); }
.pill-fog .dot { background: var(--fog-dim); }

/* ============================================================
   Signature element — Clearance Seal Timeline
   Circular customs-stamp waypoints instead of a plain dot track,
   reflecting the "document gets stamped at each stage" reality of
   customs clearance rather than a generic progress bar.
   ============================================================ */
.seal-track { display: flex; align-items: flex-start; overflow-x: auto; padding-bottom: 4px; }
.seal-step { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 92px; position: relative; }
.seal-step .seal {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel-3); border: 2px solid var(--line);
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--fog-dim); transition: all .15s ease;
}
.seal-step .rail { position: absolute; top: 14px; left: 50%; width: 100%; height: 2px; background: var(--line); z-index: 1; }
.seal-step:last-child .rail { display: none; }
.seal-step .s-label { margin-top: 8px; font-size: 10.5px; text-align: center; color: var(--fog-dim); font-weight: 600; line-height: 1.25; padding: 0 2px; }
.seal-step.done .seal { background: var(--teal-dim); border-color: var(--teal); color: var(--teal); box-shadow: 0 0 0 3px rgba(43,181,150,.12); }
.seal-step.done .seal::before { content: '\2713'; }
.seal-step.done .rail { background: var(--teal); }
.seal-step.done .s-label { color: var(--teal); }
.seal-step.now .seal {
  background: radial-gradient(circle at 35% 30%, #f0d67a, var(--brass) 65%, #9c7d1e);
  border-color: #9c7d1e; color: #1a1408; width: 34px; height: 34px; margin-top: -2px;
  box-shadow: 0 0 0 4px var(--brass-dim), 0 0 14px rgba(212,175,55,.45);
}
.seal-step.now .seal::before { content: '\25CF'; font-size: 10px; }
.seal-step.now .s-label { color: var(--brass); font-weight: 700; }

.seal-track.compact .seal-step { min-width: 0; }
.seal-track.compact .s-label { display: none; }
.seal-track.compact .seal { width: 16px; height: 16px; font-size: 8px; }
.seal-track.compact .seal-step.now .seal { width: 20px; height: 20px; margin-top: 0; }
.seal-track.compact .rail { top: 8px; }

/* ============================================================
   Waybill / reference badges
   ============================================================ */
.waybill-badge {
  display: inline-flex; align-items: center; gap: 5px; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 12.5px; letter-spacing: 0.03em;
  color: var(--brass); background: var(--brass-dim); border: 1px dashed rgba(212,175,55,.45);
  border-radius: 5px; padding: 3px 9px 4px;
}

/* ============================================================
   Tables
   ============================================================ */
.table-gms { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table-gms thead th { text-align: left; font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fog-dim); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-gms tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); color: var(--bone); vertical-align: middle; }
.table-gms tbody tr { transition: background .12s ease; }
.table-gms tbody tr:hover { background: var(--panel-2); }
.table-gms tbody tr:last-child td { border-bottom: none; }
.row-link { cursor: pointer; }

/* ============================================================
   Buttons
   ============================================================ */
.btn { font-weight: 600; font-size: 13.5px; border-radius: 8px; padding: 8px 16px; }
.btn-brass { background: linear-gradient(180deg, #e8cc6a, var(--brass)); border: 1px solid #9c7d1e; color: #1a1408; }
.btn-brass:hover { background: linear-gradient(180deg, #f0d67a, #dcb941); color: #1a1408; }
.btn-ghost { background: var(--panel-2); border: 1px solid var(--line); color: var(--bone); }
.btn-ghost:hover { border-color: var(--brass); color: var(--brass); }
.btn-outline-gms { background: transparent; border: 1px solid var(--line); color: var(--fog); }
.btn-outline-gms:hover { border-color: var(--bone); color: var(--bone); }
.btn-sm-gms { padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }

/* ============================================================
   Forms
   ============================================================ */
.form-label { font-size: 12px; color: var(--fog); font-weight: 600; letter-spacing: .01em; margin-bottom: 5px; }
.form-control, .form-select { background: var(--panel-3); border: 1px solid var(--line); color: var(--bone); border-radius: 8px; font-size: 13.5px; padding: 9px 12px; }
.form-control:focus, .form-select:focus { background: var(--panel-3); color: var(--bone); border-color: var(--brass); box-shadow: 0 0 0 3px rgba(212,175,55,0.16); }
.form-control::placeholder { color: var(--fog-dim); }
.form-check-input { background-color: var(--panel-3); border-color: var(--line); }
.form-check-input:checked { background-color: var(--brass); border-color: var(--brass); }

/* OTP input group */
.otp-boxes { display: flex; gap: 10px; justify-content: center; }
.otp-boxes input {
  width: 46px; height: 54px; text-align: center; font-size: 22px; font-family: 'JetBrains Mono', monospace;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 8px; color: var(--bone);
}
.otp-boxes input:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(212,175,55,0.16); outline: none; }

/* ============================================================
   Tabs
   ============================================================ */
.gms-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 4px; overflow-x: auto; }
.gms-tabs button { background: transparent; border: 0; color: var(--fog); padding: 12px 16px; font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.gms-tabs button:hover { color: var(--bone); }
.gms-tabs button.active { color: var(--brass); border-bottom-color: var(--brass); }
.tab-pane-gms { display: none; }
.tab-pane-gms.active { display: block; }

/* ============================================================
   Kanban (Shipment pipeline board)
   ============================================================ */
.kanban-wrap { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { min-width: 260px; max-width: 260px; flex-shrink: 0; background: rgba(255,255,255,0.015); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kanban-col.drop-hover { border-color: var(--brass); background: rgba(212,175,55,0.04); }
.kanban-col-head { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; font-family: 'Zilla Slab', serif; font-weight: 600; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; color: var(--fog); position: sticky; top: 0; background: var(--ink); border-radius: var(--radius) var(--radius) 0 0; }
.kanban-count { background: var(--panel-2); border-radius: 20px; padding: 1px 8px; font-size: 11px; color: var(--fog); }
.kanban-body { padding: 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }

.job-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; cursor: grab; transition: border-color .12s ease, transform .1s ease; }
.job-card:hover { border-color: var(--fog-dim); }
.job-card.dragging { opacity: .4; }
.job-card .jc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.job-card .jc-vehicle { font-weight: 700; color: var(--white); font-size: 14px; }
.job-card .jc-issue { color: var(--fog); font-size: 12px; margin: 6px 0 10px; line-height: 1.4; }
.job-card .jc-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--fog-dim); }
.jc-mech { display: flex; align-items: center; gap: 5px; }
.jc-mech .m-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line); font-size: 9px; display: flex; align-items: center; justify-content: center; color: var(--brass); font-weight: 700; }

/* ============================================================
   Document tiles (upload methods, checklist)
   ============================================================ */
.doc-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.doc-tile .doc-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--panel-3); display: flex; align-items: center; justify-content: center; color: var(--brass); font-size: 17px; flex-shrink: 0; }
.doc-tile.uploaded .doc-icon { background: var(--teal-dim); color: var(--teal); }
.doc-tile.pending .doc-icon { background: var(--red-dim); color: var(--red); }
.upload-dropzone { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 30px 20px; text-align: center; color: var(--fog-dim); transition: border-color .12s ease, background .12s ease; }
.upload-dropzone:hover, .upload-dropzone.drag-over { border-color: var(--brass); background: rgba(212,175,55,.04); color: var(--fog); }
.method-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; height: 100%; }
.method-card .m-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--panel-3); color: var(--brass); display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 10px; }

/* ============================================================
   Misc utility
   ============================================================ */
.divider-v { width: 1px; align-self: stretch; background: var(--line); }
.text-fog { color: var(--fog) !important; }
.text-fog-dim { color: var(--fog-dim) !important; }
.text-brass { color: var(--brass) !important; }
.text-teal { color: var(--teal) !important; }
.text-red { color: var(--red) !important; }
.bg-panel2 { background: var(--panel-2); }
.hairline { border-color: var(--line) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.card-gms { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.empty-state { text-align: center; padding: 46px 20px; color: var(--fog); }
.empty-state i { font-size: 34px; color: var(--fog-dim); margin-bottom: 12px; display: block; }
.progress-gms { height: 6px; background: var(--panel-3); border-radius: 4px; overflow: hidden; }
.progress-gms .bar { height: 100%; border-radius: 4px; }

.toast-gms {
  position: fixed; bottom: 22px; right: 22px; z-index: 200; background: var(--panel-2); border: 1px solid var(--teal); border-left: 4px solid var(--teal);
  padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow-pop); font-size: 13px; display: flex; align-items: center; gap: 10px;
  transform: translateY(20px); opacity: 0; pointer-events: none; transition: all .25s ease;
}
.toast-gms.show { transform: translateY(0); opacity: 1; }

/* Client / field-agent external shells */
.driver-shell { max-width: 820px; margin: 0 auto; padding: 30px 18px 70px; }
.driver-hero { background: linear-gradient(160deg, #182234, #0e1420 70%); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; margin-bottom: 20px; position: relative; overflow: hidden; }
.driver-hero::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(212,175,55,0.035) 0 2px, transparent 2px 26px); }

.mobile-frame { max-width: 420px; margin: 0 auto; border: 1px solid var(--line); border-radius: 28px; background: var(--panel); box-shadow: var(--shadow-pop); overflow: hidden; }
.mobile-status-bar { height: 26px; background: var(--panel-2); }

@media print { .sidebar, .topbar, .no-print { display: none !important; } body { background: white; color: black; } }

/* ---------- additions for the CodeIgniter build ---------- */
.pill-amber { background: rgba(212,175,55,.10); color: #E0A83C; border-color: rgba(224,168,60,.28); }
.pill-amber .dot { background: #E0A83C; }
.text-amber { color: #E0A83C !important; }
.toast-gms.error { border-color: var(--red); }
.toast-gms.error .ico { color: var(--red); }
.toast-gms .ico { color: var(--teal); font-weight: 700; }
.dropdown-item.text-bone { color: var(--bone); background: transparent; border: 0; width: 100%; text-align: left; }
.dropdown-item.text-bone:hover { background: var(--panel-3); color: var(--brass); }
.table-gms tbody tr td form { display: inline; }
.icon-btn { background: transparent; cursor: pointer; }
.upload-dropzone input[type="file"] { display: none; }
@media print { .sidebar, .topbar { display: none !important; } }
