:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
  --bg: #05080d;
  --bg2: #08111b;
  --panel: #0d1621;
  --panel2: #121f2d;
  --panel3: #172a3c;
  --text: #f6f9ff;
  --muted: #8fa4b9;
  --border: #1d3247;
  --accent: #178bff;
  --accent2: #65b7ff;
  --accent-soft: rgba(23,139,255,.16);
  --danger: #d84a4a;
  --warning: #c38a1e;
  --shadow: 0 24px 70px rgba(0,0,0,.34);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% 0%, rgba(23,139,255,.14), transparent 34rem),
    linear-gradient(180deg, #05080d 0%, #08111b 48%, #05080d 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

/* Brand */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-logo { width: min(290px, 68vw); height: auto; display: block; }
.brand-mini { width: 210px; height: auto; display: block; }

/* Shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 235px minmax(0,1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 14px 18px;
  border-right: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(180deg, rgba(5,12,19,.98), rgba(6,14,22,.94));
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.sidebar .brand-mini { width: 205px; margin: 0 6px 24px; }
.nav-list { display: grid; gap: 7px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border-radius: 11px;
  color: #c9d7e6;
  transition: .16s ease;
}
.nav-link:hover, .nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(23,139,255,.23), rgba(23,139,255,.08)); }
.nav-icon { width: 24px; text-align: center; font-size: 1.05rem; }
.sidebar-foot { margin-top: auto; padding: 14px 12px 4px; color: var(--muted); font-size: .78rem; line-height: 1.55; }

.main-area { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 68px;
  padding: 0 26px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(5,9,14,.88);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.topbar-title { font-weight: 800; letter-spacing: .01em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 999px;
  color: #dbe9f7;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display:grid; place-items:center; background: linear-gradient(135deg, #0568ce, #39a7ff);
  color:#fff; font-weight:800;
}

.page-content { padding: 0 28px 36px; }
.container { max-width: 1180px; margin: 0 auto; padding: 28px 20px; }
.narrow { max-width: 860px; }

/* Home hero */
.hero {
  min-height: 360px;
  margin: 0 -28px 22px;
  padding: 48px 52px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background:
    linear-gradient(90deg, rgba(4,8,13,.98) 0%, rgba(4,8,13,.86) 43%, rgba(4,8,13,.28) 74%, rgba(4,8,13,.8) 100%),
    radial-gradient(circle at 72% 42%, rgba(23,139,255,.48), transparent 24rem),
    linear-gradient(120deg, #07111b, #0b2237 52%, #02070c);
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.hero::before {
  width: 330px; height: 330px; right: 11%; top: 18px; border-radius: 50%;
  border: 1px solid rgba(91,184,255,.18);
  box-shadow: 0 0 100px rgba(23,139,255,.12) inset, 0 0 120px rgba(23,139,255,.12);
}
.hero::after {
  width: 260px; height: 180px; right: 14%; top: 74px;
  background:
    radial-gradient(ellipse at center, transparent 48%, rgba(23,139,255,.52) 49% 52%, transparent 53%) center 0/100% 58px no-repeat,
    radial-gradient(ellipse at center, transparent 48%, rgba(23,139,255,.42) 49% 52%, transparent 53%) center 48px/78% 52px no-repeat,
    radial-gradient(ellipse at center, transparent 48%, rgba(23,139,255,.34) 49% 52%, transparent 53%) center 92px/54% 46px no-repeat;
  opacity: .75;
}
.hero-copy { position: relative; z-index: 2; max-width: 650px; }
.eyebrow { color: var(--accent2); text-transform: uppercase; letter-spacing: .18em; font-weight: 800; font-size: .78rem; }
.hero h1 { margin: 10px 0 8px; font-size: clamp(2.4rem, 6vw, 5rem); line-height: .96; letter-spacing: -.045em; }
.hero h1 span { color: var(--accent); }
.hero p { color: #afc0d0; font-size: 1.12rem; max-width: 560px; }
.hero-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:22px; }
.access-pill {
  display:inline-flex; align-items:center; gap:8px; margin-top:18px; padding:8px 11px;
  border:1px solid rgba(101,183,255,.25); border-radius:999px; color:#b9dcff; background:rgba(23,139,255,.08); font-size:.86rem;
}

/* Buttons */
button, .button, .primary-action {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  background: linear-gradient(135deg, #0d79e6, #1f9dff);
  color: white;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(23,139,255,.18);
}
button:hover, .button:hover, .primary-action:hover { filter: brightness(1.08); }
button.secondary, .button.secondary { background: #152331; color: #e8f3ff; box-shadow:none; border:1px solid #24384b; }
button.danger { background:#a93333; }
button.warning { background:#9a6e18; }
button.neutral { background:#26394d; }

/* Dashboard cards */
.section-title { margin: 28px 0 13px; font-size: 1.15rem; font-weight: 850; }
.grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.tile {
  min-height: 144px;
  padding: 20px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  background: linear-gradient(145deg, rgba(16,31,45,.96), rgba(10,18,27,.96));
  border:1px solid rgba(104,183,255,.12);
  border-radius:14px;
  transition:.18s ease;
  box-shadow:0 12px 32px rgba(0,0,0,.16);
}
.tile:hover { transform:translateY(-3px); border-color:rgba(23,139,255,.42); background:linear-gradient(145deg, #112b42, #0a1724); }
.tile.static:hover { transform:none; }
.icon-ring {
  width:50px; height:50px; border-radius:50%; display:grid; place-items:center;
  background:linear-gradient(145deg, #0864bf, #119cff); box-shadow:0 10px 26px rgba(23,139,255,.18); font-size:1.35rem;
}
.tile h2 { margin:13px 0 4px; font-size:1rem; }
.tile p { margin:0; color:var(--muted); font-size:.9rem; line-height:1.45; }

.media-row { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.media-card {
  min-height: 145px; border-radius:12px; overflow:hidden; position:relative; padding:18px;
  display:flex; align-items:flex-end; border:1px solid rgba(255,255,255,.06);
  background:linear-gradient(145deg,#0d2640,#08111a);
}
.media-card:nth-child(2) { background:linear-gradient(145deg,#102d44,#071827); }
.media-card:nth-child(3) { background:linear-gradient(145deg,#0a3359,#09141f); }
.media-card:nth-child(4) { background:linear-gradient(145deg,#0b1f33,#071019); }
.media-card::after { content:""; position:absolute; inset:0; background:radial-gradient(circle at 80% 10%, rgba(34,153,255,.32), transparent 42%); }
.media-card strong, .media-card span { position:relative; z-index:1; }
.media-card strong { display:block; font-size:1rem; }
.media-card span { display:block; color:#a9bfd3; font-size:.82rem; margin-top:3px; }

/* Forms */
.centered { min-height:100vh; display:grid; place-items:center; padding:24px; }
.login-scene {
  min-height:100vh;
  background:
    linear-gradient(90deg, rgba(4,8,13,.96), rgba(4,8,13,.8)),
    radial-gradient(circle at 82% 25%, rgba(23,139,255,.32), transparent 26rem),
    #05080d;
}
.card {
  background: linear-gradient(145deg, rgba(13,23,34,.97), rgba(8,15,23,.97));
  border:1px solid rgba(255,255,255,.07);
  border-radius:16px;
  padding:22px;
  box-shadow:var(--shadow);
}
.login-card { width:min(440px,100%); padding:30px; }
.login-card .brand-logo { width:100%; margin-bottom:10px; }
.login-card h1 { margin:18px 0 4px; }
label { display:block; margin:14px 0; color:#c8d7e5; font-size:.9rem; }
input, textarea {
  width:100%; margin-top:7px; background:#07101a; color:var(--text);
  border:1px solid #22384c; border-radius:10px; padding:12px 13px; outline:none;
}
input:focus, textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(23,139,255,.12); }
textarea { resize:vertical; }
.muted { color:var(--muted); }
.small { font-size:.88rem; }
.error, .error-box { background:#3b1515; border:1px solid #703030; padding:10px; border-radius:10px; color:#ffe4e4; }

/* Chat/support */
.messages, .chat-box {
  min-height:420px; max-height:62vh; overflow:auto; padding:14px;
  background:rgba(3,8,13,.58); border:1px solid rgba(255,255,255,.06); border-radius:14px;
}
.msg, .message {
  max-width:80%; padding:11px 13px; margin:9px 0; background:#142230; border:1px solid rgba(255,255,255,.04); border-radius:13px; white-space:pre-wrap; overflow-wrap:anywhere;
}
.msg.me { margin-left:auto; background:linear-gradient(135deg,#0f5da9,#087fda); }
.meta { display:block; font-size:.72rem; color:#9bb2c7; margin-top:5px; }
.composer, .composer-global { margin-top:14px; border-top:1px solid rgba(255,255,255,.06); padding-top:14px; }
.composer-footer, .composer-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:8px; }

/* Admin */
.admin-layout { display:grid; grid-template-columns:minmax(250px,330px) minmax(0,1fr); gap:16px; padding:22px 28px 34px; }
.user-row { display:block; width:100%; text-align:left; margin:7px 0; background:#122132; color:var(--text); border:1px solid #20374d; box-shadow:none; }
.user-row:hover { background:#172b40; }
.hidden { display:none; }
hr { border:0; border-top:1px solid rgba(255,255,255,.07); margin:22px 0; }

/* Shared */
.page-heading { margin:26px 0 16px; }
.page-heading h1 { margin:0 0 5px; }
.header-simple { min-height:66px; padding:0 24px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid rgba(255,255,255,.06); background:rgba(5,9,14,.9); backdrop-filter:blur(16px); }
.header-simple .brand-mini { width:210px; }
.header-actions { display:flex; gap:8px; align-items:center; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { height:auto; position:sticky; padding:10px 14px; border-right:0; border-bottom:1px solid rgba(255,255,255,.06); }
  .sidebar .brand-mini { width:180px; margin:0 0 8px; }
  .nav-list { grid-template-columns:repeat(5,1fr); overflow-x:auto; }
  .nav-link { justify-content:center; padding:10px 8px; font-size:.8rem; }
  .nav-icon { display:none; }
  .sidebar-foot { display:none; }
  .topbar { top:107px; }
  .grid, .media-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .hero { padding:40px 28px; }
}

@media (max-width: 680px) {
  .page-content { padding:0 14px 28px; }
  .topbar { top:105px; padding:0 14px; height:58px; }
  .topbar-title { display:none; }
  .user-chip span { display:none; }
  .hero { margin:0 -14px 18px; min-height:330px; padding:34px 20px; }
  .hero::before, .hero::after { opacity:.35; right:-18%; }
  .grid, .media-row { grid-template-columns:1fr; }
  .admin-layout { grid-template-columns:1fr; padding:16px; }
  .nav-list { grid-template-columns:repeat(5,minmax(100px,1fr)); }
  .msg, .message { max-width:92%; }
  .header-simple { padding:0 14px; }
  .header-simple .brand-mini { width:170px; }
}

/* Global chat details */
.chat-wrap { max-width: 980px; margin: 0 auto; }
.chat-box { min-height: 440px; max-height: 62vh; overflow-y: auto; }
.message { max-width: 100%; }
.message.admin-message { border-color: rgba(23,139,255,.55); background: linear-gradient(135deg, rgba(13,85,150,.35), rgba(12,28,44,.95)); }
.message-head { display:flex; align-items:center; gap:8px; margin-bottom:6px; font-size:.86rem; }
.username { font-weight:850; }
.admin-badge { display:inline-flex; align-items:center; padding:2px 7px; border-radius:999px; background:var(--accent); color:#fff; font-size:.72rem; font-weight:850; }
.time { margin-left:auto; color:var(--muted); font-size:.72rem; }
.message-body { line-height:1.48; white-space:pre-wrap; }
.counter { color:var(--muted); font-size:.82rem; }
.empty-chat { color:var(--muted); text-align:center; padding:42px 16px; }
.admin-tools { display:flex; flex-wrap:wrap; gap:6px; margin-top:9px; }
.admin-tools button { padding:6px 9px; font-size:.75rem; box-shadow:none; }
