:root {
  --bg: #071018;
  --surface: #0e1b25;
  --surface-2: #142532;
  --surface-3: #1b303e;
  --line: #294554;
  --text: #edf5f8;
  --muted: #91a8b4;
  --cyan: #79d4ff;
  --cyan-2: #3eb8ec;
  --gold: #f4d06f;
  --green: #5bd49b;
  --red: #ff7285;
  --orange: #ffb35b;
  --purple: #9d83ff;
  --shadow: 0 18px 50px #0008;
  --radius: 10px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}
body {
  font-size: 14px;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, #b8812426, transparent 28%),
    radial-gradient(circle at 82% 86%, #f4d06f18, transparent 30%),
    linear-gradient(145deg, #17140d 0%, #0d1216 42%, #080b0e 100%);
  padding: 24px;
}
.login-page:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(#f4d06f35 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #0008, transparent 80%);
}
.login-card {
  position: relative;
  width: min(460px, 100%);
  padding: 42px;
  background:
    linear-gradient(145deg, #f4d06f0d, transparent 38%),
    linear-gradient(155deg, #182029f7, #0b0f13f7);
  border: 1px solid #8e6b2e;
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-shell {
  position: relative;
  width: min(460px, 100%);
}
.login-shell .login-card {
  width: 100%;
}
.login-version {
  color: #738894;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin: 13px 0 0;
  text-align: center;
}
.login-card h1 {
  font-size: 2rem;
  margin: 0.25rem 0 1rem;
}
.login-logo {
  width: 94px;
  height: 94px;
  object-fit: contain;
}
.login-help {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.button,
.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 15px;
  font-weight: 750;
  letter-spacing: 0.01em;
  background: var(--cyan-2);
  color: #061019;
}
.button:hover,
.primary-button:hover {
  filter: brightness(1.12);
}
.discord-button {
  margin-top: 18px;
  background: linear-gradient(135deg, #ffe889, #e6a92f);
  color: #211704;
  padding: 13px 20px;
  border-color: #fff0a9;
  box-shadow: 0 10px 28px #d69a2730;
}
.login-page .eyebrow {
  color: var(--gold);
}
.secondary-button {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--line);
}
.danger-button {
  background: #57232d;
  color: #ffdbe0;
  border-color: #914050;
}
.small-button {
  padding: 6px 9px;
  font-size: 0.78rem;
}
.app-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: linear-gradient(180deg, #10212d, #0a151d);
  border-right: 1px solid var(--line);
  padding: 15px 12px;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 6px 17px;
  border-bottom: 1px solid #213845;
}
.brand img {
  width: 45px;
  height: 45px;
  object-fit: contain;
}
.brand span {
  display: flex;
  flex-direction: column;
}
.brand strong {
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--cyan);
}
.brand small {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}
.sidebar nav {
  padding-top: 7px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 7px;
  font-weight: 680;
  margin: 2px 0;
}
.sidebar nav .nav-link-label {
  min-width: 0;
  flex: 1;
}
.sidebar nav .nav-count {
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(243, 198, 78, 0.62);
  border-radius: 999px;
  color: #fff1bd;
  background: linear-gradient(135deg, rgba(243, 198, 78, 0.3), rgba(184, 132, 32, 0.2));
  font-size: 0.69rem;
  font-weight: 850;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.sidebar nav a:hover {
  background: #ffffff0c;
}
.sidebar nav a.active {
  background: #243946;
  color: var(--cyan);
  box-shadow: inset 3px 0 var(--cyan);
}
.nav-label {
  color: #829aa8;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 16px 8px 5px;
}
.logout-button {
  width: 100%;
  margin-top: 20px;
  background: transparent;
  border: 0;
  border-top: 1px solid #203641;
  padding: 18px 10px;
  text-align: left;
  font-weight: 700;
}
.workspace {
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  height: 62px;
  background: #102330f2;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  z-index: 20;
}
.topbar > div:nth-child(2) {
  display: flex;
  flex-direction: column;
}
.topbar small {
  color: var(--muted);
  font-size: 0.72rem;
}
.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.guide-button {
  --guide-accent: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--guide-accent) 62%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--guide-accent) 12%, var(--surface-2));
  color: color-mix(in srgb, var(--guide-accent) 86%, white);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}
.context-commission .guide-button {
  --guide-accent: var(--commission-accent, var(--cyan));
}
.guide-button:hover,
.guide-button:focus-visible {
  background: color-mix(in srgb, var(--guide-accent) 22%, var(--surface-2));
  border-color: var(--guide-accent);
  transform: translateY(-1px);
}
.guide-button .sibylla-icon {
  width: 17px;
  height: 17px;
}
.guide-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.guide-config-card {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}
.guide-config-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.guide-config-heading h3,
.guide-config-heading p {
  margin: 0;
}
.guide-config-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}
.guide-file-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.guide-file-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.guide-file-meta span {
  color: var(--muted);
  font-size: 0.75rem;
}
.guide-upload-form,
.guide-config-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.guide-file-picker {
  flex: 1 1 210px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
}
.guide-file-picker input {
  width: 100%;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.guide-commission-list {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.guide-commission-list summary {
  margin-bottom: 14px;
  color: var(--gold);
  cursor: pointer;
  font-weight: 800;
}
.menu-button {
  display: none;
  background: transparent;
  border: 0;
  font-size: 1.3rem;
}
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 7px 9px;
}
.badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge.success {
  background: #174a38;
  color: #84efbc;
}
.badge.warning {
  background: #4a3817;
  color: #ffda8a;
}
.badge.danger {
  background: #51202c;
  color: #ffa3b2;
}
.badge.info {
  background: #173b4d;
  color: #9de4ff;
}
.badge.neutral {
  background: #283743;
  color: #c3d0d6;
}
.debug-banner,
.warning-banner {
  padding: 9px 18px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
}
.debug-banner {
  background: #5a2031;
  color: #ffd7dd;
}
.warning-banner {
  background: #533e16;
  color: #ffe1a0;
}
.content {
  padding: 22px;
  max-width: 1640px;
  min-width: 0;
  width: 100%;
  margin: 0 auto;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 19px;
}
.page-header h1 {
  margin: 0;
  font-size: 1.65rem;
}
.page-header p {
  margin: 5px 0 0;
  color: var(--muted);
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.grid {
  display: grid;
  gap: 14px;
}
.grid > *,
.two-columns > *,
.panel-header > * {
  min-width: 0;
}
.cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.card,
.panel,
.loading-card {
  background: linear-gradient(155deg, var(--surface), #0b151d);
  border: 1px solid #253d4b;
  border-radius: var(--radius);
  box-shadow: 0 8px 25px #0003;
}
.card {
  padding: 18px;
}
.card h3 {
  margin: 0 0 7px;
}
.card p {
  color: var(--muted);
  margin: 4px 0;
}
.metric {
  font-size: 2rem;
  font-weight: 850;
  color: var(--cyan);
  line-height: 1.1;
}
.metric-label {
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.panel {
  padding: 17px;
  margin-bottom: 15px;
  max-width: 100%;
  min-width: 0;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}
.panel h2,
.panel h3 {
  margin: 0;
}
.loading-card {
  padding: 30px;
  text-align: center;
  color: var(--muted);
}
.spinner {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 2px solid #ffffff33;
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -4px;
  margin-right: 8px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.table-wrap {
  overflow: auto;
  border: 1px solid #263e4c;
  border-radius: 8px;
}
.data-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
  background: #0b171f;
}
.data-table th,
.data-table td {
  padding: 9px 11px;
  border-bottom: 1px solid #203744;
  text-align: left;
  vertical-align: top;
}
.data-table th {
  position: sticky;
  top: 0;
  background: #172a36;
  color: #bdd0d9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.69rem;
  z-index: 1;
}
.data-table tr:hover td {
  background: #ffffff05;
}
.data-table input,
.data-table select {
  width: 100%;
  min-width: 110px;
}
.editable-cell {
  outline: none;
  min-width: 120px;
}
.editable-cell:focus {
  background: #183243;
  box-shadow: inset 0 0 0 1px var(--cyan);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}
.field {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field.wide {
  grid-column: span 8;
}
.field.full {
  grid-column: 1/-1;
}
.field label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a8bbc5;
  font-weight: 750;
}
.field input,
.field select,
.field textarea,
.search-input {
  background: #09141c;
  border: 1px solid #334d5b;
  border-radius: 7px;
  padding: 9px 10px;
  outline: none;
}
:where(input, select, textarea):disabled,
:where(input, textarea)[readonly] {
  background: #1a242b !important;
  border-color: #34434b !important;
  color: #7f9099 !important;
  box-shadow: inset 0 0 0 1px #ffffff05 !important;
  cursor: not-allowed;
  opacity: 0.82;
}
:where(input[type="checkbox"], input[type="radio"]):disabled {
  filter: grayscale(1);
  accent-color: #687780;
}
:where(input, textarea)[readonly] {
  cursor: default;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px #79d4ff19;
}
.field textarea {
  min-height: 86px;
  resize: vertical;
}
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 24px;
}
.form-actions {
  grid-column: 1/-1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.tabs {
  display: flex;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 15px;
  overflow: auto;
}
.tabs button {
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  white-space: nowrap;
}
.tabs button.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.empty-state {
  text-align: center;
  padding: 35px;
  color: var(--muted);
}
.notice {
  border-left: 3px solid var(--cyan);
  background: #112835;
  padding: 10px 12px;
  margin: 10px 0;
  border-radius: 0 6px 6px 0;
}
.notice.warning {
  border-color: var(--gold);
  background: #302911;
}
.notice.danger {
  border-color: var(--red);
  background: #35171e;
}
.notification-drawer {
  position: fixed;
  right: 0;
  top: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: #0d1a23;
  border-left: 1px solid var(--line);
  box-shadow: -15px 0 40px #0008;
  z-index: 80;
  overflow: auto;
}
.notification-drawer header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #142633;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.notification-drawer header h2 {
  margin: 0;
}
.notification-drawer header button {
  background: transparent;
  border: 0;
  font-size: 1.6rem;
}
.notification-actions {
  position: sticky;
  top: 58px;
  z-index: 2;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #0d1a23f5;
  border-bottom: 1px solid var(--line);
}
.notification-actions button {
  flex: 1;
}
.notification-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}
.notification-item {
  padding: 14px 16px;
  border-bottom: 1px solid #203641;
}
.notification-item.unread {
  background: #143044;
}
.notification-item h3 {
  font-size: 0.9rem;
  margin: 0 0 5px;
}
.notification-item p {
  margin: 0 0 6px;
  color: #bac8ce;
}
.notification-item time {
  font-size: 0.68rem;
  color: var(--muted);
}
.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  max-width: 410px;
  padding: 11px 14px;
  border-radius: 7px;
  background: #1c3442;
  border: 1px solid #426273;
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.toast.error {
  background: #43202a;
  border-color: #944557;
}
.exam-layout {
  max-width: 1050px;
  margin: 0 auto;
}
.timer {
  font-size: 1.4rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
.question-card {
  padding: 18px;
  margin: 14px 0;
  background: #0d1b24;
  border: 1px solid #294554;
  border-radius: 9px;
}
.question-card legend {
  font-weight: 750;
  padding: 0 5px;
}
.question-image {
  display: block;
  max-height: 460px;
  max-width: 100%;
  margin: 12px auto;
  border: 1px solid #294554;
  border-radius: 7px;
  object-fit: contain;
}
.option {
  display: flex;
  gap: 9px;
  padding: 9px;
  border-radius: 6px;
}
.option:hover {
  background: #ffffff08;
}
.progress-bar {
  height: 6px;
  background: #243846;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: var(--cyan);
  transition: width 0.25s;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  padding-top: 12px;
}
.chart-bar {
  flex: 1;
  min-width: 8px;
  background: linear-gradient(var(--cyan), #246a88);
  border-radius: 3px 3px 0 0;
  position: relative;
}
.chart-bar:hover:after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  padding: 3px 5px;
  font-size: 0.65rem;
  white-space: nowrap;
}
.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.direction-dashboard-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.direction-dashboard-actions label {
  width: 100%;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-align: right;
  text-transform: uppercase;
}
.direction-dashboard-actions select {
  min-width: min(190px, 100%);
}
.direction-dashboard-columns .data-table {
  min-width: 0;
}
.monospace {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
}
.pagination {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}
.grid-comment {
  display: block;
  margin-top: 0.4rem;
  min-width: 11rem;
  width: 100%;
}
@media (max-width: 1050px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: -285px;
    width: 270px;
    transition: left 0.2s;
  }
  .sidebar.open {
    left: 0;
  }
  .menu-button {
    display: block;
  }
  .content {
    padding: 16px;
  }
  .topbar-username {
    display: none;
  }
  .form-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .field {
    grid-column: span 3;
  }
  .field.wide {
    grid-column: span 6;
  }
  .two-columns {
    grid-template-columns: 1fr;
  }
  .panel-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .direction-dashboard-actions {
    justify-content: flex-start;
    width: 100%;
  }
  .direction-dashboard-actions label {
    text-align: left;
  }
}
@media (max-width: 620px) {
  .login-card {
    padding: 28px 20px;
  }
  .content {
    padding: 12px;
  }
  .page-header {
    flex-direction: column;
  }
  .topbar {
    padding: 0 10px;
  }
  .badge {
    display: none;
  }
  .guide-button {
    padding-inline: 9px;
  }
  .guide-button span {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field,
  .field.wide,
  .field.full {
    grid-column: 1;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .metric {
    font-size: 1.55rem;
  }
}
