:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --dark: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --yellow: #ffe800;
  --yellow-dark: #d8c400;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #f59e0b;
  --blue: #2563eb;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(255,232,0,.16), transparent 30%), var(--bg);
  color: var(--dark);
}

a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }

.admin-shell { min-height: 100vh; }
.admin-header {
  height: 74px;
  background: #111827;
  border-bottom: 3px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 14px 40px rgba(15,23,42,.22);
}
.logo-wrap { display: flex; align-items: center; gap: 12px; color: #fff; }
.logo-icon {
  width: 42px; height: 42px; border-radius: 14px;
  background: var(--yellow); color: #111827;
  display: grid; place-items: center; font-weight: 900;
}
.logo-title { font-weight: 950; font-size: 21px; font-style: italic; letter-spacing: -1px; text-transform: uppercase; }
.logo-title span { color: var(--yellow); }
.logo-sub { margin-top: 3px; font-size: 9px; color: rgba(255,255,255,.48); font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.header-actions { display:flex; align-items:center; gap:10px; }
.header-btn {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: #fff;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  display:inline-flex; align-items:center; gap:8px;
  font-size: 12px; font-weight: 900;
  cursor:pointer;
}
.header-btn.primary { background: var(--yellow); color: #111827; border-color: var(--yellow); }

.admin-main { max-width: 1440px; margin: 0 auto; padding: 28px; }
.hero {
  background: linear-gradient(135deg, #111827 0%, #1f2937 52%, #343218 100%);
  color:#fff;
  border-radius: 28px;
  padding: 26px;
  display:grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap:24px;
  box-shadow: var(--shadow);
  overflow:hidden;
  position:relative;
}
.hero::after {
  content:""; position:absolute; width:260px; height:260px; border-radius:50%;
  background: rgba(255,232,0,.14); right:-70px; top:-80px;
}
.kicker {
  display:inline-flex; align-items:center; gap:8px;
  background: rgba(255,232,0,.14);
  color: var(--yellow);
  border: 1px solid rgba(255,232,0,.26);
  padding: 7px 10px; border-radius:999px;
  font-size: 11px; font-weight: 950; text-transform: uppercase; letter-spacing: .8px;
}
.hero h1 { margin: 14px 0 8px; font-size: clamp(28px, 4vw, 46px); line-height: .98; letter-spacing:-1.7px; }
.hero p { margin: 0; color: rgba(255,255,255,.72); max-width: 720px; line-height: 1.6; font-size: 14px; }
.session-card {
  position:relative; z-index:1; min-width: 290px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px; padding: 18px;
  backdrop-filter: blur(10px);
}
.session-label { font-size:10px; color:rgba(255,255,255,.5); font-weight:900; text-transform:uppercase; letter-spacing:1px; }
.session-email { margin-top:7px; font-weight:950; word-break:break-word; }
.session-state { margin-top:12px; display:flex; align-items:center; gap:8px; font-size:12px; color:rgba(255,255,255,.7); }
.dot { width:9px; height:9px; border-radius:50%; background:var(--orange); box-shadow:0 0 0 6px rgba(245,158,11,.15); }
.dot.ok { background:var(--green); box-shadow:0 0 0 6px rgba(22,163,74,.15); }

.notice {
  margin-top:18px; background:#fff; border:1px solid var(--line); border-radius:18px;
  padding:16px; color:var(--muted); font-size:13px; display:none; box-shadow: var(--shadow);
}
.notice.show { display:block; }
.notice strong { color:var(--dark); }
.notice.error { border-color:#fecaca; background:#fff7f7; color:#991b1b; }

.summary-grid { margin-top:22px; display:grid; grid-template-columns: repeat(5, minmax(150px,1fr)); gap:14px; }
.summary-card { background:var(--card); border:1px solid var(--line); border-radius:20px; padding:18px; box-shadow: var(--shadow); }
.summary-label { color:var(--muted); font-size:11px; font-weight:950; text-transform:uppercase; letter-spacing:.8px; }
.summary-value { margin-top:8px; font-size:32px; font-weight:950; letter-spacing:-1px; }
.summary-help { margin-top:3px; color:#94a3b8; font-size:12px; }

.toolbar { margin-top:22px; background:#fff; border:1px solid var(--line); border-radius:22px; padding:16px; box-shadow: var(--shadow); display:flex; align-items:center; justify-content:space-between; gap:14px; }
.search-wrap { flex:1; position:relative; }
.search-wrap i { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:#94a3b8; }
.search-wrap input { width:100%; height:46px; border:1px solid var(--line); border-radius:14px; padding:0 14px 0 40px; outline:none; font-weight:700; }
.filters { display:flex; gap:8px; flex-wrap:wrap; }
.chip { border:1px solid var(--line); background:#f8fafc; color:#334155; height:38px; padding:0 12px; border-radius:999px; font-size:12px; font-weight:900; cursor:pointer; }
.chip.active { background:#111827; border-color:#111827; color:#fff; }

.content-grid { margin-top:22px; display:grid; grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr); gap:20px; align-items:start; }
.card { background:#fff; border:1px solid var(--line); border-radius:24px; box-shadow: var(--shadow); overflow:hidden; }
.card-head { padding:18px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:12px; }
.card-title { font-size:16px; font-weight:950; }
.card-sub { color:var(--muted); font-size:12px; margin-top:3px; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; min-width:850px; }
th { text-align:left; padding:14px 16px; color:#64748b; font-size:11px; font-weight:950; text-transform:uppercase; letter-spacing:.7px; background:#f8fafc; border-bottom:1px solid var(--line); }
td { padding:14px 16px; border-bottom:1px solid #eef2f7; vertical-align:middle; font-size:13px; }
tr.user-row { cursor:pointer; transition:.15s ease; }
tr.user-row:hover { background:#fffde8; }
tr.user-row.active { background:#fff8bd; }
.user-cell { display:flex; align-items:center; gap:12px; min-width:220px; }
.avatar, .avatar-fallback { width:42px; height:42px; border-radius:14px; object-fit:cover; flex:none; }
.avatar-fallback { display:grid; place-items:center; background:#111827; color:var(--yellow); font-weight:950; }
.user-name { font-weight:950; color:#0f172a; }
.user-email { color:#64748b; font-size:12px; margin-top:2px; }
.pill { display:inline-flex; align-items:center; gap:6px; padding:7px 10px; border-radius:999px; font-size:11px; font-weight:950; white-space:nowrap; }
.pill.good { background:#dcfce7; color:#166534; }
.pill.bad { background:#fee2e2; color:#991b1b; }
.pill.warn { background:#fef3c7; color:#92400e; }
.pill.neutral { background:#e2e8f0; color:#334155; }
.pill.blue { background:#dbeafe; color:#1d4ed8; }

.detail-empty { padding:36px 20px; color:#64748b; text-align:center; font-weight:800; }
.detail-body { padding:18px; }
.detail-profile { display:flex; align-items:center; gap:14px; padding-bottom:16px; border-bottom:1px solid var(--line); }
.detail-avatar, .detail-avatar-fallback { width:72px; height:72px; border-radius:22px; object-fit:cover; }
.detail-avatar-fallback { display:grid; place-items:center; background:#111827; color:var(--yellow); font-size:28px; font-weight:950; }
.detail-name { font-size:22px; font-weight:950; letter-spacing:-.6px; }
.detail-mail { color:var(--muted); font-size:13px; margin-top:3px; }
.stage-list { margin-top:16px; display:grid; gap:9px; }
.stage { display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:14px; background:#f8fafc; border:1px solid var(--line); font-size:13px; font-weight:850; }
.stage i { width:20px; }
.stage.done { background:#ecfdf5; border-color:#bbf7d0; color:#166534; }
.stage.todo { background:#fff7ed; border-color:#fed7aa; color:#9a3412; }
.info-grid { margin-top:16px; display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.info { border:1px solid var(--line); border-radius:16px; padding:12px; background:#fff; }
.info-label { color:#94a3b8; font-size:10px; font-weight:950; text-transform:uppercase; letter-spacing:.8px; }
.info-value { margin-top:5px; font-size:13px; font-weight:850; color:#0f172a; word-break:break-word; }
.action-grid { margin-top:16px; display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.action-btn { height:44px; border:0; border-radius:14px; background:#111827; color:#fff; font-weight:950; cursor:pointer; }
.action-btn.yellow { background:var(--yellow); color:#111827; }
.usage-list { margin-top:16px; border-top:1px solid var(--line); padding-top:14px; }
.usage-item { display:flex; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px dashed #e2e8f0; font-size:13px; }
.usage-date { color:#334155; font-weight:900; }
.usage-count { color:#0f172a; font-weight:950; }

.loading { display:inline-flex; align-items:center; gap:8px; }
.spinner { width:15px; height:15px; border:2px solid rgba(255,255,255,.3); border-top-color:#fff; border-radius:50%; animation:spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1020px) {
  .hero, .content-grid { grid-template-columns:1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .toolbar { flex-direction:column; align-items:stretch; }
  .admin-header { padding:0 14px; }
  .logo-sub { display:none; }
}
@media (max-width: 620px) {
  .admin-main { padding:16px; }
  .hero { padding:20px; border-radius:22px; }
  .summary-grid, .info-grid, .action-grid { grid-template-columns:1fr; }
  .header-btn span { display:none; }
}
