/* INKERMAN — dark "operations centre" theme with antique-gold brand accent. */
:root {
  --gold: #a6884e;
  --gold-lt: #c2a567;
  --gold-dk: #7c642f;
  --bg: #0f1319;
  --bg2: #14181f;
  --panel: #1a1f29;
  --panel2: #20262f;
  --border: #2a323f;
  --text: #e8eaed;
  --muted: #9aa4b2;
  --blue: #5b8def;
  --sev-Critical: #e5484d;
  --sev-High: #f76b15;
  --sev-Medium: #e2b53e;
  --sev-Low: #3da35d;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
  height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
}
/* Installed PWA: the window is stable (no URL bar) — percentage height is the most reliable,
   so the bottom nav always stays inside the visible area. */
@media (display-mode: standalone) {
  html, body { height: 100%; }
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------- login ---------- */
.login {
  flex: 1; min-height: 0; display: grid; place-items: center; padding: 24px; overflow-y: auto;
  background: radial-gradient(1200px 600px at 50% -10%, #1c2330 0%, var(--bg) 60%);
}
.login-card { width: 100%; max-width: 420px; text-align: center; }
.login-logo { width: 140px; height: 140px; object-fit: contain; margin: 0 auto 8px; display: block; }
.login-logo.logo-missing { display: none; }
.login-fallback { display: none; margin: 0 auto 10px; }
.login-logo.logo-missing + .login-fallback { display: block; }
.login-emblem { width: 168px; height: auto; display: block; margin: 0 auto; }
.login-title { color: var(--gold-lt); font-size: 22px; letter-spacing: 1px; }
.login-sub { color: var(--muted); margin: 6px 0 28px; }
.login-roles { display: grid; gap: 14px; }
.role-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 18px 20px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); cursor: pointer; text-align: left;
  transition: border-color .15s, transform .1s;
}
.role-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.role-icon { font-size: 26px; }
.role-name { font-size: 17px; font-weight: 600; color: var(--gold-lt); }
.role-desc { color: var(--muted); font-size: 13px; }
.login-signin { text-align: left; margin-top: 8px; }
.login-signin .fld > span { color: var(--muted); }
.login-lang { display: flex; gap: 8px; justify-content: center; margin-top: 26px; }
.login-version { color: var(--muted); font-size: 12px; margin-top: 16px; opacity: .7; }
.login-err { color: var(--sev-Critical); font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ---------- app shell ---------- */
.app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.app-header {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg2); border-bottom: 1px solid var(--border);
  position: relative; z-index: 1100; /* above the scrolling view + Leaflet panes (max ~1000) */
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; }
.brand-logo.logo-missing { display: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 13px; font-weight: 700; letter-spacing: 1.5px; color: var(--gold); }
.brand-sub { font-size: 12px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer; font-size: 16px;
}
.icon-btn:hover { border-color: var(--gold); }
.lang-switch, .login-lang { display: flex; gap: 6px; justify-content: center; }
.lang-dd { position: relative; display: inline-block; }
.lang-dd-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel);
  border: 1px solid var(--border); color: var(--text); padding: 7px 10px;
  border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.lang-dd-btn:hover { border-color: var(--gold); }
.lang-flag {
  width: 20px; height: 14px; object-fit: cover; border-radius: 3px;
  border: 1px solid var(--border); display: block; flex-shrink: 0;
}
.lang-caret { color: var(--muted); font-size: 10px; }
.lang-dd-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 160px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; z-index: 2200; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.lang-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; background: none;
  border: none; color: var(--text); padding: 9px 10px; border-radius: 7px;
  cursor: pointer; font-size: 14px; text-align: left;
}
.lang-opt:hover { background: var(--panel2); }
.lang-opt.active { color: var(--gold-lt); }
.lang-check { margin-left: auto; color: var(--gold); font-weight: 700; }

