/* ============================================================
   Ports of Freedom – Maritime Dark UI
   ============================================================ */

:root {
  --bg:         #070d14;
  --surface:    #0d1b2a;
  --surface2:   #112233;
  --surface3:   #162840;
  --border:     #1e3a55;
  --text:       #e8f4f8;
  --muted:      #6b92a8;
  --accent:     #0ea5e9;
  --accent-h:   #0284c7;
  --teal:       #2dd4bf;
  --teal-bg:    rgba(45,212,191,.1);
  --green:      #22c55e;
  --green-bg:   rgba(34,197,94,.1);
  --red:        #ef4444;
  --red-bg:     rgba(239,68,68,.1);
  --yellow:     #f59e0b;
  --yellow-bg:  rgba(245,158,11,.1);
  --orange:     #f97316;
  --gold:       #fbbf24;
  --sidebar-w:  230px;
  --topbar-h:   58px;
  --radius:     10px;
  --shadow:     0 4px 24px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--teal); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── LAYOUT ─────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  height: 100dvh;
  background: linear-gradient(180deg, var(--surface) 0%, #080f18 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: width .25s ease, transform .25s ease;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-name,
.sidebar.collapsed .nav-divider { display: none; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.logo-icon { font-size: 1.5rem; color: var(--teal); }
.logo-text  { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.logo-accent { color: var(--teal); }

.sidebar-nav { padding: 12px 8px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
  margin-bottom: 2px;
  cursor: pointer;
  text-decoration: none;
}
.nav-item i { font-size: 1.1rem; flex-shrink: 0; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--teal-bg); color: var(--teal); border-left: 3px solid var(--teal); }
.nav-admin { color: var(--yellow); }
.nav-admin:hover { background: var(--yellow-bg); color: var(--yellow); }

.nav-divider { height: 1px; background: var(--border); margin: 8px 6px; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }
.sidebar-user-wrap { position: relative; }
.sidebar-user-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: .875rem;
  transition: background .15s;
}
.sidebar-user-button:hover { background: var(--surface2); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; flex-shrink: 0;
  color: #fff;
}
.user-name { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-caret { font-size: .7rem; transition: transform .2s; }
.sidebar-user-menu {
  display: none;
  flex-direction: column;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  overflow: hidden;
}
.sidebar-user-menu.open { display: flex; }
.sidebar-user-company { padding: 8px 12px; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--border); }
.sidebar-user-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; color: var(--text);
  font-size: .875rem; transition: background .15s;
}
.sidebar-user-menu-item:hover { background: var(--surface3); }
.sidebar-user-menu-danger { color: var(--red); }
.sidebar-user-menu-danger:hover { background: var(--red-bg); }

