/* =====================================================================
   Aetherquest · v4 — Modern, restrained productivity UI
   Single teal accent · neutral surfaces · generous whitespace
   Inter for body / DM Sans for headings · No decorative gradients
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=DM+Sans:wght@500;600;700&display=swap');

/* ---------- Tokens: Dark (default) ---------- */
:root,
[data-theme="night"] {
  /* Neutral surfaces */
  --aq-bg:        #0d1117;   /* page */
  --aq-surface:   #161b22;   /* cards */
  --aq-surface-2: #1c222b;   /* nested */
  --aq-border:    #262d38;
  --aq-border-strong: #353d4a;

  /* Text */
  --aq-text:        #e6edf3;
  --aq-text-muted:  #8b949e;
  --aq-text-faint:  #6e7681;

  /* Single accent */
  --aq-accent:        #4f98a3;
  --aq-accent-hover:  #5eaab5;
  --aq-accent-soft:   rgba(79, 152, 163, 0.12);
  --aq-accent-ring:   rgba(79, 152, 163, 0.45);

  /* Semantic (only when needed) */
  --aq-success: #6daa45;
  --aq-warning: #c98a3b;
  --aq-danger:  #cf6679;
  --aq-gold:    #d4a857;   /* purely for the gold currency icon tint */

  /* Inputs */
  --aq-input-bg:    #0d1117;
  --aq-input-border: #2a313c;

  /* Shadows (subtle) */
  --aq-shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --aq-shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --aq-shadow-lg: 0 12px 32px rgba(0,0,0,0.35);

  /* Radii */
  --aq-r-sm: 6px;
  --aq-r-md: 10px;
  --aq-r-lg: 14px;

  color-scheme: dark;
}

/* ---------- Tokens: Light ---------- */
[data-theme="day"] {
  --aq-bg:        #f7f6f2;
  --aq-surface:   #ffffff;
  --aq-surface-2: #fbfaf6;
  --aq-border:    #e3e1da;
  --aq-border-strong: #d0cdc4;

  --aq-text:        #28251d;
  --aq-text-muted:  #6a6862;
  --aq-text-faint:  #9b9994;

  --aq-accent:        #01696f;
  --aq-accent-hover:  #015b60;
  --aq-accent-soft:   rgba(1, 105, 111, 0.08);
  --aq-accent-ring:   rgba(1, 105, 111, 0.30);

  --aq-success: #437a22;
  --aq-warning: #964219;
  --aq-danger:  #a12c44;
  --aq-gold:    #b48628;

  --aq-input-bg: #ffffff;
  --aq-input-border: #d8d5cd;

  --aq-shadow-sm: 0 1px 2px rgba(40,37,29,0.05);
  --aq-shadow-md: 0 4px 12px rgba(40,37,29,0.06);
  --aq-shadow-lg: 0 12px 32px rgba(40,37,29,0.08);

  color-scheme: light;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--aq-text);
  background: var(--aq-bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

a { color: var(--aq-accent); text-decoration: none; }
a:hover { color: var(--aq-accent-hover); }

h1, h2, h3, h4, h5 {
  font-family: 'DM Sans', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--aq-text);
}
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.35; }
h4 { font-size: 14px; line-height: 1.4; font-weight: 600; }

p { margin: 0 0 0.75em 0; }

.aq-muted     { color: var(--aq-text-muted); }
.aq-faint     { color: var(--aq-text-faint); }
.aq-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--aq-text-muted);
}

.aq-num {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: 'tnum';
}

/* ---------- Layout ---------- */
.aq-page {
  min-height: 100vh;
  background: var(--aq-bg);
  display: flex;
  flex-direction: column;
}

.aq-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px 60px;
  flex: 1;
}

/* ---------- Header ---------- */
.aq-topbar {
  border-bottom: 1px solid var(--aq-border);
  background: var(--aq-surface);
  position: sticky;
  top: 0;
  z-index: 50;
}
.aq-topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.aq-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--aq-text);
}
.aq-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--aq-accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: -0.02em;
  font-size: 17px;
}
.aq-brand-name {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.aq-brand-sub {
  font-size: 11px;
  color: var(--aq-text-faint);
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.aq-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.aq-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--aq-text);
  border-radius: var(--aq-r-sm);
}
.aq-stat-label {
  color: var(--aq-text-faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.aq-stat-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.aq-stat-divider {
  width: 1px;
  height: 18px;
  background: var(--aq-border);
}

.aq-topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--aq-border);
}

