:root {
  color-scheme: dark;
  --bg: #050914;
  --surface: rgba(13, 23, 42, 0.88);
  --surface-strong: #101c32;
  --surface-soft: rgba(20, 34, 58, 0.72);
  --primary: #22d3ee;
  --primary-strong: #06b6d4;
  --accent: #818cf8;
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --text: #e8f1ff;
  --muted: #91a4c2;
  --border: rgba(125, 211, 252, 0.17);
  --border-bright: rgba(34, 211, 238, 0.42);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
  --glow: 0 0 32px rgba(34, 211, 238, 0.11);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 4%, rgba(34, 211, 238, 0.12), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(129, 140, 248, 0.13), transparent 30rem),
    linear-gradient(145deg, #050914 0%, #07101f 52%, #050815 100%);
  line-height: 1.6;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(125, 211, 252, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 211, 252, 0.055) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 92%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 100;
  content: "";
  pointer-events: none;
  opacity: 0.035;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, #fff 4px);
}

a, button, input, select, textarea { transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease; }

header.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 14px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--border);
  background: rgba(5, 9, 20, 0.78);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.brand::before {
  width: 12px;
  height: 12px;
  content: "";
  border: 2px solid var(--primary);
  border-radius: 3px;
  box-shadow: 0 0 16px var(--primary);
  transform: rotate(45deg);
}

nav { display: flex; align-items: center; gap: 20px; color: var(--muted); }
nav a, .nav-button {
  padding: 7px 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
nav a:hover, .nav-button:hover { color: var(--primary); border-bottom-color: var(--primary); }

.container { width: min(1220px, calc(100% - 36px)); margin: 38px auto; padding-bottom: 56px; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 260px;
  margin-bottom: 26px;
  padding: clamp(30px, 5vw, 60px);
  overflow: hidden;
  border: 1px solid var(--border-bright);
  border-radius: 26px;
  background: linear-gradient(115deg, rgba(13, 27, 49, .96), rgba(15, 24, 50, .86));
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.04), 0 0 50px rgba(34,211,238,.07);
}

.hero::before {
  position: absolute;
  z-index: -1;
  right: -120px;
  width: 420px;
  height: 420px;
  content: "";
  border: 1px solid rgba(34,211,238,.2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,.13), transparent 64%);
  box-shadow: 0 0 0 45px rgba(129,140,248,.025), 0 0 0 90px rgba(34,211,238,.02);
}

.hero h1 { max-width: 760px; }
.hero p:not(.eyebrow) { max-width: 620px; margin-bottom: 0; color: #a9bad3; font-size: 1.05rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.eyebrow::before { width: 24px; height: 1px; content: ""; background: var(--primary); box-shadow: 0 0 8px var(--primary); }

h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2.05rem, 4vw, 3.5rem); line-height: 1.08; letter-spacing: -.045em; }
h2 { margin-bottom: 20px; font-size: 1.25rem; letter-spacing: -.02em; }
h3 { margin-bottom: 14px; font-size: 1.02rem; }
h2::after { display: block; width: 42px; height: 2px; margin-top: 10px; content: ""; background: linear-gradient(90deg, var(--primary), transparent); }

.layout { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(300px, .82fr); gap: 24px; align-items: start; }
.grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  position: relative;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(17, 30, 52, .9), rgba(10, 18, 34, .9));
  box-shadow: var(--shadow), var(--glow), inset 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(15px);
}

.card::before {
  position: absolute;
  top: -1px;
  left: 24px;
  width: 70px;
  height: 1px;
  content: "";
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}

main.container > .card { margin-bottom: 24px; }

