/* ============================================
   ArcGenerations — Design Tokens v3
   Bold Gradient + Glassmorphism
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,900&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  /* Core palette */
  --plum-dark:   #241642;   /* deepest purple — gradients, headings */
  --plum:        #6D3FC0;   /* mid purple */
  --violet:      #9B6BFF;   /* bright violet — glow/accent */
  --mint:        #4CF2C2;   /* signature bright mint */
  --mint-deep:   #14D9A6;   /* mint for buttons/success */
  --mint-pale:   #DBFBF2;
  --lav-bg:      #F6F3FC;   /* base page background (light) */
  --lav-deep:    #ECE4FB;
  --paper:       #FFFFFF;
  --ink:         #1D1233;   /* near-black purple text */
  --ink-soft:    #6B6280;
  --line:        rgba(109,63,192,0.14);
  --danger:      #FF5C7A;

  /* Gradients — the signature look */
  --grad-primary: linear-gradient(135deg, #6D3FC0 0%, #9B6BFF 55%, #4CF2C2 100%);
  --grad-primary-hover: linear-gradient(135deg, #7C4FD0 0%, #A97EFF 55%, #5FFAD1 100%);
  --grad-mint: linear-gradient(135deg, #14D9A6 0%, #4CF2C2 100%);
  --grad-mint-hover: linear-gradient(135deg, #0FCB9A 0%, #3EE8B8 100%);
  --grad-hero-dark: radial-gradient(120% 140% at 15% 0%, #3A2270 0%, #241642 42%, #170D2E 100%);
  --grad-page-mesh:
    radial-gradient(60% 50% at 90% 0%, rgba(76,242,194,0.20) 0%, rgba(76,242,194,0) 70%),
    radial-gradient(55% 45% at 8% 10%, rgba(155,107,255,0.24) 0%, rgba(155,107,255,0) 70%),
    radial-gradient(50% 40% at 50% 100%, rgba(109,63,192,0.14) 0%, rgba(109,63,192,0) 70%);

  /* legacy aliases */
  --sand: var(--lav-bg);
  --sand-deep: var(--lav-deep);
  --moss: var(--plum);
  --moss-dark: var(--plum-dark);
  --fern: var(--violet);
  --leaf: var(--mint);
  --bark: var(--plum);
  --gold: var(--mint);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-card: 0 1px 2px rgba(36,22,66,0.05), 0 16px 36px -18px rgba(36,22,66,0.35);
  --shadow-glow-mint: 0 8px 24px -8px rgba(20,217,166,0.5);
  --shadow-glow-violet: 0 8px 24px -8px rgba(109,63,192,0.55);
  --glass-bg: rgba(255,255,255,0.62);
  --glass-bg-strong: rgba(255,255,255,0.78);
  --glass-border: rgba(255,255,255,0.55);
  --blur: blur(18px);
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  background-color: var(--lav-bg);
  background-image: var(--grad-page-mesh);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--plum-dark);
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 3.4vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; color: var(--ink-soft); }
a { color: var(--plum); text-decoration: none; }
a:hover { color: var(--violet); }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
img { max-width: 100%; display: block; }
::selection { background: var(--mint); color: var(--plum-dark); }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--mint-deep); outline-offset: 2px;
}

/* Gradient text utility */
.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--grad-hero-dark);
  color: var(--lav-bg);
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 8px 0 40px -20px rgba(36,22,66,0.5);
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; color: #fff; }
.sidebar .brand svg { width: 30px; height: 30px; flex-shrink: 0; }
.sidebar .brand span { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; color: #fff; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  color: rgba(246,243,252,0.75);
  padding: 11px 12px; border-radius: var(--radius-sm); margin-bottom: 3px;
  font-weight: 600; font-size: 0.95rem;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; transform: translateX(2px); }
.sidebar nav a.active {
  background: var(--grad-mint); color: #0F2A22 !important; font-weight: 800;
  box-shadow: var(--shadow-glow-mint);
}
.sidebar nav a.active svg { color: #0F2A22; }
.sidebar nav a svg { width: 18px; height: 18px; opacity: 0.95; flex-shrink: 0; }
.sidebar .nav-section-label {
  text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.09em;
  color: rgba(246,243,252,0.4); margin: 20px 12px 8px; font-weight: 700;
}
.sidebar .sidebar-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.14); }
.sidebar .user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.sidebar .user-chip:hover { background: rgba(255,255,255,0.08); }
.sidebar .user-chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--mint); }
.sidebar .user-chip .who { font-size: 0.85rem; color: #fff; font-weight: 700; line-height: 1.2; }
.sidebar .user-chip .who small { display:block; color: rgba(246,243,252,0.55); font-weight: 400; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 1.3rem; margin: 0; }
.topbar .search {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.7); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 16px; width: 320px; max-width: 40vw;
}
.topbar .search input { background: none; border: none; outline: none; width: 100%; color: var(--ink); }
.topbar .search svg { width: 16px; height: 16px; color: var(--ink-soft); flex-shrink: 0; }
.topbar .actions { display: flex; align-items: center; gap: 14px; }

