/* ==========================================================================
   ACB Invoice Management — Design System
   Corporate blue/white, navy #2D4152, teal #55C3BB accent, rounded, airy.
   ========================================================================== */

:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --navy: #2d4152;
  --navy-dark: #1c2b38;
  --teal: #55c3bb;
  --teal-dark: #3aa79f;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e3e8ef;
  --text: #1a2433;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --primary: #2d4152;
  --primary-hover: #1c2b38;
  --primary-soft: #e8edf3;
  --accent: #55c3bb;
  --accent-soft: #e3f6f4;

  --success: #16a34a;
  --success-soft: #e7f7ed;
  --warning: #d97706;
  --warning-soft: #fef3e2;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info: #2563eb;
  --info-soft: #e8effe;

  --sidebar-bg: #ffffff;
  --sidebar-text: #64748b;
  --sidebar-text-active: #173554;
  --sidebar-active-bg: #e9f1ff;
  --sidebar-border: #e3e8ef;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;

  --sidebar-width: 300px;
  --sidebar-collapsed-width: 80px;
  --topbar-height: 64px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #10161f;
  --surface: #17202b;
  --surface-alt: #1d2733;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef2f7;
  --text-muted: #a3adba;
  --text-faint: #6b7686;

  --primary: #4c76a3;
  --primary-hover: #5d89b8;
  --primary-soft: rgba(76, 118, 163, 0.18);
  --accent: #55c3bb;
  --accent-soft: rgba(85, 195, 187, 0.16);

  --success-soft: rgba(22, 163, 74, 0.16);
  --warning-soft: rgba(217, 119, 6, 0.18);
  --danger-soft: rgba(220, 38, 38, 0.18);
  --info-soft: rgba(37, 99, 235, 0.18);

  --sidebar-bg: #121c28;
  --sidebar-text: #aeb9c7;
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: rgba(76, 118, 163, 0.28);
  --sidebar-border: rgba(255, 255, 255, 0.06);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

h1, h2, h3, h4, p {
  margin: 0;
}

::selection {
  background: rgba(85, 195, 187, 0.28);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ---------------------------------------------------------------------- */
/* App shell layout                                                        */
/* ---------------------------------------------------------------------- */

#app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.24s ease;
}

#app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: 40;
  border-right: 1px solid var(--sidebar-border);
  transition: width 0.24s ease, transform 0.25s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border-bottom: 1px solid var(--sidebar-border);
  height: var(--topbar-height);
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--surface-alt);
  border-radius: 9px;
  padding: 3px;
}

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand-copy { min-width: 0; flex: 1; }

.sidebar-collapse-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--surface);
  cursor: pointer;
  font-size: 27px;
  line-height: 1;
}

.sidebar-collapse-btn:hover { color: var(--text); background: var(--surface-alt); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  padding: 14px 10px 6px;
}

.sidebar-section-label:first-child {
  padding-top: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
}

.sidebar-link .icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.sidebar-dashboard-link {
  min-height: 48px;
  padding: 11px 13px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.sidebar-dashboard-link.active { background: var(--navy); color: #fff; }

.sidebar-group { margin-bottom: 7px; }

.sidebar-group-toggle {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
  font-weight: 700;
}

.sidebar-group-toggle:hover { background: var(--surface-alt); }
.sidebar-group.open > .sidebar-group-toggle { background: var(--navy); color: #fff; }

.sidebar-group-toggle .icon,
.sidebar-dashboard-link .icon { width: 20px; height: 20px; flex: 0 0 20px; }

.sidebar-group-title { flex: 1; white-space: nowrap; }
.sidebar-group-chevron { width: 16px; height: 16px; transition: transform 0.18s ease; }
.sidebar-group.open .sidebar-group-chevron { transform: rotate(180deg); }

.sidebar-group-items {
  margin: 8px 0 4px 23px;
  padding: 2px 0 2px 16px;
  border-left: 1px solid var(--border);
}

.sidebar-group-items[hidden] { display: none; }
.sidebar-group-items .sidebar-link { min-height: 38px; padding: 8px 11px; margin: 1px 0; }
.sidebar-group-items .sidebar-link.active {
  border-left: 3px solid var(--info);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--sidebar-text-active);
  font-weight: 700;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--text-faint);
}

#app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
#app-shell.sidebar-collapsed .sidebar-header { justify-content: center; padding: 11px; }
#app-shell.sidebar-collapsed .sidebar-logo { width: 44px; height: 44px; }
#app-shell.sidebar-collapsed .sidebar-brand-copy,
#app-shell.sidebar-collapsed .sidebar-link-text,
#app-shell.sidebar-collapsed .sidebar-group-title,
#app-shell.sidebar-collapsed .sidebar-group-chevron,
#app-shell.sidebar-collapsed .sidebar-group-items,
#app-shell.sidebar-collapsed .sidebar-footer { display: none; }

#app-shell.sidebar-collapsed .sidebar-collapse-btn {
  position: absolute;
  top: 14px;
  left: calc(var(--sidebar-collapsed-width) + 8px);
  z-index: 45;
  background: var(--surface);
}

#app-shell.sidebar-collapsed .sidebar-collapse-btn span { display: inline-block; transform: rotate(180deg); }
#app-shell.sidebar-collapsed .sidebar-nav { padding: 14px 10px; overflow: visible; }
#app-shell.sidebar-collapsed .sidebar-link,
#app-shell.sidebar-collapsed .sidebar-group-toggle {
  width: 50px;
  height: 50px;
  min-height: 50px;
  padding: 0;
  margin: 0 auto 8px;
  justify-content: center;
}

#app-shell.sidebar-collapsed .sidebar-group.open > .sidebar-group-toggle,
#app-shell.sidebar-collapsed .sidebar-group.has-active > .sidebar-group-toggle {
  color: var(--navy);
  background: var(--info-soft);
  border-left: 3px solid var(--info);
}

:root[data-theme="dark"] #app-shell.sidebar-collapsed .sidebar-group.open > .sidebar-group-toggle,
:root[data-theme="dark"] #app-shell.sidebar-collapsed .sidebar-group.has-active > .sidebar-group-toggle { color: #fff; }

