/* ===== PSYCIK — Obsidian & Gold ===== */

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

:root {
  --bg: #050508;
  --bg-warm: #0a0a0f;
  --surface: rgba(201, 169, 110, 0.04);
  --surface-hover: rgba(201, 169, 110, 0.08);
  --surface-border: rgba(201, 169, 110, 0.08);
  --surface-border-strong: rgba(201, 169, 110, 0.14);
  --gold: #C9A96E;
  --gold-light: #E8C97D;
  --gold-dim: rgba(201, 169, 110, 0.12);
  --gold-glow: rgba(201, 169, 110, 0.25);
  --lavender: #9B8EC4;
  --lavender-dim: rgba(155, 142, 196, 0.12);
  --rose: #C4767A;
  --rose-dim: rgba(196, 118, 122, 0.12);
  --text: #EDE8E0;
  --text-muted: #8A8378;
  --text-dim: #5C574F;
  --danger: #C4767A;
  --success: #7AB88F;
  --warning: #D4A74E;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --nav-height: 68px;
  --font: 'Sora', -apple-system, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --mono: 'JetBrains Mono', monospace;
  --gradient-gold: linear-gradient(135deg, #C9A96E, #E8C97D);
  --gradient-warm: linear-gradient(135deg, #C9A96E 0%, #9B8EC4 100%);
  --gradient-surface: linear-gradient(135deg, rgba(201, 169, 110, 0.06), rgba(155, 142, 196, 0.03));
  --shadow-gold: 0 4px 24px rgba(201, 169, 110, 0.15);
  --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.4);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}

/* ===== ATMOSPHERIC BACKGROUND ===== */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.atmo-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  animation: orbFloat 20s ease-in-out infinite;
}

.atmo-orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(201, 169, 110, 0.15), transparent 70%);
  top: -10%;
  right: -5%;
  animation-duration: 25s;
}

.atmo-orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(155, 142, 196, 0.1), transparent 70%);
  bottom: -10%;
  left: -5%;
  animation-duration: 30s;
  animation-delay: -8s;
}

.atmo-orb-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(201, 169, 110, 0.08), transparent 70%);
  top: 40%;
  left: 30%;
  animation-duration: 22s;
  animation-delay: -15s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.025;
  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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-light); text-decoration: none; }

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  outline: none;
}

input, textarea, select {
  font-family: var(--font);
  outline: none;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201, 169, 110, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201, 169, 110, 0.3); }

/* ===== LAYOUT ===== */
#app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding-bottom: 0;
}

body.logged-in #app {
  padding-bottom: calc(var(--nav-height) + 8px);
}

body.logged-in {
  overflow: hidden;
  height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.page {
  padding: 28px 20px 40px;
  max-width: 800px;
  margin: 0 auto;
  animation: fadeUp 0.5s var(--ease-smooth);
  overflow-y: auto;
  height: calc(100vh - var(--nav-height) - 8px);
  height: calc(100dvh - var(--nav-height) - 8px);
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(5, 5, 8, 0.88);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid rgba(201, 169, 110, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav.hidden {
  display: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 18px;
  border-radius: var(--radius);
  background: none;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  transition: all 0.3s var(--ease-smooth);
  text-transform: uppercase;
  position: relative;
}

.nav-item .nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: transform 0.3s var(--ease-spring);
}

.nav-item .nav-icon svg {
  width: 20px;
  height: 20px;
}

.nav-item:hover {
  color: var(--text-muted);
}

.nav-item:hover .nav-icon {
  transform: translateY(-1px);
}

.nav-item.active {
  color: var(--gold);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--gradient-gold);
  border-radius: 0 0 4px 4px;
}

/* ===== GLASS CARD ===== */
.card {
  background: linear-gradient(145deg, rgba(201, 169, 110, 0.04), rgba(155, 142, 196, 0.02));
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.35s var(--ease-smooth), transform 0.35s var(--ease-smooth), box-shadow 0.35s var(--ease-smooth);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 169, 110, 0.12), transparent);
  opacity: 0;
  transition: opacity 0.35s;
}

