:root {
  --bg: #061014;
  --surface: rgba(12, 24, 28, 0.92);
  --surface2: #122226;
  --border: rgba(0, 212, 170, 0.16);
  --text: #e8fff8;
  --muted: rgba(180, 210, 200, 0.72);
  --accent: #00d4aa;
  --danger: #ff5c5c;
  --twitch: #9146ff;
  --font: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --display: 'Syne', 'Manrope', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(0, 212, 170, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

.screen { min-height: 100vh; }

.login-card {
  max-width: 420px;
  margin: 12vh auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.kicker { color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; }
.login-card h1, .page-head h2, .brand strong { font-family: var(--display); }
.tagline, .muted { color: var(--muted); margin: 10px 0 20px; }
.error, .denied { color: var(--danger); margin-top: 14px; }

.btn-twitch, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  color: #04120f;
  background: var(--accent);
}

.btn-twitch { background: var(--twitch); color: #fff; width: 100%; padding: 12px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

#app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
#app.hidden { display: none !important; }

.sidebar {
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(6, 16, 20, 0.7);
}

.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent); color: #04120f;
  display: grid; place-items: center; font-weight: 800; font-family: var(--display);
}
.brand span { display: block; color: var(--muted); font-size: 12px; }

nav { display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
  background: transparent; color: var(--text); border: 0; text-align: left;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font: inherit;
}
.nav-btn.active, .nav-btn:hover { background: rgba(0, 212, 170, 0.12); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; color: var(--muted); }

.main { padding: 28px 32px 48px; }
.page-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 20px; }
.add-form, .contacts-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }

input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface2);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
}

.card-list { display: flex; flex-direction: column; gap: 8px; }
.row-card, .panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
}
.row-card { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; cursor: pointer; }
.row-card:hover { border-color: var(--accent); }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); }
.badge.on { color: var(--accent); border-color: var(--accent); }
.badge.off { color: var(--muted); }
.badge.no { color: var(--danger); border-color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.stats dt { color: var(--muted); }
#settings-json { width: 100%; min-height: 280px; font-family: ui-monospace, monospace; font-size: 12px; margin: 10px 0; }
.tickets-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.messages { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.bubble { padding: 10px 12px; border-radius: 12px; background: var(--surface2); }
.bubble.admin { border: 1px solid var(--accent); }
.bubble small { display: block; color: var(--muted); margin-bottom: 4px; }
#thread-reply { display: flex; flex-direction: column; gap: 8px; }
.thread-head { display: flex; justify-content: space-between; gap: 12px; }
.ticket-mini { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 960px) {
  #app { grid-template-columns: 1fr; }
  .grid-2, .tickets-layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin-top: 0; }
}
