@import url('/vendor/geist/index.css');
@import url('/vendor/geist-mono/index.css');

/* Brand: teal #00E0D5 on ink #060B0E (from the ELSS mark) */
:root {
  --teal: #00e0d5;
  --teal-ink: #04201f;
  --font: 'Geist Variable', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono Variable', ui-monospace, monospace;
  --radius: 14px;
  --radius-sm: 9px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* light */
  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #eef2f2;
  --line: #dde4e4;
  --text: #0b1417;
  --muted: #5b6b70;
  --accent: #00a59d;           /* teal darkened for contrast on light */
  --accent-soft: #d6f7f5;
  --danger: #c2413b;
  --danger-soft: #fbe6e4;
  --shadow: 0 1px 2px rgb(11 20 23 / .05), 0 8px 24px -12px rgb(11 20 23 / .12);
}
:root[data-theme='dark'] {
  --bg: #060b0e;
  --surface: #0c1418;
  --surface-2: #121c21;
  --line: #1c2a30;
  --text: #e7f1f1;
  --muted: #82969c;
  --accent: #00e0d5;
  --accent-soft: rgb(0 224 213 / .1);
  --danger: #ff7b72;
  --danger-soft: rgb(255 123 114 / .1);
  --shadow: 0 1px 0 rgb(255 255 255 / .03) inset, 0 12px 32px -16px rgb(0 0 0 / .6);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
i.ph, i[class^='ph'] { font-size: 1.15em; line-height: 1; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 500 14px var(--font);
  cursor: pointer; text-decoration: none;
  transition: transform .15s var(--ease), background .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--teal); color: var(--teal-ink); border-color: transparent; }
.btn-primary:hover { background: #2cf0e6; border-color: transparent; }
.btn-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.icon-btn { width: 36px; padding: 0; justify-content: center; }

label.field { display: grid; gap: 6px; }
label.field > span { font-size: 13px; font-weight: 500; }
label.field > small { color: var(--muted); font-size: 12.5px; }
input[type='text'], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus, .btn:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line);
  transition: background .2s var(--ease); pointer-events: none;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .2s var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ---------- landing ---------- */
