:root {
  --bg0: #05080f;
  --bg1: #0a1220;
  --bg2: #101a2c;
  --elev: rgba(14, 22, 38, 0.78);
  --elev-solid: #101a2c;
  --line: rgba(160, 210, 255, 0.12);
  --line-strong: rgba(160, 210, 255, 0.22);
  --text: #eaf2ff;
  --muted: #8ea3c2;
  --cyan: #2ee8d4;
  --cyan-2: #67fff0;
  --blue: #6ea8ff;
  --violet: #8b7dff;
  --amber: #f5c15c;
  --ok: #3ee0a0;
  --ok-bg: rgba(62, 224, 160, 0.12);
  --danger: #ff6b7a;
  --danger-bg: rgba(255, 107, 122, 0.12);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: "Manrope", "Segoe UI", sans-serif;
  --display: "Sora", "Manrope", sans-serif;
}

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

html {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--cyan-2); }

h1, h2, h3, h4 {
  font-family: var(--display);
  letter-spacing: -0.03em;
  font-weight: 650;
  color: var(--text);
}

/* ========== APP BACKGROUND ========== */
.page-app {
  background:
    radial-gradient(1200px 700px at -10% -20%, rgba(46, 232, 212, 0.10), transparent 50%),
    radial-gradient(900px 600px at 110% 0%, rgba(110, 168, 255, 0.12), transparent 46%),
    radial-gradient(800px 500px at 70% 120%, rgba(139, 125, 255, 0.10), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 40%, #071018);
  background-attachment: fixed;
}

.page-app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(110, 168, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 168, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 80%);
  z-index: 0;
}

.page-app .wrap,
.page-app .app-foot { position: relative; z-index: 1; }
.page-app .topbar { z-index: 50; }

/* ========== TOPBAR ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: rgba(5, 8, 15, 0.72);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
}

.brand-lockup:hover { color: inherit; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(12px 12px at 30% 28%, rgba(255,255,255,.35), transparent 60%),
    linear-gradient(145deg, rgba(46, 232, 212, 0.85), rgba(110, 168, 255, 0.75));
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 10px 28px rgba(46, 232, 212, 0.22);
}

.brand-copy { min-width: 0; }
.brand-copy strong {
  display: block;
  font-family: var(--display);
  font-size: 14.5px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.brand-copy span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.user-chip {
  display: none;
}

@media (min-width: 900px) {
  .user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    padding: 6px 10px 6px 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.03);
    color: var(--muted);
    font-size: 12.5px;
    white-space: nowrap;
  }
  .user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #041016;
    background: linear-gradient(135deg, var(--cyan), var(--blue));
  }
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 16px;
  height: 1.6px;
  background: currentColor;
  border-radius: 2px;
  position: relative;
  margin: 0 auto;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

.navlinks {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.navlinks a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color .15s ease, background .15s ease, border-color .15s ease, transform .15s ease;
}

.navlinks a:hover {
  color: var(--text);
  background: rgba(255,255,255,.05);
}

.navlinks a.is-active {
  color: #041016;
  background: linear-gradient(135deg, var(--cyan), #7ad7ff);
  border-color: transparent;
}

.navlinks a.nav-logout {
  color: #ffb4bb;
  border-color: rgba(255, 107, 122, 0.25);
  background: rgba(255, 107, 122, 0.08);
}
.navlinks a.nav-logout:hover {
  color: #fff;
  background: rgba(255, 107, 122, 0.18);
}

@media (max-width: 860px) {
  .nav-toggle { display: grid; place-items: center; }
  .navlinks {
    display: none;
    position: absolute;
    left: 12px;
    right: 12px;
    top: calc(100% + 8px);
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
    background: rgba(10, 16, 28, 0.96);
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    box-shadow: var(--shadow);
  }
  .topbar { position: sticky; }
  .topbar-inner { position: relative; }
  .topbar.is-open .navlinks { display: flex; }
  .navlinks a { text-align: center; }
}

/* ========== LAYOUT ========== */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 22px 64px;
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card h2 { margin: 0 0 6px; font-size: 22px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 260px; }

.muted { color: var(--muted); }

.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  font-weight: 700;
  margin-bottom: 8px;
}

