
:root {
  --pad: 18px;
  --bg: #edf3f6;
  --surface: #f8fbfd;
  --surface-strong: #ffffff;
  --border: #d2dee7;
  --border-soft: #e3ebf1;
  --text: #21313f;
  --text-soft: #607283;
  --primary: #4f87a3;
  --primary-dark: #376d89;
  --accent: #6aa8c5;
  --shadow: 0 18px 40px rgba(26, 51, 72, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(255,255,255,.96), rgba(237,243,246,.98) 34%),
    linear-gradient(180deg, #edf3f6 0%, #e4edf3 100%);
}

a { color: inherit; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(214, 222, 230, .9);
  background: rgba(250, 252, 253, .88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-wrap { display: flex; align-items: center; gap: 14px; }
.brand-title { font-weight: 800; letter-spacing: .02em; }
.brand-subtitle { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.brand-logo {
  height: 50px;
  width: auto;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(42, 56, 73, 0.10);
  background: rgba(255,255,255,.9);
}

.userbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.nav {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  padding: 12px 28px 14px;
  border-bottom: 1px solid rgba(214, 222, 230, .75);
  background: rgba(245, 248, 250, .84);
  backdrop-filter: blur(8px);
}
.nav a {
  text-decoration: none;
  color: var(--text);
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  border: 1px solid transparent;
  transition: .2s ease;
}
.nav a:hover {
  background: rgba(255,255,255,1);
  border-color: rgba(180, 203, 220, .95);
  box-shadow: 0 8px 18px rgba(31, 73, 103, .09);
}

.container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 14px 24px 20px;
}

.card {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(214, 222, 230, .95);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.glass-card {
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(8px);
}

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

.btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.9);
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .2s ease;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(31, 44, 58, .08);
}
.btn.primary {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: #fff;
}

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 6px 0 10px 0;
  background: rgba(255,255,255,.95);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #9aacbf;
  box-shadow: 0 0 0 4px rgba(154, 172, 191, .14);
}
label { font-size: 12px; color: var(--text-soft); font-weight: 600; letter-spacing: .02em; }

.tableWrap {
  overflow-x: auto;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(214, 222, 230, .95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f4;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}
th {
  background: #f4f7f9;
  position: sticky;
  top: 0;
  z-index: 1;
  color: #546273;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
}

.pager, .filters, .hdr { display: flex; gap: 10px; align-items: center; }
.filters { align-items: flex-end; flex-wrap: wrap; }
.filters input { width: 260px; }
.filters select { width: 200px; }
.hdr { justify-content: space-between; margin-bottom: 12px; }

.pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(255,255,255,.9);
}
.pill.soft { background: rgba(245,248,250,.95); border-color: #d9e1e8; }
.pill.ok { border-color: #6fa787; color: #315d45; }
.pill.warn, .pill.at_risk { border-color: #d2a255; color: #8a6323; }
.pill.breached { border-color: #d28181; color: #8f4040; }

.muted { color: var(--text-soft); font-size: 12px; }
.kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed #e6ebf0;
}
.kpi, .timeline { list-style: none; padding-left: 0; }
.kpi { display: flex; flex-direction: column; gap: 8px; }
.kpiRow {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f5f8fa;
  border: 1px solid #e4ebf0;
  border-radius: 12px;
}
.timeline li { padding: 10px 0; border-bottom: 1px solid #ecf0f3; }

.flashes .flash {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.95);
  box-shadow: var(--shadow);
}
.flash.success { border-color: #a8c9b2; }
.flash.danger { border-color: #d9a1a1; }
.flash.warning { border-color: #dfc08e; }

/* Auth */
.auth-screen { min-height: calc(100vh - 84px); }
.auth-split {
  display: grid;
  grid-template-columns: 1.48fr .72fr;
  gap: 16px;
  align-items: stretch;
}
.auth-hero,
.auth-panel {
  min-height: clamp(430px, 59vh, 610px);
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(214, 222, 230, .95);
  box-shadow: var(--shadow);
  position: relative;
}
.auth-hero {
  display: flex;
  align-items: center;
  background: #d8dde3;
}
.auth-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.035);
  filter: saturate(1.42) contrast(1.14) brightness(1.06);
}
.auth-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 74, 104, .10) 2%, rgba(14, 42, 62, .34) 44%, rgba(10, 24, 37, .56) 100%);
}
.auth-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 26px 34px 28px;
  color: #f7fafc;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
}
.auth-hero-content {
  width: min(74%, 720px);
  margin-top: auto;
  padding-left: 4px;
  padding-bottom: 10px;
}
.hero-kicker {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero-mark {
  height: 92px;
  width: auto;
  margin: 14px 0 18px;
  display: block;
  align-self: flex-start;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.18));
}
.hero-copy {
  font-size: clamp(20px, 1.75vw, 26px);
  line-height: 1.28;
  font-weight: 650;
  max-width: 680px;
  margin-bottom: 14px;
  text-wrap: balance;
}
.hero-list {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.hero-list .pill {
  background: rgba(255,255,255,.12);
  color: #f7fafc;
  border-color: rgba(255,255,255,.2);
}
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #dfe6eb;
}
.auth-panel--whales::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/static/brand/ballenas.jpeg");
  background-size: cover;
  background-position: center;
  transform: scale(1.06);
  filter: saturate(1.28) contrast(1.08) brightness(1.05);
}
.auth-panel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(242,248,251,.34), rgba(228,238,244,.58));
}
.auth-card {
  position: relative;
  z-index: 2;
  width: min(412px, 100%);
  margin-bottom: 0;
  border-radius: 24px;
  box-shadow: 0 24px 50px rgba(28, 61, 89, .14);
}
.auth-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.auth-logo {
  height: 68px;
  width: auto;
  border-radius: 16px;
  border: 1px solid #e6ebf0;
  background: rgba(255,255,255,.95);
}
.auth-title { font-size: 25px; font-weight: 800; line-height: 1.05; color: #173247; }
.auth-subtitle { font-size: 13px; color: #4f6575; }
.auth-form .field { margin-bottom: 8px; }
.auth-form input { margin-top: 6px; }
.auth-submit { width: 100%; padding: 12px 14px; margin-top: 2px; }
.auth-hint { margin-top: 10px; }

.ai-health { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #bbb; display: inline-block; }
.dot.ok { background: #22c55e; }
.dot.bad { background: #ef4444; }
.dot.warn { background: #f59e0b; }

.dashboard-shell .card,
.tableWrap {
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(249,252,254,.92));
}

canvas { max-width: 100%; }

@media (max-width: 1100px) {
  .auth-split,
  .grid,
  .grid2 {
    grid-template-columns: 1fr;
  }
  .auth-hero,
  .auth-panel { min-height: 360px; }
}

@media (max-width: 720px) {
  .topbar, .nav, .container { padding-left: 16px; padding-right: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .brand-subtitle { display: none; }
  .auth-screen { min-height: auto; }
  .auth-hero-inner { padding: 18px; }
  .auth-hero-content { width: 100%; padding-left: 0; }
  .hero-mark { height: 72px; margin-left: auto; margin-right: auto; }
  .hero-copy { font-size: 18px; }
  .auth-panel { padding: 14px; }
}

@media (min-width: 1101px) {
  body:has(.auth-screen) .container {
    max-width: 1520px;
    padding-top: 10px;
    padding-bottom: 14px;
  }
}