.card:hover {
  border-color: var(--surface-border-strong);
}

.card:hover::before {
  opacity: 1;
}

.card-glow:hover {
  border-color: rgba(201, 169, 110, 0.2);
  box-shadow: 0 0 40px rgba(201, 169, 110, 0.06);
  transform: translateY(-2px);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.3s var(--ease-smooth);
  border: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-gold);
  color: #0a0a0f;
  box-shadow: var(--shadow-gold);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-primary:hover {
  box-shadow: 0 6px 32px rgba(201, 169, 110, 0.35);
  transform: translateY(-2px);
}

.btn-primary:hover::after {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-gold);
}

.btn-secondary {
  background: rgba(201, 169, 110, 0.06);
  color: var(--gold);
  border: 1px solid rgba(201, 169, 110, 0.12);
}

.btn-secondary:hover {
  background: rgba(201, 169, 110, 0.1);
  border-color: rgba(201, 169, 110, 0.2);
}

.btn-danger {
  background: rgba(196, 118, 122, 0.08);
  color: var(--danger);
  border: 1px solid rgba(196, 118, 122, 0.12);
}

.btn-danger:hover {
  background: rgba(196, 118, 122, 0.14);
  border-color: rgba(196, 118, 122, 0.2);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 13px 18px;
  background: rgba(201, 169, 110, 0.03);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
  letter-spacing: -0.01em;
}

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
  background: rgba(201, 169, 110, 0.05);
}

.form-input::placeholder {
  color: var(--text-dim);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238A8378' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

select.form-input option {
  background: #12120f;
  color: var(--text);
}

.form-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== AUTH PAGE ===== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
  position: relative;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  animation: scaleIn 0.6s var(--ease-smooth);
}

.auth-card .card {
  padding: 44px 32px;
  border: 1px solid rgba(201, 169, 110, 0.1);
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(201, 169, 110, 0.04);
}

.auth-logo {
  text-align: center;
  margin-bottom: 36px;
}

.auth-logo h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 400;
  font-style: italic;
  background: var(--gradient-warm);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s ease-in-out infinite;
  letter-spacing: 0.02em;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 6px;
  font-weight: 300;
  letter-spacing: 0.02em;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--gold);
  font-weight: 500;
}

/* ===== CHAT ===== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - 8px);
  height: calc(100dvh - var(--nav-height) - 8px);
  max-width: 800px;
  margin: 0 auto;
}

.chat-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(5, 5, 8, 0.5);
  backdrop-filter: blur(12px);
}

.chat-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  font-style: italic;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chat-remaining {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 82%;
  animation: fadeUp 0.35s var(--ease-smooth);
}

.message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-assistant {
  align-self: flex-start;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease-spring);
}

.message:hover .message-avatar {
  transform: scale(1.05);
}

.message-assistant .message-avatar {
  background: var(--gradient-gold);
  box-shadow: 0 2px 12px rgba(201, 169, 110, 0.2);
}

.message-user .message-avatar {
  background: rgba(201, 169, 110, 0.06);
  border: 1px solid var(--surface-border);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gold);
}

.message-bubble {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: break-word;
}

.message-user .message-bubble {
  background: var(--gradient-gold);
  color: #0a0a0f;
  border-bottom-right-radius: 6px;
  font-weight: 400;
}

.message-assistant .message-bubble {
  background: linear-gradient(145deg, rgba(201, 169, 110, 0.05), rgba(155, 142, 196, 0.03));
  border: 1px solid var(--surface-border);
  border-bottom-left-radius: 6px;
}

.message-system {
  align-self: center;
  max-width: 90%;
}

.message-system .message-bubble {
  background: var(--lavender-dim);
  border: 1px solid rgba(155, 142, 196, 0.15);
  color: var(--lavender);
  font-size: 0.82rem;
  text-align: center;
  border-radius: var(--radius);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.32s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-7px); opacity: 1; }
}

/* Chat input */
.chat-input-bar {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--surface-border);
  background: rgba(5, 5, 8, 0.85);
  backdrop-filter: blur(16px);
  flex-shrink: 0;
}

