:root {
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  color: #20263a;
  background: #f5f7fb;
  font-synthesis: none;
  --primary: #5578f6;
  --primary-strong: #4164e7;
  --primary-soft: #edf2ff;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f8faff;
  --canvas: #f5f7fb;
  --text: #20263a;
  --text-soft: #667085;
  --text-faint: #98a2b3;
  --line: #e7eaf1;
  --line-strong: #d9deea;
  --green: #12a678;
  --green-soft: #e9f9f3;
  --red: #e25563;
  --red-soft: #fff0f1;
  --amber: #e59a29;
  --amber-soft: #fff7e8;
  --violet: #7b61e8;
  --violet-soft: #f2efff;
  --cyan: #159eb3;
  --cyan-soft: #e9f9fb;
  --shadow-sm: 0 1px 2px rgba(24, 34, 58, .035), 0 4px 12px rgba(24, 34, 58, .025);
  --shadow-md: 0 12px 35px rgba(40, 55, 92, .08);
  --sidebar-width: 236px;
  --topbar-height: 68px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--canvas); }
a { color: inherit; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, label:focus-visible {
  outline: 3px solid rgba(85, 120, 246, .22);
  outline-offset: 2px;
}

/* Shared brand */
.brand, .auth-brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark { position: relative; display: grid; place-items: center; width: 34px; height: 38px; flex: 0 0 34px; border-radius: 10px 10px 13px 13px; background: linear-gradient(150deg, #142b50, #0c1730); box-shadow: 0 8px 20px rgba(22, 43, 82, .18); clip-path: polygon(50% 0, 94% 18%, 88% 73%, 50% 100%, 12% 73%, 6% 18%); }
.brand-mark::before { content: ""; width: 20px; height: 24px; border: 2px solid rgba(104, 211, 236, .78); border-radius: 7px 7px 9px 9px; clip-path: inherit; }
.brand-mark span { position: absolute; width: 8px; height: 8px; border: 2px solid #78d7ec; border-radius: 50%; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.brand-copy small { display: block; margin-top: 1px; color: var(--text-faint); font-size: 10px; letter-spacing: .04em; }

/* App shell */
.nav-control { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 18px 14px 14px; background: var(--sidebar); border-right: 1px solid var(--line); }
.sidebar .brand { padding: 0 10px 21px; border-bottom: 1px solid var(--line); }
.side-nav { display: flex; flex: 1; flex-direction: column; gap: 4px; padding-top: 14px; overflow-y: auto; }
.nav-section { padding: 17px 12px 7px; color: #a4abba; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-item { position: relative; display: flex; align-items: center; min-height: 42px; gap: 12px; padding: 9px 12px; border-radius: 8px; color: #596278; font-size: 13px; font-weight: 600; text-decoration: none; transition: color .16s ease, background .16s ease, transform .16s ease; }
.nav-item:hover { color: var(--primary); background: #f6f8ff; transform: translateX(2px); }
.nav-item.active { color: var(--primary-strong); background: var(--primary-soft); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; width: 3px; height: 24px; border-radius: 0 4px 4px 0; background: var(--primary); }
.nav-icon { display: grid; place-items: center; width: 22px; height: 22px; color: currentColor; font-size: 18px; font-weight: 400; }
.sidebar-footer { padding: 14px 4px 0; border-top: 1px solid var(--line); }
.admin-profile { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 5px 7px 12px; }
.admin-profile > span:last-child { min-width: 0; }
.admin-profile strong { display: block; overflow: hidden; max-width: 132px; color: #3c455c; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-profile small { display: block; margin-top: 2px; color: var(--text-faint); font-size: 10px; }
.avatar, .top-avatar, .table-avatar, .mini-avatar, .activity-avatar, .profile-avatar { display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, #637ff2, #89a1fb); color: #fff; font-weight: 700; }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; font-size: 12px; }
.logout-button { display: flex; justify-content: space-between; width: 100%; padding: 9px 11px; border: 0; border-radius: 8px; background: transparent; color: #7b8498; cursor: pointer; font-size: 12px; }
.logout-button:hover { color: var(--red); background: var(--red-soft); }
.app-frame { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; height: var(--topbar-height); padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); }
.topbar-left, .topbar-actions { display: flex; align-items: center; }
.topbar-left { gap: 13px; }
.topbar-left strong { display: block; color: #30384c; font-size: 14px; }
.topbar-left small { display: block; margin-top: 2px; color: var(--text-faint); font-size: 10px; }
.topbar-actions { gap: 11px; }
.service-state { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #dff1eb; border-radius: 999px; background: #f4fbf8; color: #46836e; font-size: 11px; }
.service-state i, .status-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.topbar-link { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: #788196; text-decoration: none; }
.topbar-link:hover { color: var(--primary); border-color: #cfd8fa; background: var(--primary-soft); }
.top-avatar { width: 34px; height: 34px; font-size: 12px; }
.menu-button { display: none; width: 36px; height: 36px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.menu-button span { display: block; height: 2px; margin: 3px 0; border-radius: 2px; background: #687185; }
.content-shell { width: min(1560px, 100%); min-height: calc(100vh - var(--topbar-height) - 48px); margin: 0 auto; padding: 26px 30px 40px; }
.app-footer { padding: 0 30px 25px; color: #a0a7b5; font-size: 10px; text-align: center; }
.nav-overlay { display: none; }

/* Page framing */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.page-header h1, .profile-title h1 { margin: 2px 0 5px; color: #252c3f; font-size: clamp(22px, 2vw, 30px); line-height: 1.15; letter-spacing: -.035em; }
.page-header p, .profile-header p { margin: 0; color: var(--text-soft); font-size: 12px; line-height: 1.6; }
.page-kicker { color: var(--primary); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.header-actions { display: flex; gap: 9px; }
.button, button { min-height: 36px; padding: 9px 15px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-weight: 650; font-size: 12px; text-align: center; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease; }
.button:hover, button:hover { transform: translateY(-1px); }
.primary { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: 0 7px 16px rgba(85, 120, 246, .18); }
.primary:hover { background: var(--primary-strong); box-shadow: 0 9px 22px rgba(85, 120, 246, .25); }
.secondary { color: #4e5870; border-color: var(--line-strong); background: #fff; }
.secondary:hover { color: var(--primary); border-color: #bfcaf5; background: #fafbff; }
.ghost { color: #8a93a6; border-color: transparent; background: transparent; box-shadow: none; }
.danger { color: #fff; border-color: var(--red); background: var(--red); box-shadow: 0 7px 16px rgba(226, 85, 99, .14); }
.ghost-danger { color: var(--red); border-color: #f4c6cc; background: var(--red-soft); box-shadow: none; }
.full { width: 100%; }
.panel { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 20px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; color: #343c50; font-size: 14px; }
.panel-header p { margin: 4px 0 0; color: var(--text-faint); font-size: 10px; }
.panel-header > a { color: var(--primary); font-size: 11px; font-weight: 650; text-decoration: none; }
.panel-header > a span { margin-left: 4px; }
.notice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; padding: 11px 14px; border: 1px solid; border-radius: 8px; font-size: 12px; line-height: 1.5; }
.notice > span { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; font-size: 10px; font-weight: 800; }
.notice.success { color: #267b5e; border-color: #cdeee2; background: #f0fbf7; }
.notice.success > span { color: #fff; background: var(--green); }
.notice.error { color: #ad4351; border-color: #f4d2d6; background: #fff5f6; }
.notice.error > span { color: #fff; background: var(--red); }

/* Dashboard */
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric-card { display: flex; align-items: flex-start; justify-content: space-between; min-height: 118px; padding: 18px 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card span, .metric-card small { display: block; color: var(--text-soft); font-size: 10px; }
.metric-card strong { display: block; margin: 10px 0 6px; color: #263047; font-size: 27px; line-height: 1; letter-spacing: -.04em; }
.metric-card small { color: var(--text-faint); }
.metric-card.highlight, .cost-card { background: linear-gradient(145deg, #fff, #f7f9ff); }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px; font-style: normal; font-size: 16px; }
.metric-icon.blue { color: #4f73ee; background: #edf2ff; }
.metric-icon.violet { color: #765ce2; background: var(--violet-soft); }
.metric-icon.green { color: #0f966c; background: var(--green-soft); }
.metric-icon.amber { color: #cf8618; background: var(--amber-soft); }
.metric-icon.cyan { color: #148ca0; background: var(--cyan-soft); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: 16px; margin-bottom: 16px; }
.activity-panel, .health-panel { min-height: 325px; }
.activity-list { padding: 5px 18px 12px; }
.activity-row { display: flex; align-items: center; gap: 11px; padding: 11px 2px; border-bottom: 1px solid #eff1f5; text-decoration: none; }
.activity-row:last-child { border-bottom: 0; }
.activity-row:hover .activity-main strong { color: var(--primary); }
.activity-avatar { width: 31px; height: 31px; flex: 0 0 31px; background: #eef2ff; color: var(--primary); font-size: 11px; }
.activity-main { min-width: 0; flex: 1; }
.activity-main strong, .activity-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-main strong { color: #424a5f; font-size: 11px; }
.activity-main small { margin-top: 3px; color: var(--text-faint); font-size: 9px; }
.activity-amount { font-size: 12px; font-weight: 750; }
.health-score { display: grid; place-items: center; padding: 23px 20px 14px; }
.score-ring { display: grid; place-items: center; width: 116px; height: 116px; border: 9px solid #e9f7f2; border-top-color: var(--green); border-right-color: var(--green); border-radius: 50%; transform: rotate(22deg); }
.score-ring strong, .score-ring span { transform: rotate(-22deg); }
.score-ring strong { color: #263047; font-size: 27px; line-height: 1; }
.score-ring span { margin-top: -20px; color: var(--text-faint); font-size: 9px; }
.health-list { display: grid; gap: 0; margin: 0; padding: 0 20px 17px; list-style: none; }
.health-list li { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid #f0f2f6; color: var(--text-soft); font-size: 10px; }
.health-list li span { display: flex; align-items: center; gap: 7px; }
.health-list li strong { color: #4e586d; font-size: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.green { background: var(--green); }.dot.blue { background: var(--primary); }.dot.violet { background: var(--violet); }.dot.amber { background: var(--amber); }

/* Forms */
.form-stack { display: grid; gap: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label > span, .filter-bar label > span { color: #596278; font-size: 10px; font-weight: 650; }
input, select { width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 7px; outline: none; background: #fff; color: #30384c; font-size: 11px; transition: border-color .15s ease, box-shadow .15s ease; }
input::placeholder { color: #b1b7c4; }
input:hover, select:hover { border-color: #c5ccda; }
input:focus, select:focus { border-color: #8ca4fa; box-shadow: 0 0 0 3px rgba(85, 120, 246, .11); }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, #9aa2b2 50%), linear-gradient(135deg, #9aa2b2 50%, transparent 50%); background-position: calc(100% - 15px) 16px, calc(100% - 11px) 16px; background-repeat: no-repeat; background-size: 4px 4px, 4px 4px; }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(140px, 210px)) auto auto; align-items: end; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: #fbfcff; }
.filter-bar label { display: grid; gap: 5px; }
.filter-search { position: relative; }
.filter-search > span { position: absolute; z-index: 1; left: 11px; bottom: 10px; color: #a1a8b6; font-size: 15px !important; }
.filter-search input { padding-left: 33px; }
.create-panel { margin-bottom: 16px; border: 1px solid #dce3fa; border-radius: 10px; background: linear-gradient(145deg, #fff, #f8faff); box-shadow: var(--shadow-sm); }
.create-panel summary { display: flex; align-items: center; justify-content: space-between; min-height: 66px; padding: 14px 18px; cursor: pointer; list-style: none; }
.create-panel summary::-webkit-details-marker, .secondary-actions summary::-webkit-details-marker { display: none; }
.create-panel summary > span { display: flex; align-items: center; gap: 12px; }
.create-panel summary i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-style: normal; font-size: 18px; }
.create-panel summary strong, .create-panel summary small { display: block; }
.create-panel summary strong { color: #3a4256; font-size: 12px; }
.create-panel summary small { margin-top: 3px; color: var(--text-faint); font-size: 9px; }
.create-panel summary b { color: var(--primary); font-size: 10px; }
.create-panel[open] summary { border-bottom: 1px solid var(--line); }
.create-form { display: grid; grid-template-columns: minmax(200px, 1.4fr) .6fr 1fr 1fr auto; align-items: end; gap: 11px; padding: 17px 18px 19px; }
.create-form label { display: grid; gap: 5px; }

/* Tables */
.table-panel { overflow: hidden; }
.table-meta { display: flex; justify-content: space-between; padding: 9px 18px; color: var(--text-faint); font-size: 9px; }
.table-meta strong { color: var(--text-soft); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 880px; border-collapse: collapse; }
th, td { padding: 12px 13px; border-top: 1px solid #eef0f4; color: #5e677a; font-size: 10px; text-align: left; vertical-align: middle; }
th { height: 38px; border-top: 0; background: #fbfcfe; color: #8c94a5; font-size: 9px; font-weight: 700; white-space: nowrap; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #fafbff; }
td strong { color: #41495e; }
.identity-cell { display: flex; align-items: center; min-width: 190px; gap: 10px; }
.identity-cell.compact { min-width: 150px; }
.identity-cell > div { min-width: 0; }
.identity-cell strong, .identity-cell small { display: block; overflow: hidden; max-width: 210px; text-overflow: ellipsis; white-space: nowrap; }
.identity-cell strong { font-size: 10px; }
.identity-cell small { margin-top: 3px; color: var(--text-faint); font-size: 8px; }
.table-avatar { width: 30px; height: 30px; flex: 0 0 30px; background: #eef2ff; color: var(--primary); font-size: 10px; }
.mini-avatar { width: 24px; height: 24px; flex: 0 0 24px; background: #eef2ff; color: var(--primary); font-size: 8px; }
.identity-link { display: inline-flex; align-items: center; min-width: 170px; gap: 8px; color: #4a5368; font-weight: 650; text-decoration: none; }
.identity-link:hover { color: var(--primary); }
.numeric, .amount { font-variant-numeric: tabular-nums; font-weight: 750; }
.table-action { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border: 1px solid #d9e0fa; border-radius: 6px; color: var(--primary); background: #f8faff; font-size: 9px; font-weight: 700; text-decoration: none; }
.table-action:hover { border-color: #aebdf6; background: var(--primary-soft); }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 650; white-space: nowrap; }
.status-pill.good { color: #16825f; background: var(--green-soft); }
.status-pill.bad { color: #c34855; background: var(--red-soft); }
.status-pill.warning { color: #b97917; background: var(--amber-soft); }
.status-pill.neutral { color: #737d91; background: #f0f2f5; }
.type-pill { display: inline-flex; max-width: 150px; padding: 4px 7px; overflow: hidden; border: 1px solid #e0e5f6; border-radius: 5px; background: #f7f9ff; color: #687598; font-family: "Cascadia Code", Consolas, monospace; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.audit-type { color: #805bbd; border-color: #e4daf5; background: #faf7ff; }
.row-id { color: #9ba3b2; font-family: "Cascadia Code", Consolas, monospace; font-size: 9px; }
code { display: inline-block; max-width: 210px; overflow: hidden; color: #778197; font-family: "Cascadia Code", Consolas, monospace; font-size: 8px; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.device-code { max-width: 190px; color: #566383; }
.detail-code { max-width: 280px; }
.balance-change { color: #9aa2b2; white-space: nowrap; }
.balance-change strong { color: #4e586c; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.warning-text { color: var(--amber) !important; }
.muted-number { color: #7e879a !important; }
.empty-state { display: grid; place-items: center; min-height: 270px; padding: 35px 20px; color: var(--text-faint); text-align: center; }
.empty-state.compact { min-height: 180px; }
.empty-state strong { margin-top: 12px; color: #6f788c; font-size: 11px; }
.empty-state p { margin: 6px 0 0; font-size: 9px; }
.empty-box { position: relative; display: grid; place-items: center; width: 50px; height: 42px; border-radius: 7px; background: #f1f3f8; color: #c2c8d3; font-size: 21px; transform: rotate(-4deg); }

/* Summary bars */
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-sm); }
.summary-strip > div { position: relative; padding: 15px 18px; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span, .summary-strip strong { display: block; }
.summary-strip span { color: var(--text-faint); font-size: 9px; }
.summary-strip strong { margin-top: 6px; color: #3d465a; font-size: 18px; }
.audit-seal { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid #dce9e4; border-radius: 7px; background: #f5fbf8; color: #4b806d; font-size: 10px; font-weight: 650; }

/* User detail */
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--text-faint); font-size: 10px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.profile-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.profile-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-avatar { width: 48px; height: 48px; flex: 0 0 48px; font-size: 17px; }
.profile-title { display: flex; align-items: center; gap: 11px; }
.profile-title h1 { overflow: hidden; max-width: 580px; text-overflow: ellipsis; white-space: nowrap; }
.compact-grid { grid-template-columns: repeat(4, 1fr); }
.user-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .55fr); align-items: start; gap: 16px; }
.user-actions { display: grid; gap: 13px; }
.action-card { padding: 17px; }
.action-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.action-title > i { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; font-style: normal; font-size: 18px; }
.action-title > i.blue { color: var(--primary); background: var(--primary-soft); }
.action-title > i.red { color: var(--red); background: var(--red-soft); }
.action-title h2 { margin: 0; color: #3d455a; font-size: 12px; }
.action-title p { margin: 3px 0 0; color: var(--text-faint); font-size: 9px; }
.secondary-actions { overflow: hidden; }
.secondary-actions summary { display: flex; justify-content: space-between; padding: 15px 17px; color: #4f586d; cursor: pointer; font-size: 11px; font-weight: 650; list-style: none; }
.secondary-actions[open] summary { border-bottom: 1px solid var(--line); }
.secondary-body { padding: 16px; }
.control-buttons { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Security */
.security-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .6fr); align-items: start; gap: 16px; }
.password-panel { overflow: hidden; }
.security-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: 19px; }
.security-form { padding: 20px; }
.password-hint { display: flex; justify-content: space-between; color: var(--text-faint); font-size: 9px; }
.security-cards { display: grid; gap: 12px; }
.security-info { display: flex; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-sm); }
.security-info strong { color: #424b60; font-size: 11px; }
.security-info p { margin: 5px 0 0; color: var(--text-faint); font-size: 9px; line-height: 1.6; }
.security-badge { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 31px; border-radius: 8px; }
.security-badge.green { color: var(--green); background: var(--green-soft); }.security-badge.blue { color: var(--primary); background: var(--primary-soft); }.security-badge.violet { color: var(--violet); background: var(--violet-soft); }

/* Error */
.error-state { display: grid; place-items: center; max-width: 560px; min-height: 420px; margin: 5vh auto; padding: 45px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-md); text-align: center; }
.error-illustration { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 18px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-size: 31px; font-weight: 800; }
.error-state h1 { margin: 8px 0; font-size: 24px; }
.error-state p { max-width: 420px; margin: 0 0 22px; color: var(--text-soft); font-size: 12px; line-height: 1.7; }
.error-state > div { display: flex; gap: 9px; }

/* Auth pages */
.auth-app, .auth-shell { min-height: 100vh; background: #fff; }
.auth-split { display: grid; grid-template-columns: minmax(500px, 1.08fr) minmax(460px, .92fr); min-height: 100vh; }
.auth-visual { position: relative; display: flex; flex-direction: column; min-height: 100vh; padding: 28px 38px 30px; overflow: hidden; background: #edf2ff; }
.auth-brand { position: relative; z-index: 2; width: max-content; }
.auth-brand strong { color: #2c3549; font-size: 15px; letter-spacing: -.02em; }
.auth-illustration { position: relative; z-index: 2; width: min(600px, 84%); margin: auto; }
.auth-illustration svg { display: block; width: 100%; height: auto; }
.visual-orbit { position: absolute; border: 1px solid rgba(117, 147, 239, .16); border-radius: 50%; }
.orbit-one { top: -90px; right: -55px; width: 260px; height: 260px; }
.orbit-two { bottom: 80px; left: -80px; width: 180px; height: 180px; }
.visual-square { position: absolute; width: 28px; height: 28px; border-radius: 5px; background: rgba(119, 151, 244, .17); transform: rotate(20deg); }
.square-one { top: 29%; left: 9%; }.square-two { right: 10%; bottom: 16%; }
.visual-caption { position: relative; z-index: 2; text-align: center; }
.visual-caption strong, .visual-caption span { display: block; }
.visual-caption strong { color: #48536a; font-size: 12px; font-weight: 600; }
.visual-caption span { margin-top: 7px; color: #9aa6bd; font-size: 8px; letter-spacing: .06em; }
.auth-form-side { display: grid; place-items: center; min-height: 100vh; padding: 46px 8vw; background: #fff; }
.auth-form-card { width: min(390px, 100%); }
.auth-kicker { margin-bottom: 12px; color: var(--primary); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.auth-form-card h1 { margin: 0; color: #283044; font-size: 28px; letter-spacing: -.04em; }
.auth-form-card > p { margin: 8px 0 25px; color: #9aa2b2; font-size: 11px; }
.auth-form { display: grid; gap: 15px; }
.auth-form label { display: grid; gap: 7px; }
.auth-form label > span { color: #535c71; font-size: 10px; }
.auth-form input { min-height: 42px; }
.input-with-icon { position: relative; }
.input-with-icon i { position: absolute; left: 12px; top: 50%; z-index: 1; color: #9ca5b7; font-style: normal; font-size: 12px; transform: translateY(-50%); }
.input-with-icon input { padding-left: 35px; }
.auth-security-note { display: flex; align-items: center; gap: 7px; color: #7d879a; font-size: 9px; }
.auth-security-note > span { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 800; }
.auth-submit { display: flex; align-items: center; justify-content: center; min-height: 43px; margin-top: 2px; gap: 11px; }
.auth-submit > span { font-size: 15px; }
.auth-meta { display: flex; justify-content: space-between; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); color: #b0b6c2; font-size: 8px; }
.setup-story { position: relative; z-index: 2; width: min(520px, 82%); margin: auto; }
.setup-badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: rgba(85, 120, 246, .11); color: var(--primary); font-size: 9px; font-weight: 700; }
.setup-story h2 { max-width: 430px; margin: 18px 0 10px; color: #344057; font-size: 30px; letter-spacing: -.04em; }
.setup-story > p { max-width: 450px; margin: 0; color: #78859d; font-size: 11px; line-height: 1.8; }
.setup-steps { display: grid; gap: 17px; margin: 30px 0 0; padding: 0; list-style: none; }
.setup-steps li { display: flex; align-items: center; gap: 12px; color: #9aa5b8; }
.setup-steps li > span { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #cfd8ec; border-radius: 50%; font-size: 10px; font-weight: 700; }
.setup-steps li strong, .setup-steps li small { display: block; }
.setup-steps li strong { color: #626e84; font-size: 11px; }
.setup-steps li small { margin-top: 3px; font-size: 9px; }
.setup-steps li.done > span { color: #fff; border-color: var(--green); background: var(--green); }
.setup-steps li.current > span { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: 0 0 0 5px rgba(85, 120, 246, .1); }
.setup-steps li.current strong { color: #3c4962; }
.setup-card { width: min(470px, 100%); }

@media (max-width: 1300px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-grid .metric-card:nth-child(4), .metric-grid .metric-card:nth-child(5) { grid-column: span 1; }
  .create-form { grid-template-columns: 1.2fr .5fr 1fr 1fr; }
  .create-form button { grid-column: 4; }
}

@media (max-width: 1080px) {
  :root { --sidebar-width: 210px; }
  .content-shell { padding: 22px 20px 35px; }
  .dashboard-grid, .user-layout, .security-layout { grid-template-columns: 1fr; }
  .health-panel { min-height: auto; }
  .health-score { padding-top: 18px; }
  .health-list { grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .auth-split { grid-template-columns: 1fr 1fr; }
  .auth-visual { padding: 24px; }
  .auth-form-side { padding: 40px 6vw; }
  .filter-bar { grid-template-columns: minmax(200px, 1fr) repeat(2, minmax(120px, 180px)) auto; }
  .filter-bar .ghost { display: none; }
}

@media (max-width: 840px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 18px 0 45px rgba(30, 42, 72, .13); }
  .app-frame { margin-left: 0; }
  .menu-button { display: block; }
  .nav-overlay { position: fixed; inset: 0; z-index: 35; display: block; visibility: hidden; background: rgba(24, 31, 48, .28); opacity: 0; transition: opacity .2s ease, visibility .2s ease; }
  .nav-control:checked ~ .sidebar { transform: translateX(0); }
  .nav-control:checked ~ .nav-overlay { visibility: visible; opacity: 1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .compact-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-strip > div:nth-child(2) { border-right: 0; }
  .summary-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-search { grid-column: 1 / -1; }
  .create-form { grid-template-columns: 1fr 1fr; }
  .create-form button { grid-column: auto; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form-side { min-height: 100vh; padding: 38px 24px; background: linear-gradient(160deg, #f5f7ff 0, #fff 35%); }
}

@media (max-width: 600px) {
  .topbar { height: 60px; padding: 0 14px; }
  .topbar-left small, .service-state, .topbar-link { display: none; }
  .content-shell { padding: 18px 13px 30px; }
  .page-header, .profile-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1; }
  .metric-grid, .compact-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .form-grid, .create-form { grid-template-columns: 1fr; }
  .create-form button { width: 100%; }
  .create-panel summary b { display: none; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .filter-bar .ghost { display: block; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .health-list { grid-template-columns: 1fr; }
  .profile-title { align-items: flex-start; flex-direction: column; gap: 6px; }
  .profile-title h1 { max-width: 250px; font-size: 20px; }
  .profile-identity { align-items: flex-start; }
  .profile-avatar { width: 42px; height: 42px; flex-basis: 42px; }
  .password-hint { align-items: flex-start; flex-direction: column; gap: 4px; }
  .panel-header { padding: 15px; }
  .activity-list { padding-inline: 13px; }
  .error-state { min-height: 360px; margin: 2vh auto; padding: 28px 18px; }
  .app-footer { padding-inline: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Dual authorization: cards */
.metric-grid.six-grid { grid-template-columns: repeat(6, minmax(128px, 1fr)); }
.dashboard-identity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dashboard-identity-grid table { min-width: 620px; }
.card-avatar { background: var(--violet-soft) !important; color: var(--violet) !important; }
.card-create-form { grid-template-columns: minmax(210px, 1.4fr) .45fr .65fr .7fr auto; }
.card-facts { display: grid; grid-template-columns: repeat(4, 1fr); margin: -1px 0 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-sm); }
.card-facts > div { padding: 13px 17px; border-right: 1px solid var(--line); }
.card-facts > div:last-child { border-right: 0; }
.card-facts span, .card-facts strong { display: block; }
.card-facts span { color: var(--text-faint); font-size: 9px; }
.card-facts strong { margin-top: 5px; color: #465066; font-size: 11px; }
.field-help { display: block; margin-top: -7px; color: var(--text-faint); font-size: 9px; }
.identity-link > span:last-child strong, .identity-link > span:last-child small { display: block; }
.identity-link > span:last-child small { margin-top: 2px; color: var(--text-faint); font-size: 8px; font-weight: 500; }
.secret-warning { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; padding: 15px 17px; border: 1px solid #f1d29c; border-radius: 10px; background: var(--amber-soft); color: #855b1b; }
.secret-warning > span { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; background: var(--amber); color: #fff; font-weight: 800; }
.secret-warning strong { font-size: 12px; }
.secret-warning p { margin: 4px 0 0; font-size: 10px; line-height: 1.6; }
.created-cards-panel { overflow: hidden; }
.secret-export { display: grid; gap: 7px; padding: 17px 20px; border-bottom: 1px solid var(--line); background: #fbfcff; }
.secret-export textarea { width: 100%; min-height: 88px; resize: vertical; padding: 12px; border: 1px solid #cfd7ee; border-radius: 8px; background: #fff; color: #38445e; font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; line-height: 1.7; }
.full-card-code { max-width: none; color: #3f4f75; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.filter-bar.wide-filters { grid-template-columns: minmax(210px, 1fr) repeat(3, minmax(120px, 175px)) auto auto; }

@media (max-width: 1300px) {
  .metric-grid.six-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-identity-grid { grid-template-columns: 1fr; }
  .card-create-form { grid-template-columns: 1.2fr .45fr .65fr .7fr; }
  .card-create-form button { grid-column: 4; }
  .filter-bar.wide-filters { grid-template-columns: minmax(200px, 1fr) repeat(3, minmax(110px, 160px)) auto; }
  .filter-bar.wide-filters .ghost { display: none; }
}
@media (max-width: 840px) {
  .card-facts { grid-template-columns: repeat(2, 1fr); }
  .card-facts > div:nth-child(2) { border-right: 0; }
  .card-facts > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .filter-bar.wide-filters { grid-template-columns: 1fr 1fr; }
  .filter-bar.wide-filters .filter-search { grid-column: 1 / -1; }
  .card-create-form { grid-template-columns: 1fr 1fr; }
  .card-create-form button { grid-column: auto; }
}
@media (max-width: 600px) {
  .metric-grid.six-grid, .dashboard-identity-grid { grid-template-columns: 1fr; }
  .card-facts, .card-create-form, .filter-bar.wide-filters { grid-template-columns: 1fr; }
  .card-facts > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .card-facts > div:last-child { border-bottom: 0; }
  .filter-bar.wide-filters .filter-search { grid-column: auto; }
  .filter-bar.wide-filters .ghost { display: block; }
  .secret-export { padding: 14px; }
}
