/* GEO PORT CHECK — Application UI */

:root {
  --navy: #0a1628;
  --navy-2: #0f2137;
  --navy-3: #152a45;
  --cyan: #22d3ee;
  --cyan-dim: #0891b2;
  --accent: #38bdf8;
  --ok: #10b981;
  --ok-bg: #ecfdf5;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --fail: #ef4444;
  --fail-bg: #fef2f2;
  --surface: #ffffff;
  --bg: #f1f5f9;
  --bg-2: #e8eef5;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(10, 22, 40, 0.14);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sidebar: 248px;
  --header-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Shell ── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  border-right: 1px solid rgba(34, 211, 238, 0.08);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #0891b2, #22d3ee);
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.7rem; color: var(--navy); letter-spacing: -0.02em;
}
.sidebar-title { font-weight: 700; font-size: 0.92rem; letter-spacing: 0.02em; }
.sidebar-title b { color: var(--cyan); font-weight: 600; }
.sidebar-sub { font-size: 0.68rem; color: #64748b; margin-top: 1px; }
.sidebar-nav { padding: 0.85rem 0.7rem; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  width: 100%; text-align: left;
  padding: 0.62rem 0.75rem;
  border-radius: 9px;
  color: #94a3b8;
  font-size: 0.9rem; font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }
.nav-item.active {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
}
.nav-item svg { width: 18px; height: 18px; opacity: 0.9; flex-shrink: 0; }
.sidebar-foot {
  padding: 0.9rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.78rem;
}
.sidebar-tenant { color: #e2e8f0; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user { color: #64748b; }
.sidebar-user span { color: #94a3b8; }

.main {
  margin-left: var(--sidebar);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  height: var(--header-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 700; font-size: 1.05rem; color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; }
.content { padding: 1.35rem 1.5rem 2.5rem; flex: 1; }

/* ── Auth ── */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--navy);
}
.auth-hero {
  padding: 3rem;
  display: flex; flex-direction: column; justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(34,211,238,0.18), transparent),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(56,189,248,0.1), transparent),
    linear-gradient(160deg, #061018 0%, var(--navy) 50%, #0c1f3d 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(34,211,238,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,211,238,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 440px; }
.auth-tag {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em;
  color: var(--cyan); font-weight: 600; margin-bottom: 1rem;
}
.auth-hero h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800; line-height: 1.15; letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.auth-hero h1 em { font-style: normal; color: var(--cyan); }
.auth-hero p { color: #94a3b8; font-size: 1.02rem; margin-bottom: 1.75rem; }
.auth-points { list-style: none; display: grid; gap: 0.65rem; }
.auth-points li {
  display: flex; gap: 0.65rem; align-items: flex-start;
  font-size: 0.92rem; color: #cbd5e1;
}
.auth-points li::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan); margin-top: 0.45rem; flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(34,211,238,0.15);
}
.auth-panel {
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 2rem 1.75rem;
}
.auth-card h2 { font-size: 1.35rem; margin-bottom: 0.25rem; color: var(--navy); }
.auth-card .lead { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.4rem; }
.auth-tabs {
  display: flex; gap: 0.35rem; background: var(--bg);
  padding: 4px; border-radius: 10px; margin-bottom: 1.25rem;
}
.auth-tab {
  flex: 1; padding: 0.55rem; border-radius: 8px;
  font-weight: 600; font-size: 0.88rem; color: var(--muted);
}
.auth-tab.active { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.demo-box {
  margin-top: 1rem; padding: 0.85rem;
  background: #f0f9ff; border: 1px solid #bae6fd;
  border-radius: var(--radius-sm); font-size: 0.8rem; color: #0c4a6e;
}
.demo-box code {
  font-family: var(--mono); font-size: 0.78rem;
  background: #e0f2fe; padding: 0.1em 0.35em; border-radius: 4px;
}

/* ── Forms ── */
.form-grid { display: grid; gap: 0.85rem; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label {
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.field input, .field select, .field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.62rem 0.75rem;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--cyan-dim);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}
.field textarea { min-height: 80px; resize: vertical; }
.field-hint { font-size: 0.75rem; color: var(--muted-2); }
.check-row {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem;
  padding: 0.75rem 0;
}
.check-row label {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.9rem; font-weight: 500; color: var(--text);
  text-transform: none; letter-spacing: 0; cursor: pointer;
}
.check-row input { width: 16px; height: 16px; accent-color: var(--cyan-dim); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.62rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, #0e7490, #0891b2);
  color: #fff;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}
.btn-primary:hover { box-shadow: 0 4px 14px rgba(8, 145, 178, 0.4); }
.btn-secondary {
  background: #fff; color: var(--navy);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-danger { background: var(--fail-bg); color: #b91c1c; border: 1px solid #fecaca; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.btn-lg { padding: 0.8rem 1.4rem; font-size: 0.98rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Cards / layout ── */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 1rem;
  margin-bottom: 1.35rem;
}
.page-head h1 { font-size: 1.45rem; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.page-head p { color: var(--muted); font-size: 0.92rem; margin-top: 0.2rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.35rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 1.75rem; font-weight: 800; color: var(--navy); margin-top: 0.15rem; font-variant-numeric: tabular-nums; }
.stat-card .sub { font-size: 0.78rem; color: var(--muted-2); margin-top: 0.15rem; }
.stat-card.ok .value { color: #047857; }
.stat-card.warn .value { color: #b45309; }
.stat-card.fail .value { color: #b91c1c; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 0.95rem; font-weight: 700; color: var(--navy); }
.card-body { padding: 1.15rem; }
.card-body.tight { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stack { display: grid; gap: 1rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 0.88rem;
}
table.data th {
  text-align: left; padding: 0.7rem 1rem;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbfc; }
table.data .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 0.82rem; }
.mono { font-family: var(--mono); font-size: 0.82rem; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: #047857; }
.badge-warn { background: var(--warn-bg); color: #b45309; }
.badge-fail { background: var(--fail-bg); color: #b91c1c; }
.badge-muted { background: #f1f5f9; color: #475569; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* ── Verdict hero ── */
.verdict-hero {
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}
.verdict-hero.ok { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border-color: #6ee7b7; }
.verdict-hero.warn { background: linear-gradient(135deg, #fffbeb, #fef3c7); border-color: #fcd34d; }
.verdict-hero.fail { background: linear-gradient(135deg, #fef2f2, #fecaca); border-color: #fca5a5; }
.verdict-hero .vh-label {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em;
  text-transform: uppercase;
}
.verdict-hero.ok .vh-label { color: #047857; }
.verdict-hero.warn .vh-label { color: #b45309; }
.verdict-hero.fail .vh-label { color: #b91c1c; }
.verdict-hero .vh-sum { color: #334155; margin-top: 0.25rem; font-size: 0.95rem; }

/* ── Check wizard ── */
.wizard-steps {
  display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.wizard-step {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem; font-weight: 600;
  background: #fff; border: 1px solid var(--border); color: var(--muted);
}
.wizard-step.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.wizard-step.done { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.wizard-step .n {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.72rem; background: rgba(0,0,0,0.08);
}
.wizard-step.active .n { background: rgba(255,255,255,0.2); }

.berth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.berth-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: #fff;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.berth-card:hover { border-color: #94a3b8; }
.berth-card.selected {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
  background: #f0fdfa;
}
.berth-card .code { font-weight: 800; color: var(--navy); font-size: 0.95rem; }
.berth-card .meta { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; }
.berth-card .products { margin-top: 0.55rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.berth-card .products span {
  font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.4rem;
  border-radius: 4px; background: #f1f5f9; color: #475569;
}

.vessel-pick {
  display: grid; gap: 0.5rem; max-height: 320px; overflow-y: auto;
}
.vessel-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.85rem 1rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; text-align: left; width: 100%;
}
.vessel-row:hover { border-color: #94a3b8; }
.vessel-row.selected {
  border-color: var(--cyan-dim);
  background: #f0fdfa;
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}
.vessel-row .name { font-weight: 700; color: var(--navy); }
.vessel-row .dims { font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }

/* ── Check detail rows ── */
.check-list { display: grid; gap: 0.45rem; }
.check-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem; align-items: center;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.88rem;
}
.check-item.pass { border-left: 3px solid var(--ok); }
.check-item.tight { border-left: 3px solid var(--warn); background: #fffef7; }
.check-item.fail { border-left: 3px solid var(--fail); background: #fffafa; }
.check-item.missing { border-left: 3px solid #94a3b8; }
.check-item .ci-label { font-weight: 600; }
.check-item .ci-msg { color: var(--muted); font-size: 0.8rem; grid-column: 1 / -1; margin-top: -0.25rem; }
.check-item .ci-margin {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 600;
  color: var(--navy);
}

/* ── Empty / error ── */
.empty {
  text-align: center; padding: 2.5rem 1.5rem; color: var(--muted);
}
.empty h3 { color: var(--navy); margin-bottom: 0.35rem; }
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.88rem; margin-bottom: 1rem;
}
.alert-error { background: var(--fail-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-ok { background: var(--ok-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: #e0f2fe; color: #0c4a6e; border: 1px solid #bae6fd; }

.toast {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 100;
  background: var(--navy); color: #fff;
  padding: 0.85rem 1.15rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 0.9rem;
  animation: toast-in 0.25s ease;
  max-width: 360px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.loading {
  display: flex; align-items: center; justify-content: center;
  gap: 0.65rem; padding: 3rem; color: var(--muted);
}
.spinner {
  width: 22px; height: 22px; border: 2.5px solid var(--border);
  border-top-color: var(--cyan-dim); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 22, 40, 0.5);
  backdrop-filter: blur(4px); z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: #fff; border-radius: 16px;
  width: min(640px, 100%); max-height: min(90vh, 800px);
  overflow: auto; box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-head h2 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.modal-body { padding: 1.25rem; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 1rem 1.25rem; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: #fff;
}

/* ── Mobile ── */
.menu-toggle { display: none; }
@media (max-width: 960px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2, .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .check-item { grid-template-columns: 1fr; }
}
