/* 11Foundry Beacon — Dark Data-Dense Theme (ported from Atlas) */

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

:root {
  --navy:       #0f1c2e;
  --navy-mid:   #162436;
  --navy-light: #1e3249;
  --navy-edge:  #243b55;
  --faint:      #2e4360;
  --amber:      #f5a623;
  --amber-dim:  #c47e10;
  --amber-pale: rgba(245,166,35,0.12);
  --amber-glow: rgba(245,166,35,0.06);
  --white:      #f5f8fb;
  --muted:      #8fa5be;
  --green:      #34c26e;
  --yellow:     #f5c842;
  --red:        #e05252;
  --on-amber:   #0f1c2e;
  --radius-lg:  18px;
  --radius-md:  12px;
  --radius-sm:  8px;
  --transition: 0.15s ease;
}

/* --- Light mode overrides --- */
html[data-theme="light"] {
  --navy:       #f5f7fa;
  --navy-mid:   #ffffff;
  --navy-light: #eef1f6;
  --navy-edge:  #dce1e9;
  --faint:      #c8d0dc;
  --amber:      #f5a623;
  --amber-dim:  #c47e10;
  --amber-pale: rgba(245,166,35,0.12);
  --amber-glow: rgba(245,166,35,0.06);
  --white:      #1a2332;
  --muted:      #5a6b7f;
  --green:      #34c26e;
  --yellow:     #e8a817;
  --red:        #e05252;
  --on-amber:   #1a2332;
}

html[data-theme="light"] .navbar { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
html[data-theme="light"] .card { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
html[data-theme="light"] .stat-card { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
html[data-theme="light"] th { border-bottom-color: rgba(0,0,0,0.10); }
html[data-theme="light"] td { border-top-color: rgba(0,0,0,0.06); }
html[data-theme="light"] .navbar-brand img { filter: brightness(0) saturate(100%) invert(12%) sepia(20%) saturate(800%) hue-rotate(180deg); }
html[data-theme="light"] .login-brand .login-logo { filter: brightness(0) saturate(100%) invert(12%) sepia(20%) saturate(800%) hue-rotate(180deg); }
html[data-theme="light"] .badge-green  { background: rgba(26,157,82,0.10); border-color: rgba(26,157,82,0.20); }
html[data-theme="light"] .badge-yellow { background: rgba(201,160,6,0.10); border-color: rgba(201,160,6,0.20); }
html[data-theme="light"] .badge-red    { background: rgba(201,58,58,0.10); border-color: rgba(201,58,58,0.20); }
html[data-theme="light"] .badge-amber  { background: rgba(245,166,35,0.08); border-color: rgba(245,166,35,0.20); }
html[data-theme="light"] .badge-gray   { border-color: rgba(0,0,0,0.10); }
html[data-theme="light"] .form-group input:focus,
html[data-theme="light"] .form-group select:focus,
html[data-theme="light"] .form-group textarea:focus {
  box-shadow: 0 0 0 3px rgba(245,166,35,0.12);
}
html[data-theme="light"] .form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6b7f' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
html[data-theme="light"] .form-group select option { background: #fff; color: #1a2332; }
html[data-theme="light"], html[data-theme="light"] body {
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}

/* --- Theme toggle --- */
.theme-toggle {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--transition), background var(--transition);
}
.theme-toggle:hover { color: var(--white); background: rgba(0,0,0,0.08); }
.theme-toggle svg { width: 18px; height: 18px; }
html:not([data-theme="light"]) .theme-toggle:hover { background: var(--faint); }
html:not([data-theme="light"]) .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }

/* --- Base typography (from Atlas) --- */
html {
  overflow-x: clip;
  overflow-y: hidden;  /* html doesn't scroll */
}

/* Wrapper div is the scroll container — navbar sits outside it.
   scrollbar-gutter only affects this div, so the navbar spans full viewport. */
.scroll-wrap {
  height: calc(100vh - 56px); /* viewport minus navbar */
  overflow-y: auto;
  scrollbar-gutter: stable;
}

html, body {
  font-family: 'Geist', sans-serif;
  background: var(--navy);
  color: var(--white);
  font-size: 17.5px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Navbar (sits above scroll-wrap, spans full viewport) --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--navy-mid);
  border-bottom: 1px solid var(--faint);
  z-index: 100;
}


.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.navbar-brand img {
  height: 28px;
  width: auto;
}

.brand-beacon {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 14px;
  color: var(--amber);
  opacity: 0.9;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'Geist', sans-serif;
}

.nav-link:hover, .nav-link.active {
  color: var(--white);
  background: var(--faint);
  text-decoration: none;
}

/* --- Layout (from Atlas) --- */
.container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  overflow-x: hidden;
}