/* ── MAIN WRAP ───────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(13,27,42,.95);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.sidebar-toggle {
  background: transparent; border: none; color: var(--muted);
  font-size: 1.4rem; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.sidebar-toggle:hover { background: var(--surface2); color: var(--text); }
.topbar-title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-title i { color: var(--teal); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.balance-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .875rem;
  font-weight: 600;
}
.balance-badge i { color: var(--teal); }
.balance-sep { color: var(--border); }

/* ── FLASH MESSAGES ──────────────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  font-size: .9rem; font-weight: 500;
  position: relative;
}
.flash-success { background: var(--green-bg); border-bottom: 1px solid var(--green); color: var(--green); }
.flash-error   { background: var(--red-bg);   border-bottom: 1px solid var(--red);   color: var(--red); }
.flash-info    { background: var(--teal-bg);  border-bottom: 1px solid var(--teal);  color: var(--teal); }
.flash-warning { background: var(--yellow-bg);border-bottom: 1px solid var(--yellow);color: var(--yellow); }
.flash-close { margin-left: auto; background: transparent; border: none; color: inherit; cursor: pointer; font-size: 1rem; }

/* ── PAGE CONTENT ────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }
.page-footer  { padding: 16px 24px; text-align: center; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h2 { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.page-header h2 i { color: var(--teal); }
.page-subtitle { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.card-header h3 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--teal); }
.card-body { padding: 16px 18px; }

/* ── STAT CARDS ──────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card--blue   { border-top: 3px solid var(--accent); }
.stat-card--teal   { border-top: 3px solid var(--teal); }
.stat-card--green  { border-top: 3px solid var(--green); }
.stat-card--red    { border-top: 3px solid var(--red); }
.stat-card--yellow { border-top: 3px solid var(--yellow); }
.stat-card--orange { border-top: 3px solid var(--orange); }
.stat-icon { font-size: 1.8rem; color: var(--muted); }
.stat-card--blue .stat-icon   { color: var(--accent); }
.stat-card--teal .stat-icon   { color: var(--teal); }
.stat-card--green .stat-icon  { color: var(--green); }
.stat-card--red .stat-icon    { color: var(--red); }
.stat-card--yellow .stat-icon { color: var(--yellow); }
.stat-card--orange .stat-icon { color: var(--orange); }
.stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary  { background: var(--accent);  color: #fff; }
.btn-primary:hover  { background: var(--accent-h); color: #fff; }
.btn-teal     { background: var(--teal);   color: var(--bg); }
.btn-teal:hover  { opacity: .85; }
.btn-ghost    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface3); color: var(--text); }
.btn-yellow   { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); }
.btn-yellow:hover { background: var(--yellow); color: var(--bg); }
.btn-red      { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.btn-red:hover { background: var(--red); color: #fff; }
.btn-disabled, .btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn-sm   { padding: 5px 12px; font-size: .8rem; }
.btn-xs   { padding: 3px 8px;  font-size: .75rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-large { padding: 12px 24px; font-size: 1rem; }

/* ── FORMS ───────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group--inline { flex-direction: row; align-items: center; gap: 10px; }
.form-group--inline .form-label { min-width: 200px; }
.form-label { font-size: .85rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.form-control {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--text);
  font-size: .875rem;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.form-control:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(45,212,191,.15); }
.form-control::placeholder { color: var(--muted); }
.form-control-sm { padding: 5px 10px; font-size: .8rem; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .78rem; color: var(--muted); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── BADGES & CHIPS ──────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); }
.badge-blue   { background: rgba(14,165,233,.1); color: var(--accent); border: 1px solid var(--accent); }
.badge-teal   { background: var(--teal-bg);   color: var(--teal);   border: 1px solid var(--teal); }
.badge-muted  { background: var(--surface2);  color: var(--muted);  border: 1px solid var(--border); }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: .75rem; font-weight: 600;
}
.chip--blue  { background: rgba(14,165,233,.15); color: var(--accent); }
.chip--teal  { background: var(--teal-bg);  color: var(--teal); }
.chip--green { background: var(--green-bg); color: var(--green); }
.chip--red   { background: var(--red-bg);   color: var(--red); }
.chip--yellow{ background: var(--yellow-bg);color: var(--yellow); }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th {
  padding: 10px 14px; text-align: left;
  font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid rgba(30,58,85,.4); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.65); }
.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  padding: 0;
}
.modal-box--wide { max-width: 720px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 12px 12px 0 0;
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 1.1rem; cursor: pointer; border-radius: 6px; padding: 4px;
}
.modal-close:hover { background: var(--surface3); color: var(--text); }
.modal-box .form { padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* ── FLEET GRID ──────────────────────────────────────────── */
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.ship-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.ship-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ship-card--underway { border-color: var(--yellow); }
.ship-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.ship-type-icon { font-size: 1.6rem; color: var(--teal); }
.ship-card-title h3 { font-size: 1rem; font-weight: 700; }
.ship-type-label { font-size: .75rem; color: var(--muted); }
.ship-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
}
.ship-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ship-stat:nth-child(2n) { border-right: none; }
.ship-stat:nth-last-child(-n+2) { border-bottom: none; }
.ship-stat-icon { font-size: 1.1rem; color: var(--muted); }
.ship-stat-val  { font-size: .95rem; font-weight: 700; }
.ship-stat-lbl  { font-size: .72rem; color: var(--muted); }
.ship-condition { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.condition-header { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: 4px; }
.condition-bar  { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.condition-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.ship-location  { padding: 8px 16px; font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ship-location i { color: var(--teal); }
.ship-card-footer { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; border-top: 1px solid var(--border); }
.ship-metrics { font-size: .78rem; color: var(--muted); display: flex; gap: 12px; }

/* ── FLEET MINI (DASHBOARD) ──────────────────────────────── */
.fleet-mini-grid { display: flex; flex-direction: column; gap: 8px; }
.fleet-mini-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: 7px;
}
.fleet-mini-icon { font-size: 1.3rem; color: var(--teal); flex-shrink: 0; }
.fleet-mini-info { flex: 1; }
.fleet-mini-name { font-size: .85rem; font-weight: 600; }
.fleet-mini-status { margin-top: 2px; }
.fleet-mini-cond { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.fleet-mini-cond .condition-bar { width: 50px; }

/* ── CONTRACTS ───────────────────────────────────────────── */
.contracts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.contract-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .15s, border-color .15s;
}
.contract-card:hover { transform: translateY(-1px); border-color: var(--teal); }
.contract-card-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.contract-good-icon { font-size: 1.6rem; color: var(--teal); }
.contract-good-name { font-size: .95rem; font-weight: 700; }
.contract-quantity  { font-size: .8rem; color: var(--muted); }
.contract-route {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border-radius: 8px; padding: 10px 12px;
}
.contract-port { flex: 1; }
.contract-port span { display: block; font-size: .9rem; font-weight: 600; }
.contract-port small { color: var(--muted); font-size: .75rem; }
.contract-arrow { color: var(--teal); font-size: 1.2rem; flex-shrink: 0; }
.contract-details { display: flex; gap: 8px; }
.contract-detail { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.contract-detail i { font-size: 1rem; }
.contract-detail span { font-size: .9rem; font-weight: 700; }
.contract-detail small { font-size: .72rem; color: var(--muted); }

/* ── VOYAGE CARDS ────────────────────────────────────────── */
.voyages-active-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.voyage-card {
  background: var(--surface);
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  padding: 16px;
}
.voyage-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.voyage-ship-info { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.voyage-time { font-size: .85rem; color: var(--muted); }
.voyage-route-display {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2); border-radius: 8px; padding: 10px 14px;
  margin-bottom: 12px;
}
.voyage-port { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.voyage-origin i { color: var(--teal); margin-right: 4px; }
.voyage-dest   i { color: var(--red);  margin-right: 4px; }
.voyage-progress-track {
  flex: 1; position: relative; height: 6px;
  background: var(--surface3); border-radius: 3px; overflow: visible;
}
.voyage-progress-bar { height: 100%; background: var(--teal); border-radius: 3px; }
.voyage-ship-icon {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--yellow); font-size: 1.1rem; margin-left: -8px;
  transition: left .5s;
  filter: drop-shadow(0 0 4px var(--yellow));
}
.voyage-card-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.voyage-card-stats span { display: flex; align-items: center; gap: 4px; }

/* Dashboard voyage rows */
.voyage-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(30,58,85,.4); flex-wrap: wrap; }
.voyage-row:last-child { border-bottom: none; }
.voyage-ship { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; min-width: 120px; }
.voyage-route { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); flex: 1; min-width: 140px; }
.voyage-progress-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 140px; }
.progress-bar-track { flex: 1; height: 5px; background: var(--surface3); border-radius: 3px; }
.progress-bar-fill  { height: 100%; background: var(--teal); border-radius: 3px; }
.voyage-eta { font-size: .78rem; color: var(--muted); white-space: nowrap; }

