:root {
  --bg: #05050a;
  --panel: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.08);
  --cyan: #22d3ee;
  --cyan-dim: rgba(6,182,212,0.14);
  --text: #f2f2f5;
  --text-dim: rgba(255,255,255,0.45);
  --text-faint: rgba(255,255,255,0.25);
  --red: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

a { color: var(--cyan); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ── Login page ─────────────────────────────────────── */
.login-hero {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  background:
    linear-gradient(100deg, rgba(3,4,8,0.96) 0%, rgba(3,4,8,0.82) 30%, rgba(3,4,8,0.35) 58%, rgba(3,4,8,0.15) 100%),
    linear-gradient(0deg, rgba(3,4,8,0.6) 0%, transparent 40%),
    url('/assets/login-bg.jpg');
  background-size: cover;
  background-position: center;
}

.login-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  padding: 24px 32px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--cyan);
  text-transform: uppercase;
  margin: 0 0 16px;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(6,182,212,0.7);
  flex-shrink: 0;
}

.headline {
  font-size: clamp(30px, 4.5vw, 42px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0 0 28px;
}
.headline .cyan { color: var(--cyan); }

.hint {
  font-size: 12px;
  color: var(--text-faint);
  margin: 14px 0 4px;
}
.copyright {
  font-size: 11px;
  color: var(--text-faint);
  margin: 4px 0 0;
}

.footnote {
  position: absolute;
  left: 32px;
  bottom: 28px;
  z-index: 2;
  display: flex;
  gap: 10px;
  max-width: 340px;
}
.footnote .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #a78bfa;
  box-shadow: 0 0 8px rgba(167,139,250,0.6);
  margin-top: 6px;
  flex-shrink: 0;
}
.footnote strong { display: block; font-size: 12px; color: #c4b5fd; margin-bottom: 2px; }
.footnote p { margin: 0; font-size: 11.5px; color: var(--text-faint); line-height: 1.5; }

.login-hero input {
  background: rgba(5,6,12,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.14);
}
.login-hero input::placeholder { color: rgba(255,255,255,0.3); }
.login-hero input:focus { border-color: rgba(6,182,212,0.5); background: rgba(5,6,12,0.7); }

.login-hero .tabs {
  background: rgba(5,6,12,0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255,255,255,0.12);
}

@media (max-width: 640px) {
  .login-content { padding: 20px 20px 100px; }
  .footnote { left: 20px; right: 20px; bottom: 20px; max-width: none; }
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  border-radius: 7px;
  cursor: pointer;
  background: none;
  border: none;
}
.tab.active { background: var(--cyan-dim); color: var(--cyan); }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 6px;
}
input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus { outline: none; border-color: rgba(6,182,212,0.4); }

button.primary {
  width: 100%;
  padding: 12px;
  background: var(--cyan);
  color: #001318;
  border: none;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  margin-top: 6px;
}
button.primary:hover { opacity: 0.9; }
button.primary:disabled { opacity: 0.5; cursor: default; }

.msg { font-size: 12px; margin-top: 12px; padding: 10px 12px; border-radius: 8px; }
.msg.error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); color: var(--red); }
.msg.ok { background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.2); color: var(--cyan); }

.hidden { display: none !important; }

/* ── Dashboard ──────────────────────────────────────── */
.who { font-size: 13px; color: var(--text-dim); }
.who strong { color: var(--text); }

button.ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
button.ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }

/* ── App shell (sidebar + main) ────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.015);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  font-weight: 700;
  font-size: 16px;
  padding: 0 10px;
  margin-bottom: 24px;
}
.sidebar-brand span { color: var(--cyan); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  background: none;
  border: none;
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: 0.8; }
.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.nav-item.active { background: var(--cyan-dim); color: var(--cyan); }
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--cyan);
  color: #001318;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  display: none;
}
.nav-badge.show { display: inline-block; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-footer .pill { width: fit-content; }
.sidebar-footer button.ghost { width: 100%; }

.app-main {
  flex: 1;
  min-width: 0;
  padding: 36px 40px 80px;
}

.app-section { display: none; }
.app-section.active { display: block; }

.page-title { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
.page-desc { font-size: 13px; color: var(--text-faint); margin: 0 0 24px; }
.page-desc code { background: rgba(255,255,255,0.05); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 16px;
    gap: 10px 16px;
  }
  .sidebar-brand { margin-bottom: 0; order: 1; }
  .sidebar-footer {
    order: 2;
    margin-left: auto;
    flex-direction: row;
    align-items: center;
    border-top: none;
    padding-top: 0;
  }
  .sidebar-footer button.ghost { width: auto; }
  .sidebar-nav {
    order: 3;
    flex-basis: 100%;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
  }
  .nav-item { flex-shrink: 0; }
  .app-main { padding: 24px 20px 60px; }
}

/* ── Overview stats ─────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; }
.stat-value { font-size: 26px; font-weight: 700; color: #fff; }
@media (max-width: 700px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Settings sub-tabs ───────────────────────────────────── */
.settings-tabs { max-width: 420px; margin-bottom: 20px; }
.settings-panel.hidden { display: none; }

/* ── Ticket mock-up ──────────────────────────────────────── */
.ticket-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.ticket-tabs { display: flex; gap: 8px; }

.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.015);
}
.ticket-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--cyan-dim); color: var(--cyan);
}
.ticket-body { flex: 1; min-width: 0; }
.ticket-title { font-size: 13px; font-weight: 600; color: var(--text); margin: 0 0 3px; }
.ticket-meta { font-size: 11.5px; color: var(--text-faint); }
.ticket-status.open { background: rgba(34,197,94,0.12); color: #4ade80; }
.ticket-status.pending { background: rgba(245,158,11,0.12); color: #fbbf24; }
.ticket-status.closed { background: rgba(255,255,255,0.05); color: var(--text-faint); }

section.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}
section.card h2 {
  font-size: 15px;
  margin: 0 0 4px;
}
section.card .desc {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 18px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-faint); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
tr:last-child td { border-bottom: none; }

.pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pill.unread { background: var(--cyan-dim); color: var(--cyan); }
.pill.read { background: rgba(255,255,255,0.04); color: var(--text-faint); }

td.status-cell { cursor: pointer; }
td.status-cell:hover .pill { filter: brightness(1.3); }
.pill.director { background: rgba(139,92,246,0.14); color: #c4b5fd; }
.pill.admin { background: var(--cyan-dim); color: var(--cyan); }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.inline-form .field { margin-bottom: 0; min-width: 160px; }
.inline-form button.primary { width: auto; padding: 11px 18px; margin-top: 0; }

.reveal-once {
  font-family: monospace;
  font-size: 13px;
  background: rgba(6,182,212,0.06);
  border: 1px solid rgba(6,182,212,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--cyan);
  margin-bottom: 16px;
  word-break: break-all;
}

.empty { color: var(--text-faint); font-size: 13px; padding: 20px 0; text-align: center; }

details.data-preview summary { cursor: pointer; color: var(--cyan); font-size: 12px; }
details.data-preview pre {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
