@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;600&display=swap');

:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --panel: #12121a;
  --card: #1a1a25;
  --border: #2a2a33;
  --text: #ffffff;
  --muted: #888;
  --accent: #4285f4;
  --accent-2: #2ecc71;
  --danger: #e74c3c;
  --text-dim: #888;
  --success: #2ecc71;
  --warning: #f39c12;
  --purple: #a78bfa;
  --accent-hover: #5a9bf4;
  --warn: #f39c12;
  /* Appearance system — overridden by JS */
  --accent-color: #4A9FD9;
  --accent-color-hover: #3A8FC9;
  --accent-color-rgb: 74, 159, 217;
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a25;
  --text-primary: #e0e6ed;
  --text-secondary: #94a3b8;
  --border-color: #2a2a33;
}

/* Light theme overrides */
body.theme-light {
  --bg: #f8fafc;
  --panel: #ffffff;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --text-dim: #64748b;
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  color-scheme: light;
}
body.theme-light input,
body.theme-light textarea,
body.theme-light select {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #1e293b;
}
body.theme-light .module-btn {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}
body.theme-light .module-btn:hover {
  background: rgba(74, 159, 217, 0.08);
  color: #1e293b;
}
body.theme-light .module-btn.active {
  background: var(--accent-color, var(--accent));
  color: #ffffff;
  border-color: var(--accent-color, var(--accent));
}
body.theme-light .module-btn .nav-subtitle {
  color: #64748b;
}
body.theme-light .module-btn.active .nav-subtitle {
  color: rgba(255, 255, 255, 0.85);
}