/* ── PLANNER ─────────────────────────────────────────────── */
.planner-layout { display: grid; grid-template-columns: 360px 1fr; gap: 18px; }
@media (max-width: 900px) { .planner-layout { grid-template-columns: 1fr; } }
.planner-form-card { height: fit-content; }
.estimate-box {
  background: var(--surface2);
  border: 1px solid var(--teal);
  border-radius: 8px;
  padding: 14px;
}
.estimate-box h4 { font-size: .9rem; margin-bottom: 10px; color: var(--teal); display: flex; align-items: center; gap: 6px; }
.estimate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.estimate-item { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; background: var(--surface3); border-radius: 6px; }
.estimate-item--total { grid-column: 1/-1; background: rgba(239,68,68,.1); }
.estimate-label { font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.estimate-val   { font-size: .95rem; font-weight: 700; }

/* ── CATALOG ─────────────────────────────────────────────── */
.ships-catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.catalog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .15s, border-color .15s;
}
.catalog-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.catalog-card-header { display: flex; align-items: flex-start; gap: 12px; }
.catalog-ship-icon { font-size: 2rem; color: var(--teal); }
.catalog-ship-name { font-size: 1rem; font-weight: 700; }
.catalog-desc { font-size: .8rem; color: var(--muted); }
.catalog-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.catalog-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--surface2); border-radius: 7px; padding: 8px;
  font-size: .85rem; font-weight: 600;
}
.catalog-stat i { font-size: 1rem; color: var(--muted); }
.catalog-stat small { font-size: .72rem; color: var(--muted); }
.catalog-cargo-types { font-size: .78rem; color: var(--muted); }
.catalog-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 8px; }
.catalog-price { display: flex; flex-direction: column; gap: 1px; }
.price-label { font-size: .72rem; color: var(--muted); }
.price-value { font-size: 1.1rem; font-weight: 800; }