/* Theme toggle */
.aq-theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--aq-border);
  background: var(--aq-surface);
  color: var(--aq-text-muted);
  border-radius: var(--aq-r-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.15s ease;
}
.aq-theme-toggle:hover {
  border-color: var(--aq-border-strong);
  color: var(--aq-text);
}

/* Lang switch */
.aq-lang-switch {
  display: flex;
  background: var(--aq-surface-2);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-sm);
  padding: 2px;
}
.aq-flag {
  border: 0;
  background: transparent;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.5;
  transition: all 0.15s ease;
}
.aq-flag:hover { opacity: 0.85; }
.aq-flag.is-active {
  opacity: 1;
  background: var(--aq-surface);
  box-shadow: var(--aq-shadow-sm);
}

/* Logoff button */
.aq-logoff {
  padding: 8px 14px;
  border: 1px solid var(--aq-border);
  background: var(--aq-surface);
  color: var(--aq-text-muted);
  border-radius: var(--aq-r-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.aq-logoff:hover {
  color: var(--aq-text);
  border-color: var(--aq-border-strong);
}

/* ---------- Sidebar ---------- */
.aq-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 88px;
  align-self: start;
}
.aq-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--aq-r-sm);
  color: var(--aq-text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.12s ease;
}
.aq-nav-item:hover {
  background: var(--aq-surface);
  color: var(--aq-text);
}
.aq-nav-item.is-active {
  background: var(--aq-accent-soft);
  color: var(--aq-accent);
  font-weight: 600;
}
.aq-nav-icon {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  font-size: 14px;
  opacity: 0.85;
}

/* ---------- Main ---------- */
.aq-main {
  min-width: 0;
}
.aq-section {
  margin-bottom: 36px;
}
.aq-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--aq-border);
}
.aq-section-head-text { min-width: 0; }
.aq-section-head .aq-eyebrow { margin-bottom: 6px; display: block; }
.aq-section-head h1 { font-size: 26px; }
.aq-section-sub {
  margin-top: 6px;
  color: var(--aq-text-muted);
  font-size: 14px;
}

/* ---------- Card ---------- */
.aq-card {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-lg);
  padding: 22px;
}
.aq-card-tight { padding: 16px; }

/* ---------- Buttons ---------- */
.aq-btn,
.aq-btn-primary,
.aq-btn-ghost,
.aq-btn-danger,
.aq-btn-gold,
.aq-btn-success,
.aq-btn-violet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--aq-r-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.aq-btn-primary,
.aq-btn-violet,
.aq-btn-gold,
.aq-btn-success {
  background: var(--aq-accent);
  color: #fff;
  border-color: var(--aq-accent);
}
.aq-btn-primary:hover,
.aq-btn-violet:hover,
.aq-btn-gold:hover,
.aq-btn-success:hover {
  background: var(--aq-accent-hover);
  border-color: var(--aq-accent-hover);
}
.aq-btn-ghost {
  background: transparent;
  color: var(--aq-text-muted);
  border-color: var(--aq-border);
}
.aq-btn-ghost:hover {
  color: var(--aq-text);
  border-color: var(--aq-border-strong);
}
.aq-btn-danger {
  background: transparent;
  color: var(--aq-danger);
  border-color: var(--aq-border);
}
.aq-btn-danger:hover {
  border-color: var(--aq-danger);
  background: rgba(207, 102, 121, 0.08);
}
.aq-btn-block { width: 100%; }
.aq-btn-sm { padding: 5px 10px; font-size: 12px; }
.aq-btn-icon {
  padding: 6px 8px;
  min-width: 30px;
}
.aq-btn:disabled,
.aq-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Forms ---------- */
.aq-field { display: block; margin-bottom: 14px; }
.aq-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--aq-text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.aq-input,
.aq-textarea,
.aq-select {
  width: 100%;
  background: var(--aq-input-bg);
  border: 1px solid var(--aq-input-border);
  color: var(--aq-text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: var(--aq-r-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.aq-input:focus,
.aq-textarea:focus,
.aq-select:focus {
  border-color: var(--aq-accent);
  box-shadow: 0 0 0 3px var(--aq-accent-ring);
}
.aq-textarea { resize: vertical; min-height: 80px; }
.aq-input::placeholder,
.aq-textarea::placeholder { color: var(--aq-text-faint); }

.aq-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.aq-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--aq-text);
}

/* ---------- Stat cards (Character KPIs) ---------- */
.aq-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.aq-kpi {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-md);
  padding: 16px;
}
.aq-kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--aq-text-faint);
  margin-bottom: 8px;
}
.aq-kpi-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--aq-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.aq-kpi-meta {
  font-size: 12px;
  color: var(--aq-text-muted);
  margin-top: 6px;
}