.chat-input-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  max-width: 760px;
  margin: 0 auto;
}

.chat-input {
  flex: 1;
  padding: 13px 20px;
  background: rgba(201, 169, 110, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  color: var(--text);
  font-size: 0.9rem;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.chat-input:focus {
  border-color: rgba(201, 169, 110, 0.25);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.06);
}

.chat-send-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--gradient-gold);
  color: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
  box-shadow: var(--shadow-gold);
}

.chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(201, 169, 110, 0.35);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  opacity: 0.25;
  transform: none;
  box-shadow: none;
}

/* Upgrade banner */
.upgrade-banner {
  margin: 14px 20px;
  padding: 16px 22px;
  border-radius: var(--radius);
  background: var(--gradient-surface);
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  animation: fadeIn 0.4s var(--ease-smooth);
}

.upgrade-banner p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upgrade-banner strong {
  color: var(--gold);
}

/* ===== CONTACTS ===== */
.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  transition: border-color 0.3s, background 0.3s;
}

.contact-card:hover {
  border-color: var(--surface-border-strong);
  background: rgba(201, 169, 110, 0.03);
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--gradient-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0a0a0f;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(201, 169, 110, 0.15);
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.contact-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.contact-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--gold-dim);
  color: var(--gold);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contact-delete {
  background: none;
  color: var(--text-dim);
  font-size: 1rem;
  padding: 8px;
  border-radius: 10px;
  transition: all 0.25s;
}

.contact-delete:hover {
  color: var(--danger);
  background: var(--rose-dim);
}

/* Add form */
.add-form {
  margin-bottom: 24px;
}

.add-form .card {
  padding: 22px;
}

.add-form h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--text);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ===== MEMORIES ===== */
.memory-group {
  margin-bottom: 32px;
  animation: fadeUp 0.4s var(--ease-smooth);
}

.memory-category {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 12px;
  padding-left: 4px;
}

.memory-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memory-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
}

.memory-content {
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.6;
}

.memory-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.badge-preference { background: var(--gold-dim); color: var(--gold); }
.badge-goal { background: var(--lavender-dim); color: var(--lavender); }
.badge-fact { background: rgba(122, 184, 143, 0.1); color: var(--success); }
.badge-habit { background: rgba(212, 167, 78, 0.1); color: var(--warning); }
.badge-reminder { background: var(--rose-dim); color: var(--rose); }

.memory-delete {
  background: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.25s;
  flex-shrink: 0;
}

.memory-delete:hover {
  color: var(--danger);
  background: var(--rose-dim);
}

/* ===== SETTINGS ===== */
.settings-section {
  margin-bottom: 32px;
  animation: fadeUp 0.4s var(--ease-smooth);
}

.settings-section:nth-child(2) { animation-delay: 0.05s; }
.settings-section:nth-child(3) { animation-delay: 0.1s; }
.settings-section:nth-child(4) { animation-delay: 0.15s; }

.settings-section h3 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 14px;
  padding-left: 4px;
}