/* ========== FORMS ========== */
label {
  display: block;
  margin: 12px 0 7px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0.02em;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--line-strong) !important;
  background: rgba(4, 10, 18, 0.72) !important;
  color: var(--text) !important;
  font: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238ea3c2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 36px !important;
  background-color: rgba(4, 10, 18, 0.72) !important;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(46, 232, 212, 0.7) !important;
  box-shadow: 0 0 0 4px rgba(46, 232, 212, 0.14);
}

input[type="file"] {
  width: 100%;
  color: var(--muted);
  background: rgba(4, 10, 18, 0.45);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 18px 14px;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
  margin-right: 6px;
}

input::placeholder, textarea::placeholder { color: #6d829e; }

/* ========== BUTTONS ========== */
.btn,
button.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease, background .15s ease, border-color .15s ease;
}

.btn:hover, a.btn:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
  transform: translateY(-1px);
}

.btn-primary,
button.btn-primary,
a.btn-primary {
  color: #041016;
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), #7ad7ff);
  box-shadow: 0 10px 28px rgba(46, 232, 212, 0.18);
}
.btn-primary:hover, a.btn-primary:hover {
  color: #041016;
  filter: brightness(1.06);
}

.btn-danger,
button.btn-danger,
a.btn-danger {
  color: #fff;
  border-color: rgba(255, 107, 122, 0.4);
  background: linear-gradient(135deg, #e23b4c, #ff6b7a);
}
.btn-danger:hover, a.btn-danger:hover { color: #fff; }

button { font: inherit; }

/* ========== ALERTS ========== */
.error {
  color: #ffd5d9;
  background: var(--danger-bg);
  border: 1px solid rgba(255, 107, 122, 0.35);
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.success {
  color: #c8ffe6;
  background: var(--ok-bg);
  border: 1px solid rgba(62, 224, 160, 0.35);
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
}

/* ========== TABLES ========== */
.card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.card thead tr {
  text-align: left;
  border-bottom: 1px solid var(--line) !important;
}

.card th {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 12px 10px !important;
}

.card td {
  padding: 12px 10px !important;
  border-bottom: 1px solid rgba(160, 210, 255, 0.06) !important;
  vertical-align: middle;
}

.card tbody tr:hover td {
  background: rgba(255,255,255,.025);
}

.badge,
.card td span[style] {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  font-size: 12px;
  font-weight: 700;
}

.badge-success,
.card td span[style*="d1fae5"] {
  color: #b8ffde !important;
  background: var(--ok-bg) !important;
  border: 1px solid rgba(62, 224, 160, 0.35) !important;
}

.badge-danger,
.card td span[style*="fee2e2"] {
  color: #ffd0d5 !important;
  background: var(--danger-bg) !important;
  border: 1px solid rgba(255, 107, 122, 0.35) !important;
}

/* ========== DASHBOARD ========== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 28px 28px 26px;
}

.hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -60px;
  top: -80px;
  background: radial-gradient(circle, rgba(46, 232, 212, 0.22), transparent 70%);
  pointer-events: none;
}

.hero h2 { font-size: 30px; margin: 0 0 8px; }
.hero p { margin: 0; max-width: 62ch; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.action-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  color: inherit;
  min-height: 150px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.action-card:hover {
  color: inherit;
  transform: translateY(-4px);
  border-color: rgba(46, 232, 212, 0.4);
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
}

.action-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(46, 232, 212, 0.12);
  border: 1px solid rgba(46, 232, 212, 0.25);
}

.action-card h3 { margin: 0; font-size: 16px; }
.action-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.action-card .go { margin-top: auto; font-size: 12.5px; font-weight: 800; color: var(--cyan); }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.kv { margin: 0; }
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(160, 210, 255, 0.07);
  font-size: 13.5px;
}
.kv div:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }

.role-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(110, 168, 255, 0.14);
  color: #c9dbff;
  border: 1px solid rgba(110, 168, 255, 0.28);
}

/* ========== LOGIN ========== */
.page-login {
  min-height: 100vh;
  overflow: hidden;
  background: #04070d;
}

.login-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.login-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  animation: orbDrift 12s ease-in-out infinite alternate;
}
.login-orb.a {
  width: 420px; height: 420px; left: -80px; top: -40px;
  background: rgba(46, 232, 212, 0.22);
}
.login-orb.b {
  width: 380px; height: 380px; right: -60px; top: 18%;
  background: rgba(110, 168, 255, 0.22);
  animation-delay: -4s;
}
.login-orb.c {
  width: 460px; height: 460px; left: 30%; bottom: -180px;
  background: rgba(139, 125, 255, 0.16);
  animation-delay: -7s;
}

@keyframes orbDrift {
  from { transform: translate3d(0,0,0) scale(1); }
  to { transform: translate3d(24px, -18px, 0) scale(1.08); }
}

.login-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
}

.login-showcase {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 48px 56px 64px;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.login-kicker i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 6px rgba(46, 232, 212, 0.15);
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 232, 212, 0.45); }
  100% { box-shadow: 0 0 0 12px rgba(46, 232, 212, 0); }
}