/* Turquoise Economy domain override */
.te-domain { --accent-color: #2EC4B6; }
@font-face {
  font-family: "Ethnocentric";
  src: url("../../ethnocentric rg.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Cormorant Garamond", "Palatino Linotype", Georgia, serif;
  min-height: 100vh;
}
header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 {
  font-family: "Ethnocentric", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--accent);
}
nav {
  display: flex;
  gap: 12px;
}
nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
}
nav a.active,
nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
main {
  padding: 32px;
  display: grid;
  gap: 24px;
}
.section-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.card h2 {
  font-size: 16px;
  color: var(--accent);
}
label {
  font-size: 13px;
  color: var(--muted);
}
input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1018;
  color: var(--text);
  font-size: 14px;
}
textarea {
  min-height: 120px;
  resize: vertical;
}
button {
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
button.secondary {
  background: #2d2f3e;
}
button.danger {
  background: var(--danger);
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.status {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1018;
  white-space: pre-wrap;
}
.status.success {
  border-color: rgba(46, 204, 113, 0.4);
  color: var(--accent-2);
}
.status.error {
  border-color: rgba(231, 76, 60, 0.6);
  color: var(--danger);
}
.table {
  display: grid;
  gap: 8px;
}
.table-row {
  padding: 10px;
  background: #0f1018;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: rgba(66, 133, 244, 0.15);
  color: var(--accent);
}
.badge.warn {
  background: rgba(243, 156, 18, 0.15);
  color: var(--warn);
}
.badge.success {
  background: rgba(46, 204, 113, 0.15);
  color: var(--accent-2);
}
footer {
  padding: 24px 32px;
  color: var(--muted);
  font-size: 12px;
}

/* Ethnocentric font */
@font-face {
  font-family: 'Ethnocentric';
  src: url('https://fonts.cdnfonts.com/css/ethnocentric') format('woff2');
  font-weight: normal;
  font-style: normal;
}

/* Logo styling */
.logo {
  font-family: 'Ethnocentric', 'Orbitron', sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
}

/* Module navigation */
.module-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.module-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: #c8dce8;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.module-btn .nav-label {
  display: block;
  line-height: 1.2;
}
.module-btn .nav-subtitle {
  display: block;
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
  font-weight: 300;
  opacity: 0.7;
}
.module-btn:hover .nav-subtitle {
  opacity: 1;
}
.module-btn.active .nav-subtitle {
  color: var(--bg);
  opacity: 0.85;
}

.module-btn:hover {
  border-color: var(--accent);
  color: #ffffff;
  background: rgba(66, 133, 244, 0.1);
}

.module-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

/* Sub-navigation */
.subnav {
  display: flex;
  gap: 0;
  padding: 0 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  height: 36px;
  align-items: stretch;
}
.subnav-link {
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #8899aa;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.subnav-link:hover { color: #c8dce8; }
.subnav-link.active { color: #c8dce8; border-bottom-color: #0d9488; }
.subnav-divider {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #4a5568;
  border-left: 1px solid #2a2a4a;
  margin-left: 4px;
  user-select: none;
}

/* Breadcrumb */
.identity-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 32px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-dim, #64748b);
  background: rgba(0,0,0,0.15);
  border-bottom: 1px solid var(--border, #1a1a2a);
}
.bc-link {
  color: var(--text-dim, #64748b);
  text-decoration: none;
  transition: color 0.15s;
}
.bc-link:hover { color: var(--accent, #2dd4bf); }
.bc-sep { color: #3a3a5a; font-size: 14px; }
.bc-current { color: var(--text, #e2e8f0); font-weight: 500; }

body.user-view-mode .admin-only {
  display: none !important;
}

/* Collapsible sections */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.collapsible-header .chevron {
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.collapsible-header .chevron.expanded {
  transform: rotate(90deg);
}
.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.collapsible-body.expanded {
  max-height: 2000px;
}

/* ── Mobile Bottom Nav ─────────────────────────────── */
.mobile-bottom-nav {
  display: none;
}

/* ── Mobile Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  header h1 {
    font-size: 16px;
  }
  nav {
    flex-wrap: wrap;
    gap: 6px;
  }
  nav a {
    font-size: 12px;
    padding: 6px 8px;
  }
  main {
    padding: 16px;
    padding-bottom: 80px;
    gap: 16px;
  }
  .section-grid {
    grid-template-columns: 1fr;
  }
  .module-nav {
    display: none;
  }
  .subnav {
    padding: 0 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .subnav-link {
    font-size: 12px;
    padding: 0 14px;
    white-space: nowrap;
  }
  footer {
    padding: 16px;
    padding-bottom: 80px;
  }

  /* Mobile bottom navigation bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(18, 18, 26, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.2s;
    min-width: 56px;
  }
  .mobile-nav-item:hover,
  .mobile-nav-item.active {
    color: var(--accent-color, var(--accent));
  }
  .mobile-nav-icon {
    font-size: 18px;
    line-height: 1;
  }
  .mobile-nav-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.3px;
    text-transform: uppercase;
  }
}

/* Light theme mobile bottom nav */
body.theme-light .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.92);
}

/* Sprint C: Module header styling */
.module-header {
  font-family: "Ethnocentric", "Segoe UI", sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent);
}

/* ═══ IDENTITY STRIP ═══ */
.identity-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 24px;
  background: var(--bg-secondary, #12121a);
  border-bottom: 1px solid var(--border-color, #2a2a33);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  position: sticky;
  top: 0;
  z-index: 90;
  min-height: 40px;
}
.identity-strip.strip-princeps {
  border-bottom: 1px solid rgba(46, 196, 182, 0.3);
}
.strip-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-color, #4A9FD9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.strip-princeps .strip-avatar {
  background: linear-gradient(135deg, #1a8a8a, #2EC4B6);
}
.strip-name {
  font-weight: 500;
  color: var(--text-primary, #e0e6ed);
  white-space: nowrap;
}
.strip-handle {
  color: var(--text-secondary, #94a3b8);
  font-size: 0.8rem;
  white-space: nowrap;
}
.strip-role {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--accent-color, #4A9FD9);
  color: #fff;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.strip-princeps .strip-role {
  background: linear-gradient(135deg, #1a8a8a, #2EC4B6);
  color: #0D1117;
  font-weight: 700;
}
.strip-tier {
  display: flex;
  gap: 3px;
  align-items: center;
}
.strip-tier-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-color, #2a2a33);
}
.strip-tier-dot.active {
  background: var(--accent-color, #4A9FD9);
}
.strip-balance {
  color: var(--text-secondary, #94a3b8);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.8rem;
  white-space: nowrap;
}
.strip-security {
  display: flex;
  align-items: center;
  color: var(--text-dim, #888);
}
.strip-security.strip-security-ok {
  color: #10b981;
}
.strip-security.strip-security-warn {
  color: #f59e0b;
}
.strip-security.strip-security-crit {
  color: #ef4444;
}
.strip-bell {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.strip-bell:hover {
  color: var(--text-primary, #e0e6ed);
}
.strip-bell-count {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}
.strip-bell-count.strip-bell-critical {
  background: #ef4444;
}
.strip-spacer {
  flex: 1;
}
.strip-expand {
  background: none;
  border: none;
  color: var(--text-dim, #888);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
}
.strip-expand:hover {
  color: var(--text-primary, #e0e6ed);
}

/* Dropdown panel */
.strip-dropdown {
  display: none;
  flex-direction: column;
  gap: 12px;
  position: absolute;
  top: 100%;
  right: 24px;
  width: 320px;
  background: var(--bg-card, #1a1a25);
  border: 1px solid var(--border-color, #2a2a33);
  border-radius: 12px;
  padding: 16px;
  z-index: 91;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-family: 'Inter', sans-serif;
}
.strip-dd-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.strip-dd-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim, #888);
}
.strip-dd-value {
  font-size: 13px;
  color: var(--text-primary, #e0e6ed);
}
.strip-dd-link {
  color: var(--accent-color, #4A9FD9);
  font-size: 11px;
  text-decoration: none;
  margin-left: 8px;
}
.strip-dd-link:hover {
  text-decoration: underline;
}
.strip-dd-links {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, #2a2a33);
}
.strip-dd-links a {
  font-size: 12px;
  color: var(--accent-color, #4A9FD9);
  text-decoration: none;
}
.strip-dd-links a:hover {
  text-decoration: underline;
}

/* Identity strip wrapper for sticky + dropdown positioning */
.identity-strip-wrap {
  position: sticky;
  top: 0;
  z-index: 90;
}

/* Mobile: collapse to avatar + name + bell */
@media (max-width: 768px) {
  .identity-strip {
    gap: 8px;
    padding: 6px 16px;
  }
  .strip-handle,
  .strip-tier,
  .strip-balance,
  .strip-security,
  .strip-role {
    display: none;
  }
  .strip-dropdown {
    right: 8px;
    width: calc(100vw - 16px);
    max-width: 360px;
  }
}

/* Tribe detail — module buttons (AKADEMY, ANAMNESIS) */
.tribe-module-btn-akademy,
.tribe-module-btn-anamnesis {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  border-radius: 10px;
  text-decoration: none;
  font-family: Ethnocentric, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 3px;
  transition: all 0.3s;
}
.tribe-module-btn-akademy {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.15), rgba(45, 212, 191, 0.05));
  border: 1px solid rgba(45, 212, 191, 0.4);
  color: #2dd4bf;
}
.tribe-module-btn-akademy:hover {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.25), rgba(45, 212, 191, 0.1));
}
.tribe-module-btn-anamnesis {
  background: linear-gradient(135deg, rgba(212, 167, 45, 0.15), rgba(212, 167, 45, 0.05));
  border: 1px solid rgba(212, 167, 45, 0.4);
  color: #d4a72d;
}
.tribe-module-btn-anamnesis:hover {
  background: linear-gradient(135deg, rgba(212, 167, 45, 0.25), rgba(212, 167, 45, 0.1));
}
.tribe-module-btn-label {
  font-size: 0.85rem;
  opacity: 0.6;
}
.tribe-module-btn-icon {
  width: 20px;
  height: 20px;
}