/* ── FILTER TABS ─────────────────────────────────────────── */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.filter-tab {
  padding: 5px 14px; border-radius: 20px; font-size: .8rem; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; transition: all .15s;
}
.filter-tab:hover { color: var(--teal); border-color: var(--teal); }
.filter-tab.active { background: var(--teal-bg); color: var(--teal); border-color: var(--teal); }

/* ── TAB NAV ─────────────────────────────────────────────── */
.tab-nav { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab-btn {
  padding: 10px 18px; background: transparent; border: none; color: var(--muted);
  font-size: .875rem; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s; border-radius: 0; display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

/* ── EVENTS / TIMELINE ───────────────────────────────────── */
.event-list { display: flex; flex-direction: column; gap: 8px; }
.event-item { display: flex; gap: 10px; padding: 8px 10px; border-radius: 7px; }
.event-info    { background: var(--teal-bg);   border-left: 3px solid var(--teal); }
.event-warning { background: var(--yellow-bg); border-left: 3px solid var(--yellow); }
.event-critical{ background: var(--red-bg);    border-left: 3px solid var(--red); }
.event-icon { font-size: 1.1rem; flex-shrink: 0; padding-top: 1px; }
.event-info .event-icon    { color: var(--teal); }
.event-warning .event-icon { color: var(--yellow); }
.event-critical .event-icon{ color: var(--red); }
.event-title { font-size: .875rem; font-weight: 600; }
.event-meta  { font-size: .78rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }

.events-timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; gap: 14px;
  padding: 14px 16px;
  border-left: 3px solid var(--border);
  margin-left: 20px;
  position: relative;
  transition: background .15s;
}
.timeline-item:hover { background: var(--surface); border-radius: 0 8px 8px 0; }
.timeline-icon {
  position: absolute; left: -18px; top: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
  background: var(--surface);
  border: 2px solid var(--border);
}
.timeline-info     { border-left-color: var(--teal); }
.timeline-info .timeline-icon    { color: var(--teal);   border-color: var(--teal); }
.timeline-warning  { border-left-color: var(--yellow); }
.timeline-warning .timeline-icon { color: var(--yellow); border-color: var(--yellow); }
.timeline-critical { border-left-color: var(--red); }
.timeline-critical .timeline-icon{ color: var(--red);    border-color: var(--red); }
.timeline-body { padding-left: 8px; }
.timeline-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.timeline-date   { font-size: .78rem; color: var(--muted); }
.timeline-impact { font-size: .85rem; font-weight: 700; }
.timeline-desc   { font-size: .85rem; color: var(--muted); }

/* ── FINANCES ────────────────────────────────────────────── */
.finances-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .finances-grid { grid-template-columns: 1fr; } }
.finance-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.finance-item { background: var(--surface2); border-radius: 8px; padding: 12px; }
.finance-profit { grid-column: 1/-1; background: var(--surface3); }
.finance-label { font-size: .78rem; color: var(--muted); display: block; }
.finance-value { font-size: 1.15rem; font-weight: 700; display: block; margin-top: 2px; }
.loan-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: var(--surface2); border-radius: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.loan-principal { font-weight: 700; }
.loan-remaining { font-size: .875rem; }
.loan-meta { font-size: .78rem; margin-top: 2px; }
.breakdown-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(30,58,85,.3); }
.breakdown-cat { font-size: .85rem; color: var(--muted); }
.period-tabs { display: flex; gap: 4px; }