.landing {
  min-height: 100dvh; display: grid; grid-template-rows: auto 1fr;
  max-width: 1200px; margin: 0 auto; padding: 24px 24px 48px;
}
.landing nav { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding-top: 32px;
}
.hero h1 { font-size: clamp(2.4rem, 5vw, 4rem); font-weight: 600; max-width: 13ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin-top: 20px; font-size: 18px; color: var(--muted); max-width: 42ch; }
.hero .actions { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-mark {
  aspect-ratio: 1; border-radius: 32px; overflow: hidden; background: #060b0e;
  box-shadow: var(--shadow); animation: rise .8s var(--ease) both;
}
.hero-mark img { width: 100%; height: 100%; object-fit: cover; }
.hero-copy { animation: rise .6s var(--ease) both; }
.landing-error {
  margin-top: 20px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: 14px; max-width: 42ch;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 20px;
  padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface);
}
.sidebar .brand { padding: 0 8px; }
.guild-picker { position: relative; }
.guild-picker select { padding-left: 44px; height: 48px; font-weight: 500; appearance: none; cursor: pointer; }
.guild-picker img, .guild-picker .gicon {
  position: absolute; left: 10px; top: 10px; width: 28px; height: 28px; border-radius: 8px; pointer-events: none;
}
.guild-picker .caret { position: absolute; right: 12px; top: 15px; pointer-events: none; color: var(--muted); }
.gicon {
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
  font-weight: 600; font-size: 12px;
}
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .count {
  margin-left: auto; font: 500 12px var(--mono); padding: 1px 8px; border-radius: 999px;
  background: var(--accent); color: var(--teal-ink);
}
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px; }
.sidebar-foot img { width: 32px; height: 32px; border-radius: 50%; }
.sidebar-foot .who { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { padding: 32px 40px 64px; width: 100%; max-width: 1600px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 600; }
.page-head p { margin-top: 6px; color: var(--muted); max-width: 60ch; }
.mobile-bar { display: none; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }
.card h2 { font-size: 17px; font-weight: 600; }
.card h2 + p { margin-top: 4px; color: var(--muted); font-size: 14px; }
.stack { display: grid; gap: 20px; }

/* overview */
.stats { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.stat { padding: 22px 24px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font: 600 40px/1.1 var(--mono); letter-spacing: -0.03em; margin-top: 10px; }
.stat.hero-stat { background: var(--teal); color: var(--teal-ink); border-color: transparent; }
.stat.hero-stat .label { color: rgb(4 32 31 / .7); }
.stat.hero-stat .value { font-size: 56px; }
.overview-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.checklist { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 4px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.checklist li + li { border-top: 1px solid var(--line); }
.checklist .ok { color: var(--accent); }
.checklist .no { color: var(--muted); }
.checklist a { color: var(--accent); font-weight: 500; text-decoration: none; }

/* role chips */
.role-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.role-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 13.5px; cursor: pointer; user-select: none; color: var(--text);
  transition: border-color .15s, background .15s, transform .15s var(--ease);
}
.role-chip:active { transform: scale(.97); }
.role-chip .swatch { width: 10px; height: 10px; border-radius: 50%; }
.role-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.role-chip.on .check { display: inline; }
.role-chip .check { display: none; color: var(--accent); }
.role-chip[disabled] { opacity: .45; cursor: not-allowed; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.notice {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted); font-size: 13.5px;
}
.notice.warn { background: var(--danger-soft); color: var(--danger); }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
.form-grid .full { grid-column: 1 / -1; }
.save-bar {
  position: sticky; bottom: 16px; margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px;
}

/* panel preview */
.panel-preview {
  margin-top: 16px; padding: 14px 16px; border-radius: 8px; background: #1e1f22; color: #dbdee1;
  border-left: 4px solid var(--teal); font-size: 14px;
}
.panel-preview strong { color: #fff; display: block; margin-bottom: 4px; }
.panel-preview .btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.panel-preview .fake-btn { padding: 6px 14px; border-radius: 4px; font-size: 13px; font-weight: 500; color: #fff; background: #5865f2; }
.panel-preview .fake-btn.red { background: #da373c; }

/* tickets */
.tabs { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface-2); gap: 2px; }
.tabs button {
  border: 0; background: transparent; color: var(--muted); font: 500 13.5px var(--font);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.ticket-list { list-style: none; margin: 0; padding: 0; }
.ticket-list a {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 16px; align-items: center;
  padding: 16px 20px; text-decoration: none; transition: background .15s;
}
.ticket-list li + li a { border-top: 1px solid var(--line); }
.ticket-list a:hover { background: var(--surface-2); }
.ticket-list .num { color: var(--muted); font-size: 13px; }
.ticket-list .subject { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-list .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.tag.open { background: var(--accent-soft); color: var(--accent); }
.tag.issue { background: var(--danger-soft); color: var(--danger); }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty > i { font-size: 32px; color: var(--accent); display: block; margin: 0 auto 12px; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }

.thread-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.thread { padding: 8px 0; }
.msg { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 12px 20px; }
.msg img.av { width: 36px; height: 36px; border-radius: 50%; }
.msg .who { font-weight: 600; font-size: 14px; }
.msg .who .time { font: 400 12px var(--mono); color: var(--muted); margin-left: 8px; }
.msg .body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.msg .files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg .files a { font-size: 13px; color: var(--accent); }
.msg .bot-badge {
  font: 600 10px var(--font); background: var(--accent); color: var(--teal-ink);
  padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: 2px;
}
.composer { border-top: 1px solid var(--line); padding: 16px 20px; display: grid; gap: 10px; }
.composer .row-between { justify-content: flex-end; }
dl.facts { margin: 0; display: grid; gap: 14px; }
dl.facts dt { font-size: 12.5px; color: var(--muted); }
dl.facts dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; transition: opacity .2s, transform .25s var(--ease);
  pointer-events: none; z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.skeleton { background: var(--surface-2); border-radius: var(--radius); min-height: 120px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.fade-in { animation: rise .35s var(--ease) both; }

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

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero-mark { max-width: 280px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 20;
    transform: translateX(-100%); transition: transform .25s var(--ease);
  }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
    border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10;
  }
  main { padding: 24px 16px 48px; }
  .stats, .overview-grid, .thread-layout, .form-grid { grid-template-columns: 1fr; }
  .ticket-list a { grid-template-columns: 1fr auto; }
  .ticket-list .num { display: none; }
}

#recent .ticket-list a { grid-template-columns: 1fr auto; }
#recent .ticket-list .num { display: none; }
@media (max-width: 1180px) {
  .overview-grid, .thread-layout { grid-template-columns: 1fr; }
}
.msg .bot-badge.staff { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* application form editor */
.q-list { display: grid; gap: 12px; margin-top: 16px; }
.q-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.q-fields { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.q-opts { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; }
.q-opts select { width: auto; }
.q-req { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.q-req input { accent-color: var(--accent); width: 16px; height: 16px; }
.q-actions { display: flex; flex-direction: column; gap: 2px; }
.tag.approved { background: rgb(59 165 93 / .14); color: #3ba55d; }
dl.answers dt { font-weight: 500; color: var(--text); font-size: 14px; }
dl.answers dd { font-weight: 400; color: var(--muted); white-space: pre-wrap; }
@media (max-width: 900px) { .q-fields { grid-template-columns: 1fr; } }

/* application setup: editor + live Discord preview */
.appsetup { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.q-fields .full { grid-column: 1 / -1; }
.count-chars { float: right; font: 400 11.5px var(--mono); color: var(--muted); font-style: normal; }
.count-chars.full { color: var(--danger); }
label.field > span { display: block; }
.dc-preview-wrap { position: sticky; top: 24px; }
.dc-caption { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 10px; }

/* Discord look-alike: fixed Discord dark palette regardless of dashboard theme */
.dc {
  background: #313338; color: #dbdee1; border-radius: var(--radius); padding: 16px;
  font: 15px/1.375 'gg sans', 'Noto Sans', var(--font); border: 1px solid var(--line);
}
.dc-msg { display: grid; grid-template-columns: 40px 1fr; gap: 14px; }
.dc-av { width: 40px; height: 40px; border-radius: 50%; }
.dc-name { font-weight: 600; color: #f2f3f5; font-size: 15px; }
.dc-app { background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 4px; border-radius: 3px; vertical-align: 2px; }
.dc-time { color: #949ba4; font-size: 12px; font-weight: 400; margin-left: 4px; }
.dc-embed {
  margin-top: 6px; background: #2b2d31; border-left: 4px solid var(--teal); border-radius: 4px;
  padding: 10px 14px 12px; font-size: 14px; max-width: 432px;
}
.dc-embed strong { color: #f2f3f5; display: block; margin-bottom: 4px; font-size: 15px; word-break: break-word; }
.dc-embed p { white-space: pre-wrap; word-break: break-word; }
.dc-btn {
  display: inline-block; margin-top: 8px; background: #5865f2; color: #fff; font-size: 14px; font-weight: 500;
  padding: 6px 16px; border-radius: 8px;
}
.dc-click { text-align: center; color: #949ba4; font-size: 12px; margin: 18px 0 12px; display: flex; gap: 10px; align-items: center; }
.dc-click::before, .dc-click::after { content: ''; flex: 1; height: 1px; background: #3f4147; }
.dc-modal { background: #393a41; border-radius: 12px; padding: 18px; }
.dc-modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.dc-modal-head img { width: 24px; height: 24px; border-radius: 50%; }
.dc-modal-head strong { flex: 1; color: #f2f3f5; font-size: 17px; word-break: break-word; }
.dc-modal-head i { color: #b5bac1; }
.dc-q { margin-bottom: 16px; }
.dc-label { color: #f2f3f5; font-weight: 600; font-size: 14px; word-break: break-word; }
.dc-req { color: #f23f42; margin-left: 4px; }
.dc-desc { color: #b5bac1; font-size: 13px; margin-top: 2px; word-break: break-word; }
.dc-input {
  margin-top: 8px; background: #2b2d31; border: 1px solid #44464d; border-radius: 8px;
  min-height: 40px; padding: 9px 12px; color: #6d6f78; font-size: 14px;
}
.dc-input.tall { min-height: 92px; }
.dc-modal-foot { display: flex; justify-content: flex-end; gap: 16px; align-items: center; font-size: 14px; font-weight: 500; margin-top: 6px; }
.dc-submit { background: #5865f2; color: #fff; padding: 8px 18px; border-radius: 8px; }

@media (max-width: 1180px) {
  .appsetup { grid-template-columns: 1fr; }
  .dc-preview-wrap { position: static; }
}
.q-fields { grid-template-columns: 1fr; }
.q-fields textarea { min-height: 64px; resize: none; overflow: hidden; }
.dc-channel { color: #949ba4; font-size: 12px; font-weight: 600; margin: 4px 0 10px; }
.dc-small { display: block; color: #b5bac1; font-size: 12px; }
.dc-embed p + .dc-small { margin-top: 6px; }
.dc-embed .dc-small + p { margin-top: 2px; color: #f2f3f5; white-space: pre-wrap; }
.dc-btn.grey { background: #4e5058; }
.dc-msg + .dc-msg { margin-top: 12px; }
