:root {
  --bg-base: #070b12;
  --bg-surface: #0d1421;
  --bg-elevated: #131d2f;
  --bg-glass: rgba(15, 24, 40, 0.82);
  --border-subtle: rgba(148, 163, 184, 0.14);
  --border-accent: rgba(16, 185, 129, 0.38);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.22);
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.22);
  --accent-yandex: #fc3f1d;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --shadow-card: 0 14px 34px -8px rgba(0, 0, 0, 0.55);
  --radius-lg: 14px;
  --radius-md: 10px;
}

[data-theme="light"] {
  --bg-base: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --border-subtle: rgba(15, 23, 42, 0.1);
  --border-accent: rgba(5, 150, 105, 0.4);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* App Layout */
.os-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.os-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, #10b981 0%, #f59e0b 55%, #fc3f1d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #06101e;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--accent-emerald);
  font-weight: 600;
  margin-top: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 14px 20px 6px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 10px;
  flex: 1;
  overflow-y: auto;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
}

.nav-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-btn.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.16) 0%, rgba(245, 158, 11, 0.06) 100%);
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.nav-btn .nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--bg-elevated);
  color: var(--accent-gold);
  border: 1px solid var(--border-subtle);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: 11.5px;
}

.corridor-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--accent-emerald);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Main Content Area */
.os-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.os-topbar {
  height: 64px;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 14px;
}

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

.Rate-ticker {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  background: var(--bg-elevated);
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.ticker-val {
  font-weight: 700;
  color: var(--accent-gold);
}

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

.os-workspace {
  padding: 24px 28px 60px;
  max-width: 1620px;
  width: 100%;
  margin: 0 auto;
}

/* Buttons & Badges */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  transition: all 0.16s ease;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--accent-emerald);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #04130d;
  border-color: transparent;
  font-weight: 700;
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #140b00;
  border-color: transparent;
  font-weight: 700;
}

.btn-yandex {
  background: linear-gradient(135deg, #fc3f1d 0%, #dc2626 100%);
  color: #ffffff;
  border-color: transparent;
  font-weight: 700;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-gold {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-yandex {
  background: rgba(252, 63, 29, 0.15);
  color: #ff6b52;
  border-color: rgba(252, 63, 29, 0.32);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border-color: rgba(6, 182, 212, 0.3);
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.3);
}

/* Cards & Grids */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

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

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

.card-accent {
  border-color: var(--border-accent);
  background: linear-gradient(160deg, var(--bg-surface) 0%, rgba(16, 185, 129, 0.06) 100%);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

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

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

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

.data-table th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

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

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

.data-table tr:hover td {
  background: rgba(148, 163, 184, 0.04);
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-emerald);
}

.range-slider {
  width: 100%;
  accent-color: var(--accent-emerald);
  cursor: pointer;
}

/* Maritime Radar SVG Animation */
.radar-box {
  background: radial-gradient(circle at 50% 50%, #0f2138 0%, #070d17 100%);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.ship-route-animated {
  stroke-dasharray: 8 6;
  animation: routeFlow 18s linear infinite;
}

@keyframes routeFlow {
  to {
    stroke-dashoffset: -280;
  }
}

.svg-spin-slow {
  animation: spinSlow 24s linear infinite;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Quote Callout from Conversation */
.story-quote-banner {
  background: linear-gradient(120deg, rgba(16, 185, 129, 0.12) 0%, rgba(245, 158, 11, 0.12) 55%, rgba(252, 63, 29, 0.1) 100%);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Modal / Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--accent-emerald);
  color: var(--text-primary);
  padding: 13px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.22s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .os-layout { grid-template-columns: 1fr; }
  .os-sidebar { position: relative; height: auto; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .Rate-ticker { display: none; }
}