/* ---------- Profile header ---------- */
.aq-profile {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}
.aq-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--aq-surface-2);
  border: 1px solid var(--aq-border);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.aq-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.aq-avatar-placeholder {
  color: var(--aq-text-faint);
  font-size: 11px;
}
.aq-profile-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--aq-text);
}
.aq-profile-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--aq-text-muted);
}
.aq-profile-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.aq-profile-meta-item .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--aq-text-faint);
}
.aq-profile-bio {
  margin-top: 14px;
  color: var(--aq-text-muted);
  max-width: 70ch;
}

/* ---------- Chips (small, restrained) ---------- */
.aq-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--aq-text-muted);
  background: var(--aq-surface-2);
  border: 1px solid var(--aq-border);
  border-radius: 999px;
  line-height: 1.4;
}
.aq-chip-icon { font-size: 11px; opacity: 0.85; }

.aq-chip-accent {
  color: var(--aq-accent);
  background: var(--aq-accent-soft);
  border-color: transparent;
}
.aq-chip-emerald { /* alias kept for templates */
  color: var(--aq-accent);
  background: var(--aq-accent-soft);
  border-color: transparent;
}
.aq-chip-gold {
  color: var(--aq-warning);
  background: rgba(201, 138, 59, 0.10);
  border-color: transparent;
}
[data-theme="day"] .aq-chip-gold {
  color: #8a5817;
  background: rgba(180, 134, 40, 0.12);
}
.aq-chip-success {
  color: var(--aq-success);
  background: rgba(109, 170, 69, 0.10);
  border-color: transparent;
}
.aq-chip-danger {
  color: var(--aq-danger);
  background: rgba(207, 102, 121, 0.10);
  border-color: transparent;
}

/* ---------- Skills list ---------- */
.aq-list { display: flex; flex-direction: column; gap: 8px; }

.aq-skill-group {
  margin-bottom: 18px;
}
.aq-skill-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--aq-text-muted);
  margin-bottom: 8px;
  padding-left: 4px;
}

.aq-skill-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-md);
}
.aq-skill-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--aq-surface-2);
}
.aq-skill-icon img { width: 16px; height: 16px; }
.aq-skill-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--aq-text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aq-skill-progress {
  width: 110px;
  height: 5px;
  background: var(--aq-surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.aq-skill-progress-fill {
  height: 100%;
  background: var(--aq-accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.aq-skill-level {
  font-size: 12px;
  font-weight: 600;
  color: var(--aq-text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Achievements ---------- */
.aq-ach-group { margin-bottom: 18px; }
.aq-ach-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--aq-text-muted);
  margin-bottom: 10px;
  padding-left: 4px;
}
.aq-ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.aq-ach-card {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  transition: border-color 0.15s;
}
.aq-ach-card.is-unlocked {
  border-color: var(--aq-accent);
  background: var(--aq-accent-soft);
}
.aq-ach-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--aq-surface-2);
  display: grid;
  place-items: center;
}
.aq-ach-icon img { width: 22px; height: 22px; }
.aq-ach-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--aq-text);
  line-height: 1.3;
}
.aq-ach-meta {
  font-size: 11px;
  color: var(--aq-text-muted);
}
.aq-ach-quest {
  font-size: 11px;
  color: var(--aq-text-faint);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.aq-ach-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
}
.aq-ach-actions .aq-btn-sm { flex: 1; }
.aq-shadowed {
  opacity: 0.55;
}
.aq-shadowed .aq-ach-icon { opacity: 0.85; }

