/* ============================================================
   REFRESHAGENT VOICE — Biolux Interface
   Direction: Advanced computing interface inside a luxury
   year-2500 rainforest villa. Sharp geometry, translucent
   dark glass panels, bioluminescent amber/emerald accents,
   precision typography.
   ============================================================ */

:root {
  /* ── Deep surfaces ─────────────────────────────── */
  --bg: #0e100f;
  --paper: rgba(18, 22, 20, 0.82);
  --surface-raised: rgba(26, 32, 28, 0.90);
  --surface-glass: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.05);

  /* ── Text ──────────────────────────────────────── */
  --ink: #e8e4de;
  --muted: #7a8072;
  --faint: #464e46;

  /* ── Borders ───────────────────────────────────── */
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.10);
  --line-glow: rgba(200, 170, 80, 0.12);

  /* ── Accent — Bioluminescent Amber ─────────────── */
  --accent: #d4a843;
  --accent-dim: #a07e2e;
  --accent-soft: rgba(212, 168, 67, 0.10);
  --accent-glow: rgba(212, 168, 67, 0.20);
  --accent-flare: rgba(212, 168, 67, 0.40);

  /* ── Secondary — Deep Canopy Emerald ───────────── */
  --emerald: #3da86a;
  --emerald-dim: #2d7a4e;
  --emerald-soft: rgba(61, 168, 106, 0.10);
  --emerald-glow: rgba(61, 168, 106, 0.20);

  /* ── Status ────────────────────────────────────── */
  --info: #5b9ec9;
  --info-soft: rgba(91, 158, 201, 0.12);
  --success: #3da86a;
  --success-soft: rgba(61, 168, 106, 0.12);
  --warn: #d4a843;
  --warn-soft: rgba(212, 168, 67, 0.12);
  --error: #d45a4a;
  --error-soft: rgba(212, 90, 74, 0.12);

  /* ── Elevation ─────────────────────────────────── */
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.40);
  --shadow-glow: 0 0 40px rgba(212, 168, 67, 0.06);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* ── Typography ────────────────────────────────── */
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Satoshi", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;

  /* ── Spacing ───────────────────────────────────── */
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 18px;
  --space-lg: 28px;
  --space-xl: 48px;

  /* ── Radii — sharp geometry ────────────────────── */
  --radius: 3px;
  --radius-lg: 4px;
}


/* ── Reset & Base ─────────────────────────────────── */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Subtle noise grain texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  color: var(--muted);
  line-height: 1.7;
}


/* ── Typography ───────────────────────────────────── */

h1,
h2,
.brand {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
}

strong {
  font-weight: 600;
  color: var(--ink);
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1.04;
}

h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.14;
}

/* Amber glow-line under section headings */
.section-heading h2 {
  display: inline-block;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--accent-dim);
  box-shadow: 0 1px 12px rgba(212, 168, 67, 0.15);
}


/* ── Eyebrow / Labels ────────────────────────────── */

.eyebrow,
.signal-label,
.detail-label,
.sidebar-label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.70rem;
  font-weight: 500;
  color: var(--accent-dim);
}


/* ── Layout Shells ────────────────────────────────── */

.public-shell main,
.admin-main {
  position: relative;
  z-index: 1;
}

.site-header,
.admin-main,
.public-shell main {
  padding: 24px;
}

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

.brand {
  font-size: 1.25rem;
  color: var(--accent);
}


/* ── Navigation ───────────────────────────────────── */

.top-nav,
.sidebar-nav,
.hero-actions,
.panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.top-nav a,
.panel-header a {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 250ms ease, border-color 250ms ease;
}

.top-nav a:hover,
.panel-header a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-dim);
}


/* ── Glass Panels & Cards ─────────────────────────── */

.hero,
.form-section,
.thank-you,
.panel,
.metric-card,
.task-card,
.attention-card {
  background: var(--paper);
  backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--shadow-inset);
}

.hero,
.form-section,
.thank-you {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto var(--space-lg);
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: var(--space-lg);
  padding: var(--space-xl);
  position: relative;
  overflow: hidden;
}

