/* Atlas Offshore v0.2 — Premium Shell (sidebar nav + topbar + AI chat) */
:root {
  --bg: #0a0e1a;
  --surface: #131826;
  --surface-2: #1c2436;
  --surface-3: #232d44;
  --border: #2a3447;
  --border-soft: rgba(255,255,255,0.06);
  --text: #e8ecf4;
  --text-dim: #9ba3b4;
  --text-faint: #6b7280;
  --accent: #5b8def;
  --accent-2: #7a9eff;
  --accent-soft: rgba(91,141,239,0.12);
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --purple: #c084fc;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', Menlo, monospace;
  --sidebar-w: 260px;
  --topbar-h: 60px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* SHELL */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* SIDEBAR */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 22px 24px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #5b8def 0%, #c084fc 100%);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  color: white;
  box-shadow: 0 4px 16px rgba(91,141,239,0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text .name { font-family: var(--serif); font-size: 18px; font-weight: 500; }
.brand-text .ver { font-size: 10px; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.tenant-switcher {
  margin: 14px 16px 18px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.tenant-switcher:hover { border-color: var(--accent); }
.tenant-switcher .label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.tenant-switcher .name { font-weight: 600; margin-top: 2px; display: flex; align-items: center; justify-content: space-between; }
.tenant-switcher .name::after { content: "▾"; opacity: 0.5; font-size: 10px; }

.nav-section {
  margin: 8px 0 4px;
  padding: 0 24px;
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 24px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.1s;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-item .icon { width: 18px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
}
.sidebar-footer .user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
}
.sidebar-footer .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--accent));
  color: white;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 12px;
}

/* MAIN */
.main { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: rgba(10,14,26,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 20px;
}
.page-title { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(91,141,239,0.3); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); box-shadow: none; transform: none; }
.btn-icon { padding: 8px 10px; }

.content { padding: 32px; flex: 1; }
.content-narrow { max-width: 1200px; }

/* HEADINGS */
h1.page-h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.page-sub { color: var(--text-dim); font-size: 15px; margin: 0 0 28px; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 32px 0 12px; }
h3 { font-weight: 600; font-size: 15px; margin: 20px 0 10px; color: var(--accent-2); }

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
}
.card h2 { margin-top: 0; }
.card-tight { padding: 16px 18px; }

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: 1.6fr 1fr; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-equal-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid-2, .grid-equal-2 { grid-template-columns: 1fr; } }

/* STATS */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0.6;
}
.stat .label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.stat .value { font-family: var(--serif); font-size: 30px; font-weight: 500; margin: 6px 0 2px; line-height: 1.1; }
.stat .delta { font-size: 12px; color: var(--text-dim); }
.stat .value.green { color: var(--green); }
.stat .value.red { color: var(--red); }
.stat .value.amber { color: var(--yellow); }
.stat .value.purple { color: var(--purple); }

/* TABLE */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 700; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: rgba(91,141,239,0.04); }

/* PILLS / TAGS */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.pill.green { background: rgba(74,222,128,0.15); color: var(--green); }
.pill.red { background: rgba(248,113,113,0.15); color: var(--red); }
.pill.yellow { background: rgba(251,191,36,0.15); color: var(--yellow); }
.pill.blue { background: rgba(91,141,239,0.15); color: var(--accent); }
.pill.purple { background: rgba(192,132,252,0.15); color: var(--purple); }
.pill.BR { background: rgba(74,222,128,0.15); color: var(--green); }
.pill.US { background: rgba(91,141,239,0.15); color: var(--accent); }
.pill.BVI { background: rgba(248,113,113,0.15); color: var(--red); }
.pill.UY { background: rgba(251,191,36,0.15); color: var(--yellow); }

/* FORM */
label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 14px; font-family: inherit; margin-bottom: 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,141,239,0.12); }

/* FINDINGS */
.finding {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
}
.finding.ERRO { border-left-color: var(--red); background: rgba(248,113,113,0.06); }
.finding.AVISO { border-left-color: var(--yellow); background: rgba(251,191,36,0.06); }
.finding.INFO { border-left-color: var(--accent); background: rgba(91,141,239,0.06); }
.finding .code { font-family: var(--mono); font-size: 10px; opacity: 0.7; letter-spacing: 0.05em; }

/* AI CHAT FAB */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(91,141,239,0.4);
  z-index: 100;
  transition: all 0.15s;
  font-size: 22px;
  color: white;
  border: none;
}
.ai-fab:hover { transform: scale(1.1); }

.ai-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 420px;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  z-index: 100;
}
.ai-panel.open { display: flex; }
.ai-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-header .title { font-family: var(--serif); font-weight: 500; font-size: 16px; }
.ai-header .badge { font-size: 10px; padding: 2px 8px; background: var(--accent-soft); color: var(--accent); border-radius: 4px; font-weight: 600; }
.ai-header .close { margin-left: auto; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 18px; }
.ai-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg { padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.msg.user { background: var(--accent); color: white; align-self: flex-end; max-width: 85%; }
.msg.assistant { background: var(--surface-2); color: var(--text); max-width: 90%; }
.msg.system { background: rgba(192,132,252,0.08); border: 1px solid rgba(192,132,252,0.3); color: var(--purple); font-size: 11px; }
.ai-input {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}
.ai-input input { margin: 0; }
.ai-input button { padding: 10px 16px; }

/* MISC */
.callout { border-left: 3px solid var(--accent); padding: 8px 0 8px 18px; margin: 14px 0; color: var(--text-dim); }
.callout.warn { border-left-color: var(--yellow); }
.callout.danger { border-left-color: var(--red); }
.callout.ok { border-left-color: var(--green); }
.empty { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.loading { text-align: center; padding: 20px; color: var(--text-dim); }
.actions { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.urgent { color: var(--red); font-weight: 600; }
.soon { color: var(--yellow); }
.flag { font-size: 18px; vertical-align: middle; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-size: 11px; }