/* ---------- install / update banners ---------- */
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; font-size: 14px; }
.banner-msg { display: flex; align-items: center; gap: 8px; min-width: 0; }
.banner-msg .mi { flex-shrink: 0; }
.banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.banner-update { background: var(--gold); color: #0b0e13; font-weight: 600; }
.banner-update .btn { background: #0b0e13; color: var(--gold); border-color: #0b0e13; }
.banner-update .btn:hover { background: #000; }
.banner-install { background: var(--panel2); border-bottom: 1px solid var(--border); color: var(--text); }
.banner-install .btn { background: var(--gold); color: #0b0e13; border-color: var(--gold); }
.banner-x { width: 30px; height: 30px; }
.banner-update .banner-x { color: #0b0e13; border-color: rgba(0,0,0,.25); background: transparent; }

/* ---------- nav ---------- */
/* Bottom tab bar — flex row pinned at the bottom of the app column (always visible). */
.nav {
  flex: none; z-index: 30;
  display: flex; gap: 2px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--bg2); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .35);
}
.nav-btn {
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px 5px; border-radius: 10px; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 10px; line-height: 1.1; text-align: center;
}
.nav-btn > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-btn:hover { color: var(--text); }
.nav-btn.active { color: var(--gold-lt); }
.nav-btn.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold);
}
.nav-ico { font-size: 19px; }
/* Narrow phones: icons only (hide labels) so many tabs still fit. */
@media (max-width: 480px) {
  .nav-btn > span:not(.nav-ico) { display: none; }
  .nav-btn { padding: 9px 2px; }
  .nav-ico { height: 26px; font-size: 23px; }
}

/* ---------- view / panels ---------- */
.view { padding: 16px; max-width: 1200px; width: 100%; margin: 0 auto; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 16px; color: var(--gold-lt); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 820px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border);
}
.stat-ico {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 20px;
  background: var(--panel2);
}
.stat-num { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-link { cursor: pointer; transition: border-color .15s, transform .1s; }
.stat-link:hover { border-color: var(--gold); transform: translateY(-1px); }
.stat-gold .stat-ico { color: var(--gold); } .stat-gold { border-left: 3px solid var(--gold); }
.stat-blue .stat-ico { color: var(--blue); } .stat-blue { border-left: 3px solid var(--blue); }
.stat-amber .stat-ico { color: var(--sev-Medium); } .stat-amber { border-left: 3px solid var(--sev-Medium); }
.stat-red .stat-ico { color: var(--sev-Critical); } .stat-red { border-left: 3px solid var(--sev-Critical); }

/* ---------- map ---------- */
/* position+z-index contain Leaflet's internal z-indexes so they can't overlap the header/menus */
.map { height: 440px; border-radius: 10px; overflow: hidden; background: #0b0e13; position: relative; z-index: 0; }
.map-sm { height: 300px; }
.leaflet-popup-content-wrapper { background: var(--panel); color: var(--text); border-radius: 10px; }
.leaflet-popup-tip { background: var(--panel); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop-meta { color: var(--gold-lt); font-size: 12px; }
.pop-sum { color: var(--muted); font-size: 12px; }
.ink-pin {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--pin); color: #0b0e13; font-weight: 700; font-size: 12px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 35%, transparent), 0 1px 4px rgba(0,0,0,.5);
}

/* ---------- lists / rows ---------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 6px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--panel2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 14px; }
.row-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.row-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pin); flex-shrink: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--panel2); color: var(--gold-lt);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.empty { color: var(--muted); text-align: center; padding: 24px; font-size: 14px; }

/* ---------- badges / pills ---------- */
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; color: #0b0e13; }
.sev-Critical { background: var(--sev-Critical); } .sev-High { background: var(--sev-High); }
.sev-Medium { background: var(--sev-Medium); } .sev-Low { background: var(--sev-Low); }
.pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border); }
.pill-ok { color: var(--sev-Low); border-color: var(--sev-Low); }
.pill-warn { color: var(--sev-Medium); border-color: var(--sev-Medium); }
.pill-sos { color: #fff; background: var(--sev-Critical); border-color: var(--sev-Critical); }

/* ---------- filters / inputs ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
select, input, textarea {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 9px; font-size: 14px; font-family: inherit; width: 100%;
}
.filters select { width: auto; min-width: 150px; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--gold); }
.search { margin-bottom: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 9px 14px; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 600;
}
/* Material icons (inline SVG) */
.mi { display: inline-block; vertical-align: middle; fill: currentColor; flex-shrink: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.nav-ico { position: relative; display: flex; align-items: center; justify-content: center; height: 22px; }
.nav-badge { position: absolute; top: -5px; left: 56%; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--sev-Critical); color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px;
  display: grid; place-items: center; line-height: 1; }
.mt-loc .mi { vertical-align: -4px; }
.lang-caret, .lang-check { display: inline-flex; align-items: center; }
.btn:hover { border-color: var(--gold); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #0b0e13; }
.btn-gold:hover { background: var(--gold-lt); }
.btn-sos { background: var(--sev-Critical); border-color: var(--sev-Critical); color: #fff; }
.btn-block { width: 100%; margin-top: 14px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-danger { color: var(--sev-Critical); border-color: var(--sev-Critical); background: transparent; }
.btn-danger:hover { background: var(--sev-Critical); color: #fff; }

/* toolbar (client filter + actions above content) */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .btn-gold { margin-left: auto; }
.client-filter { min-width: 180px; width: auto; }
.badge-role { background: var(--panel2); color: var(--gold-lt); border: 1px solid var(--border); font-weight: 600; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center;
  z-index: 2000; padding: 16px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; padding: 18px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 18px; color: var(--gold-lt); }
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.fld-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; font-size: 13px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 20px; cursor: pointer;
}
.detail { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row > span:first-child { color: var(--muted); }
.detail-h { font-size: 14px; color: var(--gold-lt); margin: 14px 0 6px; }

/* ---------- travel planning ---------- */
.timeline { display: flex; flex-direction: column; margin: 4px 0; }
.tl-item { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.tl-item:not(:last-child)::before { content: ''; position: absolute; left: 8px; top: 22px; bottom: -8px; width: 2px; background: var(--border); }
.tl-dot { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--pin);
  margin-top: 2px; flex-shrink: 0; color: #14181f; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 28%, transparent); z-index: 1; }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tl-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.banner-warn { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 10px 0; padding: 10px 12px;
  border-radius: 9px; border: 1px solid var(--sev-High); background: color-mix(in srgb, var(--sev-High) 15%, var(--panel)); }
.banner-warn .mi { color: var(--sev-High); flex-shrink: 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.planned-now { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 6px 0; color: var(--gold-lt); }
/* segment editor cards */
.seg-card { border: 1px solid var(--border); border-radius: 9px; padding: 10px; margin-bottom: 8px; background: var(--panel2); }
.seg-top { display: flex; gap: 8px; margin-bottom: 8px; }
.seg-top .sg-type { flex: 1; }
.seg-fields { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.seg-fields input { width: 100%; }
.seg-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.pnr-box { margin-top: 8px; }
.pnr-box textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 13px; }
.pnr-actions { display: flex; gap: 8px; margin-top: 6px; justify-content: flex-end; }

/* messages */
.msg-unread .row-title { font-weight: 700; }
.dot-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--sev-High); display: inline-block; }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.msg-body { font-size: 14px; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.msg-read { display: flex; align-items: center; gap: 5px; font-size: 12px; margin-top: 12px; }
/* documents */
.doc-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.doc-photo { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; margin-bottom: 8px; }
.doc-upload { cursor: pointer; }

/* ---------- traveller view ---------- */
.mt-pick { margin-bottom: 12px; }
.mt-card .mt-loc { font-size: 15px; margin-bottom: 6px; }
.mt-card .mt-status { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.mt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.mt-actions .btn { padding: 16px; font-size: 15px; }
.mt-itin { color: var(--text); font-size: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: #0b0e13; padding: 12px 20px; border-radius: 10px;
  font-weight: 600; font-size: 14px; z-index: 2100; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}

@media print {
  .app-header, .nav, .panel-head .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { border: none; }
}