/* Subtle amber glow in hero top-left corner */
.hero::before {
  content: "";
  position: absolute;
  top: -60px;
  left: -60px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.hero h1,
.thank-you h1,
.admin-header h1 {
  margin: 0 0 16px;
}

.hero-text {
  max-width: 56ch;
  font-size: 1.05rem;
}


/* ── Buttons ──────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 200ms ease;
}

.button-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(212, 168, 67, 0.15);
}

.button-primary:hover {
  background: #dfb44e;
  box-shadow: 0 0 32px rgba(212, 168, 67, 0.30);
  transform: translateY(-1px);
}

.button-secondary {
  border-color: var(--line-strong);
  color: var(--muted);
  background: transparent;
}

.button-secondary:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: var(--accent-soft);
}

.button-small {
  padding: 8px 14px;
  font-size: 0.78rem;
}


/* ── Grids ────────────────────────────────────────── */

.stats-grid,
.detail-grid,
.metric-grid,
.admin-grid,
.attention-grid,
.task-grid {
  display: grid;
  gap: var(--space-md);
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 36px;
}

.stats-grid div,
.signal-card,
.detail-card,
.metric-card,
.attention-card,
.task-card {
  padding: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  backdrop-filter: blur(12px);
}

.stats-grid dt,
.signal-label,
.detail-label,
.metric-card span {
  font-size: 0.74rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.stats-grid dd,
.metric-card strong {
  margin: 8px 0 0;
  font-size: 1.3rem;
  font-family: var(--font-display);
  color: var(--ink);
}

.signal-panel {
  display: grid;
  gap: var(--space-md);
  align-content: start;
}

.signal-card.accent {
  border-color: var(--line-glow);
  background: linear-gradient(
    135deg,
    rgba(212, 168, 67, 0.06),
    var(--surface-raised)
  );
  box-shadow: inset 0 0 30px rgba(212, 168, 67, 0.04);
}


/* ── Forms ────────────────────────────────────────── */

.form-section,
.thank-you,
.panel {
  padding: var(--space-lg);
}

.section-heading {
  margin-bottom: var(--space-lg);
}

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

.compact-form {
  max-width: 620px;
}

.demo-form label {
  display: grid;
  gap: 8px;
  font-weight: 500;
  font-size: 0.84rem;
  color: var(--muted);
}

.demo-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.30);
  color: var(--ink);
  font: inherit;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.demo-form input:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 0 20px rgba(212, 168, 67, 0.08);
}

.demo-form input::placeholder {
  color: var(--faint);
}

.crm-filter-form {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr auto;
  gap: 16px;
}

.crm-filter-form label {
  display: grid;
  gap: 8px;
  font-weight: 500;
  font-size: 0.84rem;
  color: var(--muted);
}

.crm-filter-form select,
.crm-stage-form select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.30);
  color: var(--ink);
  font: inherit;
  transition: border-color 200ms ease;
}

.crm-filter-form select:focus,
.crm-stage-form select:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.crm-stage-form {
  display: grid;
  gap: 14px;
  margin-bottom: var(--space-md);
}

.crm-stage-form label {
  display: grid;
  gap: 8px;
  font-weight: 500;
  font-size: 0.84rem;
  color: var(--muted);
}

.crm-filter-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: end;
}

.demo-form textarea,
.import-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.30);
  color: var(--ink);
  font: inherit;
  resize: vertical;
  transition: border-color 200ms ease;
}

.demo-form textarea:focus,
.import-form textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.demo-form button {
  margin-top: 8px;
}


/* ── Admin Layout ─────────────────────────────────── */

.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  min-height: 100vh;
  padding: 24px 20px;
  border-right: 1px solid var(--line);
  background: rgba(10, 12, 11, 0.96);
  backdrop-filter: blur(24px);
  position: relative;
}

/* Faint emerald glow at sidebar bottom */
.sidebar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to top, rgba(61, 168, 106, 0.04), transparent);
  pointer-events: none;
}

.sidebar-nav {
  flex-direction: column;
  align-items: flex-start;
  margin-top: var(--space-lg);
  gap: 2px;
}

.sidebar-nav a {
  font-family: var(--font-mono);
  font-size: 0.80rem;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  border-radius: var(--radius);
  width: 100%;
  color: var(--muted);
  border-bottom: none;
  transition: background 200ms ease, color 200ms ease;
}

