/* ── Dashboard Layout ── */
.dash-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ── Dashboard Nav ── */
.dash-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.dash-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--teal);
  font-family: 'Syne', sans-serif;
  letter-spacing: -0.03em;
  margin-right: auto;
}
.dash-nav-link {
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.dash-nav-link:hover { background: var(--surface); color: var(--text); }
.dash-nav-link.active { color: var(--teal); background: var(--teal-dim); }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.page-sub {
  font-size: 14px;
  color: var(--text-dim);
}

/* ── Stat cards row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.stat-card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.stat-card-value {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-card-value.teal { color: var(--teal); }
.stat-card-value.warn { color: var(--warn); }
.stat-card-value.critical { color: var(--critical); }
.stat-card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Alert list ── */
.alerts-section { margin-bottom: 40px; }
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-badge {
  display: inline-block;
  background: var(--critical);
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.alert-badge.warn { background: var(--warn); }
.alert-item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 8px;
}
.alert-severity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.alert-severity-dot.critical { background: var(--critical); animation: pulse 2s infinite; }
.alert-severity-dot.warning { background: var(--warn); }
.alert-body { flex: 1; }
.alert-vessel { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.alert-text { font-size: 13px; color: var(--text-dim); }
.alert-hours {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--critical);
  white-space: nowrap;
}
.alert-hours.warn { color: var(--warn); }
.resolve-btn {
  font-size: 12px;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid rgba(0,201,167,0.2);
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.resolve-btn:hover { background: rgba(0,201,167,0.2); }

/* ── Vessel table ── */
.vessel-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 100px;
  padding: 12px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 500;
}
.table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 100px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.1s;
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--surface2); }
.vessel-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vessel-icon {
  width: 32px;
  height: 32px;
  background: var(--teal-dim);
  border: 1px solid rgba(0,201,167,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  font-size: 14px;
}
.vessel-name-text { font-size: 14px; font-weight: 600; color: var(--text); }
.vessel-type-text { font-size: 12px; color: var(--text-muted); }
.table-cell { font-size: 14px; color: var(--text-dim); }
.table-cell.ok { color: var(--ok); }
.table-cell.warn { color: var(--warn); font-weight: 500; }
.table-cell.critical { color: var(--critical); font-weight: 500; }
.view-btn {
  font-size: 13px;
  color: var(--teal);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid rgba(0,201,167,0.2);
  border-radius: 5px;
  background: var(--teal-dim);
}
.view-btn:hover { background: rgba(0,201,167,0.2); }

/* ── Progress bar inside table cell ── */
.pct-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stock-bar-sm {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  max-width: 80px;
}
.stock-bar-sm .bar-fill { height: 100%; background: var(--teal); border-radius: 3px; }
.stock-bar-sm .bar-fill.warn { background: var(--warn); }

/* ── Vessel Detail Page ── */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.inv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.inv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.inv-name { font-size: 15px; font-weight: 600; color: var(--text); }
.inv-unit { font-size: 12px; color: var(--text-muted); }
.inv-qty {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}
.inv-qty.low { color: var(--warn); }
.inv-qty.critical { color: var(--critical); }
.inv-threshold { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.inv-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.inv-bar-fill { height: 100%; background: var(--teal); border-radius: 3px; }
.inv-bar-fill.warn { background: var(--warn); }
.inv-bar-fill.critical { background: var(--critical); }
.inv-actions { display: flex; gap: 6px; }
.inv-action-btn {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-dim);
  cursor: pointer;
}
.inv-action-btn:hover { border-color: var(--teal); color: var(--teal); }
.inv-message {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
  line-height: 1.4;
}

/* ── Back nav ── */
.back-link {
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.back-link:hover { color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: var(--teal);
  color: #040d1a;
}
.btn-primary:hover { background: #00e0bb; }
.btn-secondary {
  background: var(--surface2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 32px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

/* ── AI run button ── */
.ai-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 7px;
  background: rgba(0,201,167,0.1);
  color: var(--teal);
  border: 1px solid rgba(0,201,167,0.25);
  cursor: pointer;
}
.ai-run-btn:hover { background: rgba(0,201,167,0.18); }

/* ── Form ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}
.form-input:focus { outline: none; border-color: var(--teal); }
.form-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}
.form-select:focus { outline: none; border-color: var(--teal); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4,13,26,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 440px;
  max-width: 90vw;
}
.modal-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 20px; }
.modal-close {
  float: right;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; justify-content: flex-end; }

/* ── Port badge ── */
.port-badge {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Toast / feedback ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--teal);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 14px;
  color: var(--teal);
  z-index: 200;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .table-header, .table-row { grid-template-columns: 2fr 1fr 1fr 60px; }
  .table-header > *:nth-child(3),
  .table-header > *:nth-child(4),
  .table-row > *:nth-child(3),
  .table-row > *:nth-child(4) { display: none; }
  .dash-layout { padding: 0 16px; }
}