/* Default = Persian Blue + Turquoise + Sand */
:root,
[data-palette="persian"] {
  --ink: #0A1628;
  --forest: #12243D;
  --forest-light: #1A3254;
  --forest-hover: #23406A;
  --forest-border: #2A4A75;
  --mint: #40E0D0;
  --mint-dim: #2A9D8F;
  --gold: #E8D5B7;
  --white: #F5F7FA;
  --muted: #9BB0C9;
  --muted-dim: #6B8299;
  --danger: #E38C72;
  --hero-glow: #1C39BB;
  --mint-rgb: 64, 224, 208;
  --gold-rgb: 232, 213, 183;
  --danger-rgb: 227, 140, 114;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-soft: 0 20px 40px -20px rgba(0, 0, 0, 0.55);
  --primary: var(--forest);
  --primary-dark: var(--ink);
  --background: var(--ink);
  --surface: var(--forest);
  --text-primary: var(--white);
  --text-secondary: var(--muted);
  --border: var(--forest-border);
}

/* Classic dark green (original) */
[data-palette="classic"] {
  --ink: #06170F;
  --forest: #0D2B1E;
  --forest-light: #153A29;
  --forest-hover: #1B4632;
  --forest-border: #204934;
  --mint: #8FF0B8;
  --mint-dim: #4FAE7C;
  --gold: #E3B872;
  --white: #F7FAF7;
  --muted: #9FC3AE;
  --muted-dim: #6E9482;
  --danger: #E38C72;
  --hero-glow: #113626;
  --mint-rgb: 143, 240, 184;
  --gold-rgb: 227, 184, 114;
  --danger-rgb: 227, 140, 114;
}

/* Navy + Electric Lime */
[data-palette="navy_lime"] {
  --ink: #060B18;
  --forest: #0C1630;
  --forest-light: #132040;
  --forest-hover: #1A2C55;
  --forest-border: #243660;
  --mint: #C8FF00;
  --mint-dim: #A8D900;
  --gold: #A8B4D0;
  --white: #F4F7FF;
  --muted: #8FA0C0;
  --muted-dim: #5C6E90;
  --danger: #FF6B6B;
  --hero-glow: #152850;
  --mint-rgb: 200, 255, 0;
  --gold-rgb: 168, 180, 208;
  --danger-rgb: 255, 107, 107;
}

/* Forest Green + Cream + Coral */
[data-palette="forest_cream"] {
  --ink: #0C1610;
  --forest: #1B3324;
  --forest-light: #264433;
  --forest-hover: #315540;
  --forest-border: #3D644C;
  --mint: #F5EBD8;
  --mint-dim: #D9C9A8;
  --gold: #FF6F61;
  --white: #FFFBF5;
  --muted: #B0C4B4;
  --muted-dim: #7E9686;
  --danger: #E85A4F;
  --hero-glow: #234030;
  --mint-rgb: 245, 235, 216;
  --gold-rgb: 255, 111, 97;
  --danger-rgb: 232, 90, 79;
}

/* Mono — Black + White */
[data-palette="mono"] {
  --ink: #0A0A0A;
  --forest: #1A1A1A;
  --forest-light: #262626;
  --forest-hover: #333333;
  --forest-border: #404040;
  --mint: #F5F5F5;
  --mint-dim: #D4D4D4;
  --gold: #A0A0A0;
  --white: #FAFAFA;
  --muted: #B0B0B0;
  --muted-dim: #737373;
  --danger: #EF4444;
  --hero-glow: #2A2A2A;
  --mint-rgb: 245, 245, 245;
  --gold-rgb: 160, 160, 160;
  --danger-rgb: 239, 68, 68;
}

/* Forest — Green + Cream */
[data-palette="forest"] {
  --ink: #0E1812;
  --forest: #1A2E22;
  --forest-light: #243A2C;
  --forest-hover: #2F4A38;
  --forest-border: #3A5A44;
  --mint: #E8DCC8;
  --mint-dim: #C9BBA0;
  --gold: #7A9E7E;
  --white: #FBF7F0;
  --muted: #A8BBA8;
  --muted-dim: #6E8670;
  --danger: #D97757;
  --hero-glow: #1F3A28;
  --mint-rgb: 232, 220, 200;
  --gold-rgb: 122, 158, 126;
  --danger-rgb: 217, 119, 87;
}

