:root {
  color-scheme: light;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #eff6ff;
  --ink: #142033;
  --muted: #64748b;
  --line: #e5eaf2;
  --surface: #ffffff;
  --canvas: #f2f5fa;
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --sidebar: #0b1424;
  --radius: 10px;
  --shadow: 0 6px 22px rgba(15, 23, 42, .055);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font: 14px/1.55 Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }

/* Login */
.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--brand) 17%, transparent), transparent 32%),
    radial-gradient(circle at 90% 80%, rgba(14, 165, 233, .14), transparent 30%),
    #f6f9fe;
}
.login-card {
  width: min(430px, 100%);
  padding: 38px;
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 24px 70px rgba(30, 64, 175, .13);
}
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 13px;
  font-weight: 800;
  font-size: 20px;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 48%, #06b6d4));
  box-shadow: 0 10px 25px color-mix(in srgb, var(--brand) 30%, transparent);
}
.brand-mark.brand-logo { padding: 5px; overflow: hidden; background: #fff; border: 1px solid rgba(255,255,255,.28); }
.brand-mark.brand-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }
.login-card h1 { margin: 20px 0 5px; font-size: 25px; }
.login-product { margin-top: 6px; color: var(--brand); font-weight: 650; }
.login-card > p { margin: 5px 0 25px; color: var(--muted); }
.login-card footer { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px; }

