:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3ff;
  --text: #182033;
  --muted: #687086;
  --border: rgba(24, 32, 51, 0.12);
  --primary: #3366ff;
  --primary-strong: #1f4fe0;
  --accent: #14b8a6;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #16a34a;
  --shadow: 0 18px 50px rgba(25, 36, 70, 0.12);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="aurora"] {
  --bg: #f3fbf8;
  --surface: #ffffff;
  --surface-soft: #dff7ef;
  --text: #10231f;
  --muted: #5a746d;
  --border: rgba(16, 35, 31, 0.12);
  --primary: #0f9f8c;
  --primary-strong: #087c6d;
  --accent: #f97316;
}

body[data-theme="sunset"] {
  --bg: #fff7f3;
  --surface: #ffffff;
  --surface-soft: #ffe8df;
  --text: #30201a;
  --muted: #806b62;
  --border: rgba(48, 32, 26, 0.13);
  --primary: #e11d48;
  --primary-strong: #be123c;
  --accent: #7c3aed;
}

body[data-theme="midnight"] {
  --bg: #111827;
  --surface: #182235;
  --surface-soft: #22304a;
  --text: #f7fafc;
  --muted: #a8b3c7;
  --border: rgba(255, 255, 255, 0.12);
  --primary: #38bdf8;
  --primary-strong: #0ea5e9;
  --accent: #a3e635;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.svg-icon,
.svg-icon svg {
  display: inline-flex;
  height: 18px;
  width: 18px;
}

.svg-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  min-height: 100vh;
}

.auth-layout {
  align-items: center;
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 1fr) 430px;
  min-height: 100vh;
  padding: 42px;
}

.auth-intro {
  max-width: 660px;
}

.eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  text-transform: uppercase;
}

.auth-intro h1,
.topbar h1 {
  font-size: clamp(34px, 5vw, 62px);
  letter-spacing: 0;
  line-height: 1.02;
  margin: 0;
}

.auth-intro p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
  margin: 20px 0 0;
}

.auth-panel,
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.segmented {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 22px;
  padding: 6px;
}

.segmented button {
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  padding: 12px;
}

.segmented a {
  background: transparent;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  padding: 12px;
  text-align: center;
  text-decoration: none;
}

.segmented button.active,
.segmented a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 7px 20px rgba(20, 35, 70, 0.08);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  min-height: 46px;
  outline: none;
  padding: 12px 13px;
  resize: vertical;
  width: 100%;
}

.field textarea {
  min-height: 112px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.btn {
  align-items: center;
  background: var(--surface-soft);
  border-radius: var(--radius);
  color: var(--text);
  display: inline-flex;
  font-weight: 850;
  gap: 9px;
  justify-content: center;
  min-height: 42px;
  padding: 11px 14px;
}

.btn.primary {
  background: var(--primary);
  color: white;
}

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

.btn.success {
  background: var(--success);
  color: white;
}

.btn.danger {
  background: var(--danger);
  color: white;
}

.icon-danger {
  align-items: center;
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
  border-radius: 50%;
  color: var(--danger);
  display: inline-flex;
  font-size: 18px;
  font-weight: 900;
  height: 32px;
  justify-content: center;
  line-height: 1;
  width: 32px;
}

.icon-danger:hover {
  background: var(--danger);
  color: white;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.feedback {
  border-radius: var(--radius);
  display: none;
  font-size: 14px;
  font-weight: 750;
  margin-top: 16px;
  padding: 12px;
}

.feedback.show {
  display: block;
}

.feedback.error {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--danger);
}

.feedback.success {
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
  color: var(--success);
}

.dashboard {
  margin: 0 auto;
  max-width: 1180px;
  padding: 30px 22px 54px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 26px;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 44px);
}

.user-pill {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  display: flex;
  gap: 10px;
  padding: 8px 8px 8px 14px;
}

.online-strip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.online-strip strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.online-users {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.online-user {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: 7px;
  padding: 7px 10px;
}

.online-user i {
  background: var(--success);
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.empty-inline {
  color: var(--muted);
  font-size: 13px;
}

.role-badge,
.type-badge {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.role-badge {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
}

.cards-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nav-card {
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  display: grid;
  gap: 14px;
  min-height: 150px;
  padding: 18px;
  text-decoration: none;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.nav-card:hover,
.nav-card.active {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.nav-card .icon-box,
.section-icon {
  align-items: center;
  background: color-mix(in srgb, var(--primary) 15%, var(--surface));
  border-radius: var(--radius);
  color: var(--primary);
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.nav-card strong {
  display: block;
  font-size: 17px;
  margin-bottom: 6px;
}

.nav-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.workspace {
  margin-top: 22px;
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 35px rgba(25, 36, 70, 0.07);
  padding: 22px;
}

.section-header {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  align-items: center;
  display: flex;
  gap: 12px;
}

.section h2 {
  font-size: 24px;
  margin: 0 0 4px;
}

.section p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.split-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.7fr);
}

.history-list,
.accounts-list,
.codes-list {
  display: grid;
  gap: 10px;
}

.list-item {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-width: 0;
  padding: 12px;
}

.list-item-main {
  flex: 1 1 auto;
  min-width: 0;
}

.list-item-main strong {
  display: block;
  overflow-wrap: anywhere;
}

.list-item-main span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 4px;
}

.list-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  justify-content: flex-end;
}

.list-actions form {
  display: flex;
}

.type-badge.ban {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
  color: var(--danger);
}

.type-badge.warn {
  background: color-mix(in srgb, var(--warning) 20%, var(--surface));
  color: #a16207;
}

.type-badge.kick {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
}

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-box strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-box span {
  color: var(--muted);
  font-weight: 750;
}

.chart {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.bar-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 70px minmax(0, 1fr) 44px;
}

.bar-track {
  background: var(--surface-soft);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.bar-fill {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: inherit;
  height: 100%;
}

.settings-grid,
.admin-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.theme-options {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.theme-options form,
.inline-form {
  display: contents;
}

.theme-option {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  padding: 12px;
  width: 100%;
}

.theme-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent);
}

.swatches {
  display: flex;
}

.swatch {
  border: 2px solid var(--surface);
  border-radius: 50%;
  height: 18px;
  margin-left: -5px;
  width: 18px;
}

.swatch:first-child {
  margin-left: 0;
}

.modal-backdrop {
  align-items: center;
  background: rgba(7, 12, 24, 0.58);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 10;
}

.modal-panel {
  max-width: 460px;
  width: min(100%, 460px);
}

.empty {
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

@media (max-width: 920px) {
  .auth-layout,
  .split-grid,
  .settings-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .cards-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .auth-layout {
    padding: 22px;
  }

  .topbar,
  .online-strip,
  .section-header,
  .list-item {
    align-items: stretch;
    flex-direction: column;
  }

  .online-users,
  .list-actions {
    justify-content: flex-start;
  }

  .cards-grid,
  .filters,
  .stats-grid,
  .theme-options {
    grid-template-columns: 1fr;
  }

  .user-pill {
    border-radius: var(--radius);
    justify-content: space-between;
  }
}

