:root {
  --bg: #07080b;
  --panel: #111318;
  --panel-2: #161920;
  --line: #232733;
  --text: #e6e8ee;
  --muted: #8b91a1;
  --accent: #7c5cff;
  --accent-2: #b39bff;
  --cyan: #7ee0ff;
  --green: #35d07f;
  --red: #ff5d6c;
  --yellow: #ffc24b;
  --blue: #4fa8ff;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(900px 400px at 10% -5%, rgba(124,92,255,.12), transparent 60%),
              radial-gradient(700px 300px at 90% 0%, rgba(75,47,214,.08), transparent 60%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

h1, h2, h3 { font-weight: 650; letter-spacing: -0.02em; margin: 0 0 8px; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

p { margin: 0 0 12px; }

code, .mono {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 13px;
}

/* layout */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px;
  flex: 0 0 244px;
  background: linear-gradient(180deg, rgba(17,19,24,.96), rgba(10,12,16,.96));
  backdrop-filter: blur(12px);
  border-inline-end: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #4b2fd6);
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 0 24px rgba(124,92,255,.5);
}

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(124, 92, 255, .14); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(124,92,255,.3); }
.nav .sep { height: 1px; background: var(--line); margin: 10px 6px; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.main { flex: 1; min-width: 0; padding: 28px 34px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.topbar .who { color: var(--muted); font-size: 13px; }

/* cards + grid */
.card {
  background: linear-gradient(180deg, rgba(17,19,24,.92), rgba(13,15,20,.92));
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  transition: border-color .2s ease;
}
.card:hover { border-color: rgba(124,92,255,.3); }
.card.tight { padding: 14px 16px; }

.grid { display: grid; gap: 16px; }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1280px) { .grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { position: relative; width: 100%; flex: none; height: auto; border-inline-end: none; border-bottom: 1px solid var(--line); }
  .main { padding: 20px; }
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: 1fr; }
}

.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; }
.stat .value {
  font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px;
  background: linear-gradient(135deg, #e6e8ee, #b39bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%;
  background: #0a0b0e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.15); }
textarea { min-height: 88px; resize: vertical; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
button:hover, .btn:hover { background: #1d212b; text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #8a6bff, #6a4aee);
  border-color: #6a4aee;
  color: #fff;
  box-shadow: 0 8px 24px rgba(124,92,255,.35);
}
.btn-primary:hover { background: linear-gradient(180deg, #9a7fff, #7557f5); transform: translateY(-1px); }
.btn-danger { color: var(--red); border-color: rgba(255, 93, 108, .35); background: rgba(255, 93, 108, .07); }
.btn-danger:hover { background: rgba(255, 93, 108, .14); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0,0,0,.3); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: start;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 600;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(17,19,24,.95);
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(124,92,255,.05); }
td.actions { white-space: nowrap; }
td.actions form { display: inline; }

/* badges + flash */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge-green { color: var(--green); border-color: rgba(53, 208, 127, .3); background: rgba(53, 208, 127, .08); }
.badge-red { color: var(--red); border-color: rgba(255, 93, 108, .3); background: rgba(255, 93, 108, .08); }
.badge-yellow { color: var(--yellow); border-color: rgba(255, 194, 75, .3); background: rgba(255, 194, 75, .08); }
.badge-blue { color: var(--blue); border-color: rgba(79, 168, 255, .3); background: rgba(79, 168, 255, .08); }
.badge-gray { color: var(--muted); }

.flash {
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
}
.flash-ok { color: var(--green); border-color: rgba(53, 208, 127, .3); background: rgba(53, 208, 127, .07); }
.flash-err { color: var(--red); border-color: rgba(255, 93, 108, .3); background: rgba(255, 93, 108, .07); }
.flash-warn { color: var(--yellow); border-color: rgba(255, 194, 75, .35); background: rgba(255, 194, 75, .08); }

/* chart */
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 140px; padding-top: 12px; }
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; gap: 3px; align-items: flex-end; height: 96px; width: 100%; justify-content: center; }
.chart-bar-ok { width: 12px; background: linear-gradient(180deg, var(--green), rgba(53,208,127,.35)); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-bar-fail { width: 12px; background: linear-gradient(180deg, var(--red), rgba(255,93,108,.35)); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-lbl { font-size: 11px; color: var(--muted); }

/* bulk bar */
.bulk-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(124,92,255,.4);
  background: rgba(124,92,255,.08);
  border-radius: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.bulk-bar.active { display: flex; }

/* misc */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.right { margin-inline-start: auto; }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secret {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  background: #0a0b0e;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  word-break: break-all;
  color: var(--accent-2);
  direction: ltr;
  text-align: left;
}
details { border-top: 1px solid var(--line); }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 8px 0; }
details[open] summary { color: var(--text); }
pre {
  background: #0a0b0e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
  direction: ltr;
  text-align: left;
}
hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* auth page */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(760px 360px at 50% -10%, rgba(124, 92, 255, .22), transparent 70%),
    radial-gradient(500px 260px at 80% 100%, rgba(126, 224, 255, .08), transparent 70%),
    #07080b;
}
.auth-card {
  width: 100%;
  max-width: 430px;
  background: linear-gradient(180deg, rgba(19, 22, 30, .96), rgba(13, 15, 21, .96));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 700; font-size: 19px; }
.auth-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; line-height: 1.55; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 58px; }
.pw-eye {
  position: absolute;
  top: 50%;
  inset-inline-end: 6px;
  transform: translateY(-50%);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11.5px;
  cursor: pointer;
}
.pw-eye:hover { color: var(--text); background: rgba(255,255,255,.08); transform: translateY(-50%); }
.pw-meter { height: 4px; border-radius: 99px; background: #1c202c; overflow: hidden; margin-top: 7px; }
.pw-meter > i { display: block; height: 100%; width: 0%; transition: width .2s ease, background .2s ease; }
.pw-meter-lbl { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .sidebar .nav, .sidebar .sidebar-foot { display: none; }
  .sidebar.open .nav, .sidebar.open .sidebar-foot { display: flex; flex-direction: column; }
  .sidebar.open .sidebar-foot { display: block; }
}

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.countdown { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--accent-2); font-weight: 600; }
.countdown.expired { color: var(--red); }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .row { flex-direction: column; }
}