.sidebar-nav a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-bottom: none;
}

.sidebar-logout {
  margin-top: var(--space-lg);
}

.admin-header {
  margin-bottom: var(--space-lg);
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: var(--space-lg);
}

.metric-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Amber glow-line on metric card top edge */
.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent-dim) 30%,
    var(--accent) 50%,
    var(--accent-dim) 70%,
    transparent
  );
  opacity: 0.6;
}

/* Subtle inner glow */
.metric-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 40px;
  background: radial-gradient(ellipse, rgba(212, 168, 67, 0.06), transparent);
  pointer-events: none;
}

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

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

.detail-card strong {
  display: block;
  margin-top: 8px;
}


/* ── Lists & Timeline ─────────────────────────────── */

.list-stack {
  display: grid;
  gap: var(--space-sm);
}

.action-stack,
.import-form {
  display: grid;
  gap: 14px;
}

.list-item,
.timeline-item,
.attention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-glass);
  transition: border-color 250ms ease, background 250ms ease;
}

.list-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.static-item {
  justify-content: flex-start;
}

.timeline {
  display: grid;
  gap: var(--space-sm);
}

.timeline-item {
  align-items: flex-start;
  border-left: 1px solid var(--line-strong);
  border-top: none;
  border-right: none;
  border-bottom: none;
  border-radius: 0;
  padding-left: 20px;
  background: transparent;
}

.timeline-item span {
  min-width: 56px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}


/* ── Badges ───────────────────────────────────────── */

.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-info {
  background: var(--info-soft);
  border-color: rgba(91, 158, 201, 0.20);
  color: var(--info);
}

.badge-success {
  background: var(--success-soft);
  border-color: rgba(61, 168, 106, 0.20);
  color: var(--success);
}

.badge-warning {
  background: var(--warn-soft);
  border-color: rgba(212, 168, 67, 0.20);
  color: var(--warn);
}

.badge-muted {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--faint);
}


/* ── Data Table ───────────────────────────────────── */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
}

.data-table td {
  text-align: left;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.9rem;
}

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

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


/* ── Info List ────────────────────────────────────── */

.info-list {
  display: grid;
  gap: 14px;
}

.info-list div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
}

.info-list dt {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}


/* ── Task Grid ────────────────────────────────────── */

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


/* ── Open Sections (no panel) ─────────────────────── */

.open-section {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--line);
}

.open-section .section-heading {
  margin-bottom: var(--space-lg);
}

.open-section .section-heading h2 {
  border-bottom: none;
  box-shadow: none;
}

.open-section .detail-card {
  background: var(--surface-glass);
  border-color: var(--line);
}

.open-section .detail-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}


/* ── Utilities ────────────────────────────────────── */

.muted-copy {
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-alert {
  margin-bottom: var(--space-md);
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 168, 67, 0.16);
  border-left: 2px solid var(--accent-dim);
  background: rgba(212, 168, 67, 0.05);
}

.auth-alert strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
}


/* ── Ambient Background ───────────────────────────── */

.ambient {
  position: fixed;
  inset: auto;
  width: 400px;
  height: 400px;
  border-radius: 999px;
  filter: blur(140px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.ambient-left {
  top: -40px;
  left: -120px;
  background: rgba(212, 168, 67, 0.30);
}

.ambient-right {
  right: -100px;
  bottom: 60px;
  background: rgba(61, 168, 106, 0.25);
}


/* ── Responsive ───────────────────────────────────── */

@media (max-width: 980px) {
  .hero,
  .detail-grid,
  .detail-grid.wide,
  .admin-grid,
  .metric-grid,
  .task-grid,
  .stats-grid,
  .demo-form,
  .crm-filter-form {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .site-header,
  .admin-main,
  .public-shell main {
    padding: 18px;
  }

  .hero,
  .form-section,
  .thank-you {
    width: calc(100% - 36px);
    padding: 24px;
  }

  .top-nav,
  .hero-actions,
  .panel-header,
  .list-item,
  .timeline-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .info-list div {
    grid-template-columns: 1fr;
  }
}