@media (min-width: 901px) and (hover: hover) {
  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) {
    width: var(--sidebar-width);
    box-shadow: var(--shadow-lg);
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-header {
    justify-content: flex-start;
    padding: 14px;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-logo {
    width: 42px;
    height: 42px;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-brand-copy,
  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-link-text,
  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-group-title,
  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-group-chevron,
  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-footer {
    display: block;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-group-chevron {
    display: inline-flex;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-group-items:not([hidden]) {
    display: block;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-nav {
    padding: 14px 12px;
    overflow-y: auto;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-link,
  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-group-toggle {
    width: 100%;
    height: auto;
    min-height: 48px;
    padding: 11px 13px;
    margin: 0 0 7px;
    justify-content: flex-start;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-group-items .sidebar-link {
    min-height: 38px;
    padding: 8px 11px;
    margin: 1px 0;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-group.open > .sidebar-group-toggle {
    color: #fff;
    background: var(--navy);
    border-left: 0;
  }

  #app-shell.sidebar-collapsed .sidebar:is(:hover, .sidebar-peek) .sidebar-collapse-btn {
    left: auto;
    right: 14px;
  }
}

.sidebar-backdrop {
  display: none;
}

.main-area {
  grid-column: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hamburger-btn {
  display: none;
}

.content-area {
  padding: 22px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-header .page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                  */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-accent {
  background: var(--accent);
  color: #08312e;
}
.btn-accent:hover {
  background: var(--teal-dark);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

/* ---------------------------------------------------------------------- */
/* Cards / KPI                                                              */
/* ---------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 17px;
  height: 17px;
}

.kpi-value {
  /* Large Rupiah amounts must never be clipped with "..." — a truncated
     nominal is worse than a wrapped one for a finance app. Clamp keeps
     today's desktop size (21px) as the ceiling (so desktop is visually
     unchanged) and lets it shrink gracefully down to ~16.8px on narrow
     screens; overflow-wrap + allowing normal white-space means a value
     that still doesn't fit at the smallest size wraps to a 2nd line
     instead of being cut off, per the reported bug. */
  font-size: clamp(1.05rem, 4vw, 1.3125rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-faint);
}

/* Dashboard "Pembayaran Invoice/Vendor Terbaru" mini-cards. Deliberately its
   own class instead of reusing .form-grid.cols-2: a plain CSS grid item's
   automatic minimum width is its content's min-content size (here, the
   table inside), NOT 0 — so without `minmax(0, 1fr)` a wide table forces
   its column wider than the viewport instead of shrinking/scrolling,
   pushing (and visually cutting off) the second card. This was the actual
   cause of the "Pembayaran Vendor Terbaru terpotong di sisi kanan" bug. */
.dashboard-recent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

@media (max-width: 1024px) {
  .dashboard-recent-grid {
    /* minmax(0, 1fr), not plain 1fr — a bare 1fr track still won't shrink
       below its content's min-content size even when it's the only track,
       which is exactly what let the stacked card overflow the page on
       mobile during testing. */
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Compact variant of .data-table for the two dashboard mini-tables above —
   only 4 narrow columns, so it needs a much lower scroll threshold than the
   640px full-page tables use. Kept as a separate modifier (not a change to
   the shared table.data-table rule) so every other table in the app keeps
   its existing min-width/behavior untouched. */
table.data-table.data-table-compact {
  min-width: 460px;
}

/* Customer/vendor name column on those same mini-tables: clamp to 2 lines
   with ellipsis instead of forcing the column (and the whole table/card)
   to grow to fit one long company name; the full name is still available
   via the native title tooltip set alongside this class in dashboard.js. */
.cell-clamp {
  max-width: 170px;
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------------- */
/* Fleet Command Center                                                     */
/* ---------------------------------------------------------------------- */

.fleet-page-header {
  align-items: center;
}

.fleet-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: stretch;
}

.fleet-map-panel,
.fleet-status-panel,
.fleet-vessel-card,
.fleet-wave-summary,
.fleet-mini-kpi,
.fleet-detail-grid > .card {
  min-width: 0;
}

.fleet-map-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.fleet-map-toolbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.fleet-map-toolbar h2,
.fleet-vessel-card h2 {
  font-size: 16px;
  line-height: 1.2;
}

.fleet-eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.fleet-layer-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.fleet-layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.fleet-layer-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--teal);
}

.fleet-map-wrap {
  position: relative;
  height: min(68vh, 690px);
  min-height: 520px;
  background: #dbeafe;
}

.fleet-map,
.fleet-map-fallback {
  position: absolute;
  inset: 0;
}

.fleet-map .maplibregl-canvas {
  outline: none;
}

.fleet-map .leaflet-container,
.fleet-map.leaflet-container {
  width: 100%;
  height: 100%;
  background: #dbeafe;
  font-family: inherit;
}

.fleet-map-badge,
.fleet-legend,
.fleet-map-actions,
.fleet-weather-status {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.fleet-map-badge {
  left: 14px;
  top: 14px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
}

.fleet-legend {
  left: 14px;
  bottom: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 700;
}

.fleet-map-actions {
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(620px, calc(100% - 470px));
  padding: 7px;
  border-radius: var(--radius-sm);
}

.fleet-map-actions button {
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.fleet-map-actions button:hover {
  background: #fff;
  border-color: rgba(20, 184, 166, 0.75);
}

.fleet-weather-status {
  left: 14px;
  top: 56px;
  max-width: min(520px, calc(100% - 28px));
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 750;
}

.fleet-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-swatch {
  width: 16px;
  height: 10px;
  display: inline-block;
  border-radius: 3px;
}

.legend-arrow {
  width: 18px;
  height: 4px;
  display: inline-block;
  border-radius: 999px;
  position: relative;
}

.legend-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.legend-arrow.wind {
  background: #16a34a;
  color: #16a34a;
}

.legend-swatch.rain { background: rgba(37, 99, 235, 0.82); }
.legend-dot.wave { background: #f97316; }

.fleet-wind-arrow {
  width: 52px !important;
  height: 52px !important;
  display: grid;
  place-items: center;
  color: #16a34a;
  filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.34));
  pointer-events: auto;
}

.fleet-wind-arrow span {
  width: 34px;
  height: 6px;
  display: block;
  border-radius: 999px;
  background: currentColor;
  position: relative;
}

.fleet-wind-arrow span::before {
  content: "";
  position: absolute;
  inset: -7px -9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  z-index: -1;
}

.fleet-wind-arrow span::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 13px;
  height: 13px;
  border-top: 5px solid currentColor;
  border-right: 5px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.fleet-wind-arrow em {
  position: absolute;
  right: 2px;
  bottom: 0;
  min-width: 21px;
  padding: 2px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.fleet-wind-arrow.wind-light {
  color: #22c55e;
}

.fleet-wind-arrow.wind-moderate {
  color: #16a34a;
}

.fleet-wind-arrow.wind-strong {
  color: #f97316;
}

.fleet-wind-marker {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #0f766e;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.25));
}

.fleet-wind-marker span {
  width: 27px;
  height: 4px;
  display: block;
  border-radius: 999px;
  background: currentColor;
  position: relative;
}

.fleet-wind-marker span::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 11px;
  height: 11px;
  border-top: 4px solid currentColor;
  border-right: 4px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.fleet-ship-marker {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.32);
}

.fleet-ship-marker span {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.fleet-ship-marker svg {
  width: 22px;
  height: 22px;
}

.fleet-leaflet-ship {
  width: 42px !important;
  height: 42px !important;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.32);
}

.fleet-leaflet-ship span {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.fleet-leaflet-ship svg {
  width: 22px;
  height: 22px;
}

.fleet-status-panel {
  display: grid;
  gap: 14px;
}

.fleet-vessel-card,
.fleet-wave-summary,
.fleet-mini-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.fleet-vessel-card {
  padding: 18px;
}

.fleet-vessel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.fleet-status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px var(--success-soft);
  margin-top: 5px;
}

.fleet-metrics {
  display: grid;
  gap: 10px;
  margin: 0;
}

.fleet-metrics div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 10px;
}

.fleet-metrics div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.fleet-metrics dt {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.fleet-metrics dd {
  margin: 0;
  text-align: right;
  font-size: 12.5px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.fleet-source-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
}

.fleet-source-badge.source-live {
  border-color: rgba(22, 163, 74, 0.26);
  background: var(--success-soft);
  color: #166534;
}

.fleet-source-badge.source-manual {
  border-color: rgba(245, 158, 11, 0.28);
  background: #fffbeb;
  color: #92400e;
}

.fleet-source-badge.source-sim {
  border-color: rgba(100, 116, 139, 0.24);
  background: #f8fafc;
  color: #475569;
}

.fleet-wave-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(14, 116, 144, 0.08), rgba(20, 184, 166, 0.06)),
    var(--surface);
}

.fleet-data-clarity {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.fleet-data-clarity span,
.fleet-data-clarity p {
  display: block;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.fleet-data-clarity strong {
  display: block;
  margin: 3px 0 4px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.fleet-data-clarity.safe {
  border-color: rgba(22, 163, 74, 0.18);
  background: var(--success-soft);
}

.fleet-data-clarity.watch {
  border-color: rgba(249, 115, 22, 0.22);
  background: #fff7ed;
}

.fleet-data-clarity.danger {
  border-color: rgba(220, 38, 38, 0.22);
  background: #fef2f2;
}

.fleet-wave-summary h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
}

.fleet-wave-summary p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.fleet-wave-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.fleet-wave-facts span,
.fleet-risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 850;
}

.fleet-wave-facts span {
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  color: var(--text);
}

.fleet-risk-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid transparent;
}

.risk-loading {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text-muted);
}

.risk-safe {
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, 0.24);
  color: #166534;
}

.risk-watch {
  background: #fff7ed;
  border-color: rgba(249, 115, 22, 0.28);
  color: #9a3412;
}

.risk-danger {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.28);
  color: #991b1b;
}

.fleet-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fleet-mini-kpi {
  padding: 13px;
  display: grid;
  gap: 4px;
}

.fleet-mini-kpi span {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
}

.fleet-mini-kpi strong {
  font-size: 18px;
  line-height: 1.15;
}

.voyage-active-card {
  display: grid;
  gap: 12px;
}

.voyage-active-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.15;
}

.voyage-active-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.fleet-mini-kpi small {
  color: var(--text-faint);
  font-size: 10.5px;
  line-height: 1.25;
}

.fleet-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.fleet-source-list,
.fleet-integration-steps {
  display: grid;
  gap: 12px;
}

.fleet-source-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.fleet-source-row strong,
.fleet-source-row span {
  display: block;
}

.fleet-source-row span,
.fleet-source-row p,
.fleet-step p {
  color: var(--text-muted);
  font-size: 12px;
}

.fleet-source-row p,
.fleet-step p {
  margin: 0;
}

.fleet-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
}

.fleet-step > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
}

.fleet-step strong {
  display: block;
  margin-bottom: 2px;
}

.fallback-ocean {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(14, 116, 144, 0.78), rgba(37, 99, 235, 0.42)),
    radial-gradient(circle at 18% 26%, rgba(22, 163, 74, 0.38) 0 9%, transparent 10%),
    radial-gradient(circle at 72% 18%, rgba(22, 163, 74, 0.34) 0 7%, transparent 8%),
    radial-gradient(circle at 80% 82%, rgba(22, 163, 74, 0.35) 0 8%, transparent 9%);
}

.fallback-route {
  position: absolute;
  left: 18%;
  top: 54%;
  width: 62%;
  border-top: 4px dashed #f97316;
  transform: rotate(8deg);
}

.fallback-ship,
.fallback-rain,
.fallback-wave {
  position: absolute;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.fallback-ship { left: 55%; top: 48%; }
.fallback-rain { left: 36%; top: 33%; }
.fallback-wave { right: 15%; bottom: 27%; }

@media (max-width: 1180px) {
  .fleet-shell,
  .fleet-detail-grid {
    grid-template-columns: 1fr;
  }

  .fleet-status-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .fleet-map-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .fleet-layer-controls {
    justify-content: flex-start;
  }

  .fleet-map-wrap {
    min-height: 430px;
    height: 62vh;
  }

  .fleet-status-panel,
  .fleet-mini-grid,
  .fleet-source-row {
    grid-template-columns: 1fr;
  }

  .fleet-legend {
    right: 14px;
  }

  .fleet-map-actions {
    right: 10px;
    bottom: 62px;
    flex-wrap: wrap;
    max-width: calc(100% - 20px);
    justify-content: flex-end;
  }

  .fleet-weather-status {
    top: 52px;
  }
}

@media (max-width: 640px) {
  .operation-content-area {
    padding: 14px 10px 20px;
  }

  .operation-topbar {
    gap: 8px;
    padding: 8px 10px;
  }

  .operation-brand img {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .operation-brand-name {
    font-size: 12.5px;
  }

  .operation-brand-sub {
    font-size: 10.5px;
  }

  .operation-topbar-center {
    margin: 0 -10px;
    padding: 0 10px 2px;
  }

  .operation-pill {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .operation-topbar-actions .btn,
  .operation-topbar-actions button {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .fleet-page-header,
  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .page-actions {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .fleet-shell,
  .tracker-core-shell {
    gap: 12px;
  }

  .fleet-map-panel {
    border-radius: var(--radius-sm);
  }

  .fleet-map-toolbar {
    min-height: 0;
    padding: 10px;
    gap: 10px;
  }

  .fleet-map-toolbar h2 {
    font-size: 14px;
  }

  .fleet-layer-controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    margin: 0 -10px;
    padding: 0 10px 2px;
    -webkit-overflow-scrolling: touch;
  }

  .fleet-layer-toggle {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .fleet-map-wrap,
  .tracker-core-map-wrap {
    height: 58vh;
    min-height: 360px;
    max-height: 520px;
  }

  .fleet-map-badge {
    left: 10px;
    top: 10px;
    max-width: calc(100% - 20px);
    padding: 6px 8px;
    font-size: 10.5px;
  }

  .fleet-weather-status {
    left: 10px;
    top: 44px;
    max-width: calc(100% - 20px);
    padding: 6px 8px;
    font-size: 10.5px;
  }

  .fleet-map-actions {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .fleet-map-actions button {
    flex: 0 0 auto;
    height: 30px;
    min-width: 32px;
    padding: 0 8px;
    font-size: 11px;
  }

  .fleet-legend {
    display: none;
  }

  .fleet-status-panel,
  .tracker-core-panel {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .fleet-metrics {
    grid-template-columns: 1fr;
  }

  .fleet-metrics dd,
  .tracker-fact strong,
  .tracker-fact small {
    overflow-wrap: anywhere;
  }

  .tracker-fact {
    padding: 10px;
  }

  .tracker-fact strong {
    font-size: 15px;
  }

  .fleet-wave-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

/* ---------------------------------------------------------------------- */
/* Forms                                                                    */
/* ---------------------------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
}

.form-grid.cols-1 {
  grid-template-columns: 1fr;
}

.form-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Financial statements may contain long account names and large Rupiah
   values. minmax(0, 1fr) lets both columns shrink inside the workspace;
   each panel then handles its own table instead of pushing its neighbour
   beyond the right edge. */
.accounting-statement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 100%;
}

.accounting-statement-grid > * {
  min-width: 0;
}

.accounting-statement-grid .data-table {
  min-width: 0;
  table-layout: fixed;
}

.accounting-statement-grid .data-table td:first-child {
  overflow-wrap: anywhere;
}

.accounting-statement-grid .data-table td:last-child {
  width: 42%;
  white-space: nowrap;
}

.accounting-export-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin: -4px 0 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field.span-2 {
  grid-column: span 2;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.field .hint {
  font-size: 11px;
  color: var(--text-faint);
}

.field .error {
  font-size: 11.5px;
  color: var(--danger);
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: 0.2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: var(--shadow-sm);
}

.switch input:checked + .switch-slider {
  background: var(--accent);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-left: 34px;
}

.input-with-icon svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.filter-bar select,
.filter-bar input {
  width: auto;
  min-width: 140px;
}

.filter-bar .search-field {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

/* ---------------------------------------------------------------------- */
/* Tables                                                                   */
/* ---------------------------------------------------------------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.3px;
  min-width: 640px;
}

table.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

table.data-table tbody tr {
  transition: background 0.12s ease;
}

table.data-table tbody tr:hover {
  background: var(--surface-alt);
}

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination {
  display: flex;
  gap: 4px;
}

.pagination button {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}

.pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---------------------------------------------------------------------- */
/* Badges                                                                   */
/* ---------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-draft { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.badge-approved { background: var(--info-soft); color: var(--info); }
.badge-sent { background: #eef2ff; color: #4f46e5; }
.badge-paid { background: var(--success-soft); color: var(--success); }
.badge-void { background: var(--danger-soft); color: var(--danger); }
.badge-partial { background: var(--warning-soft); color: var(--warning); }
.badge-unpaid { background: var(--danger-soft); color: var(--danger); }
.badge-overpaid { background: var(--info-soft); color: var(--info); }
.badge-cancelled { background: var(--surface-alt); color: var(--text-faint); }
.badge-received { background: var(--success-soft); color: var(--success); }
.badge-pending { background: var(--warning-soft); color: var(--warning); }
.badge-waiting_approval { background: var(--warning-soft); color: var(--warning); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-partially_received { background: var(--info-soft); color: var(--info); }
.badge-completed { background: var(--success-soft); color: var(--success); }

/* ---------------------------------------------------------------------- */
/* Empty states                                                             */
/* ---------------------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--text-faint);
}

.empty-state .empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 13px;
  max-width: 340px;
}

/* ---------------------------------------------------------------------- */
/* Modals                                                                   */
/* ---------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.18s ease;
  overflow-y: auto;
}

.modal-overlay.modal-in {
  opacity: 1;
}
.modal-overlay.modal-out {
  opacity: 0;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.18s ease;
  margin: auto;
}

.modal-overlay.modal-in .modal-card {
  transform: translateY(0) scale(1);
}

.modal-card.modal-sm {
  max-width: 420px;
}
.modal-card.modal-lg {
  max-width: 920px;
}
.modal-card.modal-xl {
  max-width: 1180px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
}
.modal-close:hover {
  background: var(--surface-alt);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-message {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------------- */
/* Toasts                                                                   */
/* ---------------------------------------------------------------------- */

#toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.22s ease;
}

.toast-in {
  opacity: 1;
  transform: translateX(0);
}

.toast-out {
  opacity: 0;
  transform: translateX(30px);
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

/* ---------------------------------------------------------------------- */
/* Tabs                                                                     */
/* ---------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------------- */
/* Skeleton / loading                                                       */
/* ---------------------------------------------------------------------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 37%, var(--surface-alt) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 300;
}

/* ---------------------------------------------------------------------- */
/* Invoice line-item editor                                                 */
/* ---------------------------------------------------------------------- */

.item-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
  gap: 8px;
  align-items: start;
  background: var(--surface-alt);
  padding: 10px;
  border-radius: var(--radius-md);
}

.item-row-header {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
  gap: 8px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-faint);
}

.item-subtotal-display {
  padding: 9px 4px;
  font-weight: 700;
  font-size: 13px;
  text-align: right;
}

/* Purchase Order item rows have two extra columns (Discount, Remarks) */
.po-item-row,
.po-item-row-header {
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 0.6fr) minmax(0, 0.8fr) minmax(0, 0.9fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1fr) auto;
}

/* ---------------------------------------------------------------------- */
/* Invoice preview (kop surat)                                              */
/* ---------------------------------------------------------------------- */

.invoice-preview-wrap {
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow-x: auto;
}

#invoice-print-area {
  width: 210mm;
  min-height: 148mm;
  margin: 0 auto;
  background: #fff;
  color: #141b2e;
  padding: 12mm;
  font-family: Arial, Helvetica, sans-serif;
  box-shadow: var(--shadow-md);
  font-size: 11px;
}

/* ---------------------------------------------------------------------- */
/* Attachments / dropzone                                                   */
/* ---------------------------------------------------------------------- */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--navy);
}

/* ---------------------------------------------------------------------- */
/* AI document upload (auto-fill from NPWP / vendor quotation)              */
/* ---------------------------------------------------------------------- */

.ai-dropzone {
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  text-align: center;
  color: var(--text);
  background: var(--accent-soft);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 16px;
}

.ai-dropzone.dragover {
  border-color: var(--teal-dark);
  background: var(--accent-soft);
  filter: brightness(0.98);
}

.ai-dropzone.busy {
  cursor: wait;
  opacity: 0.75;
}

.ai-dropzone-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--teal-dark);
  text-transform: uppercase;
}

.ai-dropzone-badge svg {
  width: 14px;
  height: 14px;
}

.ai-dropzone p {
  margin: 4px 0 0;
}

.ai-dropzone .ai-dropzone-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.ai-dropzone .ai-dropzone-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.attachment-item .file-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attachment-item .file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.attachment-item .file-size {
  color: var(--text-faint);
  font-size: 11.5px;
}

/* ---------------------------------------------------------------------- */
/* Avatar / upload circles                                                  */
/* ---------------------------------------------------------------------- */

.upload-box {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: var(--surface-alt);
  flex-shrink: 0;
  position: relative;
}

.upload-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.upload-box .upload-placeholder {
  color: var(--text-faint);
  font-size: 10.5px;
  text-align: center;
  padding: 6px;
}

/* ---------------------------------------------------------------------- */
/* Misc utility                                                             */
/* ---------------------------------------------------------------------- */

.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }

.section-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.detail-kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.detail-kv div:last-child { border-bottom: none; }
.detail-kv span { color: var(--text-muted); }
.detail-kv strong { text-align: right; font-weight: 600; word-break: break-word; }

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 18px;
}

