/* ==========================================================================
   Wazang Bot Dashboard — design system
   Discord-native dark theme. No build step, no external CDN: this file is
   served straight from web/public by express.static.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Surfaces, darkest to lightest. Everything stacks on --bg-deep. */
  --bg-deep: #16171a;
  --bg-base: #1e1f22;
  --bg-surface: #232428;
  --bg-elevated: #2b2d31;
  --bg-hover: #35373c;
  --bg-active: #3f4147;
  --bg-input: #1b1c1f;

  --border: #2e3035;
  --border-strong: #3f4147;

  --text: #f2f3f5;
  --text-muted: #b5bac1;
  --text-faint: #80848e;

  /* Discord brand + status colors */
  --blurple: #5865f2;
  --blurple-hover: #4752c4;
  --blurple-soft: rgba(88, 101, 242, 0.14);

  --green: #23a55a;
  --green-hover: #1e8f4e;
  --green-soft: rgba(35, 165, 90, 0.14);

  --red: #da373c;
  --red-hover: #b62a2f;
  --red-soft: rgba(218, 55, 60, 0.14);

  --yellow: #f0b232;
  --yellow-hover: #d19a24;
  --yellow-soft: rgba(240, 178, 50, 0.14);

  --purple: #a855f7;
  --purple-soft: rgba(168, 85, 247, 0.14);

  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.14);

  --pink: #eb459e;
  --pink-soft: rgba(235, 69, 158, 0.14);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);

  --sidebar-w: 256px;
  --topbar-h: 64px;

  --font: "gg sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.25;
}

/* Visible focus for keyboard users only — mouse clicks stay clean. */
:focus-visible {
  outline: 2px solid var(--blurple);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--blurple-soft);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-active);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #4e5058;
  background-clip: content-box;
}

/* --------------------------------------------------------------------------
   Icons
   -------------------------------------------------------------------------- */
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm {
  width: 16px;
  height: 16px;
}
.icon-lg {
  width: 24px;
  height: 24px;
}
.icon-xl {
  width: 32px;
  height: 32px;
}

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar --------------------------------------------------------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-base);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform 0.24s var(--ease);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.sidebar__logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--blurple), #7b83f7);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
  box-shadow: 0 2px 10px rgba(88, 101, 242, 0.4);
}

.sidebar__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sidebar__subtitle {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding: 16px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
  position: relative;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-link[aria-current="page"] {
  background: var(--blurple-soft);
  color: #fff;
  font-weight: 600;
}

/* Left rail marks the active page without shifting the label. */
.nav-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: var(--blurple);
}

.nav-link__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.sidebar__footer {
  flex: none;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.sidebar__user-meta {
  min-width: 0;
  flex: 1;
}

.sidebar__user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: 11px;
  color: var(--text-faint);
}

.sidebar__logout {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  flex: none;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.sidebar__logout:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* Backdrop only exists on mobile, where the sidebar becomes a drawer. */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease);
}

body.nav-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Main ------------------------------------------------------------------ */
.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(30, 31, 34, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar__menu {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  place-items: center;
  color: var(--text-muted);
}

.topbar__menu:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.topbar__heading {
  min-width: 0;
  flex: 1;
}

.topbar__title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__desc {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.page {
  padding: 24px;
  flex: 1;
  width: 100%;
  max-width: 1440px;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card__title {
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card__desc {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
  margin-top: 2px;
}

.card__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.card__body {
  padding: 20px;
}

.card__body--flush {
  padding: 0;
}

.card__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-base);
}

/* Collapsible card (settings sections) ---------------------------------- */
.card__header--toggle {
  cursor: pointer;
  user-select: none;
  width: 100%;
  text-align: left;
  background: none;
  transition: background 0.12s var(--ease);
}

.card__header--toggle:hover {
  background: var(--bg-elevated);
}

.card__chevron {
  margin-left: auto;
  color: var(--text-faint);
  transition: transform 0.2s var(--ease);
  flex: none;
}

.card__header--toggle[aria-expanded="false"] .card__chevron {
  transform: rotate(-90deg);
}

.card__header--toggle[aria-expanded="false"] + .card__body {
  display: none;
}

/* Icon chip used in card titles and stat cards -------------------------- */
.chip-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex: none;
  background: var(--blurple-soft);
  color: var(--blurple);
}

.chip-icon--green { background: var(--green-soft); color: var(--green); }
.chip-icon--red { background: var(--red-soft); color: var(--red); }
.chip-icon--yellow { background: var(--yellow-soft); color: var(--yellow); }
.chip-icon--purple { background: var(--purple-soft); color: var(--purple); }
.chip-icon--cyan { background: var(--cyan-soft); color: var(--cyan); }
.chip-icon--pink { background: var(--pink-soft); color: var(--pink); }

/* --------------------------------------------------------------------------
   Stat cards
   -------------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.stat:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* Accent hairline along the top edge, tinted per stat colour. */
.stat::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--stat-accent, var(--blurple));
  opacity: 0.7;
}

