/* Spiritshalo Guardian: dark-first product shell and reusable module surfaces. */
:root {
  color-scheme: dark;
  --bg: #0b0d14;
  --surface: #11141e;
  --surface-raised: #171b28;
  --surface-hover: #1d2231;
  --line: #292f40;
  --line-soft: #202637;
  --text: #edf0f8;
  --muted: #929bb0;
  --faint: #667087;
  --accent: #a78bfa;
  --accent-strong: #8b6cf2;
  --cyan: #5cd3d1;
  --green: #4bd3a0;
  --red: #ff7186;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: radial-gradient(ellipse at 78% -24%, #242043 0, transparent 40%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}
.glow { display: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-soft);
  background: #0e111af2;
  box-shadow: 0 8px 28px #0003;
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid #a78bfa55; border-radius: 12px;
  background: linear-gradient(145deg, #a78bfa28, #5cd3d118);
  color: #c5b5ff; font-size: 22px; box-shadow: 0 0 25px #9871f01c;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 12px; font-weight: 800; letter-spacing: .17em; }
.brand small { margin-top: 3px; color: #8a92a8; font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.account { display: flex; align-items: center; gap: 14px; margin-left: auto; color: #c6cbda; font-size: 12px; }
.account[hidden] { display: none; }
.quiet-button {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  background: #171b27; color: #c7cce0; font-size: 12px; font-weight: 650; cursor: pointer;
}
.quiet-button:hover { border-color: #61558b; background: #211d35; color: #fff; }
.mobile-nav-toggle { display: none; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: #171b27; color: #d8d4ec; cursor: pointer; }
.sidebar-backdrop { display: none; }

main { width: 100%; max-width: none; margin: 0; padding: 72px 0 0; }
#workspace { min-height: calc(100vh - 72px); }
#workspace[hidden], #server-content[hidden] { display: none !important; }
.welcome {
  width: min(620px, calc(100% - 40px)); max-width: 620px; margin: 12vh auto 80px; padding: 48px 40px;
  border: 1px solid #292e40; border-radius: 22px; background: linear-gradient(150deg, #171a27, #10131d 65%);
  box-shadow: 0 24px 80px #0005; text-align: left;
}
.welcome .eyebrow { color: var(--cyan); }
.welcome h1 { margin: 25px 0 16px; color: #f3f4fb; font-size: clamp(40px, 7vw, 68px); font-weight: 780; letter-spacing: -.065em; line-height: 1.02; }
.welcome h1 span { color: var(--accent); }
.welcome p { max-width: 440px; margin: 0 0 28px; color: #a5aec2; font-size: 15px; line-height: 1.75; }
.login-note { color: #7f899f; font-size: 11px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 13px #4bd3a080; }
.primary-button {
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid #a58af1; border-radius: 9px; padding: 0 16px;
  background: linear-gradient(135deg, #a78bfa, #8265e9); color: #110f1d;
  font-size: 12px; font-weight: 760; cursor: pointer; box-shadow: 0 8px 24px #8b6cf22b;
  transition: transform .15s ease, filter .15s ease;
}
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary-button span { font-size: 16px; }
.error-text { color: var(--red); font-size: 12px; }

.app-shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.app-sidebar {
  position: sticky; top: 72px; align-self: start; height: calc(100vh - 72px); overflow: auto;
  display: flex; flex-direction: column; padding: 21px 14px 12px;
  border-right: 1px solid var(--line-soft); background: #0e1119;
  scrollbar-color: #34394c transparent; scrollbar-width: thin;
}
.server-picker { display: grid; gap: 7px; padding: 0 3px; }
.server-picker > span { color: #788299; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.server-picker select, .field select, .field textarea, .field input:not([type=checkbox]), .field input[type=search], .nav-search input {
  width: 100%; min-height: 41px; border: 1px solid #30364a; border-radius: 8px; outline: none;
  background: #111520; color: #e7eaf4; padding: 9px 11px; font-size: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.server-picker select:focus, .field select:focus, .field textarea:focus, .field input:focus, .nav-search input:focus {
  border-color: #8c75dd; box-shadow: 0 0 0 3px #9b7cf01a;
}
.sidebar-server-card { min-width: 0; display: flex; align-items: center; gap: 11px; margin: 15px 1px 17px; padding: 12px 10px; border: 1px solid #292e3e; border-radius: 10px; background: #141824; }
.sidebar-guild-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #a78bfa44; border-radius: 11px; background: linear-gradient(140deg, #a78bfa33, #5cd3d122); color: #c9bbff; font-size: 20px; background-size: cover; background-position: center; }
.sidebar-server-card strong { display: block; overflow: hidden; color: #f0f1f7; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-server-card small { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: #8290a6; font-size: 10px; }
.sidebar-server-card small i, .connection-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px #4bd3a070; }
.nav-search { position: relative; display: flex; align-items: center; margin: 0 2px 14px; }
.nav-search > span { position: absolute; left: 11px; color: #7f899e; font-size: 18px; }
.nav-search input { min-height: 36px; padding: 6px 10px 6px 33px; background: #11141d; font-size: 11px; }
.app-navigation { display: grid; gap: 11px; }
.nav-group { display: grid; gap: 3px; }
.nav-group h2 { margin: 7px 10px 4px; color: #788299; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.nav-link {
  width: 100%; min-height: 37px; display: flex; align-items: center; gap: 11px;
  border: 1px solid transparent; border-radius: 8px; padding: 7px 10px;
  background: transparent; color: #aab2c5; text-align: left; font-size: 12px; cursor: pointer;
  transition: color .14s ease, background .14s ease, border-color .14s ease;
}
.nav-link > span { width: 19px; flex: 0 0 auto; color: #8c92ab; font-size: 15px; text-align: center; }
.nav-link b { font-weight: 590; }
.nav-link:hover { border-color: #34394f; background: #171b28; color: #f4f2fc; }
.nav-link.active { border-color: #7b69c249; background: linear-gradient(90deg, #866be52b, #7667d113); color: #e8e0ff; box-shadow: inset 2px 0 #a78bfa; }
.nav-link.active > span { color: #c0adff; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 18px 7px 4px; color: #727b91; font-size: 9px; font-weight: 800; letter-spacing: .11em; }
.sidebar-brand-mark { color: #a78bfa; font-size: 15px; }
.version-label { margin-left: auto; color: #505a70; font-size: 9px; letter-spacing: 0; }

.dashboard-content { min-width: 0; width: 100%; max-width: 1580px; margin: 0 auto; padding: 26px clamp(20px, 3vw, 46px) 70px; }
.content-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 23px; padding: 2px 0 18px; border-bottom: 1px solid var(--line-soft); }
.breadcrumbs { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; color: #737e96; font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.breadcrumbs span:nth-child(2) { color: #485169; }
.content-heading h1 { margin: 0; color: #f0eff9; font-size: clamp(22px, 2.4vw, 28px); font-weight: 730; letter-spacing: -.035em; }
.content-heading p { margin: 5px 0 0; color: #8f99af; font-size: 12px; }
.connection-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid #2e5348; border-radius: 999px; background: #10201e; color: #8ddfc2; font-size: 10px; font-weight: 700; white-space: nowrap; }
.empty-state { width: min(680px, calc(100% - 32px)); margin: 13vh auto; padding: 25px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: #a5aec1; line-height: 1.8; }
.server-title { display: flex; align-items: center; gap: 13px; margin: 0 0 17px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(110deg, #161a27, #11151f); }
.guild-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #9e84e34a; border-radius: 10px; background: #8b6cf226; color: #c4b1ff; font-size: 20px; background-size: cover; background-position: center; }
.server-title h2 { margin: 0; color: #f0eff8; font-size: 14px; font-weight: 700; }
.server-title p { margin: 3px 0 0; color: #8993a9; font-size: 11px; }
.online-pill { display: none; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin: 0 0 15px; }
.stat-card, .analytics-card, .settings-card, .quick-access-card, .info-card, .empty-state {
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 8px 24px #00000012;
}
.stat-card { min-height: 104px; padding: 15px 16px; }
.stat-card span { display: block; color: #7f8aa2; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.stat-card strong { display: block; margin: 8px 0 1px; color: #edeafb; font-size: 24px; font-weight: 730; letter-spacing: -.035em; }
.stat-card small { color: #78839a; font-size: 10px; }
.analytics-card { margin: 0 0 16px; padding: 17px 19px 14px; }
.analytics-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.analytics-heading .eyebrow { color: #8d7bd0; font-size: 9px; }
.analytics-heading h2 { margin: 5px 0 0; color: #e9eaf3; font-size: 15px; font-weight: 680; }
.analytics-heading > span { color: #7c879e; font-size: 10px; }
.analytics-chart { min-height: 145px; margin-top: 13px; }
.chart-track { background: #202638; }
.chart-bar { background: linear-gradient(180deg, #a78bfa, #6957ce); box-shadow: 0 0 14px #9075ed2a; }
.chart-value, .chart-label { color: #7f8ba5; font-size: 9px; }
.quick-access { margin-top: 21px; }
.quick-access-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin: 0 0 11px; }
.quick-access-heading .eyebrow { color: #8c79d2; font-size: 9px; }
.quick-access-heading h2 { margin: 4px 0 0; color: #ebebf5; font-size: 16px; }
.quick-access-heading > span { color: #78839a; font-size: 10px; }
.quick-access-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-access-card { min-width: 0; min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s, background .15s; }
.quick-access-card:hover { transform: translateY(-1px); border-color: #655893; background: #171a28; }
.quick-access-card > span { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #8d78d541; border-radius: 9px; background: #8870df19; color: #b7a3ff; font-size: 16px; }
.quick-access-card div { min-width: 0; }
.quick-access-card strong, .quick-access-card small { display: block; }
.quick-access-card strong { color: #e7e8f2; font-size: 12px; }
.quick-access-card small { margin-top: 2px; color: #8490a5; font-size: 10px; }
.quick-access-card > b { margin-left: auto; color: #9380df; font-size: 15px; }
.module-layout { display: block; min-width: 0; }
.module-page { display: none; min-width: 0; min-height: 340px; margin: 0; }
.module-page.active { display: block; animation: page-enter .18s ease-out; }
@keyframes page-enter { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.settings-card { margin: 0 0 14px; padding: 21px 23px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 0 0 18px; }
.card-heading .eyebrow { color: #8d7bd0; font-size: 9px; }
.card-heading h2 { margin: 5px 0 0; color: #eff0f8; font-size: 18px; font-weight: 720; letter-spacing: -.02em; }
.card-heading .card-copy { max-width: 760px; margin-top: 6px; color: #8f99ae; font-size: 12px; line-height: 1.65; }
.module-icon { width: 35px; height: 35px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #8974d94d; border-radius: 10px; background: #8d75df19; color: #b6a3fa; }
.form-grid { gap: 15px 17px; }
.field { min-width: 0; display: grid; align-content: start; gap: 6px; }
.field > span { color: #c6ccdc; font-size: 11px; font-weight: 680; }
.field small { color: #78839a; font-size: 10px; line-height: 1.5; }
.field input:not([type=checkbox]), .field input[type=search], .field select, .field textarea { border-color: #30364a; background: #0e121b; color: #e5e8f2; }
.field select option { background: #111520; color: #e7eaf4; }
.field input[type=color] { width: 48px; height: 38px; border: 1px solid #30364a; border-radius: 8px; background: #111520; padding: 4px; }
.image-upload-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.image-upload-controls input[type=file] { min-width: 220px; flex: 1 1 260px; color: #aab2c5; font-size: 11px; }
.image-upload-controls input[type=file]::file-selector-button { margin-right: 9px; padding: 8px 10px; border: 1px solid #37334f; border-radius: 7px; background: #1a1928; color: #c8b9ff; font: 650 11px var(--sans); cursor: pointer; }
.image-upload-controls input[type=file]::file-selector-button:hover { border-color: #8772d2; background: #25213a; }
.image-upload-controls small { flex-basis: 100%; color: #75d7b2; font-size: 10px; }
.image-upload-controls small.error { color: #ff8498; }
.image-upload-controls button:disabled, .image-upload-controls input:disabled { opacity: .55; cursor: wait; }
.field input[type=checkbox], .switch-field input, .event-toggle input, .command-item input { accent-color: #a78bfa; }
.check-field { display: flex; align-items: center; gap: 9px; min-height: 40px; }
.check-field span, .switch-field { color: #bec5d6; font-size: 11px; }
.switch-field { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.switch-field input { width: 16px; height: 16px; }
.subheading { margin: 12px 0 0; color: #c9c3e4; font-size: 11px; font-weight: 750; letter-spacing: .025em; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 13px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
.save-status { min-height: 17px; color: #75d7b2; font-size: 11px; }
.save-status.error { color: #ff8498; }
.info-card { padding: 17px; }
.info-card h3 { margin: 0 0 6px; color: #d9dceb; font-size: 13px; }
.info-card p, .card-copy { margin: 0; color: #8e98ad; font-size: 11px; line-height: 1.7; }
.toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.event-toggle { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: #141824; color: #bfc6d8; font-size: 11px; }
.advanced-settings { border-color: var(--line); border-radius: 9px; background: #10141e; padding: 0 12px; }
.advanced-settings summary { padding: 12px 0; color: #c8c1e2; font-size: 11px; }
.advanced-settings[open] summary { border-color: var(--line); }
.advanced-settings summary::after { color: var(--accent); }
.advanced-grid { padding-bottom: 13px; }
.command-category { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #141824; }
.command-category-head { padding: 12px 13px; }
.command-category-head strong { color: #e0e3ee; font-size: 12px; }
.command-category-head small { color: #818ba1; font-size: 10px; }
.command-category-toggle { color: #c8c4da; font-size: 10px; }
.command-list { border-color: var(--line-soft); }
.command-item { color: #bcc4d5; font-size: 11px; }
.command-item small { color: #78839a; }
.role-picker { position: relative; border: 0; background: transparent; padding: 0; }
.role-picker-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid #30364a; border-radius: 8px; background: #0e121b; color: #e6e8f1; text-align: left; cursor: pointer; }
.role-picker-trigger:hover, .role-picker-trigger[aria-expanded=true] { border-color: #8671d1; }
.role-picker-menu { position: absolute; z-index: 12; top: calc(100% + 6px); left: 0; right: 0; padding: 10px; border: 1px solid #36334e; border-radius: 10px; background: #151827; box-shadow: 0 18px 42px #0009; }
.role-picker-menu[hidden] { display: none; }
.role-picker-menu > input[type=search] { width: 100%; padding: 9px; border: 1px solid #30364a; border-radius: 7px; background: #0e121b; color: var(--text); }
.role-picker-option { border-color: #2e3445; background: #171b28; color: #c7cede; }
.role-picker-option:hover { border-color: #6e60a3; background: #211f31; }
.role-picker-option:has(input:checked) { border-color: #7665bc; background: #2a2540; color: #e7e0ff; }
.role-picker-chip { border-color: #655594; background: #211e32; color: #c5b5ff; }
.role-picker-option-locked:hover { border-color: #2e3445; background: #171b28; }
.level-reward-row { border-color: #30364a; background: #111520; }
.level-reward-row strong { color: #b7a5ff; }
.level-rewards-empty { border-color: #353b4e; color: #808ba2; }
.ticket-button-row { border-color: #30364a; background: #111520; }
.ticket-button-row > strong { color: #b7a5ff; }
.ticket-button-remove { color: #ff8999; }
.welcome-preview { border-color: #2d3344; border-radius: 9px; background: #0d1018; }
.welcome-preview-label { color: #929bb0; }
.welcome-preview-embed { background: #1c1f28; }
.footnote { margin: 18px 0 0; color: #677187; font-size: 10px; }
.update-form-footer { align-items: center; gap: 16px; }
.update-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.update-now-button { min-height: 42px; padding: 0 14px; border: 1px solid #443d63; border-radius: 9px; background: #1a1928; color: #c8b9ff; font-size: 11px; font-weight: 720; cursor: pointer; }
.update-now-button:hover { border-color: #8772d2; background: #25213a; }
.update-now-button:disabled { opacity: .55; cursor: wait; }

footer { display: none; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 246px minmax(0, 1fr); }
  .app-sidebar { padding-right: 11px; padding-left: 11px; }
  .dashboard-content { padding-right: 23px; padding-left: 23px; }
}
@media (max-width: 860px) {
  .topbar { height: 64px; padding: 0 15px; }
  .mobile-nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .app-shell { display: block; min-height: calc(100vh - 64px); }
  .app-sidebar { position: fixed; z-index: 41; inset: 64px auto 0 0; width: min(310px, 88vw); height: auto; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 50px #0008; }
  body.nav-open .app-sidebar { transform: translateX(0); }
  .sidebar-backdrop:not([hidden]) { display: block; position: fixed; z-index: 40; inset: 64px 0 0; width: 100%; border: 0; background: #05060bc9; }
  .dashboard-content { padding: 23px 20px 55px; }
  .app-navigation { padding-bottom: 15px; }
}
@media (max-width: 620px) {
  .topbar { gap: 10px; }
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand strong { font-size: 10px; }
  .brand small { font-size: 8px; }
  .account { gap: 7px; font-size: 10px; }
  .account .quiet-button { padding: 7px 8px; font-size: 10px; }
  .dashboard-content { padding: 18px 13px 40px; }
  .content-heading { align-items: flex-start; flex-direction: column; gap: 11px; margin-bottom: 16px; }
  .connection-badge { align-self: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { min-height: 91px; padding: 12px; }
  .stat-card span { font-size: 8px; letter-spacing: .08em; }
  .stat-card strong { font-size: 20px; }
  .analytics-card, .settings-card { padding: 15px; }
  .quick-access-grid { grid-template-columns: 1fr; }
  .quick-access-heading { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > .full-width { grid-column: auto; }
  .toggle-grid, .command-list { grid-template-columns: 1fr; }
  .form-footer, .update-form-footer { align-items: stretch; flex-direction: column; }
  .update-actions { width: 100%; margin-left: 0; }
  .update-actions > button { flex: 1; }
  .server-title { padding: 12px; }
}
