/* ── Fonts ──────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/static/fonts/SourceSans3-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/static/fonts/SourceSans3-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Quantico';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/Quantico-regular.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Quantico';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/Quantico-bold.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

.hidden { display: none !important; }

:root {
  --bg:            #1f1f1f;
  --surface:       #000000;
  --surface-alt:   #1f1f1f;
  --surface-soft:  #141414;
  --accent:        #ffe554;
  --accent-contrast: #000000;
  --accent-muted:  rgba(255, 229, 84, 0.12);
  --accent-hover:  rgba(255, 229, 84, 0.18);
  --muted:         #b5b5b5;
  --border:        rgba(255, 229, 84, 0.16);
  --shadow:        0 32px 80px rgba(0, 0, 0, 0.45);
  --radius:        24px;
  --sidebar-w:     260px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color-scheme: dark;
}

html, body {
  margin: 0;
  min-height: 100vh;
  min-width: 100vw;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: #ffffff;
}

/* ── App shell layout ──────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
nav.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  padding: 28px 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--accent-muted);
}

.sidebar-logo {
  margin: 0 0 32px;
  padding: 0 24px;
  font-size: 22px;
  font-weight: 900;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.75);
  background: none;
  border: none;
  border-radius: 12px;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: var(--accent-muted); color: #ffffff; }
.nav-btn.active { background: var(--accent-hover); color: #ffffff; font-weight: 600; }
.nav-btn .icon { font-size: 18px; width: 20px; text-align: center; flex-shrink: 0; }

/* ── Lucide icons ────────────────────────────────────────────────────────────── */
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.75; }
.nav-icon svg { display: block; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  text-decoration: none;
  vertical-align: middle;
}
.btn-icon:hover { color: #ffffff; background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.btn-icon svg { width: 14px; height: 14px; }
.btn-icon.btn-danger-icon { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.btn-icon.btn-danger-icon:hover { color: #fff; background: #ef4444; border-color: #ef4444; }

.sidebar-divider { border: none; border-top: 1px solid rgba(248,250,252,0.08); margin: 12px 24px; }

.sidebar-security {
  padding: 16px 20px;
  margin: 0 12px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  font-size: 13px;
  color: rgba(248,250,252,0.5);
}
.sidebar-security strong { display: block; color: rgba(248,250,252,0.75); margin-bottom: 2px; font-size: 13px; }

/* ── Main content ──────────────────────────────────────────────────────────── */
main.content {
  grid-column: 2;
  min-height: 100vh;
  padding: 0 24px;
}

.page {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1, h2, h3 { letter-spacing: -0.02em; font-family: 'Quantico', 'Source Sans 3', sans-serif; }
.page-title { font-size: 32px; font-weight: 700; margin: 0 0 8px; color: #ffffff; }
.page-sub   { color: var(--muted); margin: 0 0 28px; font-size: 16px; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--accent-muted);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  color: #ffffff;
}
.card-title { margin: 0 0 20px; font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }
.card.note {
  position: relative;
  background: var(--accent);
  color: #000000;
  border-color: rgba(0, 0, 0, 0.12);
}
.card.note::before {
  content: '';
  position: absolute;
  top: -12px;
  left: calc(50% - 14px);
  width: 28px;
  height: 14px;
  background: var(--accent);
  border-radius: 0 0 14px 14px;
}

/* ── Hero card ─────────────────────────────────────────────────────────────── */
.hero-card {
  background: linear-gradient(180deg, #101010 0%, #000000 100%);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
  border: 1px solid var(--accent-muted);
}
.hero-animal {
  font-size: clamp(52px, 5vw, 88px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}
.hero-score {
  font-size: clamp(64px, 7vw, 104px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.06em;
}
.hero-meta { color: rgba(248,250,252,0.65); font-size: 16px; margin-top: 12px; }
.tier-badge {
  display: inline-block;
  background: rgba(248,250,252,0.1);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

/* ── Dashboard layout ──────────────────────────────────────────────────────── */
.dash-deck {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
.dash-charts {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  margin-top: 24px;
}

.dashboard-page {
  display: grid;
  gap: 32px;
}

.suggestion-strip {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-muted, #8899aa);
}

.dashboard-hero {
  display: grid;
  gap: 16px;
}

.dashboard-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.dashboard-runner {
  font-size: clamp(40px, 6vw, 72px);
  font-family: 'Quantico', 'Source Sans 3', sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.dashboard-score {
  background: var(--accent);
  color: #000000;
  border-radius: 24px;
  padding: 18px 28px;
  font-size: 36px;
  font-weight: 900;
  min-width: 120px;
  text-align: center;
}

.dashboard-subtitle {
  color: var(--muted);
  font-size: 15px;
}

.ai-summary-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.ai-summary-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--accent);
}

.ai-summary-card p {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
  color: #ffffff;
}

.upcoming-section .section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.section-copy {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.upcoming-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.upcoming-card {
  border-radius: 28px;
  padding: 24px;
  min-height: 240px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.upcoming-card.has-notch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 20px;
  border-radius: 0 0 16px 16px;
  background: currentColor;
}

.upcoming-contact {
  background: #ffffff;
  color: #000000;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.upcoming-activity {
  background: #000000;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.upcoming-note,
.upcoming-secret-note {
  background: var(--accent);
  color: #000000;
}

.upcoming-secret-contact {
  background: #ffffff;
  color: #000000;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.upcoming-card-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.8;
}

.upcoming-card-title {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
}

.upcoming-card-body {
  color: inherit;
  opacity: 0.88;
  font-size: 15px;
  line-height: 1.6;
}

.upcoming-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 15px;
  font-weight: 700;
}

/* Local Noto Emoji Monochrome (optional)
   Place a monochrome Noto Emoji font at /static/fonts/NotoEmoji-Regular.woff2
   If present, the UI will prefer this to render monochrome emoji glyphs for secret masks.
*/
@font-face {
  font-family: 'Noto Emoji Monochrome';
  src: url('/static/fonts/NotoEmoji-Regular.woff2') format('woff2'),
       url('/static/fonts/NotoEmoji-Regular.woff') format('woff'),
       url('/static/fonts/NotoEmoji-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  /* Limit unicode-range to common emoji blocks to avoid replacing text fonts */
  unicode-range: U+1F300-1F5FF, U+1F600-1F64F, U+1F680-1F6FF, U+1F700-1F77F;
}

.secret-mask {
  filter: blur(2px);
  font-family: 'Noto Emoji Monochrome', 'Noto Emoji', 'Segoe UI Emoji', 'Apple Color Emoji', 'Segoe UI Symbol', sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

/* Monochrome SVG emoji styling for secret masks */
.secret-mask svg.emoji {
  width: 1.6rem;
  height: 1.6rem;
  vertical-align: middle;
  display: inline-block;
  fill: currentColor;
}

/* When a card is revealed, remove blur from all secret masks inside it */
.upcoming-card.revealed .secret-mask {
  filter: none;
}

.redacted {
  filter: blur(4px);
  user-select: none;
  cursor: pointer;
  transition: filter 0.15s;
}
.redacted.revealed {
  filter: none;
}

.stats-section {
  display: grid;
  gap: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface-soft);
  border: 1px solid var(--accent-muted);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 32px;
  font-weight: 900;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.chart-card {
  background: var(--surface-soft);
  border: 1px solid var(--accent-muted);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.chart-card--wide {
  grid-column: span 2;
}

.chart-title {
  font-weight: 700;
  margin-bottom: 20px;
}

.chart-wrap {
  position: relative;
  height: 260px;
}

.contacts-section,
.activity-section,
.notes-section {
  display: grid;
  gap: 18px;
}

.activity-feed {
  display: grid;
  gap: 14px;
}

.activity-item {
  background: var(--surface-soft);
  border: 1px solid var(--accent-muted);
  border-radius: 22px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.activity-item > div:first-child {
  flex: 1;
  min-width: 0;
}

.activity-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.activity-offer {
  font-weight: 700;
  color: #ffffff;
}

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

.note-item {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 22px;
  padding: 20px;
  color: #000000;
}

.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: rgba(0, 0, 0, 0.6);
  font-size: 13px;
  margin-top: 12px;
}

@media (max-width: 1200px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-card--wide { grid-column: span 1; }
}

@media (max-width: 768px) {
  .chart-wrap { height: 200px; }
  .chart-card { padding: 16px; border-radius: 16px; }
  .chart-grid { gap: 12px; }
}

@media (max-width: 900px) {
  .upcoming-cards { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .dashboard-hero,
  .stats-grid { grid-template-columns: 1fr; }
  .dashboard-page { gap: 24px; }
}

@media (max-width: 500px) {
  .dashboard-runner { font-size: 36px; }
}

/* Prevent horizontal scrolling introduced by wide fixed elements */
html, body { overflow-x: hidden; }

/* Collapse sidebar and remove left margin on narrow screens */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  nav.sidebar {
    position: relative;
    width: 100%;
    height: auto;
    left: 0; top: 0;
    border-right: none;
    z-index: 10;
  }
  main.content { grid-column: 1; padding: 0 12px; }
}

/* Tighter card sizing and single-column layout on small devices */
@media (max-width: 720px) {
  .upcoming-cards { grid-template-columns: 1fr; gap: 12px; }
  .upcoming-card { padding: 16px; border-radius: 18px; min-height: auto; }
  .contact-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .tile-row { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 20px 12px 40px; }
}

/* Ensure long words and inline SVGs don't force overflow */
.upcoming-card, .contact-card, .note-item, .activity-item { overflow-wrap: anywhere; word-break: break-word; }

/* ── Tiles ─────────────────────────────────────────────────────────────────── */
.tile-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.tile {
  background: var(--surface-soft);
  border: 1px solid var(--accent-muted);
  border-radius: 22px;
  padding: 22px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.tile-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }
.tile-count { color: #ffffff; }
.tile-count { font-size: 36px; font-weight: 900; line-height: 1; }
.tile-sub   { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* tile accent borders */
.tile.follow-ups { border-top: 3px solid #fbbf24; }
.tile.offers     { border-top: 3px solid #fb923c; }
.tile.visibility { border-top: 3px solid #2dd4bf; }

/* ── Visibility battery ─────────────────────────────────────────────────────── */
.visibility-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.visibility-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.visibility-cells { display: flex; gap: 4px; }
.visibility-cell { width: 20px; height: 8px; border-radius: 3px; background: rgba(255,255,255,0.12); }
.visibility-cell.filled { background: #2dd4bf; }

/* ── Lists ─────────────────────────────────────────────────────────────────── */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(15,23,42,0.06);
  font-size: 16px;
}
.list-item:last-child { border-bottom: none; }
.list-item-main { flex: 1; min-width: 0; }
.list-item-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub  { font-size: 13px; color: var(--muted); }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.view-title {
  margin: 0;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #ffffff;
}
.new-note-form {
  margin-bottom: 24px;
}
.note-list {
  display: grid;
  gap: 16px;
}
.note-item {
  display: grid;
  gap: 14px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 22px;
  padding: 20px;
  color: #000000;
}
.note-body {
  font-size: 16px;
  color: #000000;
  white-space: pre-wrap;
}
.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: rgba(0, 0, 0, 0.6);
  font-size: 13px;
}
.note-deadline {
  font-weight: 700;
}
.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.note-item .btn-ghost {
  color: rgba(0, 0, 0, 0.7);
  border-color: rgba(0, 0, 0, 0.2);
}
.note-item .btn-ghost:hover {
  color: #000000;
  background: rgba(0, 0, 0, 0.08);
}
.note-item .btn-icon {
  color: rgba(0, 0, 0, 0.55);
  border-color: rgba(0, 0, 0, 0.15);
}
.note-item .btn-icon:hover {
  color: #000000;
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.25);
}
.note-item .btn-icon.btn-danger-icon {
  color: rgba(185, 28, 28, 0.7);
  border-color: rgba(185, 28, 28, 0.2);
}
.note-item .btn-icon.btn-danger-icon:hover {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}
.note-item--editing {
  background: var(--surface-alt);
  border-color: var(--border);
  color: #ffffff;
}

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.badge-green  { background: #16a34a; }
.badge-amber  { background: #d97706; }
.badge-red    { background: #dc2626; }
.badge-gray   { background: #6b7280; color: #fff; }
.badge-note   { background: #e0f2fe; color: #0369a1; }
.badge-secret { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: #fef3c7; color: #92400e; vertical-align: middle; }
.note-item--secret { border-left: 3px solid #f59e0b; }

/* ── Contact grid ──────────────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.15s;
  display: grid;
  gap: 8px;
}
.contact-card:hover { box-shadow: 0 24px 60px rgba(15,23,42,0.13); }
.contact-codename { font-size: 18px; font-weight: 700; }
.contact-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.contact-card--secret .redacted { cursor: default; }
.contact-card .btn-icon { color: rgba(0,0,0,0.45); border-color: rgba(0,0,0,0.12); }
.contact-card .btn-icon:hover { color: rgba(0,0,0,0.8); background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.2); }
.contact-name-hidden { font-size: 13px; color: var(--muted); font-style: italic; user-select: none; cursor: pointer; }

/* ── Tap-and-hold reveal ───────────────────────────────────────────────────── */
.reveal-target {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { display: grid; gap: 6px; margin-bottom: 18px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--dark); text-transform: uppercase; letter-spacing: 0.04em; }
.form-input, .form-select, .form-textarea {
  padding: 12px 16px;
  border: 1px solid rgba(15,23,42,0.16);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--dark);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(100,200,255,0.15);
}
.form-input.code-input {
  letter-spacing: 0.25em;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  font-family: ui-monospace, monospace;
}
.form-textarea { min-height: 80px; resize: vertical; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s, transform 0.15s;
  text-decoration: none;
}
.btn:hover { filter: brightness(0.95); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface-soft);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-secondary:hover { background: #1a1a1a; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: none; color: var(--muted); border: 1px solid rgba(255,255,255,0.08); padding: 6px 12px; }
.btn-ghost:hover { color: #ffffff; background: rgba(255,255,255,0.05); }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: min(100% - 32px, 640px);
  width: 100%;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border-radius: 24px;
  width: min(100%, 600px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(15,23,42,0.2);
}
.modal-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h2 { margin: 0; font-size: 22px; font-weight: 700; }
.modal-title { font-size: 20px; font-weight: 700; margin: 0 0 2px; }
.modal-subtitle { font-size: 14px; color: var(--muted); margin: 0; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); padding: 0; line-height: 1; }
.modal-body { padding: 28px 32px; }
.modal-footer { padding: 20px 32px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-tabs { display: flex; gap: 4px; padding: 0 32px; border-bottom: 1px solid var(--border); }
.modal-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--muted); margin-bottom: -1px; transition: color 0.15s, border-color 0.15s;
}
.modal-tab.active { color: var(--dark); border-bottom-color: var(--accent); }
.tab-panel { display: block; }
.tab-panel[hidden] { display: none; }

/* ── Auth pages ────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  width: min(100%, 420px);
  background: var(--surface-soft);
  border: 1px solid var(--accent-muted);
  border-radius: var(--radius);
  padding: 48px 36px;
  box-shadow: var(--shadow);
}
.auth-logo {
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 24px;
  letter-spacing: 0.12em;
  font-family: 'Quantico', 'Source Sans 3', sans-serif;
  text-transform: uppercase;
}
.auth-card h1 {
  margin: 0 0 14px;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #ffffff;
  font-family: 'Quantico', 'Source Sans 3', sans-serif;
}
.auth-card p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
}
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #b5b5b5;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #141414;
  color: #ffffff;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  background: #1a1a1a;
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.btn--full { width: 100%; }
.auth-notice {
  background: var(--accent-muted);
  border: 1px solid var(--accent-hover);
  color: #ffffff;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 18px;
  font-size: 14px;
}
.auth-notice--alpha {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.18);
  color: #ffffff;
}
.alpha-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.18);
  color: #f8fafc;
  font-size: 13px;
  border-radius: 0 0 0 14px;
  margin-bottom: 12px;
}
.alpha-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.2);
  color: #ffeeee;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-info {
  margin: 0 0 18px;
  color: #b5b5b5;
  font-size: 14px;
}
.auth-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}
.auth-link { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px; }
.auth-link:hover { text-decoration: underline; }

/* ── Banners ───────────────────────────────────────────────────────────────── */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 20px;
}
.banner-warning { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.banner-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.banner-dismiss { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; font-size: 18px; padding: 0; }

/* ── Security indicator ────────────────────────────────────────────────────── */
.security-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  font-size: 15px;
}
.security-level { font-weight: 700; font-size: 16px; }
.security-meta  { font-size: 13px; color: var(--muted); }

/* ── Activity log ──────────────────────────────────────────────────────────── */
.activity-feed { display: grid; gap: 0; }
.activity-entry {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(15,23,42,0.06);
}
.activity-entry:last-child { border-bottom: none; }
.activity-date { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 90px; padding-top: 2px; }
.activity-type { font-weight: 700; font-size: 15px; }
.activity-contact { font-size: 13px; color: var(--muted); }

/* ── Settings ──────────────────────────────────────────────────────────────── */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid rgba(15,23,42,0.06);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-weight: 600; font-size: 16px; }
.setting-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Recovery codes display ────────────────────────────────────────────────── */
.recovery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f8fafc;
  border-radius: 14px;
  padding: 20px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  margin-bottom: 20px;
}
.recovery-code { font-weight: 700; color: #0f172a; padding: 4px 0; }

/* ── Loading / empty states ────────────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; color: var(--muted); font-size: 16px; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* ── Inline section headers ────────────────────────────────────────────────── */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 18px; font-weight: 700; }

/* ── QR code area ──────────────────────────────────────────────────────────── */
.qr-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.qr-box {
  width: 200px; height: 200px;
  border: 2px solid var(--border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

/* ── Error banner ──────────────────────────────────────────────────────────── */
.error-msg {
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .dash-deck { grid-template-columns: 1fr; }
  .dash-charts { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .tile-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile nav elements (hidden on desktop) ─────────────────────────────── */
.mobile-header,
.mobile-tabs,
.mobile-menu { display: none; }

@media (max-width: 768px) {
  /* Hide desktop sidebar */
  nav.sidebar { display: none; }
  .alpha-banner { display: none; }

  .app-shell { grid-template-columns: 1fr; }
  main.content { grid-column: 1; min-width: 0; margin-top: 52px; padding: 0; }
  .page { padding: 20px 16px 80px; min-width: 0; }

  /* Layout fixes */
  .dash-deck { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .dashboard-page, .upcoming-cards, .contact-grid, .chart-grid, .stats-grid, .activity-feed, .note-list, .section-head { min-width: 0; }
  .upcoming-card, .contact-card, .activity-item, .note-item { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }

  /* ── Mobile top header ── */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--accent-muted);
    padding: 0 16px;
    z-index: 100;
  }
  .is-preview .mobile-header { top: 30px; }
  .is-preview main.content { margin-top: calc(52px + 30px); }

  .mobile-logo {
    font-family: 'Quantico', sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: var(--accent);
  }

  .mobile-hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    transition: color 0.15s, background 0.15s;
  }
  .mobile-hamburger-btn svg { width: 18px; height: 18px; }
  .mobile-hamburger-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

  /* ── Hamburger dropdown ── */
  .mobile-menu { display: block; } /* controlled by .open */
  .mobile-menu:not(.open) .mobile-menu-backdrop,
  .mobile-menu:not(.open) .mobile-menu-panel { display: none; }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
  }
  .mobile-menu-panel {
    position: fixed;
    top: 60px; right: 12px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 6px;
    z-index: 111;
    min-width: 180px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  }
  .is-preview .mobile-menu-panel { top: calc(60px + 30px); }

  .mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    background: none;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, color 0.12s;
  }
  .mobile-menu-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
  .mobile-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
  .mobile-menu-divider { border: none; border-top: 1px solid var(--border); margin: 6px 0; }

  /* ── Bottom tab bar ── */
  .mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--accent-muted);
    z-index: 100;
  }
  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
  }
  .mobile-tab svg { width: 22px; height: 22px; stroke-width: 1.75; }
  .mobile-tab.active { color: var(--accent); }
  .mobile-tab:hover { color: rgba(255, 255, 255, 0.7); }
}

@media (max-width: 480px) {
  .tile-row { grid-template-columns: 1fr; }
  .auth-card { padding: 32px 24px; }
  .modal-header, .modal-body, .modal-footer { padding: 20px 18px; }
}

/* ── Themes ──────────────────────────────────────────────────────────────── */
/* theme1: default — :root values apply, no override block needed            */

[data-theme="theme2"] {
  --bg:            #0d1b2e;
  --surface:       #061020;
  --surface-alt:   #0d1b2e;
  --surface-soft:  #090f1e;
  --accent:        #38bdf8;
  --accent-contrast: #000000;
  --accent-muted:  rgba(56, 189, 248, 0.12);
  --accent-hover:  rgba(56, 189, 248, 0.18);
  --muted:         #94a3b8;
  --border:        rgba(56, 189, 248, 0.16);
  --shadow:        0 32px 80px rgba(0, 10, 40, 0.65);
  --radius:        16px;
}

[data-theme="theme3"] {
  --bg:            #32805a;
  --surface:       #000000;
  --surface-alt:   #32805a;
  --surface-soft:  #1a4030;
  --accent:        #e4ff5a;
  --accent-contrast: #000000;
  --accent-muted:  rgba(228, 255, 90, 0.14);
  --accent-hover:  rgba(228, 255, 90, 0.22);
  --muted:         #ccd2ba;
  --border:        rgba(112, 205, 112, 0.30);
  --shadow:        0 32px 80px rgba(0, 0, 0, 0.70);
  --radius:        0px;
  font-family: 'Quantico', 'Courier New', monospace;
}
[data-theme="theme3"] * {
  border-radius: 0 !important;
}

/* ── Theme picker (settings) ─────────────────────────────────────────────── */
.theme-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.theme-btn:hover { color: #ffffff; border-color: var(--accent); }
.theme-btn.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