.banner-warning {
  background: var(--warning-soft);
  color: #92440a;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                               */
/* ---------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.span-2 {
    grid-column: span 1;
  }
  .form-grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .accounting-statement-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  #app-shell {
    grid-template-columns: 1fr;
  }

  #app-shell.sidebar-collapsed { grid-template-columns: 1fr; }

  .sidebar {
    width: min(var(--sidebar-width), calc(100vw - 28px));
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  #app-shell.sidebar-collapsed .sidebar { width: min(var(--sidebar-width), calc(100vw - 28px)); }
  #app-shell.sidebar-collapsed .sidebar-header { justify-content: flex-start; padding: 14px; }
  #app-shell.sidebar-collapsed .sidebar-brand-copy,
  #app-shell.sidebar-collapsed .sidebar-link-text,
  #app-shell.sidebar-collapsed .sidebar-group-title,
  #app-shell.sidebar-collapsed .sidebar-group-chevron,
  #app-shell.sidebar-collapsed .sidebar-footer { display: initial; }
  #app-shell.sidebar-collapsed .sidebar-brand-copy,
  #app-shell.sidebar-collapsed .sidebar-group-title,
  #app-shell.sidebar-collapsed .sidebar-footer { display: block; }
  #app-shell.sidebar-collapsed .sidebar-group-chevron { display: inline-flex; }
  #app-shell.sidebar-collapsed .sidebar-link,
  #app-shell.sidebar-collapsed .sidebar-group-toggle {
    width: 100%;
    height: auto;
    min-height: 48px;
    padding: 11px 13px;
    margin: 0 0 7px;
    justify-content: flex-start;
  }
  #app-shell.sidebar-collapsed .sidebar-group-items:not([hidden]) { display: block; }
  #app-shell.sidebar-collapsed .sidebar-collapse-btn,
  .sidebar-collapse-btn { display: none; }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 39;
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .main-area {
    grid-column: 1;
  }

  .hamburger-btn {
    display: inline-flex;
  }

  .form-grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .item-row,
  .item-row-header,
  .po-item-row,
  .po-item-row-header {
    grid-template-columns: 1fr;
  }

  .item-row-header,
  .po-item-row-header {
    display: none;
  }

  .item-row,
  .po-item-row {
    position: relative;
  }

  .item-row .field label {
    display: block;
  }
}

@media (max-width: 640px) {
  .content-area {
    padding: 14px;
  }

  .topbar {
    padding: 0 14px;
  }

  .kpi-grid {
    /* Single column through phone widths (was 1fr 1fr here, 1fr only
       below 420px) — two columns left too little width for a large
       Rupiah value to stay readable without shrinking/wrapping more
       than necessary; one column gives each amount the full card width. */
    grid-template-columns: 1fr;
  }

  .kpi-card {
    padding: 14px 16px;
  }

  .kpi-icon {
    width: 28px;
    height: 28px;
  }

  .kpi-icon svg {
    width: 14px;
    height: 14px;
  }

  .page-header {
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .modal-body {
    padding: 16px;
  }

  #invoice-print-area {
    width: 100%;
    padding: 5mm;
    font-size: 9.5px;
  }
}