/* ---------- Quests ---------- */
.aq-quest-group { margin-bottom: 18px; }
.aq-quest-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--aq-text-muted);
  margin-bottom: 8px;
  padding-left: 4px;
}
.aq-quest-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-md);
  margin-bottom: 8px;
}
.aq-quest-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--aq-surface-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.aq-quest-icon img { width: 22px; height: 22px; }
.aq-quest-body { flex: 1; min-width: 0; }
.aq-quest-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--aq-text);
  line-height: 1.3;
}
.aq-quest-desc {
  font-size: 13px;
  color: var(--aq-text-muted);
  margin-top: 2px;
}
.aq-quest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.aq-quest-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- Chronicles timeline ---------- */
.aq-timeline {
  position: relative;
  padding-left: 28px;
}
.aq-timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--aq-border);
}
.aq-timeline-day {
  position: relative;
  margin-bottom: 28px;
}
.aq-timeline-day::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--aq-accent);
  border: 2px solid var(--aq-bg);
}
.aq-timeline-date {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--aq-text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.aq-timeline-count {
  font-size: 11px;
  color: var(--aq-text-muted);
  font-weight: 500;
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  padding: 2px 8px;
  border-radius: 999px;
}
.aq-timeline-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.aq-timeline-item {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-md);
  padding: 14px;
}
.aq-timeline-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--aq-text);
  margin-bottom: 4px;
}
.aq-timeline-item-meta {
  font-size: 11px;
  color: var(--aq-text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.aq-timeline-rewards {
  display: flex;
  gap: 6px;
}

/* ---------- Shop ---------- */
.aq-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.aq-shop-item {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.aq-shop-item-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.aq-shop-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--aq-surface-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.aq-shop-icon img { width: 26px; height: 26px; }
.aq-shop-info { flex: 1; min-width: 0; }
.aq-shop-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--aq-text);
  line-height: 1.3;
}
.aq-shop-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.aq-shop-desc {
  font-size: 13px;
  color: var(--aq-text-muted);
  line-height: 1.5;
  flex: 1;
}
.aq-shop-prices {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.aq-shop-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.aq-shop-actions .aq-btn-primary { flex: 1; }

/* ---------- Modal ---------- */
.aq-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
[data-theme="day"] .aq-modal-backdrop {
  background: rgba(40, 37, 29, 0.45);
}
.aq-modal-backdrop.is-open {
  display: flex;
}
.aq-modal {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--aq-shadow-lg);
}
.aq-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--aq-border);
}
.aq-modal-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  font-weight: 600;
}
.aq-modal-close {
  background: transparent;
  border: 0;
  color: var(--aq-text-muted);
  font-size: 20px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.aq-modal-close:hover { background: var(--aq-surface-2); color: var(--aq-text); }
.aq-modal-body { padding: 22px; }
.aq-modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--aq-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Icon picker grid (used in modals) */
.aq-icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: var(--aq-surface-2);
  border-radius: var(--aq-r-sm);
  border: 1px solid var(--aq-border);
}
.aq-icon-picker label {
  cursor: pointer;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  transition: all 0.12s;
}
.aq-icon-picker label:hover { background: var(--aq-surface); }
.aq-icon-picker input { display: none; }
.aq-icon-picker input:checked + img,
.aq-icon-picker label:has(input:checked) {
  border-color: var(--aq-accent);
  background: var(--aq-accent-soft);
}
.aq-icon-picker img { width: 24px; height: 24px; }

/* ---------- Flash messages ---------- */
.aq-flash-list {
  position: fixed;
  top: 76px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
}
.aq-flash {
  padding: 10px 14px;
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-left: 3px solid var(--aq-accent);
  border-radius: var(--aq-r-sm);
  font-size: 13px;
  color: var(--aq-text);
  box-shadow: var(--aq-shadow-md);
  min-width: 240px;
}
.aq-flash.success { border-left-color: var(--aq-success); }
.aq-flash.error   { border-left-color: var(--aq-danger); }
.aq-flash.warning { border-left-color: var(--aq-warning); }