.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  color: var(--white);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.page-header p { color: var(--muted); font-size: 14px; }

/* --- Cards (from Atlas) --- */
.card {
  background: var(--navy-mid);
  border: 1px solid var(--faint);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  overflow: hidden;
  animation: cardrise 0.45s cubic-bezier(.22,.68,0,1.2) both;
}

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

.card h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--white);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.card h3 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--white);
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.card-header {
  padding: 22px 22px 18px;
  margin: -22px -22px 0;
  border-bottom: 1px solid var(--faint);
  background: linear-gradient(135deg, var(--navy-light) 0%, var(--navy-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-family: 'Geist', sans-serif;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--faint);
}
td {
  padding: 10px 12px;
  font-size: 14px;
  border-top: 1px solid var(--navy-light);
}
tr { transition: var(--transition); }
tr:hover { background: var(--amber-glow); }
tr.clickable { cursor: pointer; }

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}
.badge-green  { color: var(--green); background: rgba(52,194,110,0.12); border-color: rgba(52,194,110,0.25); }
.badge-yellow { color: var(--yellow); background: rgba(245,200,66,0.12); border-color: rgba(245,200,66,0.25); }
.badge-red    { color: var(--red); background: rgba(224,82,82,0.12); border-color: rgba(224,82,82,0.25); }
.badge-amber  { color: var(--amber); background: var(--amber-pale); border-color: rgba(245,166,35,0.25); }
.badge-gray   { color: var(--muted); background: rgba(143,165,190,0.08); border-color: var(--faint); }

/* --- Buttons (from Atlas) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.btn-primary {
  background: var(--amber);
  color: var(--on-amber);
  font-weight: 600;
}
.btn-primary:hover { background: var(--amber-dim); }
.btn-primary:disabled { background: var(--faint); color: var(--muted); cursor: not-allowed; }

.btn-secondary {
  background: var(--navy-light);
  color: var(--white);
  border: 1px solid var(--faint);
}
.btn-secondary:hover { background: var(--faint); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* --- Forms (from Atlas) --- */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--muted);
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--navy);
  border: 1px solid var(--faint);
  border-radius: var(--radius-sm);
  font-family: 'Geist', sans-serif;
  font-size: 16px;
  color: var(--white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input::placeholder, .form-group textarea::placeholder {
  color: var(--faint);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a93b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-group select option { background: var(--navy-mid); color: var(--white); }

/* --- Stats row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--navy-mid);
  border: 1px solid var(--faint);
  border-radius: var(--radius-lg);
  padding: 18px;
  animation: cardrise 0.45s cubic-bezier(.22,.68,0,1.2) both;
}
.stat-value {
  font-size: 28px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.5px;
}
.stat-label {
  font-family: 'Geist', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

/* --- Findings --- */
.finding {
  padding: 14px 18px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--faint);
  background: var(--navy-light);
}
.finding-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.finding-type {
  font-family: 'Geist', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.finding-desc { font-size: 14px; color: var(--white); margin-bottom: 6px; line-height: 1.5; }
.finding-rec { font-size: 13px; color: var(--muted); font-style: italic; line-height: 1.5; }
.finding-actions { display: flex; gap: 6px; margin-top: 10px; }

/* --- Notes --- */
.note {
  padding: 12px 16px;
  margin-bottom: 10px;
  border-left: 3px solid var(--amber);
  background: var(--navy-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.note-meta {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.note-content { font-size: 14px; line-height: 1.5; }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--faint);
  padding-bottom: 0;
}
.tab {
  padding: 8px 16px;
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.tab:hover { color: var(--white); }
.tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state p { margin-top: 8px; font-size: 14px; }

/* --- Loading --- */
.loading { text-align: center; padding: 32px; color: var(--muted); font-size: 14px; }

/* --- Floating theme toggle (login page) --- */
.theme-toggle-float {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  z-index: 50;
}

/* --- Login page (from Atlas) --- */
.login-container {
  max-width: 400px;
  margin: 60px auto 0;
  padding: 0 20px;
}

.login-brand {
  text-align: center;
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--faint);
  margin-bottom: 24px;
}

.login-brand .login-logo {
  height: 48px;
  width: auto;
}

.login-product-name {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 20px;
  color: var(--amber);
  margin-top: 4px;
}

.login-tagline {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

/* --- Utility --- */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-mono { font-family: 'DM Mono', monospace; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .navbar { padding: 0 12px; }
  td, th { padding: 8px 6px; }
  .login-container { margin-top: 24px; padding: 0 12px; }
  .login-brand .login-logo { height: 36px; }
  .login-product-name { font-size: 16px; }
}