/* Midnight — Black + Blue */
[data-palette="midnight"] {
  --ink: #05070E;
  --forest: #0A0E18;
  --forest-light: #121826;
  --forest-hover: #1A2438;
  --forest-border: #243048;
  --mint: #3B82F6;
  --mint-dim: #2563EB;
  --gold: #94A3B8;
  --white: #F1F5F9;
  --muted: #94A3B8;
  --muted-dim: #64748B;
  --danger: #F87171;
  --hero-glow: #1E3A8A;
  --mint-rgb: 59, 130, 246;
  --gold-rgb: 148, 163, 184;
  --danger-rgb: 248, 113, 113;
}

/* Ocean — Navy + Cyan */
[data-palette="ocean"] {
  --ink: #061018;
  --forest: #0B1F33;
  --forest-light: #123048;
  --forest-hover: #1A3E5C;
  --forest-border: #244E70;
  --mint: #22D3EE;
  --mint-dim: #06B6D4;
  --gold: #7DD3FC;
  --white: #F0F9FF;
  --muted: #7EB6D0;
  --muted-dim: #4A849E;
  --danger: #FB7185;
  --hero-glow: #0E4A6E;
  --mint-rgb: 34, 211, 238;
  --gold-rgb: 125, 211, 252;
  --danger-rgb: 251, 113, 133;
}

/* Sunset — Purple + Orange */
[data-palette="sunset"] {
  --ink: #120A18;
  --forest: #1A0F24;
  --forest-light: #2A1838;
  --forest-hover: #3A224C;
  --forest-border: #4A2E60;
  --mint: #FB923C;
  --mint-dim: #F97316;
  --gold: #C084FC;
  --white: #FFF7ED;
  --muted: #C4A8D8;
  --muted-dim: #8B6FA8;
  --danger: #F43F5E;
  --hero-glow: #5B21B6;
  --mint-rgb: 251, 146, 60;
  --gold-rgb: 192, 132, 252;
  --danger-rgb: 244, 63, 94;
}

/* Sakura — Burgundy + Pink */
[data-palette="sakura"] {
  --ink: #16080C;
  --forest: #2A1218;
  --forest-light: #3A1C24;
  --forest-hover: #4A2830;
  --forest-border: #5C343C;
  --mint: #F9A8D4;
  --mint-dim: #F472B6;
  --gold: #9F1239;
  --white: #FFF1F5;
  --muted: #D4A0B0;
  --muted-dim: #A06A7A;
  --danger: #E11D48;
  --hero-glow: #7F1D3A;
  --mint-rgb: 249, 168, 212;
  --gold-rgb: 159, 18, 57;
  --danger-rgb: 225, 29, 72;
}

/* Lavender — Violet + Gray */
[data-palette="lavender"] {
  --ink: #100E18;
  --forest: #1A1528;
  --forest-light: #262038;
  --forest-hover: #322C48;
  --forest-border: #403858;
  --mint: #C4B5FD;
  --mint-dim: #A78BFA;
  --gold: #94A3B8;
  --white: #F8F7FC;
  --muted: #B0A8C8;
  --muted-dim: #7A7290;
  --danger: #FB7185;
  --hero-glow: #4C1D95;
  --mint-rgb: 196, 181, 253;
  --gold-rgb: 148, 163, 184;
  --danger-rgb: 251, 113, 133;
}

/* Sand — Beige + Terracotta */
[data-palette="sand"] {
  --ink: #1A1510;
  --forest: #2A2218;
  --forest-light: #3A3024;
  --forest-hover: #4A3E30;
  --forest-border: #5C4E3C;
  --mint: #E7D5C0;
  --mint-dim: #D4BFA6;
  --gold: #C47A5A;
  --white: #FBF6F0;
  --muted: #C4B4A0;
  --muted-dim: #8A7A68;
  --danger: #E05A40;
  --hero-glow: #8B5A3C;
  --mint-rgb: 231, 213, 192;
  --gold-rgb: 196, 122, 90;
  --danger-rgb: 224, 90, 64;
}