.login-showcase h1 {
  font-size: clamp(36px, 5vw, 58px);
  line-height: 0.95;
  margin: 0 0 16px;
  max-width: 11ch;
}

.login-showcase .lead {
  font-size: 16.5px;
  color: var(--muted);
  max-width: 42ch;
  line-height: 1.55;
  margin: 0 0 28px;
}

.gantry-stage {
  position: relative;
  width: min(420px, 100%);
  height: 280px;
  margin: 8px 0 28px;
}

.gantry {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.gantry-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(46, 232, 212, 0.22);
  box-shadow: inset 0 0 40px rgba(46, 232, 212, 0.06);
}
.gantry-ring.r1 { width: 250px; height: 250px; animation: spin 18s linear infinite; }
.gantry-ring.r2 { width: 190px; height: 190px; border-style: dashed; animation: spin 12s linear infinite reverse; }
.gantry-ring.r3 { width: 124px; height: 124px; border-color: rgba(110, 168, 255, 0.4); animation: spin 9s linear infinite; }

.gantry-ring.r1::before,
.gantry-ring.r2::before {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
  top: -5px; left: 50%;
}

.scanline {
  position: absolute;
  width: 220px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: scan 2.8s ease-in-out infinite;
  opacity: 0.85;
}

.crosshair {
  width: 72px; height: 72px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  position: relative;
}
.crosshair::before, .crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,.35);
}
.crosshair::before { width: 1px; height: 100%; left: 50%; }
.crosshair::after { height: 1px; width: 100%; top: 50%; }

.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  font-size: 12.5px;
  color: #cfe0f7;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 32px 28px;
}

.auth-card {
  width: min(440px, 100%);
  position: relative;
  border-radius: 22px;
  background: rgba(10, 16, 28, 0.72);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  animation: liftIn .7s ease both;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: conic-gradient(from 180deg, transparent, rgba(46,232,212,.55), rgba(110,168,255,.45), transparent 62%);
  filter: blur(18px);
  opacity: .45;
  animation: spin 7s linear infinite;
  pointer-events: none;
}

.auth-inner {
  position: relative;
  z-index: 1;
  padding: 28px 26px 22px;
  background: linear-gradient(180deg, rgba(16,26,44,.88), rgba(10,16,28,.92));
  border-radius: 22px;
}

.auth-head h2 {
  margin: 0 0 6px;
  font-size: 26px;
}
.auth-head p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.field { margin-top: 14px; position: relative; }
.field label { margin-top: 0; }

.input-wrap { position: relative; }

.input-wrap input {
  padding-right: 44px;
}

.icon-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.05); }

.btn-signin {
  width: 100%;
  margin-top: 18px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #041016;
  background: linear-gradient(135deg, var(--cyan), #7ad7ff 55%, var(--blue));
  background-size: 160% 160%;
  box-shadow: 0 16px 40px rgba(46, 232, 212, 0.22);
  transition: transform .15s ease, filter .15s ease;
}
.btn-signin:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-signin:active { transform: translateY(0) scale(.99); }

.login-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #6f829c;
  font-size: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes liftIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes scan {
  0%, 100% { transform: translateY(-70px); opacity: .2; }
  50% { transform: translateY(70px); opacity: 1; }
}

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-showcase {
    padding: 36px 22px 8px;
    text-align: center;
    align-items: center;
  }
  .login-showcase h1 { max-width: none; }
  .login-showcase .lead { margin-left: auto; margin-right: auto; }
  .gantry-stage { margin-left: auto; margin-right: auto; height: 220px; }
  .feature-row { justify-content: center; }
  .login-panel { padding: 8px 16px 40px; }
}

.app-foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px 28px;
  color: #6f829c;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