/* ---------------------------------------------------------------------- */
/* Print                                                                    */
/* ---------------------------------------------------------------------- */

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 12mm 14mm 12mm;
  }
  html, body {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #app-shell > .sidebar,
  #app-shell > .main-area > .topbar,
  .no-print,
  #toast-container,
  .sidebar-backdrop {
    display: none !important;
  }
  .main-area {
    grid-column: 1 / -1;
  }
  .content-area {
    padding: 0 !important;
  }
  .invoice-preview-wrap {
    padding: 0;
    background: none;
    overflow: visible;
  }
  #invoice-print-area {
    width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
  }
  /* Keep the signature/materai sign-off block (js/components/signature-
     block.js) whole on one page when the browser's own print/print-preview
     paginates a long invoice/PO across pages — never split mid-signature/
     mid-stamp onto two pages. The equivalent for the "Export PDF" download
     button (a separate, html2canvas-based path) is handled in js/pdf-
     export.js's own page-slicing logic instead, since window.print() never
     runs that code. */
  .signoff-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body * {
    visibility: hidden;
  }
  #invoice-print-area, #invoice-print-area * {
    visibility: visible;
  }
  #invoice-print-area {
    position: absolute;
    left: 0;
    top: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Auth screen (login gate)                                            */
/* ------------------------------------------------------------------ */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 36px 32px;
  text-align: center;
}
.auth-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 0 auto 14px;
  display: block;
}
.auth-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}
.auth-subtitle {
  font-size: 13px;
  margin: 0 0 24px;
}
#login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}
.auth-error {
  margin: -6px 0 0;
  font-size: 12.5px;
}