/* ── RANKING ─────────────────────────────────────────────── */
.my-rank-badge { background: var(--teal-bg); border: 1px solid var(--teal); color: var(--teal); padding: 8px 16px; border-radius: 20px; font-size: .9rem; }
.ranking-my-row td { background: var(--teal-bg) !important; }
.ranking-pos { text-align: center; }
.trophy { font-size: 1.2rem; }
.trophy--gold   { color: var(--gold); }
.trophy--silver { color: #adb5bd; }
.trophy--bronze { color: #cd7f32; }
.rank-num { font-size: .9rem; font-weight: 700; color: var(--muted); }
.rep-bar-wrap { display: flex; align-items: center; gap: 6px; }

/* ── DASHBOARD GRID ──────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.dashboard-grid .stat-cards { grid-column: 1/-1; }
.dashboard-grid .card { grid-column: span 6; }
.dashboard-grid .card:first-of-type { grid-column: span 12; }
@media (max-width: 1100px) { .dashboard-grid .card { grid-column: span 12; } }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: .85rem; font-weight: 600;
  transition: all .15s; text-decoration: none;
}
.quick-btn i { font-size: 1.5rem; color: var(--teal); }
.quick-btn:hover { background: var(--teal-bg); border-color: var(--teal); color: var(--teal); }

/* ── ADMIN ───────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .admin-grid { grid-template-columns: 1fr; } }

/* ── MISC ────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 32px; text-align: center; color: var(--muted);
}
.empty-state i { font-size: 2rem; }
.empty-state h3 { color: var(--text); }
.empty-state--lg { padding: 56px; }

.text-green  { color: var(--green)  !important; }
.text-red    { color: var(--red)    !important; }
.text-yellow { color: var(--yellow) !important; }
.text-teal   { color: var(--teal)   !important; }
.text-muted  { color: var(--muted)  !important; }

.risk-bar  { width: 80px; height: 5px; background: var(--surface3); border-radius: 3px; overflow: hidden; display: inline-block; margin-right: 4px; vertical-align: middle; }
.risk-fill { height: 100%; border-radius: 3px; }

.animate-pulse { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ── GUEST / LOGIN ───────────────────────────────────────── */
.guest-body { background: radial-gradient(ellipse at 20% 50%, #0a1628 0%, var(--bg) 60%); }
.guest-layout {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; gap: 60px; flex-wrap: wrap;
}
.guest-brand { text-align: center; flex: 1; min-width: 240px; }
.guest-logo { font-size: 5rem; color: var(--teal); margin-bottom: 12px; display: block; }
.guest-title { font-size: 2.5rem; font-weight: 800; color: var(--text); }
.guest-subtitle { color: var(--muted); margin-top: 6px; font-size: 1rem; }
.guest-tagline { display: flex; gap: 16px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.guest-tagline span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .875rem; }
.guest-tagline i { color: var(--teal); }
.guest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}
.guest-form-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; text-align: center; }
.guest-desc { font-size: .875rem; color: var(--muted); margin-bottom: 20px; text-align: center; line-height: 1.6; }
.guest-link { text-align: center; font-size: .875rem; color: var(--muted); margin-top: 16px; }

/* ── LEAFLET MAP DOTS ────────────────────────────────────── */
.map-port-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); border: 2px solid rgba(255,255,255,.3); box-shadow: 0 0 6px var(--teal); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-230px); width: 230px; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .page-content { padding: 16px; }
  .fleet-grid, .contracts-grid, .ships-catalog-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .finances-grid { grid-template-columns: 1fr; }
}