.stat--green { --stat-accent: var(--green); }
.stat--red { --stat-accent: var(--red); }
.stat--yellow { --stat-accent: var(--yellow); }
.stat--purple { --stat-accent: var(--purple); }
.stat--cyan { --stat-accent: var(--cyan); }
.stat--pink { --stat-accent: var(--pink); }

.stat__meta {
  min-width: 0;
  flex: 1;
}

.stat__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat__value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.stat__hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid transparent;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease),
    opacity 0.12s var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--blurple);
  color: #fff;
}
.btn--primary:hover:not(:disabled) {
  background: var(--blurple-hover);
}

.btn--success {
  background: var(--green);
  color: #fff;
}
.btn--success:hover:not(:disabled) {
  background: var(--green-hover);
}

.btn--danger {
  background: var(--red);
  color: #fff;
}
.btn--danger:hover:not(:disabled) {
  background: var(--red-hover);
}

.btn--warning {
  background: var(--yellow);
  color: #1e1f22;
}
.btn--warning:hover:not(:disabled) {
  background: var(--yellow-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.btn--outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-muted);
}
.btn--outline:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.btn--sm {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  gap: 6px;
}

.btn--icon {
  width: 38px;
  padding: 0;
}
.btn--icon.btn--sm {
  width: 32px;
}

.btn--block {
  width: 100%;
}

/* Inline spinner shown while a button action is in flight. */
.btn[data-loading="true"] {
  pointer-events: none;
  opacity: 0.7;
}
.btn[data-loading="true"] .icon:first-child {
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Small square action button used inside table rows. */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.icon-btn--danger:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field {
  display: block;
}

.field + .field {
  margin-top: 16px;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.12s var(--ease), background 0.12s var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--blurple);
  background: var(--bg-base);
}

.textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.6;
}

.select {
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
  /* Chevron baked in as a data URI so there's no extra request. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2380848e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.select option {
  background: var(--bg-elevated);
}

/* Search input with a leading icon. */
.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search .icon {
  position: absolute;
  left: 10px;
  color: var(--text-faint);
  pointer-events: none;
}

.search .input {
  padding-left: 36px;
}

/* Toggle switch ---------------------------------------------------------- */
.switch-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}

.switch-row + .switch-row {
  border-top: 1px solid var(--border);
}

.switch-row__meta {
  flex: 1;
  min-width: 0;
}

.switch-row__title {
  font-size: 14px;
  font-weight: 600;
}

.switch-row__desc {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex: none;
  display: inline-block;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch__track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: #4e5058;
  transition: background 0.16s var(--ease);
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s var(--ease);
  box-shadow: var(--shadow-sm);
}

.switch input:checked + .switch__track {
  background: var(--green);
}

.switch input:checked + .switch__track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--blurple);
  outline-offset: 2px;
}

/* Field grid ------------------------------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Badges & pills
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 650;
  background: var(--bg-elevated);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge--green { background: var(--green-soft); color: #43c97a; }
.badge--red { background: var(--red-soft); color: #f26d71; }
.badge--yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge--blurple { background: var(--blurple-soft); color: #8b96f8; }
.badge--purple { background: var(--purple-soft); color: #c084fc; }
.badge--cyan { background: var(--cyan-soft); color: var(--cyan); }
.badge--pink { background: var(--pink-soft); color: #f472b6; }

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* Pulsing dot for "live"/"active" states. */
.badge__dot--live {
  animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* --------------------------------------------------------------------------
   Avatars
   -------------------------------------------------------------------------- */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  object-fit: cover;
  flex: none;
}

.avatar--sm { width: 28px; height: 28px; }
.avatar--lg { width: 48px; height: 48px; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 11px 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background 0.1s var(--ease);
}

.table tbody tr:hover {
  background: var(--bg-elevated);
}

.table__num {
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  font-size: 13px;
}

.table__actions {
  text-align: right;
  white-space: nowrap;
}