/* ------------------------------------------------------------------ */
/* Module selector and Operation Kapal shell                           */
/* ------------------------------------------------------------------ */
.module-select-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.module-select-shell {
  width: min(960px, 100%);
}

.module-select-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.module-select-header .auth-logo {
  margin: 0;
  flex: 0 0 56px;
}

.module-select-header h1 {
  font-size: 24px;
  line-height: 1.2;
}

.module-select-header p {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: 4px;
}

.module-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.module-card-button {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
}

.module-card-button:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.module-card-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
}

.module-card-operation .module-card-icon {
  background: var(--accent-soft);
  color: var(--teal-dark);
}

.module-card-icon svg {
  width: 24px;
  height: 24px;
}

.module-card-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.module-card-copy {
  max-width: 390px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.module-select-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.module-no-access {
  grid-column: 1 / -1;
  text-align: center;
}

.module-denied-card {
  width: min(460px, 100%);
  text-align: center;
}

.module-denied-card h1 {
  font-size: 22px;
  margin: 10px 0 6px;
}

#operation-shell {
  min-height: 100vh;
  background: var(--bg);
}

.operation-topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.8fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}

.operation-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.operation-brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex: 0 0 38px;
}

.operation-brand-name {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.operation-brand-sub {
  color: var(--text-muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.operation-topbar-center {
  display: flex;
  justify-content: flex-start;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.operation-topbar-center::-webkit-scrollbar {
  display: none;
}

.operation-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}

.operation-pill:hover,
.operation-setup-menu[open] > .operation-pill {
  background: var(--surface-alt);
  color: var(--text);
}

.operation-pill.active {
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--text);
}

.operation-pill svg {
  width: 14px;
  height: 14px;
}

.operation-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.operation-content-area {
  padding: 22px;
  min-width: 0;
}

.operation-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.operation-entry-form,
.operation-entry-help {
  min-width: 0;
}

.gps-health-grid,
.engine-health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.gps-health-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.gps-health-card span,
.gps-health-card small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.gps-health-card strong {
  display: block;
  margin: 4px 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.gps-health-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.gps-health-pill.health-online {
  background: var(--success-soft);
  color: var(--success);
}

.gps-health-pill.health-late {
  background: var(--warning-soft);
  color: var(--warning);
}

.gps-health-pill.health-offline {
  background: var(--danger-soft);
  color: var(--danger);
}

.gps-health-pill.health-inactive {
  background: var(--surface-alt);
  color: var(--text-muted);
}

.alert-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.alert-kpi-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.alert-kpi-card span,
.alert-kpi-card small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.alert-kpi-card strong {
  display: block;
  margin: 4px 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.05;
}

.alert-kpi-card em {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
}

.alert-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.42fr);
  gap: 16px;
  align-items: start;
}

.alert-list {
  display: grid;
  gap: 10px;
}

.alert-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.alert-row h3 {
  margin: 4px 0 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.alert-row p,
.alert-row small {
  display: block;
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.alert-type {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.alert-watch {
  border-color: rgba(249, 115, 22, 0.24);
  background: #fff7ed;
}

.alert-danger {
  border-color: rgba(220, 38, 38, 0.24);
  background: #fef2f2;
}

.alert-vessel-facts {
  margin-bottom: 14px;
}

.alert-rule-box {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.alert-rule-box strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 13px;
}

.alert-rule-box p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.alert-action-grid,
.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.alert-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.alert-action-card,
.history-summary-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.alert-action-card span,
.history-summary-card span,
.history-summary-card small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.alert-action-card span {
  width: fit-content;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.alert-action-card strong,
.history-summary-card strong {
  display: block;
  margin: 6px 0 4px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.history-summary-card strong {
  font-size: 20px;
}

.alert-action-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.action-safe {
  border-color: rgba(22, 163, 74, 0.18);
  background: var(--success-soft);
}

.action-watch {
  border-color: rgba(249, 115, 22, 0.22);
  background: #fff7ed;
}

.action-danger {
  border-color: rgba(220, 38, 38, 0.22);
  background: #fef2f2;
}

.compact-empty {
  min-height: 220px;
}

.gps-endpoint-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.gps-endpoint-box span {
  width: fit-content;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.gps-endpoint-box code,
.gps-payload-example {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.gps-test-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.gps-test-toolbar p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.gps-readiness-list {
  display: grid;
  gap: 10px;
}

.gps-readiness-list div {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.gps-readiness-list strong,
.gps-readiness-list span {
  display: block;
  font-size: 12px;
  line-height: 1.4;
}

.gps-readiness-list strong {
  color: var(--text);
}

.gps-readiness-list span {
  margin-top: 2px;
  color: var(--text-muted);
}

.gps-copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.operation-setup-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.operation-setup-card {
  min-width: 0;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.operation-setup-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.operation-setup-card-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--primary);
}

.operation-setup-card-icon svg {
  width: 17px;
  height: 17px;
}

.operation-setup-card-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.operation-setup-card strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.operation-setup-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.pilot-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.pilot-hero h2 {
  margin: 4px 0;
  font-size: 24px;
  line-height: 1.15;
}

.pilot-hero p,
.pilot-kpi small,
.pilot-check p,
.pilot-timeline-item p,
.pilot-log-row p,
.logbook-row p,
.handoff-rule p,
.operation-report-notes p,
.operation-report-timeline-row p,
.operation-report-log-table p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.pilot-hero-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
}

.readiness-score {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  text-align: center;
}

.readiness-score strong {
  display: block;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.readiness-score span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.readiness-score.ready {
  border-color: rgba(22, 163, 74, 0.28);
  background: var(--success-soft);
}

.readiness-score.watch {
  border-color: rgba(217, 119, 6, 0.28);
  background: var(--warning-soft);
}

.readiness-score.danger {
  border-color: rgba(220, 38, 38, 0.28);
  background: var(--danger-soft);
}

.pilot-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.pilot-kpi {
  position: relative;
  min-width: 0;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.pilot-kpi span,
.pilot-kpi small {
  display: block;
  font-size: 12px;
}

.pilot-kpi span {
  color: var(--text-muted);
  font-weight: 800;
}

.pilot-kpi strong {
  display: block;
  margin: 7px 0 3px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
}

.pilot-kpi i {
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
}

.pilot-layout,
.logbook-layout,
.handoff-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.42fr);
  gap: 16px;
}

.handoff-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.operation-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.42fr);
  gap: 16px;
  margin-bottom: 16px;
}

.pilot-checklist,
.pilot-timeline,
.pilot-log-list,
.pilot-action-list,
.logbook-list,
.handoff-rules,
.watchlist-rules {
  display: grid;
  gap: 10px;
}

.pilot-check,
.pilot-timeline-item,
.logbook-row,
.handoff-rule {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.pilot-check > span {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  background: var(--warning);
}

.pilot-check.ok > span {
  background: var(--success);
}

.pilot-check svg {
  width: 15px;
  height: 15px;
}

.pilot-check strong,
.pilot-timeline-item strong,
.handoff-rule strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}

.pilot-timeline-item {
  position: relative;
}

.pilot-timeline-item > span,
.handoff-rule > span {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: var(--warning);
}

.pilot-timeline-item.ok > span {
  background: var(--success);
}

.pilot-timeline-item small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.pilot-log-row,
.pilot-action-list a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-alt);
  text-decoration: none;
}

.pilot-log-row strong,
.logbook-row h3 {
  display: block;
  margin: 0 0 4px;
  color: var(--text);
  font-size: 15px;
}

.pilot-log-row small,
.logbook-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.pilot-action-list a {
  align-items: center;
  font-weight: 800;
}

.pilot-action-list svg {
  width: 17px;
  height: 17px;
  color: var(--primary);
}

.logbook-form {
  display: grid;
  gap: 14px;
}

.logbook-row {
  display: block;
}

.logbook-row-head,
.handoff-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.handoff-card h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.handoff-code {
  max-height: 300px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.45;
}

.handoff-rule > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.watchlist-rule {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.watchlist-rule > span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
}

.watchlist-rule.watch > span {
  background: var(--warning);
}

.watchlist-rule.danger > span {
  background: var(--danger);
}

.watchlist-rule strong,
.voyage-progress-head strong {
  display: block;
  color: var(--text);
}

.watchlist-rule p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.watchlist-rule em {
  color: var(--text-muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.voyage-progress-box {
  display: grid;
  gap: 12px;
}

.voyage-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.voyage-progress-head span {
  color: var(--text-muted);
  font-size: 12px;
}

.voyage-progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-alt);
}

.voyage-progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.operation-report-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.35fr) auto;
  gap: 12px;
  align-items: end;
}

.operation-report-paper {
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.operation-report-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.operation-report-title span,
.operation-report-summary span,
.operation-report-title small,
.operation-report-log-table small {
  color: var(--text-muted);
  font-size: 12px;
}

.operation-report-title h2 {
  margin: 4px 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.15;
}

.operation-report-title strong {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  text-align: right;
}

.operation-report-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.operation-report-summary div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.operation-report-summary strong,
.operation-report-summary small {
  display: block;
}

.operation-report-summary strong {
  margin: 6px 0 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.operation-report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.38fr);
  gap: 16px;
  margin-top: 16px;
}

.operation-report-grid h3,
.operation-report-section h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 16px;
}