.settings-card {
  padding: 22px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid rgba(201, 169, 110, 0.04);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.settings-row-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tier-free {
  background: rgba(201, 169, 110, 0.04);
  color: var(--text-dim);
  border: 1px solid var(--surface-border);
}

.tier-basic {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid rgba(201, 169, 110, 0.15);
}

.tier-standard {
  background: linear-gradient(135deg, var(--gold-dim), var(--lavender-dim));
  color: var(--gold-light);
  border: 1px solid rgba(201, 169, 110, 0.2);
}

.tier-pro {
  background: var(--gradient-gold);
  color: #0a0a0f;
  box-shadow: 0 2px 12px rgba(201, 169, 110, 0.2);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(201, 169, 110, 0.08);
  border: 1px solid var(--surface-border);
  border-radius: 28px;
  cursor: pointer;
  transition: all 0.35s var(--ease-smooth);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all 0.35s var(--ease-spring);
}

.toggle input:checked + .toggle-slider {
  background: var(--gold-dim);
  border-color: rgba(201, 169, 110, 0.2);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: var(--gold);
  box-shadow: 0 2px 8px rgba(201, 169, 110, 0.3);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 72px 20px;
  color: var(--text-muted);
  animation: fadeIn 0.5s var(--ease-smooth);
}

.empty-state-icon {
  font-size: 2.8rem;
  margin-bottom: 18px;
  display: block;
  opacity: 0.35;
}

.empty-state h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.88rem;
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(20px);
  animation: toastIn 0.4s var(--ease-spring), toastOut 0.4s var(--ease-smooth) 3s forwards;
  max-width: 360px;
  box-shadow: var(--shadow-elevated);
}

.toast-success {
  background: rgba(122, 184, 143, 0.12);
  border: 1px solid rgba(122, 184, 143, 0.2);
  color: var(--success);
}

.toast-error {
  background: rgba(196, 118, 122, 0.12);
  border: 1px solid rgba(196, 118, 122, 0.2);
  color: var(--danger);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

/* ===== LOADING SPINNER ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(201, 169, 110, 0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== ADSENSE ===== */
.ad-slot {
  text-align: center;
  padding: 12px 20px;
  min-height: 60px;
  position: relative;
  z-index: 2;
}

@media (max-width: 767px) {
  body.logged-in .ad-slot {
    display: none;
  }
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 400;
  font-style: italic;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.01em;
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
  font-weight: 300;
}

/* ===== DESKTOP SIDEBAR ===== */
@media (min-width: 768px) {
  .bottom-nav {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 80px;
    height: 100vh;
    flex-direction: column;
    justify-content: center;
    border-top: none;
    border-right: 1px solid var(--surface-border);
    gap: 6px;
    padding-bottom: 0;
  }

  .nav-item.active::before {
    top: 50%;
    left: -1px;
    right: auto;
    transform: translateY(-50%);
    width: 2px;
    height: 24px;
    border-radius: 0 4px 4px 0;
  }

  #app {
    padding-bottom: 0;
    margin-left: 80px;
  }

  body.logged-in #app {
    padding-bottom: 0;
    margin-left: 80px;
  }

  body.logged-in {
    overflow: auto;
    height: auto;
  }

  .chat-container {
    height: 100vh;
  }

  .page {
    height: auto;
    overflow-y: visible;
  }
}

/* ===== MISC ===== */
.divider {
  border: none;
  border-top: 1px solid var(--surface-border);
  margin: 20px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ===== CONTACT ACTIONS ===== */
.contact-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.contact-action-btn {
  background: rgba(201, 169, 110, 0.06);
  border: 1px solid var(--surface-border);
  color: var(--gold);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  cursor: pointer;
}

.contact-action-btn:hover {
  background: var(--gold-dim);
  border-color: rgba(201, 169, 110, 0.2);
  transform: translateY(-1px);
}

/* ===== COMPOSE MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 20px;
  animation: fadeIn 0.25s var(--ease-smooth);
}

.modal-card {
  width: 100%;
  max-width: 460px;
  padding: 28px;
  animation: scaleIn 0.3s var(--ease-spring);
  border: 1px solid rgba(201, 169, 110, 0.1);
  box-shadow: var(--shadow-elevated);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.modal-to {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 8px 12px;
  background: rgba(201, 169, 110, 0.04);
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
}

.modal-body textarea.form-input {
  min-height: 100px;
  resize: vertical;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }

/* ===== SELECTION COLOR ===== */
::selection {
  background: rgba(201, 169, 110, 0.25);
  color: var(--text);
}

/* ===== FOCUS VISIBLE ===== */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
