:root {
  color-scheme: light;
  --ink: #101828;
  --muted: #667085;
  --subtle: #98a2b3;
  --surface: #ffffff;
  --canvas: #f5f6fa;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #5146e5;
  --accent-dark: #352ca8;
  --accent-soft: #eeecff;
  --green: #079455;
  --green-soft: #ecfdf3;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --red: #d92d20;
  --red-soft: #fef3f2;
  --blue: #175cd3;
  --blue-soft: #eff8ff;
  --shadow: 0 16px 40px rgba(16, 24, 40, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(420px, .85fr); }
.auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 5vw, 72px);
  color: white;
  background:
    radial-gradient(circle at 78% 22%, rgba(139, 128, 255, .7), transparent 28%),
    radial-gradient(circle at 10% 85%, rgba(53, 44, 168, .55), transparent 32%),
    #171442;
}
.auth-visual::after {
  content: "";
  position: absolute;
  inset: 18% -16% auto auto;
  width: min(52vw, 720px);
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  box-shadow: 0 0 0 72px rgba(255,255,255,.035), 0 0 0 144px rgba(255,255,255,.025);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 780; letter-spacing: -.5px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: var(--accent); font-size: 20px; }
.brand-on-dark .brand-mark { color: #27205c; background: white; }
.auth-copy, .security-note, .brand { position: relative; z-index: 1; }
.auth-copy { max-width: 620px; }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 760; letter-spacing: .13em; }
.eyebrow.accent { color: var(--accent); }
.auth-copy h1 { margin: 0; max-width: 640px; font-size: clamp(42px, 5vw, 72px); line-height: 1.02; letter-spacing: -.055em; }
.auth-copy > p:last-child { max-width: 530px; margin: 28px 0 0; color: rgba(255,255,255,.72); font-size: 18px; line-height: 1.65; }
.security-note { display: flex; align-items: center; gap: 12px; max-width: 480px; padding: 14px 18px; border: 1px solid rgba(255,255,255,.15); border-radius: 16px; background: rgba(255,255,255,.07); backdrop-filter: blur(12px); }
.security-note span { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.16); }
.security-note p { margin: 0; color: rgba(255,255,255,.82); font-size: 14px; line-height: 1.5; }
.auth-form-wrap { display: grid; place-items: center; padding: 36px; background: white; }
.auth-form { width: min(100%, 420px); }
.mobile-brand { display: none; margin-bottom: 52px; }
.auth-form h2 { margin: 0 0 8px; font-size: 40px; letter-spacing: -.04em; }
.muted { color: var(--muted); }
.auth-form > .muted { margin: 0 0 32px; line-height: 1.6; }
label { display: block; margin: 18px 0 8px; color: #344054; font-size: 14px; font-weight: 680; }
input, select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: white;
  transition: border .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-error { margin: 16px 0 0; padding: 12px 14px; color: #b42318; background: var(--red-soft); border-radius: 10px; font-size: 14px; line-height: 1.5; }
.form-success { margin: 16px 0 0; padding: 12px 14px; color: #027a48; background: var(--green-soft); border-radius: 10px; font-size: 14px; line-height: 1.5; }
.forgot-link { display: block; min-height: 44px; margin: 4px 0 -8px auto; padding: 0; color: var(--accent); border: 0; background: transparent; font-size: 13px; font-weight: 720; }
.forgot-link:hover, .auth-switch:hover { color: var(--accent-dark); text-decoration: underline; }
.auth-switch { display: block; min-height: 44px; margin: 14px auto 0; padding: 0 12px; color: var(--muted); border: 0; background: transparent; font-size: 13px; font-weight: 680; }
.button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 11px; font-weight: 700; }
.button-primary { color: white; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-large { width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; margin-top: 26px; padding: 0 20px; }
.button-secondary { color: #344054; background: white; border: 1px solid var(--line-strong); }
.button-danger { color: var(--red); background: var(--red-soft); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.legal-copy { margin: 22px 12px 0; color: var(--subtle); font-size: 12px; line-height: 1.55; text-align: center; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #d5d1ff; background: #18163d; z-index: 20; }
.sidebar-brand { padding: 0 10px 32px; color: white; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 13px; color: #b9b6d7; background: transparent; border: 0; border-radius: 12px; text-align: left; font-weight: 620; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: rgba(117, 105, 255, .24); box-shadow: inset 3px 0 0 #857aff; }
.nav-icon { display: grid; place-items: center; width: 22px; font-size: 19px; }
.sidebar-footer { margin-top: auto; }
.privacy-chip { display: flex; gap: 9px; align-items: center; margin: 0 8px 12px; padding: 12px; color: #aaa6cb; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; line-height: 1.4; }
.privacy-chip span { flex: 0 0 7px; height: 7px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgba(50,213,131,.12); }
.logout { color: #aaa6cb; }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 92px; display: flex; align-items: center; gap: 18px; padding: 18px clamp(20px, 3vw, 44px); border-bottom: 1px solid var(--line); background: rgba(245,246,250,.92); backdrop-filter: blur(14px); }
.topbar h1 { margin: 0; font-size: 25px; letter-spacing: -.035em; }
.topbar .eyebrow { margin-bottom: 4px; font-size: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.icon-button { min-width: 44px; height: 44px; padding: 0; color: #475467; border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 20px; }
.icon-button:hover { color: var(--accent); border-color: #c7c2ff; }
.menu-button { display: none; }
.admin-profile { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; color: white; border-radius: 12px; background: linear-gradient(145deg, #766cff, #4036c8); font-weight: 780; }
.profile-copy { display: grid; max-width: 190px; }
.profile-copy strong, .profile-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy strong { font-size: 13px; }
.profile-copy small { color: var(--muted); font-size: 11px; }
.content { padding: 30px clamp(20px, 3vw, 44px) 64px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.section-head h2 { margin: 0 0 5px; font-size: 22px; letter-spacing: -.03em; }
.section-head p { margin: 0; color: var(--muted); font-size: 14px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-input { width: min(320px, 70vw); }
.toolbar select { width: auto; min-width: 150px; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card, .panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,40,.025); }
.metric-card { min-height: 148px; display: flex; flex-direction: column; justify-content: space-between; padding: 19px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; color: var(--accent); border-radius: 10px; background: var(--accent-soft); font-weight: 800; }
.metric-value { margin: 14px 0 2px; font-size: 32px; line-height: 1; letter-spacing: -.045em; }
.metric-note { color: var(--muted); font-size: 12px; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; }
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-header h3 { margin: 0; font-size: 16px; }
.panel-body { padding: 20px 22px; }
.status-list { display: grid; gap: 14px; }
.status-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 12px; font-size: 13px; }
.progress { width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: 99px; background: #eef0f4; }
.progress::-webkit-progress-bar { border-radius: 99px; background: #eef0f4; }
.progress::-webkit-progress-value { border-radius: 99px; background: var(--accent); }
.progress::-moz-progress-bar { border-radius: 99px; background: var(--accent); }
.plan-stack { display: grid; gap: 12px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: #f8f8fc; }
.plan-row strong { font-size: 22px; }
.plan-row span { color: var(--muted); font-size: 13px; text-transform: capitalize; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); background: #fcfcfd; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.person { display: flex; align-items: center; gap: 10px; }
.person-avatar { display: grid; place-items: center; flex: 0 0 34px; height: 34px; color: var(--accent); border-radius: 10px; background: var(--accent-soft); font-weight: 780; }
.person-copy { display: grid; }
.person-copy small { color: var(--muted); margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 0 9px; border-radius: 99px; color: #475467; background: #f2f4f7; font-size: 11px; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #98a2b3; }
.badge.success { color: var(--green); background: var(--green-soft); }
.badge.success::before { background: #12b76a; }
.badge.warning { color: var(--amber); background: var(--amber-soft); }
.badge.warning::before { background: #f79009; }
.badge.danger { color: var(--red); background: var(--red-soft); }
.badge.danger::before { background: var(--red); }
.badge.info { color: var(--blue); background: var(--blue-soft); }
.badge.info::before { background: #2e90fa; }
.text-button { min-height: 34px; padding: 0 10px; color: var(--accent); border: 0; border-radius: 8px; background: transparent; font-weight: 700; }
.text-button:hover { background: var(--accent-soft); }
.error-text { max-width: 340px; overflow: hidden; color: var(--red); text-overflow: ellipsis; }
.empty-state { display: grid; place-items: center; min-height: 260px; padding: 42px; text-align: center; }
.empty-state span { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 14px; color: var(--accent); border-radius: 16px; background: var(--accent-soft); font-size: 23px; }
.empty-state h3 { margin: 0 0 7px; }
.empty-state p { max-width: 420px; margin: 0; color: var(--muted); line-height: 1.55; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination-controls { display: flex; gap: 8px; }
.system-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.system-card { padding: 22px; }
.system-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.system-title h3 { margin: 0; font-size: 16px; }
.kv-list { display: grid; gap: 12px; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 13px; }
.kv strong { color: var(--ink); font-weight: 680; text-align: right; }
.notice { padding: 14px 16px; color: #344054; border: 1px solid #d6d2ff; border-radius: 12px; background: #f7f5ff; font-size: 13px; line-height: 1.55; }

.loading-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px; background: rgba(247,248,252,.86); backdrop-filter: blur(5px); }
.loader-mark { display: grid; place-items: center; width: 54px; height: 54px; color: white; border-radius: 17px; background: var(--accent); font-size: 27px; font-weight: 820; animation: loaderPulse 1.2s ease-in-out infinite; }
.loading-layer p { margin: 0; color: var(--muted); font-size: 13px; }
@keyframes loaderPulse { 50% { transform: translateY(-5px); box-shadow: 0 16px 28px rgba(81,70,229,.25); } }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 120; max-width: 380px; padding: 14px 18px; color: white; border-radius: 12px; background: #101828; box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: #b42318; }
.detail-dialog { width: min(680px, calc(100vw - 30px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 28px 80px rgba(16,24,40,.22); }
.detail-dialog::backdrop { background: rgba(16,24,40,.48); backdrop-filter: blur(3px); }
.dialog-header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); background: white; }
.dialog-header h2 { margin: 0; font-size: 22px; }
.dialog-content { padding: 24px; }
.detail-section { margin-bottom: 24px; }
.detail-section h3 { margin: 0 0 12px; font-size: 14px; }
.detail-section .kv { padding: 9px 0; border-bottom: 1px solid #f0f1f4; }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 15; border: 0; background: rgba(16,24,40,.46); }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form-wrap { min-height: 100vh; padding: 28px; }
  .mobile-brand { display: flex; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: 270px; transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; }
  .grid-two { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { min-height: 78px; padding: 14px 16px; }
  .topbar .eyebrow, .profile-copy { display: none; }
  .topbar h1 { font-size: 21px; }
  .admin-profile { padding: 0; }
  .content { padding: 22px 14px 50px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .toolbar, .toolbar input, .toolbar select { width: 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .metric-card { min-height: 132px; padding: 15px; }
  .metric-value { font-size: 27px; }
  .system-grid { grid-template-columns: 1fr; }
  .panel-header, .panel-body { padding: 17px; }
  th, td { padding: 13px 14px; }
  .toast { right: 14px; bottom: 14px; left: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