/* Lime — Black + Neon Lime */
[data-palette="lime"] {
  --ink: #050505;
  --forest: #0A0A0A;
  --forest-light: #161616;
  --forest-hover: #222222;
  --forest-border: #333333;
  --mint: #B8FF00;
  --mint-dim: #9AD600;
  --gold: #6B6B6B;
  --white: #F5F5F5;
  --muted: #A3A3A3;
  --muted-dim: #6B6B6B;
  --danger: #FF3B3B;
  --hero-glow: #1A2A00;
  --mint-rgb: 184, 255, 0;
  --gold-rgb: 107, 107, 107;
  --danger-rgb: 255, 59, 59;
}

/* Ruby — Red + Gold */
[data-palette="ruby"] {
  --ink: #100608;
  --forest: #1A0A0C;
  --forest-light: #2A1216;
  --forest-hover: #3A1C22;
  --forest-border: #4A282E;
  --mint: #F5C518;
  --mint-dim: #D4A80E;
  --gold: #E11D48;
  --white: #FFF8F0;
  --muted: #C8A0A8;
  --muted-dim: #8A6068;
  --danger: #FB7185;
  --hero-glow: #7F1D1D;
  --mint-rgb: 245, 197, 24;
  --gold-rgb: 225, 29, 72;
  --danger-rgb: 251, 113, 133;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--white);
  font-family: 'Work Sans', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}

button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--mint-dim); color: var(--ink); }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

.app {
  display: grid;
  grid-template-columns: 76px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--forest);
  border-right: 1px solid var(--forest-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 0 18px;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  width: clamp(32px, 4.2vw, 42px);
  height: clamp(32px, 4.2vw, 42px);
  aspect-ratio: 1 / 1;
  border-radius: 11px;
  background: rgba(var(--mint-rgb), 0.12);
  border: 1px solid var(--forest-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-family: 'Fraunces', serif; font-weight: 600; font-size: 18px;
  overflow: hidden; padding: 3px; text-decoration: none;
  flex-shrink: 0;
  box-sizing: border-box;
}

.brand-logo {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.brand-letter { line-height: 1; }

.auth-card .brand-lg {
  width: clamp(56px, 16vw, 88px);
  height: clamp(56px, 16vw, 88px);
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: rgba(var(--mint-rgb), 0.12);
  border: 1px solid var(--forest-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-family: 'Fraunces', serif; font-weight: 600; font-size: 22px;
  margin-bottom: 20px;
  overflow: hidden;
  padding: 6px;
  box-sizing: border-box;
}

.brand-logo-lg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; margin-top: 6px; }

.nav-item {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--muted-dim);
  transition: background .15s ease, color .15s ease;
  position: relative;
}

.nav-unread-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--forest);
  line-height: 1;
}

.nav-item svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nav-item:hover { background: var(--forest-hover); color: var(--white); }
.nav-item.active { background: var(--forest-hover); color: var(--mint); border-color: var(--forest-border); }

.nav-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.avatar-mini {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  border: 2px solid var(--forest-border);
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 40px 10px;
  gap: 20px;
}

.greet-eyebrow {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-dim); margin-bottom: 6px;
}

.greet h1 { font-size: 26px; color: var(--white); }
.greet h1 em { font-style: italic; color: var(--mint); }

.top-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--forest);
  border: 1px solid var(--forest-border);
  border-radius: 100px;
  padding: 9px 16px;
  color: var(--muted);
  min-width: 220px;
  flex: 1;
  max-width: 360px;
}

.search svg { width: 15px; height: 15px; stroke: var(--muted-dim); fill: none; stroke-width: 1.8; flex-shrink: 0; }
.search input {
  background: transparent; border: none; outline: none; color: var(--white);
  font-size: 13px; width: 100%; font-family: inherit;
}
.search input::placeholder { color: var(--muted-dim); }

.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--forest); border: 1px solid var(--forest-border);
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  transition: color .15s ease, border-color .15s ease;
}

.icon-btn:hover { color: var(--white); border-color: var(--mint-dim); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; }

.badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 50%;
  background: var(--gold); color: var(--ink);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink);
}

.section { margin: 30px 40px; }

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

.section-head h2 { font-size: 19px; }

.btn-primary {
  border: 1px solid var(--mint-dim); background: var(--mint);
  color: var(--ink); font-size: 12.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 100px;
  transition: background .15s ease;
}

.btn-primary:hover { background: var(--mint-dim); }

.btn-secondary {
  border: 1px solid var(--forest-border); background: var(--forest-light);
  color: var(--white); font-size: 12.5px; font-weight: 500;
  padding: 9px 16px; border-radius: 100px;
  transition: background .15s ease;
}

.btn-secondary:hover { background: var(--forest-hover); }

.btn-danger {
  border: 1px solid var(--danger); background: transparent;
  color: var(--danger); font-size: 12.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 100px;
}

.messages { margin: 0 40px; }
.message {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 8px; font-size: 13px;
  background: var(--forest-light); border: 1px solid var(--forest-border);
}
.message.success { border-color: var(--mint-dim); color: var(--mint); }
.message.error { border-color: var(--danger); color: var(--danger); }
.message.info { border-color: var(--gold); color: var(--gold); }

.form-page {
  max-width: 520px; margin: 30px 40px;
  background: var(--forest); border: 1px solid var(--forest-border);
  border-radius: var(--radius-md); padding: 28px;
}

.form-page-wide { max-width: 720px; }

.form-page h2 { margin-bottom: 20px; font-size: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; color: var(--muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .08em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; background: var(--forest-light);
  border: 1px solid var(--forest-border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--white); font-family: inherit; font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none; border-color: var(--mint-dim);
}

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted-dim);
  line-height: 1.4;
}

.palette-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

@media (min-width: 640px) {
  .palette-picker {
    grid-template-columns: 1fr 1fr;
  }
}

.palette-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--forest-border);
  background: var(--forest-light);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--white);
  margin: 0;
}

.palette-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.palette-option:hover {
  border-color: var(--mint-dim);
}

.palette-option.is-selected {
  border-color: var(--mint);
  box-shadow: 0 0 0 1px rgba(var(--mint-rgb), 0.35);
  background: var(--forest-hover);
}

.palette-swatches {
  display: flex;
  gap: 6px;
}

.palette-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.palette-option-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.palette-option-label {
  font-weight: 500;
  color: var(--white);
}

.palette-option-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--mint);
  border-radius: 100px;
  padding: 3px 8px;
}

.form-errors { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%; max-width: 400px;
  background: var(--forest); border: 1px solid var(--forest-border);
  border-radius: var(--radius-lg); padding: 36px;
  box-shadow: var(--shadow-soft);
}

.auth-card h1 { font-size: 24px; margin-bottom: 8px; }
.auth-card p { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.auth-link { font-size: 13px; color: var(--muted); margin-top: 16px; }
.auth-link a { color: var(--mint); }

footer {
  margin: 10px 40px 40px; font-size: 11px;
  color: var(--muted-dim); text-align: center;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--forest-border); border-radius: 8px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto;
    flex-direction: row; justify-content: space-around;
    padding: 10px 12px; width: 100%; border-right: none;
    border-top: 1px solid var(--forest-border); z-index: 40;
  }
  .brand {
    display: flex;
    width: clamp(28px, 7vw, 36px);
    height: clamp(28px, 7vw, 36px);
    padding: 2px;
  }
  .nav-foot { display: none; }
  .nav { flex-direction: row; flex: none; margin: 0; }
  .main { padding-bottom: 76px; }
  .topbar {
    padding: 16px 16px 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .greet h1 { font-size: 22px; }
  .top-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .top-actions .search,
  .topbar > .search {
    order: 1;
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .top-actions .icon-btn,
  .top-actions .account-menu {
    flex-shrink: 0;
  }
  .search { min-width: 0; flex: 1; max-width: none; }
  .section { margin: 26px 18px; }
  .form-page { margin: 26px 18px; }
  .messages { margin: 0 18px; }
  footer { margin: 10px 18px 88px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