label { display: block; margin-bottom: 14px; color: #b8c7dc; font-size: .82rem; font-weight: 700; letter-spacing: .035em; }
input, textarea, select, button { font: inherit; }
input, textarea, select {
  width: 100%;
  margin-top: 7px;
  padding: 12px 14px;
  border: 1px solid rgba(145,164,194,.22);
  border-radius: 9px;
  outline: 0;
  background: rgba(3, 9, 20, .72);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #607491; }
select { color-scheme: dark; cursor: pointer; }
textarea { min-height: 92px; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: rgba(34,211,238,.38); }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34,211,238,.1), 0 0 20px rgba(34,211,238,.08); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: .025em;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { border-color: rgba(103,232,249,.5); background: linear-gradient(135deg, #0891b2, #2563eb); color: #fff; box-shadow: 0 9px 24px rgba(6,182,212,.19); }
.btn.secondary { border-color: var(--border-bright); background: rgba(34,211,238,.07); color: #8eeaff; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.12); box-shadow: 0 12px 30px rgba(34,211,238,.2); }
.btn:active { transform: translateY(0); }
.full { width: 100%; }

.ticket-list, .ticket-admin-list { display: flex; flex-direction: column; gap: 16px; }
.ticket-item, .admin-ticket {
  padding: 20px;
  border: 1px solid rgba(145,164,194,.15);
  border-radius: 13px;
  background: linear-gradient(120deg, rgba(18,32,55,.78), rgba(9,17,31,.84));
  box-shadow: inset 3px 0 var(--accent);
}
.admin-ticket:hover, .ticket-item:hover { border-color: rgba(34,211,238,.28); background: linear-gradient(120deg, rgba(20,37,62,.9), rgba(10,20,37,.9)); }
.ticket-head, .ticket-top, .list-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ticket-top { justify-content: flex-start; margin-bottom: 14px; }
.ticket-head { padding-bottom: 14px; border-bottom: 1px solid rgba(145,164,194,.12); margin-bottom: 16px; }
.ticket-head > div:first-child { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ticket-head > div:first-child strong { color: var(--primary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.badge { display: inline-flex; align-items: center; padding: 5px 10px; border: 1px solid currentColor; border-radius: 999px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.status-open { background: rgba(56,189,248,.09); color: #7dd3fc; }
.status-in-progress { background: rgba(251,191,36,.09); color: #fcd34d; }
.status-pending { background: rgba(167,139,250,.1); color: #c4b5fd; }
.status-resolved { background: rgba(52,211,153,.09); color: #6ee7b7; }
.status-closed { background: rgba(148,163,184,.08); color: #a8b5c8; }
.priority-low { background: rgba(34,211,238,.08); color: #67e8f9; }
.priority-medium { background: rgba(251,191,36,.08); color: #fcd34d; }
.priority-high { background: rgba(251,113,133,.08); color: #fda4af; }
.priority-critical, .overdue { background: rgba(244,63,94,.13); color: #fb7185; box-shadow: 0 0 14px rgba(244,63,94,.08); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stats-grid .card { min-height: 132px; display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow: hidden; }
.stats-grid .card::after { position: absolute; right: -18px; bottom: -35px; width: 100px; height: 100px; content: ""; border: 1px solid rgba(34,211,238,.12); border-radius: 50%; }
.stats-grid strong { color: var(--primary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 2.25rem; line-height: 1; text-shadow: 0 0 18px rgba(34,211,238,.3); }
.stats-grid span { color: var(--muted); font-size: .76rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }

.filter-form { display: grid; grid-template-columns: 2fr repeat(3, 1fr) auto; gap: 10px; margin-bottom: 22px; }
.filter-form input, .filter-form select { margin-top: 0; }
.status-form { display: grid; grid-template-columns: minmax(180px, .6fr) minmax(180px, .6fr) minmax(240px, 1.4fr) auto; gap: 12px; align-items: end; margin-top: 20px; padding: 18px; border: 1px solid rgba(145,164,194,.12); border-radius: 12px; background: rgba(4,10,22,.45); }
.status-form label { margin-bottom: 0; }
.status-form textarea { min-height: 46px; height: 46px; }

.meta { margin-bottom: 9px; color: var(--muted); font-size: .86rem; }
.link, .link-button { border: 0; padding: 0; background: transparent; color: var(--primary); font: inherit; font-size: .86rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.link:hover, .link-button:hover { color: #a5f3fc; text-shadow: 0 0 10px rgba(34,211,238,.35); }
.inline-form { display: inline; margin: 0; }
.inline-action { display: inline-block; margin-left: 14px; }

.alert { margin-bottom: 22px; padding: 15px 18px; border: 1px solid; border-radius: 11px; font-weight: 650; backdrop-filter: blur(12px); }
.alert ul { margin: 0; padding-left: 20px; }
.alert.success { border-color: rgba(52,211,153,.35); background: rgba(16,185,129,.09); color: #8bf0c8; box-shadow: inset 3px 0 #34d399; }
.alert.danger { border-color: rgba(251,113,133,.35); background: rgba(244,63,94,.09); color: #fda4af; box-shadow: inset 3px 0 #fb7185; }
.empty-state { padding: 22px 0; color: var(--muted); text-align: center; }

.login-box { width: min(460px, 100%); margin: 9vh auto; }
.login-box::after { display: block; margin-top: 22px; color: #617694; font-family: ui-monospace, monospace; font-size: .68rem; letter-spacing: .14em; text-align: center; content: "SECURE ACCESS // AUTHENTICATED CHANNEL"; }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { position: relative; margin-left: 8px; padding: 4px 0 22px 24px; border-left: 1px solid rgba(34,211,238,.3); }
.timeline-item::before { position: absolute; top: 7px; left: -5px; width: 9px; height: 9px; content: ""; border: 2px solid var(--primary); border-radius: 50%; background: var(--bg); box-shadow: 0 0 10px var(--primary); }
.timeline-item:last-child { padding-bottom: 2px; }
.timeline-item p { margin: 8px 0 0; color: #b7c5d9; }
.time { margin-right: 8px; color: var(--muted); font-family: ui-monospace, monospace; font-size: .76rem; }

.description-box { margin: 24px 0; padding: 20px; border: 1px solid rgba(145,164,194,.14); border-radius: 12px; background: rgba(3,9,20,.5); box-shadow: inset 3px 0 var(--primary); }
.description-box p { margin-bottom: 0; color: #bdcbe0; }
details { margin-top: 20px; padding-top: 14px; border-top: 1px solid rgba(145,164,194,.12); }
summary { margin-bottom: 14px; color: #afbdd2; font-size: .86rem; font-weight: 750; cursor: pointer; }
code { padding: 2px 7px; border: 1px solid rgba(34,211,238,.25); border-radius: 5px; background: rgba(3,9,20,.7); color: var(--primary); user-select: all; overflow-wrap: anywhere; }
.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

@media (max-width: 1050px) {
  .status-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-form textarea { height: auto; }
}

@media (max-width: 900px) {
  .layout, .two-col, .stats-grid, .filter-form { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero::before { right: -230px; }
}

@media (max-width: 620px) {
  header.topbar { min-height: 62px; padding: 12px 18px; }
  .brand { font-size: .84rem; letter-spacing: .08em; }
  nav { gap: 10px; }
  nav span { display: none; }
  .container { width: min(100% - 24px, 1220px); margin-top: 22px; }
  .hero { min-height: 0; padding: 27px 22px; border-radius: 18px; }
  .card { padding: 20px 17px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats-grid .card { min-height: 110px; }
  .status-form { grid-template-columns: 1fr; padding: 14px; }
  .ticket-head { align-items: flex-start; }
  .inline-action { display: block; margin: 10px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