.operation-report-notes {
  display: grid;
  gap: 8px;
}

.operation-report-notes p {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.operation-report-section {
  margin-top: 18px;
}

.operation-report-timeline,
.operation-report-log-table,
.operation-report-watchlist {
  display: grid;
  gap: 10px;
}

.operation-report-timeline-row,
.operation-report-log-table article {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.operation-report-timeline-row.info {
  border-left-color: var(--primary);
}

.operation-report-timeline-row.watch {
  border-left-color: var(--warning);
}

.operation-report-timeline-row.danger {
  border-left-color: var(--danger);
}

.operation-report-timeline-row > span,
.operation-report-log-table article > span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.operation-report-timeline-row strong,
.operation-report-log-table strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.operation-report-watch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.operation-report-watch-row.safe {
  border-left-color: var(--success);
}

.operation-report-watch-row.watch {
  border-left-color: var(--warning);
}

.operation-report-watch-row.danger {
  border-left-color: var(--danger);
}

.operation-report-watch-row strong {
  color: var(--text);
}

.operation-report-watch-row span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.operation-report-watch-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-muted);
}

.contract-response-grid,
.pilot-test-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.contract-response-card,
.pilot-test-step {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.contract-response-card strong,
.pilot-test-step strong {
  display: block;
  color: var(--text);
}

.pilot-test-step {
  display: flex;
  gap: 12px;
}

.pilot-test-step > span {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.pilot-test-step p {
  margin: 3px 0 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.tracker-core-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.32fr);
  gap: 16px;
}

.tracker-core-map-wrap {
  min-height: 620px;
}

.tracker-core-panel {
  display: grid;
  gap: 10px;
}

.tracker-fact {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tracker-fact span,
.tracker-fact small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.tracker-fact strong {
  display: block;
  margin: 5px 0 4px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.2;
}

.tracker-core-weather {
  margin-top: 0;
}

.telemetry-qa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.telemetry-qa-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.telemetry-readiness-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 16px;
  align-items: start;
}

.telemetry-gate-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.telemetry-gate {
  display: grid;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.telemetry-gate strong,
.telemetry-gate p {
  display: block;
  margin: 0;
  line-height: 1.35;
}

.telemetry-gate strong {
  color: var(--text);
  font-size: 13px;
}

.telemetry-gate p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.gate-safe {
  border-color: rgba(22, 163, 74, 0.18);
}

.gate-watch {
  border-color: rgba(249, 115, 22, 0.24);
}

.gate-danger {
  border-color: rgba(220, 38, 38, 0.24);
}

.telemetry-vessel-facts {
  margin-bottom: 14px;
}

.telemetry-contract-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.telemetry-contract-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.telemetry-contract-card strong,
.telemetry-contract-card span {
  display: block;
  line-height: 1.35;
}

.telemetry-contract-card strong {
  color: var(--text);
  font-size: 14px;
}

.telemetry-contract-card span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.telemetry-contract-card pre {
  max-height: 230px;
  margin: 12px 0 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.telemetry-checklist {
  display: grid;
  gap: 10px;
}

.telemetry-checklist-compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.telemetry-check-item {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.telemetry-check-item span {
  width: fit-content;
  min-width: 42px;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.telemetry-check-item.checked span {
  background: var(--success-soft);
  color: var(--success);
}

.telemetry-check-item strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.telemetry-log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.telemetry-log-grid > div {
  min-width: 0;
}

.telemetry-log-grid > div > strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
}

.telemetry-soft-summary {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.telemetry-soft-summary span,
.telemetry-soft-summary p {
  display: block;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.telemetry-soft-summary strong {
  display: block;
  margin: 4px 0;
  color: var(--text);
  font-size: 14px;
}

.telemetry-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 850;
  list-style-position: outside;
}

.telemetry-details summary::marker {
  color: var(--text-muted);
}

.position-history-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
}

.history-summary-grid {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.position-history-map-wrap {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.position-history-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.position-history-map-head strong {
  display: block;
  font-size: 14px;
}

.position-history-map-head span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.engine-history-head {
  padding: 14px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.position-history-map {
  height: 360px;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #dbeafe;
}

.gps-payload-example {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.55;
}

.gps-test-result {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  font-size: 13px;
  line-height: 1.45;
}

.gps-test-result.success {
  border-color: rgba(22, 163, 74, 0.28);
  background: var(--success-soft);
}

.gps-test-result.error {
  border-color: rgba(220, 38, 38, 0.28);
  background: #fef2f2;
  color: #991b1b;
}

.gps-test-result p {
  margin: 0;
}

.gps-test-result pre {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  font-size: 11.5px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .module-card-grid,
  .operation-entry-grid,
  .gps-health-grid,
  .engine-health-grid,
  .alert-kpi-grid,
  .alert-layout,
  .alert-action-grid,
  .history-summary-grid,
  .position-history-filters,
  .operation-report-filter,
  .operation-report-summary,
  .operation-report-grid,
  .operation-control-grid,
  .contract-response-grid,
  .pilot-test-grid,
  .tracker-core-shell,
  .pilot-kpi-grid,
  .pilot-layout,
  .logbook-layout,
  .handoff-grid,
  .telemetry-readiness-layout,
  .telemetry-gate-list,
  .telemetry-qa-grid-compact,
  .telemetry-contract-grid,
  .telemetry-checklist-compact,
  .telemetry-log-grid,
  .operation-setup-grid,
  .operation-topbar {
    grid-template-columns: 1fr;
  }

  .operation-topbar-center {
    justify-content: flex-start;
  }

  .operation-topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .pilot-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .pilot-hero-actions {
    align-items: flex-start;
  }

  .operation-report-title {
    flex-direction: column;
  }

  .operation-report-title strong {
    text-align: left;
  }

  .operation-report-timeline-row,
  .operation-report-log-table article {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .no-print,
  .operation-topbar,
  #toast-container,
  #dialog-root {
    display: none !important;
  }

  .operation-content-area {
    padding: 0 !important;
  }

  .operation-report-paper {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  .module-select-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .module-card-button {
    min-height: 210px;
  }

  .module-select-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ---------------------------------------------------------------------- */
/* Uang Muka / DP Customer (section di form invoice, dialog, ringkasan)     */
/* ---------------------------------------------------------------------- */
#dp-section .hint,
.modal-body .hint {
  font-size: 11.5px;
  color: var(--text-faint);
  margin: 6px 0 0;
}

#dp-existing-table {
  min-width: 760px;
}

#dp-existing-table th,
#dp-existing-table td {
  padding: 8px 10px;
}

#dp-existing-table th {
  font-size: 10.5px;
}

#dp-summary-card {
  max-width: 460px;
  margin-left: auto;
}

.mapping-category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
[data-for][hidden] { display: none !important; }
.voucher-lines { min-width: 820px; }
.voucher-lines td:first-child { min-width: 210px; }
.voucher-lines input[type="number"] { width: 115px; }
.mapping-category { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.mapping-category-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mapping-category-heading h3 { margin: 0; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.mapping-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; }
.mapping-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 6px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.mapping-chip > span { min-width: 0; overflow-wrap: anywhere; }
.mapping-chip .btn { flex: 0 0 28px; width: 28px; height: 28px; }
.mapping-category .field select, .mapping-category .field input { max-width: 100%; min-width: 0; width: 100%; }
@media (max-width: 1000px) { .mapping-category-grid { grid-template-columns: minmax(0, 1fr); } }

.dp-detail-row td,
.dp-planned-row td {
  line-height: 1.35;
}

#voucher-search, #estimate-search {
  min-height:38px; padding:9px 12px; border:1px solid var(--border,#dbe3ec);
  border-radius:6px; background:var(--surface,#fff); color:inherit; min-width:0; flex:1;
}

/* Operations certificates use the existing app shell and controls. */
.cert-workspace{min-width:0;max-width:1600px;margin:0 auto}
.cert-workspace .page-header{align-items:flex-start}
.cert-tabs{display:flex;gap:6px;border-bottom:1px solid var(--border,#dbe3ec);margin:0 0 24px;overflow-x:auto;padding-bottom:0}
.cert-tabs a{flex:none;padding:13px 15px;text-decoration:none;color:var(--text-muted,#62738d);border-bottom:3px solid transparent;font-weight:600;white-space:nowrap}
.cert-tabs a.active{border-color:#178e88;color:var(--text,#182d39)}
.cert-filters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;align-items:end;margin-bottom:20px}
.cert-filters input,.cert-filters select{width:100%;min-width:0}
.cert-filters .checkbox-row{min-height:40px}
table.cert-table{min-width:1100px}
.cert-table td{vertical-align:top;max-width:280px;overflow-wrap:anywhere}
.cert-row-actions{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.cert-table .cert-row-actions{flex-wrap:nowrap}
.cert-row-actions .btn-icon{width:34px;height:34px;flex:0 0 34px}
.cert-modal>form{display:flex;flex-direction:column;max-height:90vh;min-height:0}
.cert-modal .modal-header,.cert-modal .modal-footer{flex-shrink:0}
.cert-ai-upload{border:1px dashed var(--border);border-radius:6px;padding:16px;margin-bottom:22px;background:var(--surface-alt)}
.cert-ai-upload.drag-over{border-color:#178e88;background:#eaf6f3}
.cert-ai-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.cert-ai-status{font-size:13px;margin:10px 0;overflow-wrap:anywhere}
.cert-ai-result{border-top:1px solid var(--border);padding-top:14px;margin-top:14px}
.cert-ai-values{display:grid;grid-template-columns:minmax(100px,1fr) minmax(0,2fr);gap:8px 14px;font-size:13px;margin:12px 0}
.cert-ai-values dt{color:var(--text-muted)}
.cert-ai-values dd{margin:0;overflow-wrap:anywhere;white-space:pre-wrap}
.cert-ai-upload .is-error{color:#a62c42}
.cert-ai-confirm{margin-top:14px}
.cert-ai-upload [hidden]{display:none!important}
@media(max-width:520px){.cert-ai-toolbar .cert-row-actions{width:100%}.cert-ai-toolbar .btn{flex:1}.cert-ai-values{grid-template-columns:minmax(0,1fr)}.cert-ai-values dd{margin-bottom:8px}}
.cert-status{display:inline-flex;align-items:center;min-height:27px;padding:4px 8px;border-radius:4px;font-size:12px;font-weight:600;white-space:nowrap}
.cert-valid,.cert-no_expiry{background:#eaf6f3;color:#17634f}
.cert-90,.cert-60{background:#eaf1fd;color:#245692}
.cert-30,.cert-14{background:#fff4da;color:#805617}
.cert-7,.cert-due,.cert-overdue{background:#fff0f1;color:#a62c42}
.cert-kpis{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.cert-kpi{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:18px;text-decoration:none;border:1px solid var(--border,#dbe3ec);border-radius:6px;min-height:82px}
.cert-kpi strong{font-size:27px;font-variant-numeric:tabular-nums}
.cert-kpi span{font-size:14px;font-weight:600;overflow-wrap:anywhere}
.cert-job-status{padding:16px 0;color:var(--text-muted,#62738d);font-size:13px}
.cert-section-heading{font-size:18px;margin:20px 0 14px}
.cert-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:0 0 20px}
.cert-detail-grid dt{font-size:12px;color:var(--text-muted,#62738d)}
.cert-detail-grid dd{margin:5px 0 0;overflow-wrap:anywhere}
.cert-notes{white-space:pre-wrap;overflow-wrap:anywhere}
.cert-preview{display:flex;justify-content:center;min-height:300px}
.cert-preview iframe{width:100%;height:65vh;border:0}
.cert-preview img{max-width:100%;max-height:65vh;object-fit:contain}
.cert-directory-search,.cert-history-event{max-width:360px;margin-bottom:18px}
.cert-notification-list{border-top:1px solid var(--border,#dbe3ec)}
.cert-notification{display:flex;justify-content:space-between;gap:16px;padding:18px 14px;border-bottom:1px solid var(--border,#dbe3ec)}
.cert-notification.unread{border-left:3px solid #178e88;background:var(--surface,#fff)}
.cert-notification p{margin:7px 0;font-size:14px}
.cert-notification small{color:var(--text-muted,#62738d)}
@media(max-width:900px){.cert-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.cert-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.cert-workspace h1{font-size:24px}.cert-tabs a{padding:12px 10px}.cert-filters{grid-template-columns:minmax(0,1fr)}.cert-detail-grid{grid-template-columns:minmax(0,1fr)}.cert-notification{flex-direction:column}.cert-kpi{padding:14px;gap:8px}.cert-kpi strong{font-size:24px}.cert-preview iframe{height:55vh}}

@media (max-width: 640px) {
  #dp-summary-card {
    max-width: none;
  }
}

/* Operational weather readout: model values stay separate from vessel GPS. */
.fleet-weather-readout {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:16px;background:#f8fafc;border-top:1px solid #cbd5e1;color:#0f172a}
.fleet-weather-item {min-width:0;padding:12px;border:1px solid #cbd5e1;border-radius:10px;background:white}
.fleet-weather-item h3 {margin:0 0 10px;font-size:13px;line-height:1.5}
.fleet-weather-item h3 small {display:block;color:#475569;font-size:11px;overflow-wrap:anywhere}
.fleet-weather-item strong {font-size:17px}
.fleet-weather-item p {font-size:12px;line-height:1.8;margin:8px 0}
.fleet-weather-item>small,.fleet-weather-note {font-size:11px;line-height:1.6;color:#475569}
.fleet-weather-item.is-off {background:#f1f5f9}
.fleet-weather-note {grid-column:1/-1;margin:0}
.fleet-rain-label {text-align:center;color:#172554;font-size:13px;font-weight:800;background:#fff;border:1px solid #93c5fd;border-radius:5px;box-shadow:0 1px 3px #33415566;line-height:1.1;padding:2px;pointer-events:none}
.fleet-rain-label small {display:block;font-size:9px}
.fleet-wind-arrow em {font-size:11px;white-space:nowrap;right:-9px;bottom:-4px;border:1px solid #94a3b8}
.fleet-wind-arrow.wind-moderate {color:#0f766e}
.fleet-map-badge,.fleet-weather-status,.fleet-map-actions {z-index:1000}
.fleet-map-badge {max-width:calc(100% - 80px);font-size:10px;left:55px}
.fleet-weather-status {left:55px;max-width:calc(100% - 80px)}
.fleet-map-actions {max-width:calc(100% - 28px)}
@media(max-width:760px) {.fleet-weather-readout {grid-template-columns:1fr}.fleet-weather-item strong {font-size:16px}.fleet-map-badge{display:none}.fleet-weather-status{top:12px;font-size:10px}}