/* ---------- Footer ---------- */
.aq-footer {
  border-top: 1px solid var(--aq-border);
  padding: 18px 32px;
  font-size: 12px;
  color: var(--aq-text-faint);
  text-align: center;
  background: var(--aq-surface);
}

/* ---------- Auth pages ---------- */
.aq-auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--aq-bg);
}
.aq-auth-card {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-lg);
  padding: 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--aq-shadow-lg);
}
.aq-auth-head {
  text-align: center;
  margin-bottom: 24px;
}
.aq-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.aq-auth-brand .aq-brand-mark { width: 40px; height: 40px; font-size: 19px; }
.aq-auth-brand .aq-brand-name { font-size: 18px; }
.aq-auth-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.aq-auth-sub {
  color: var(--aq-text-muted);
  font-size: 14px;
}
.aq-auth-link {
  text-align: center;
  font-size: 13px;
  color: var(--aq-text-muted);
  margin-top: 18px;
}

.aq-auth-tools {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- Empty states ---------- */
.aq-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--aq-text-muted);
}
.aq-empty h3 { color: var(--aq-text); margin-bottom: 6px; }

/* ---------- Utilities ---------- */
.aq-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.aq-stack { display: flex; flex-direction: column; }
.aq-row { display: flex; align-items: center; }
.aq-gap-2 { gap: 8px; } .aq-gap-3 { gap: 12px; } .aq-gap-4 { gap: 16px; }
.aq-mt-2 { margin-top: 8px; } .aq-mt-3 { margin-top: 12px; } .aq-mt-4 { margin-top: 16px; }
.aq-mb-2 { margin-bottom: 8px; } .aq-mb-3 { margin-bottom: 12px; } .aq-mb-4 { margin-bottom: 16px; }
.aq-flex-1 { flex: 1; }
.aq-hidden { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .aq-shell {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 16px 40px;
  }
  .aq-sidebar {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .aq-nav-item { white-space: nowrap; }
  .aq-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .aq-grid-2 { grid-template-columns: 1fr; }
  .aq-topbar-inner { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .aq-stats { gap: 0; flex-wrap: wrap; }
  .aq-profile { grid-template-columns: 1fr; text-align: center; }
  .aq-avatar { margin: 0 auto; }
}

/* ============================================================
 * v5: Lucide icon system + checkbox grids + recurrence badge
 * ============================================================ */

/* --- Icon sprite sizing --- */
.aq-i {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: middle;
  color: currentColor;
}
.aq-i-sm { width: 14px; height: 14px; }
.aq-i-md { width: 18px; height: 18px; }
.aq-i-lg { width: 22px; height: 22px; }
.aq-i-xl { width: 28px; height: 28px; }

/* Brand mark — replace text 'A' with brand glyph */
.aq-brand-mark { display: grid; place-items: center; color: #fff; }
.aq-brand-mark .aq-i { color: #fff; }

/* Topbar stat icon */
.aq-stat-icon {
  color: var(--aq-text-muted);
  margin-right: -2px;
}
.aq-stat:hover .aq-stat-icon { color: var(--aq-accent); }

/* Theme toggle */
.aq-theme-toggle .aq-i { color: var(--aq-text-muted); }
.aq-theme-toggle:hover .aq-i { color: var(--aq-text); }

/* Logoff with icon */
.aq-logoff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.aq-logoff .aq-i { color: var(--aq-text-faint); }
.aq-logoff:hover .aq-i { color: var(--aq-text); }

/* Sidebar nav icon (override the old text-based .aq-nav-icon rule) */
.aq-nav-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 auto;
  color: var(--aq-text-faint);
  opacity: 1;
}
.aq-nav-item:hover .aq-nav-icon { color: var(--aq-text-muted); }
.aq-nav-item.is-active .aq-nav-icon { color: var(--aq-accent); }

/* Card icon containers (skill / achievement / quest / shop) — when content
 * is an SVG sprite we want a clean tint instead of a flat raster image. */
.aq-skill-icon .aq-i,
.aq-ach-icon .aq-i,
.aq-quest-icon .aq-i,
.aq-shop-icon .aq-i {
  width: 18px;
  height: 18px;
  color: var(--aq-accent);
}
.aq-shadowed .aq-ach-icon .aq-i { color: var(--aq-text-faint); }

/* Icon button override — when an icon button contains an SVG */
.aq-btn-icon .aq-i { width: 12px; height: 12px; }

/* Primary/ghost/danger buttons with icons should look balanced */
.aq-btn-primary,
.aq-btn-ghost,
.aq-btn-danger,
.aq-btn-violet,
.aq-btn-gold,
.aq-btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.aq-btn-primary .aq-i { color: #fff; }


/* --- Checkbox group (replaces multi-select) --- */
.aq-check-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  padding: 8px;
  background: var(--aq-surface-2);
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-r-sm);
  max-height: 200px;
  overflow-y: auto;
}
.aq-check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--aq-text);
  transition: background 0.12s ease;
  min-width: 0;
}
.aq-check-row:hover { background: var(--aq-surface); }
.aq-check-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--aq-border-strong);
  border-radius: 4px;
  background: var(--aq-surface);
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
  transition: all 0.12s ease;
  margin: 0;
}
.aq-check-row input[type="checkbox"]:hover { border-color: var(--aq-accent); }
.aq-check-row input[type="checkbox"]:checked {
  background: var(--aq-accent);
  border-color: var(--aq-accent);
}
.aq-check-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.aq-check-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--aq-accent-soft);
  outline-offset: 2px;
}
.aq-check-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aq-check-group-title {
  grid-column: 1 / -1;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--aq-text-faint);
  font-weight: 600;
  margin-top: 4px;
  padding: 4px 4px 2px;
  border-top: 1px solid var(--aq-border);
}
.aq-check-group-title:first-child { margin-top: 0; border-top: 0; }
.aq-check-tag {
  font-size: 11px;
  color: var(--aq-text-faint);
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

/* --- Recurrence chip (on quest cards) --- */
.aq-chip-recurrence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--aq-accent-soft);
  color: var(--aq-accent);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.aq-chip-recurrence .aq-i { width: 11px; height: 11px; }