/* User cell: avatar + name/id stack, used across tickets/warnings/invites. */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-cell__name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-cell__sub {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* Long free text inside a table cell shouldn't blow the layout out. */
.cell-text {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   List rows (dashboard panels)
   -------------------------------------------------------------------------- */
.list {
  display: flex;
  flex-direction: column;
}

.list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s var(--ease);
}

.list__item:last-child {
  border-bottom: none;
}

.list__item:hover {
  background: var(--bg-elevated);
}

.list__meta {
  flex: 1;
  min-width: 0;
}

.list__title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list__sub {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list__trail {
  flex: none;
  text-align: right;
  font-size: 12px;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   Empty / error / loading states
   -------------------------------------------------------------------------- */
.state {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.state__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  background: var(--bg-elevated);
  color: var(--text-faint);
  margin-bottom: 6px;
}

.state--error .state__icon {
  background: var(--red-soft);
  color: var(--red);
}

.state__title {
  font-size: 15px;
  font-weight: 650;
}

.state__desc {
  font-size: 13px;
  color: var(--text-faint);
  max-width: 380px;
}

.state__action {
  margin-top: 12px;
}

/* Skeletons -------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 14px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.skeleton-row:last-child {
  border-bottom: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
}

.modal.is-open {
  display: flex;
  animation: fade-in 0.15s var(--ease);
}

.modal__panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: pop-in 0.18s var(--ease);
}

.modal__panel--wide {
  max-width: 720px;
}

.modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.modal__title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}

.modal__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
  flex: none;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--blurple);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toast-in 0.22s var(--ease);
  font-size: 14px;
}

.toast.is-leaving {
  animation: toast-out 0.2s var(--ease) forwards;
}

.toast--success { border-left-color: var(--green); }
.toast--error { border-left-color: var(--red); }
.toast--warning { border-left-color: var(--yellow); }

.toast__icon { flex: none; margin-top: 1px; }
.toast--success .toast__icon { color: var(--green); }
.toast--error .toast__icon { color: var(--red); }
.toast--warning .toast__icon { color: var(--yellow); }
.toast--info .toast__icon { color: var(--blurple); }

.toast__msg {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast__close {
  flex: none;
  color: var(--text-faint);
  margin: -2px -2px 0 0;
}
.toast__close:hover { color: var(--text); }

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* --------------------------------------------------------------------------
   Tabs (settings)
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-faint);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.12s var(--ease), border-color 0.12s var(--ease);
}

.tab:hover {
  color: var(--text-muted);
}

.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--blurple);
}

.tab-panel[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 20px 0;
}

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--blurple-soft);
  border: 1px solid rgba(88, 101, 242, 0.25);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.callout .icon {
  flex: none;
  color: var(--blurple);
  margin-top: 1px;
}

.callout--warning {
  background: var(--yellow-soft);
  border-color: rgba(240, 178, 50, 0.25);
}
.callout--warning .icon { color: var(--yellow); }

/* Layout helpers -------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-mono { font-family: var(--font-mono); }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hidden { display: none !important; }

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   Login page
   -------------------------------------------------------------------------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Soft blurple glow behind the login card. */
.login::before {
  content: "";
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88, 101, 242, 0.18), transparent 68%);
  pointer-events: none;
}

.login__card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  text-align: center;
}

.login__logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--blurple), #7b83f7);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 28px rgba(88, 101, 242, 0.42);
}

.login__title {
  font-size: 24px;
  letter-spacing: -0.02em;
}

.login__desc {
  color: var(--text-faint);
  font-size: 14px;
  margin-top: 6px;
  margin-bottom: 28px;
}

.login__note {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 20px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main {
    margin-left: 0;
  }

  .topbar__menu {
    display: grid;
  }
}

@media (max-width: 720px) {
  .page {
    padding: 16px;
  }

  .topbar {
    padding: 0 16px;
    gap: 12px;
  }

  .topbar__desc {
    display: none;
  }

  .stat {
    padding: 16px;
  }

  .stat__value {
    font-size: 26px;
  }

  .card__header,
  .card__body {
    padding: 16px;
  }

  .table th,
  .table td {
    padding: 11px 14px;
  }

  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal__panel {
    max-width: none;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
  }

  .toast-stack {
    top: auto;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
  }

  /* Full-width primary actions read better on a narrow screen. */
  .topbar__actions .btn span {
    display: none;
  }
  .topbar__actions .btn {
    width: 38px;
    padding: 0;
  }
}

/* --------------------------------------------------------------------------
   Kanban board (ticket lifecycle)
   -------------------------------------------------------------------------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

@media (max-width: 1100px) {
  .kanban {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 640px) {
  .kanban {
    grid-template-columns: 1fr;
  }
}

.kanban__col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 180px;
}

.kanban__col.is-drop-target {
  border-color: var(--blurple);
  background: var(--blurple-soft);
}

.kanban__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.kanban__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.kanban__count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
}

.kanban__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  flex: 1;
}

.kanban__empty {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  padding: 18px 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.kcard {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: grab;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.kcard:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.kcard.is-dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kcard__top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.kcard__num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.kcard__user {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kcard__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   Inline SVG charts (Steam health, ticket metrics)
   -------------------------------------------------------------------------- */
.chart {
  width: 100%;
  display: block;
}

.chart text {
  font-family: var(--font);
  font-size: 10.5px;
  fill: var(--text-faint);
}

.chart .chart__grid {
  stroke: var(--border);
  stroke-dasharray: 3 4;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

/* Review text: clamped to two lines until clicked open */
.review-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  cursor: pointer;
  word-break: break-word;
}

.review-text.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* Horizontal proportion bars (language breakdown) */
.hbar {
  display: grid;
  grid-template-columns: 110px 1fr 70px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 12.5px;
}

.hbar__label {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar__track {
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}

.hbar__fill {
  height: 100%;
}

.hbar__value {
  text-align: right;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