/* App shell */
.app-shell { min-height: 100%; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 14px 16px;
  color: #cbd5e1;
  background: var(--sidebar);
  z-index: 30;
  transition: transform .2s ease;
}
.sidebar > nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 3px 18px 0; scrollbar-width: thin; scrollbar-color: #35445d transparent; }
.sidebar-footer { flex: 0 0 auto; margin: 0 8px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.08); color: #687992; font-size: 11px; }
.sidebar-footer small { display: block; margin-top: 3px; color: #8c9ab0; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 21px; color: #fff; }
.sidebar-brand .brand-mark { width: 38px; height: 38px; border-radius: 10px; font-size: 16px; }
.sidebar-brand strong { display: block; font-size: 16px; }
.sidebar-brand > div:last-child { min-width: 0; }
.sidebar-brand strong, .sidebar-brand small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-brand small { display: block; max-width: 160px; color: #8290a6; }
.nav-title { margin: 19px 10px 7px; color: #65738a; font-size: 11px; letter-spacing: .08em; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 8px;
  color: #aebbd0;
  transition: .15s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: var(--brand); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 28%, transparent); }
.nav-icon { width: 20px; text-align: center; font-size: 15px; }
.app-main { grid-column: 2; min-width: 0; }
.topbar {
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(12px);
}
.topbar-left, .topbar-user, .row-actions, .inline, .pagination { display: flex; align-items: center; gap: 10px; }
.row-actions { flex-wrap: wrap; min-width: 185px; }
.global-announcement { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 26px; color: #76510b; border-bottom: 1px solid #fde6a8; background: linear-gradient(90deg, #fff9e9, #fffdf8); }
.global-announcement span { flex: 0 0 auto; padding: 2px 7px; color: #fff; border-radius: 99px; background: #d79717; font-size: 11px; font-weight: 700; }
.global-announcement p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.impersonation-banner { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 7px 20px; color: #7c2d12; border-bottom: 1px solid #fdba74; background: #fff7ed; }
.impersonation-banner strong { white-space: nowrap; }
.impersonation-banner span { font-size: 12px; }
.impersonation-banner .btn { margin-left: auto; background: #9a3412; }
.menu-button { display: none; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: #334155; }
.page { padding: 25px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 3px; font-size: 23px; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); }

/* Common cards and dashboard */
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card { transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.card:hover { border-color: color-mix(in srgb, var(--brand) 20%, var(--line)); box-shadow: 0 14px 38px rgba(15, 23, 42, .09); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 16px; }
.card-body { padding: 19px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.stat-card { padding: 19px; position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.stat-card.tone-cyan::after { background: #0891b2; }
.stat-card.tone-green::after { background: #059669; }
.stat-card.tone-orange::after { background: #d97706; }
.stat-label { color: var(--muted); margin-bottom: 9px; }
.stat-value { font-size: 25px; line-height: 1.2; font-weight: 750; letter-spacing: -.025em; }
.stat-hint { margin-top: 8px; color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; }
.metric-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); }
.metric-item { padding: 17px 19px; background: #fff; }
.metric-item strong { display: block; margin-top: 3px; font-size: 18px; }
.progress { height: 8px; overflow: hidden; background: #eaf0f8; border-radius: 999px; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 40%, #06b6d4)); }
.dashboard-meta { display: flex; flex-wrap: wrap; gap: 16px; margin: -8px 0 14px; color: var(--muted); font-size: 12px; }
.live-dot::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.12); }
.ops-health { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.health-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.health-item span { color: var(--muted); }
.health-item strong { font-size: 16px; }
.health-item.success strong { color: var(--success); }
.health-item.danger { border-color: #fecaca; background: #fff7f7; }
.health-item.danger strong { color: var(--danger); }
.success-rate-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 24px; padding: 22px; }
.success-rate-grid span { color: var(--muted); }
.success-rate-grid strong { display: block; margin: 5px 0 10px; font-size: 28px; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.text-link { padding: 0; border: 0; color: var(--brand); background: none; font-weight: 650; }

/* Forms */
.field { display: grid; gap: 6px; }
.field label, .field-label { font-size: 13px; color: #475569; font-weight: 600; }
.field input, .field select, .field textarea, .control {
  width: 100%;
  min-height: 39px;
  padding: 8px 11px;
  color: var(--ink);
  border: 1px solid #d7deea;
  border-radius: 8px;
  outline: none;
  background: #fff;
  transition: .15s ease;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .control:focus { border-color: #6b9df6; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.field small { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)) auto; align-items: end; gap: 10px; padding: 15px; border-bottom: 1px solid var(--line); }
.filters .field label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.input-group { display: flex; }
.input-group .control { border-radius: 8px 0 0 8px; }
.input-group .btn { border-radius: 0 8px 8px 0; }

/* Buttons */
.btn {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 600;
  white-space: nowrap;
  transition: .15s ease;
}
.btn:hover { background: var(--brand-strong); transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.secondary { color: #334155; background: #fff; border-color: #d8e0eb; }
.btn.secondary:hover { color: var(--brand); border-color: #93b4ee; background: #f8fbff; }
.btn.danger { background: var(--danger); }
.btn.warning { background: var(--warning); }
.btn.success { background: var(--success); }
.btn.small { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.btn.ghost { color: var(--muted); background: transparent; border-color: transparent; }
.icon-btn { width: 36px; min-width: 36px; padding: 0; }

/* Tables */
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: #526174; background: #f8fafc; font-size: 12px; font-weight: 700; white-space: nowrap; }
tbody tr:hover { background: #fafcff; }
td { color: #263449; }
.cell-main { display: block; font-weight: 600; }
.cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.money { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; color: #475569; background: #eef2f7; font-size: 12px; white-space: nowrap; }
.badge.success { color: #047857; background: #dff7ed; }
.badge.danger { color: #b91c1c; background: #fee8e8; }
.badge.warning { color: #b45309; background: #fff2d8; }
.badge.info { color: #1d4ed8; background: #e7efff; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; }
.pagination .btn { min-width: 34px; padding: 4px 8px; }
.copy-inline { margin-top: 3px; padding: 0; border: 0; color: var(--brand); background: transparent; font-size: 11px; }
.compact-actions { min-width: 220px; flex-wrap: nowrap; }
.action-panel-trigger span { min-width: 19px; height: 19px; display: inline-grid; place-items: center; margin-left: 4px; padding: 0 5px; border-radius: 99px; color: var(--brand); background: var(--brand-soft); font-size: 10px; }
.action-panel { display: grid; gap: 18px; }
.action-panel-summary { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid #cfe0fa; border-radius: 11px; background: #f6f9ff; }
.action-panel-summary span,.action-panel-summary small { color: var(--muted); font-size: 12px; }
.action-panel-summary strong { color: #182942; font-size: 16px; }
.action-panel-group { display: grid; gap: 9px; }
.action-panel-group h4 { margin: 0; color: #526174; font-size: 12px; }
.action-panel-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.action-panel-item { position: relative; min-height: 62px; display: grid; gap: 3px; padding: 11px 38px 11px 13px; border: 1px solid var(--line); border-radius: 11px; text-align: left; color: #263449; background: #fff; cursor: pointer; transition: border-color .15s,box-shadow .15s,transform .15s; }
.action-panel-item:hover { border-color: #93b4ee; box-shadow: 0 8px 22px rgba(27,72,130,.1); transform: translateY(-1px); }
.action-panel-item span { font-weight: 700; }
.action-panel-item small { color: var(--muted); font-size: 11px; }
.action-panel-item b { position: absolute; right: 14px; top: 50%; color: #94a3b8; font-size: 21px; transform: translateY(-50%); }
.action-panel-item.warning { color: #92400e; border-color: #fed7aa; background: #fffaf1; }
.action-panel-item.danger { color: #b91c1c; border-color: #fecaca; background: #fff7f7; }

/* Empty/loading */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 50%; background: #f1f5f9; font-size: 20px; }
.skeleton { border-radius: 6px; color: transparent !important; background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 20px; height: 20px; display: inline-block; border: 2px solid #dbe5f4; border-top-color: var(--brand); border-radius: 50%; animation: spin .65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal, toast, drawer */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(15,23,42,.48); backdrop-filter: blur(3px); }
.modal-open { overflow: hidden; }
.modal { width: min(650px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 30px 90px rgba(15,23,42,.25); }
.modal-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px; }
.modal-foot { flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 9px; padding: 15px 20px; border-top: 1px solid var(--line); background: #fafcff; }
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 200; display: grid; gap: 10px; }
.toast { width: min(360px, calc(100vw - 36px)); padding: 12px 15px; color: #fff; border-radius: 9px; background: #1e293b; box-shadow: 0 12px 35px rgba(15,23,42,.24); animation: toast-in .18s ease-out; }
.toast.success { background: #047857; }
.toast.error { background: #b91c1c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
.mobile-overlay { display: none; }

/* Details and API docs */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--line); }
.detail-item { min-height: 62px; padding: 11px 13px; background: #fff; }
.detail-item .label { display: block; color: var(--muted); font-size: 12px; }
.detail-item .value { display: block; margin-top: 3px; font-weight: 600; word-break: break-all; }
.code-block { overflow: auto; padding: 15px; color: #dbeafe; border-radius: 9px; background: #111827; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
.notice { padding: 12px 14px; border: 1px solid #bfdbfe; border-radius: 9px; color: #1e40af; background: #eff6ff; }
.notice.warning { color: #92400e; border-color: #fed7aa; background: #fff7ed; }
.integration-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.integration-info { max-height: 58vh; overflow: auto; margin: 0; padding: 18px; color: #dbeafe; border-radius: 9px; background: #0b1220; font: 13px/1.8 ui-monospace,SFMono-Regular,Menlo,monospace; white-space: pre-wrap; word-break: break-all; }
.permission-matrix { display: grid; gap: 12px; margin-top: 18px; }
.permission-matrix section { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; }
.permission-group-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 13px; background: #f7f9fc; }
.permission-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1px; background: var(--line); }
.permission-options label { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 3px 9px; padding: 12px; background: #fff; cursor: pointer; }
.permission-options label:hover { background: #f8fbff; }
.permission-options input { grid-row: 1 / span 2; margin-top: 3px; accent-color: var(--brand); }
.permission-options span { font-weight: 650; }
.permission-options small { color: var(--muted); font: 10px/1.35 ui-monospace,SFMono-Regular,Menlo,monospace; word-break: break-all; }
.report-filter { margin-bottom: 14px; }
.report-filter .filters { border: 0; }
.report-summary { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.report-summary > div { padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.report-summary span { display: block; color: var(--muted); font-size: 12px; }
.report-summary strong { display: block; margin-top: 5px; font-size: 18px; }
.report-summary .primary { color: #fff; border-color: var(--brand); background: linear-gradient(135deg,var(--brand),#0f4db8); }
.report-summary .primary span { color: #dbeafe; }
.settings-layout { display: grid; gap: 18px; }
.settings-section .card-head { align-items: flex-start; }
.settings-section .card-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.settings-section .card-body { padding: 22px; }
.upload-panel { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 18px; padding: 15px; border: 1px dashed #cbd5e1; border-radius: 11px; background: #f8fafc; }
.image-preview { width: 110px; height: 74px; display: grid; place-items: center; overflow: hidden; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.image-preview img { width: 100%; height: 100%; object-fit: contain; }
.upload-copy strong { display: block; margin-bottom: 4px; }
.upload-copy input { max-width: 100%; }
.security-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.setting-color { display: flex; align-items: center; gap: 9px; }
.setting-color input[type="color"] { width: 48px; min-height: 39px; padding: 3px; }
.tabs { display: flex; gap: 4px; padding: 5px; border-radius: 9px; background: #edf2f8; }
.tab { padding: 7px 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; }
.tab.active { color: var(--brand); background: #fff; box-shadow: 0 2px 6px rgba(15,23,42,.08); }
.risk-box { padding: 14px 16px; border: 1px solid #fed7aa; border-radius: 10px; color: #8a430b; background: #fff8ed; }
.risk-box strong { display: block; margin-bottom: 4px; color: #9a3412; }
.taking-controls { display: grid; gap: 8px; min-width: 205px; }
.taking-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.taking-line > span { color: var(--muted); font-size: 12px; }
.toggle-button { min-width: 68px; }
.priority-pill { display: inline-flex; min-width: 28px; justify-content: center; padding: 2px 8px; border-radius: 99px; color: #7c3aed; background: #f2eafe; font-weight: 750; }
.dashboard-section { margin-top: 18px; }
.dashboard-kicker { color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.dashboard-value-split { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 7px; }
.dashboard-value-split small { color: var(--muted); }
.risk-list { display: grid; gap: 1px; background: var(--line); }
.risk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; background: #fff; }
.risk-row p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.metric-link { color: inherit; }
.metric-link:hover { color: var(--brand); }
.grouped-report td:first-child { font-weight: 650; }
.trend-chart { height: 235px; display: grid; grid-template-columns: repeat(7,minmax(58px,1fr)); align-items: end; gap: 13px; overflow-x: auto; padding: 20px; }
.trend-column { height: 100%; min-width: 58px; display: grid; grid-template-rows: minmax(95px,1fr) auto auto; align-items: end; gap: 5px; text-align: center; }
.trend-bars { height: 100%; display: flex; align-items: end; justify-content: center; gap: 4px; }
.trend-bars i { width: 14px; min-height: 3px; border-radius: 5px 5px 2px 2px; background: var(--brand); }
.trend-bars i.payout { background: #0891b2; }
.trend-column strong { font-size: 11px; white-space: nowrap; }
.trend-column span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.ranking-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.ranking-list { display: grid; }
.ranking-row { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ranking-row:last-child { border-bottom: 0; }
.ranking-index { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; color: var(--brand); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.ranking-row strong,.ranking-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-row small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.ranking-row b { font-size: 12px; white-space: nowrap; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filters { grid-template-columns: repeat(3, minmax(120px,1fr)); }
  .report-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .permission-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ranking-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-main { grid-column: 1; }
  .sidebar { transform: translateX(-102%); box-shadow: 18px 0 50px rgba(15,23,42,.2); }
  .sidebar.open { transform: translateX(0); }
  .mobile-overlay { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15,23,42,.4); }
  .menu-button { display: inline-grid; place-items: center; }
  .topbar { padding: 0 15px; }
  .page { padding: 17px 14px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .ops-health { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .ranking-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .login-card { padding: 28px 22px; }
  .stats-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar-user .user-copy { display: none; }
  .table-footer { align-items: flex-start; flex-direction: column; }
  .ops-health,.success-rate-grid,.report-summary,.permission-options { grid-template-columns: 1fr; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal-foot .btn { flex: 1; min-height: 44px; }
  .page-head .inline { width: 100%; flex-wrap: wrap; }
  .page-head .inline .btn { flex: 1; }
  .topbar-user #logout { padding-inline: 9px; }
  .row-actions { min-width: 150px; }
  .action-panel-grid { grid-template-columns: 1fr; }
  .impersonation-banner { align-items: flex-start; flex-wrap: wrap; justify-content: flex-start; }
  .impersonation-banner .btn { width: 100%; margin-left: 0; }
}