.content { padding: 32px; max-width: 1180px; width: 100%; margin: 0 auto; }

.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.menu-toggle svg { width: 24px; height: 24px; color: var(--plum-dark); }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 100;
    transform: translateX(-100%); transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .topbar .search { display: none; }
  .content { padding: 20px; }
  .topbar { padding: 14px 18px; }
}

/* ---------- Glass cards ---------- */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

/* ---------- Buttons — bulletproof contrast, works on <a> or <button> ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700; font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.96); }

a.btn, button.btn, .btn { color: var(--ink); } /* sane default before variant applies */

a.btn-primary, button.btn-primary, .btn-primary {
  background: var(--grad-primary);
  color: #FFFFFF !important;
  box-shadow: var(--shadow-glow-violet);
}
a.btn-primary:hover, button.btn-primary:hover, .btn-primary:hover {
  background: var(--grad-primary-hover); color: #FFFFFF !important; transform: translateY(-1px);
}

a.btn-mint, button.btn-mint, .btn-mint, a.btn-gold, button.btn-gold, .btn-gold {
  background: var(--grad-mint);
  color: #0B2A22 !important;
  box-shadow: var(--shadow-glow-mint);
}
a.btn-mint:hover, button.btn-mint:hover, .btn-mint:hover, a.btn-gold:hover, button.btn-gold:hover, .btn-gold:hover {
  background: var(--grad-mint-hover); color: #0B2A22 !important; transform: translateY(-1px);
}

a.btn-outline, button.btn-outline, .btn-outline {
  background: rgba(255,255,255,0.5);
  border-color: var(--line);
  color: var(--ink) !important;
}
a.btn-outline:hover, button.btn-outline:hover, .btn-outline:hover {
  border-color: var(--plum); color: var(--plum) !important; background: rgba(255,255,255,0.8);
}

a.btn-ghost, button.btn-ghost, .btn-ghost { background: transparent; color: var(--ink-soft) !important; }
a.btn-ghost:hover, button.btn-ghost:hover, .btn-ghost:hover { background: var(--lav-deep); color: var(--ink) !important; }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 15px; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--plum); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.75); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--plum); background: #fff; }
.field small.hint { display:block; margin-top: 4px; color: var(--ink-soft); font-size: 0.78rem; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px; background: var(--lav-deep); color: var(--plum);
}
.badge.green { background: var(--mint-pale); color: #0E7A61; }
.badge.gold { background: #F0E5FE; color: #6D3FC0; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--lav-deep); }
.avatar-ring { border-radius: 50%; padding: 3px; background: var(--grad-primary); }
.avatar-ring img { border-radius: 50%; display: block; border: 2px solid var(--paper); }

.divider-roots {
  height: 28px; width: 100%; margin: 8px 0 24px;
  background-repeat: repeat-x; background-size: 140px 28px; opacity: 0.6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='28' viewBox='0 0 140 28'%3E%3Cpath d='M0 4 Q 35 24 70 4 T 140 4' stroke='%239B6BFF' stroke-width='1.4' fill='none'/%3E%3C/svg%3E");
}

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: var(--grad-hero-dark); color: #fff; padding: 13px 20px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-card);
  font-size: 0.9rem; font-weight: 700;
  opacity: 0; transform: translateY(8px); transition: all 0.25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 14px; color: var(--mint-deep); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.switch { position:relative; width:44px; height:24px; display:inline-block; }
.switch input { opacity:0; width:0; height:0; }
.switch .slider { position:absolute; inset:0; background: var(--line); border-radius:999px; cursor:pointer; transition: .2s; }
.switch .slider::before { content:''; position:absolute; width:18px;height:18px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.2s; }
.switch input:checked + .slider { background: var(--grad-mint); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.skeleton {
  background: linear-gradient(90deg, var(--lav-deep) 25%, var(--lav-bg) 37%, var(--lav-deep) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}