/* Recurrence hint under select */
.aq-recurrence-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--aq-text-faint);
}
.aq-recurrence-help .aq-i { color: var(--aq-accent); }

/* Quest actions: use ghost icon-only buttons with SVG */
.aq-btn-ghost.aq-btn-icon { padding: 6px; }

/* Icon picker — Lucide line icons render best on a clean tinted background */
.aq-icon-picker label {
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--aq-surface-2);
  padding: 8px;
  transition: all 0.12s ease;
  aspect-ratio: 1 / 1;
}
.aq-icon-picker label:hover {
  border-color: var(--aq-border-strong);
  background: var(--aq-surface);
}
.aq-icon-picker img {
  width: 22px;
  height: 22px;
  filter: invert(58%) sepia(35%) saturate(310%) hue-rotate(140deg) brightness(85%);
}
[data-theme="day"] .aq-icon-picker img {
  filter: invert(33%) sepia(54%) saturate(515%) hue-rotate(140deg) brightness(75%);
}

/* Skill/Ach/Shop card icon images render at consistent size */
.aq-skill-icon img,
.aq-ach-icon img,
.aq-quest-icon img,
.aq-shop-icon img {
  width: 18px;
  height: 18px;
  filter: invert(58%) sepia(35%) saturate(310%) hue-rotate(140deg) brightness(85%);
}
[data-theme="day"] .aq-skill-icon img,
[data-theme="day"] .aq-ach-icon img,
[data-theme="day"] .aq-quest-icon img,
[data-theme="day"] .aq-shop-icon img {
  filter: invert(33%) sepia(54%) saturate(515%) hue-rotate(140deg) brightness(75%);
}
.aq-shadowed .aq-ach-icon img { filter: invert(58%) sepia(35%) saturate(310%) hue-rotate(140deg) brightness(85%) grayscale(0.6); }

/* Inline empty hint inside fields */
.aq-empty-inline {
  padding: 12px 14px;
  border: 1px dashed var(--aq-border);
  border-radius: 10px;
  color: var(--aq-text-muted);
  font-size: 13px;
  background: var(--aq-surface);
}

/* ============ v6: Complexity tier chips ============ */
.aq-chip-complexity-easy {
  background: rgba(67, 122, 34, 0.18);
  color: #6daa45;
  border: 1px solid rgba(109, 170, 69, 0.32);
}
[data-theme="day"] .aq-chip-complexity-easy {
  background: rgba(67, 122, 34, 0.14);
  color: #437a22;
  border-color: rgba(67, 122, 34, 0.28);
}
.aq-chip-complexity-medium {
  background: rgba(218, 113, 1, 0.18);
  color: #fdab43;
  border: 1px solid rgba(253, 171, 67, 0.32);
}
[data-theme="day"] .aq-chip-complexity-medium {
  background: rgba(218, 113, 1, 0.14);
  color: #da7101;
  border-color: rgba(218, 113, 1, 0.28);
}
.aq-chip-complexity-hard {
  background: rgba(150, 66, 25, 0.22);
  color: #bb653b;
  border: 1px solid rgba(187, 101, 59, 0.36);
}
[data-theme="day"] .aq-chip-complexity-hard {
  background: rgba(150, 66, 25, 0.16);
  color: #964219;
  border-color: rgba(150, 66, 25, 0.28);
}
.aq-chip-complexity-veryhard {
  background: rgba(161, 44, 123, 0.22);
  color: #d163a7;
  border: 1px solid rgba(209, 99, 167, 0.36);
}
[data-theme="day"] .aq-chip-complexity-veryhard {
  background: rgba(161, 44, 123, 0.14);
  color: #a12c7b;
  border-color: rgba(161, 44, 123, 0.28);
}
.aq-chip-complexity-custom {
  background: var(--aq-surface-2);
  color: var(--aq-text-muted);
  border: 1px solid var(--aq-border);
}

/* ============ v6: Skill row — level + delete on same line ============ */
.aq-skill-level-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* ============ v6: Clickable achievement card ============ */
.aq-ach-card-clickable {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  color: inherit;
  font: inherit;
  border-radius: 6px;
}
.aq-ach-card-clickable:hover .aq-ach-name {
  color: var(--aq-accent);
}
.aq-ach-card-clickable:focus-visible {
  outline: 2px solid var(--aq-accent);
  outline-offset: 2px;
}

/* ============ v6: Achievement detail modal ============ */
.aq-ach-detail {
  display: flex;
  align-items: center;
  gap: 16px;
}
.aq-ach-detail-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--aq-surface-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.aq-ach-detail-icon img {
  width: 38px;
  height: 38px;
}
.aq-ach-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.aq-ach-detail-status {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aq-text-muted);
}
.aq-ach-detail-status.is-unlocked {
  color: var(--aq-success, #6daa45);
}
.aq-ach-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.aq-ach-detail-description {
  font-size: 14px;
  color: var(--aq-text);
  line-height: 1.55;
  white-space: pre-line;
}
.aq-ach-detail-quest {
  font-size: 13px;
  color: var(--aq-text-muted);
}

/* ---------- Group headers (rename/delete) ---------- */
.aq-quest-group-header,
.aq-ach-group-header,
.aq-skill-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-left: 4px;
}
.aq-quest-group-header .aq-quest-group-title,
.aq-ach-group-header .aq-ach-group-title,
.aq-skill-group-header .aq-skill-group-title {
  margin-bottom: 0;
  padding-left: 0;
}
.aq-group-actions {
  display: inline-flex;
  gap: 4px;
  opacity: 0.45;
  transition: opacity 120ms ease;
}
.aq-quest-group-header:hover .aq-group-actions,
.aq-ach-group-header:hover .aq-group-actions,
.aq-skill-group-header:hover .aq-group-actions,
.aq-group-actions:focus-within {
  opacity: 1;
}
.aq-btn-xs {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 4px;
  font-size: 12px;
  line-height: 1;
  border-radius: 6px;
}
.aq-btn-xs .aq-i { width: 12px; height: 12px; }
.aq-btn-ghost.aq-btn-xs { padding: 4px; }
