:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  font-size: 14px;
  --bg: light-dark(#ffffff, #0b0f14);
  --panel: light-dark(#ffffff, #151b24);
  --soft: light-dark(#f6f8fb, #111720);
  --text: light-dark(#16212f, #edf3fa);
  --muted: light-dark(#6f7d8d, #9aa9bb);
  --line: light-dark(#e6ebf1, #2b3644);
  --blue: light-dark(#1467d8, #7bb4ff);
  --blue-soft: light-dark(#eaf3ff, #1a2e48);
  --green: light-dark(#13815c, #67d9a4);
  --green-soft: light-dark(#e8f8ef, #19382d);
  --cyan: light-dark(#0a91ab, #65d1e4);
  --amber: light-dark(#ad761b, #f2bb65);
  --red: light-dark(#b83248, #ff8293);
  --shadow: light-dark(#152c470e, #0004);
  background: var(--bg);
  color: var(--text);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.app-shell { max-width: 1320px; min-height: 100vh; margin: 0 auto; background: var(--bg); }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 69px; padding: 0 29px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 175px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--soft); font-size: 23px; font-weight: 700; line-height: 1; }
.brand strong { display: block; font-size: 15px; font-weight: 680; letter-spacing: -.025em; }
.brand small { display: block; margin-top: 2px; font-size: 10px; font-weight: 500; color: var(--muted); }
.topnav { display: flex; align-self: stretch; align-items: stretch; gap: 4px; }
.topnav button { position: relative; padding: 0 15px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.topnav button.active { color: var(--text); font-weight: 650; }
.topnav button.active::after { content: ""; position: absolute; left: 15px; right: 15px; bottom: 0; height: 2px; border-radius: 2px; background: var(--blue); }
.toptools { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 220px; }
.connection { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--muted); font-size: 11px; font-weight: 650; }
.connection::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.connection.connected { color: var(--green); }
.connection.error { color: var(--red); }
.themes { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.themes button { padding: 5px 7px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11px; white-space: nowrap; }
.themes button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 4px var(--shadow); font-weight: 650; }
.content { padding: 28px 29px 34px; }
h1 { margin: 0 0 5px; font-size: 25px; line-height: 1.15; letter-spacing: -.045em; font-weight: 680; }
h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; font-weight: 660; }
h3 { margin: 0; font-size: 13px; }
p { margin: 0; line-height: 1.5; }
.headline { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 19px; scroll-margin-top: 84px; }
.headline p, .panel-head p { color: var(--muted); font-size: 12px; }
.button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 12px; font-weight: 650; white-space: nowrap; }
.button:hover { background: var(--soft); }
.button.primary { border-color: var(--blue); background: var(--blue); color: light-dark(#ffffff, #09111f); }
.button.primary:hover { filter: brightness(.94); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.stat { min-height: 104px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.stat-dot { width: 7px; height: 7px; border-radius: 50%; }
.stat-dot.blue { background: var(--blue); }
.stat-dot.cyan { background: var(--cyan); }
.stat-dot.green { background: var(--green); }
.stat-dot.amber { background: var(--amber); }
.stat strong { display: block; margin: 13px 0 3px; font-size: 26px; line-height: 1.1; font-weight: 690; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 10px; }
.meter-note { margin: 13px 0 26px; color: var(--muted); font-size: 11px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 16px; }
.side-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); scroll-margin-top: 84px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 61px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.panel-head > div { min-width: 0; }
.panel-head p { margin-top: 3px; }
.user-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.user-filters { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
#search { width: 100%; max-width: 300px; min-width: 0; flex: 1; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--text); font-size: 13px; }
.status-filter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status-filter select { min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.user-results { color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.users-table { table-layout: fixed; }
.email-column { width: 26%; }.balance-column { width: 20%; }.daily-column { width: 18%; }.recent-column { width: 15%; }.status-column { width: 11%; }.action-column { width: 10%; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
th { background: var(--soft); color: var(--muted); font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.users-table tbody tr:hover { background: var(--soft); }
.email-link { display: block; width: 100%; min-height: 32px; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; border: 0; background: transparent; color: var(--text); font-size: 12px; font-weight: 620; }
.email-link:hover { color: var(--blue); }
.cell-primary { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.cell-secondary { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; white-space: normal; overflow-wrap: anywhere; }
.user-recent { color: var(--muted); font-size: 11px; white-space: normal; font-variant-numeric: tabular-nums; }
.user-actions { text-align: right; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 620; }
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.disabled { background: var(--soft); color: var(--muted); }
.user-manage { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--blue); font-size: 12px; font-weight: 650; }
.user-manage:hover { background: var(--blue-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.empty { padding: 25px 16px; color: var(--muted); font-size: 12px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row span { color: var(--muted); font-size: 12px; }
.setting-row strong { font-size: 12px; font-weight: 660; font-variant-numeric: tabular-nums; white-space: nowrap; }
.security-state { display: inline-flex; align-items: center; gap: 8px; color: var(--green) !important; font-weight: 650; }
.security-state::before { content: "✓"; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; background: var(--green-soft); font-size: 11px; }
.security-state.unset { color: var(--amber) !important; }
.security-state.unset::before { content: "!"; background: var(--soft); }
.panel-foot { padding: 10px 15px; background: var(--soft); color: var(--muted); font-size: 10px; }
.setting-form { display: grid; gap: 12px; padding: 15px; border-bottom: 1px solid var(--line); }
.setting-form label, .editor-fields label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 550; }
.setting-form input, .editor-fields input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-feedback, .field-feedback { padding: 0 15px 11px; color: var(--blue); font-size: 11px; }
.field-feedback { padding: 0; color: var(--red); }
.panel-feedback:empty, .field-feedback:empty { display: none; }
.field-feedback.success { color: var(--green); }
.editor { margin-top: 16px; }
#editEmail { overflow-wrap: anywhere; line-height: 1.5; user-select: text; }
.editor > .panel-head { align-items: start; }
.editor-fields { display: flex; align-items: end; flex-wrap: wrap; gap: 11px; padding: 16px; }
.editor-fields label { min-width: 160px; flex: 1; }
.history-wrap { padding: 0 16px 18px; }
.history { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.history span { padding: 6px 9px; border-radius: 7px; background: var(--soft); color: var(--muted); font-size: 11px; }
.global-feedback { margin-top: 16px; color: var(--blue); font-size: 12px; }
.global-feedback:empty { display: none; }
footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 25px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.login-card { width: min(100%, 450px); margin: min(10vh, 90px) auto; padding: 27px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 16px 45px var(--shadow); }
.login-card p { margin-top: 9px; color: var(--muted); font-size: 12px; }
.login-row { display: flex; gap: 9px; margin-top: 22px; }
.login-row input { flex: 1; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--text); font-size: 13px; }
.login-card .error { color: var(--red); }
.login-card .error:empty { display: none; }
@media (max-width: 980px) {
  .users-table th, .users-table td { padding-left: 8px; padding-right: 8px; }
  .topbar { padding: 0 20px; }
  .content { padding: 24px 20px 31px; }
}
@media (max-width: 820px) {
  .topnav { display: none; }
  .toptools { min-width: 0; }
  .workspace-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .topbar { min-height: 0; padding: 12px 15px; flex-wrap: wrap; }
  .toptools { width: 100%; justify-content: space-between; }
  .content { padding: 19px 14px 27px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-column { grid-template-columns: 1fr; }
  .headline { align-items: start; }
  footer { display: block; }
  footer span { display: block; margin-top: 5px; }
}

@media (max-width: 700px) {
  .user-toolbar { align-items: stretch; flex-direction: column; padding: 12px; }
  .user-filters { width: 100%; gap: 10px; }
  #search { max-width: none; min-height: 44px; font-size: 16px; }
  .status-filter { gap: 6px; }
  .status-filter select { min-height: 44px; font-size: 16px; }
  .users-table colgroup { display: none; }
  .users-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .users-table, .users-table tbody { display: block; white-space: normal; }
  .users-table tbody { display: grid; gap: 10px; padding: 12px; background: var(--soft); }
  .users-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: 'email email' 'balance daily' 'recent action'; align-items: center; gap: 12px 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
  .users-table tbody tr:hover { background: var(--panel); }
  .users-table td { min-width: 0; padding: 0; border: 0; }
  .user-email { grid-area: email; padding-right: 74px !important; }
  .email-link { min-height: 32px; font-size: 13px; }
  .user-status { grid-row: 1; grid-column: 2; justify-self: end; }
  .user-balance { grid-area: balance; }
  .user-daily { grid-area: daily; }
  .user-balance::before, .user-daily::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
  .cell-primary { font-size: 16px; }
  .user-recent { grid-area: recent; line-height: 1.6; }
  .user-recent::before { content: attr(data-label); display: block; }
  .user-actions { grid-area: action; justify-self: end; }
  .user-manage { min-height: 44px; min-width: 64px; }
  .users-table:has(tbody:empty) { display: none; }
}

.protection { margin-bottom: 24px; }
.protection-grid,.safety-fields { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px; }
.protection-grid span { display:block;font-size:12px;opacity:.7;margin-bottom:8px; }
.protection-grid strong { display:block;font-size:20px; }
.safety-fields label { display:flex;flex-direction:column;gap:8px;font-size:13px; }
.safety-fields input[type=number] { width:100%;min-width:0; }
.safety-fields .pause-service { flex-direction:row;align-items:center;grid-column:span 2; }
.pause-service input { width:auto; }
@media(max-width:900px) { .protection-grid,.safety-fields { grid-template-columns:repeat(2,minmax(0,1fr)); } .safety-fields .pause-service {grid-column:span 1;} }

.protection-grid,.safety-fields { padding:18px 16px; }
.protection > .meter-note {padding:0 16px;margin:0 0 6px;}
.safety-fields input[type=number] {padding:9px 10px;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--text);}

.safety-fields {align-items:end;}

.button.danger{color:#d92d20}.button.danger:disabled{opacity:.4}.history-wrap summary{cursor:pointer;font-weight:600}.history-wrap details p{line-height:1.6}

.package-card{padding:20px;border:1px solid var(--border, #8884);border-radius:16px;margin-bottom:18px}.package-card p{font-size:13px;line-height:1.7}.package-card select{font:inherit;color:inherit;background:var(--surface,transparent);border:1px solid #8885;border-radius:10px;padding:10px 12px;min-width:220px}.package-card h3{margin:0 0 8px;font-size:16px}

#mfaQR{display:block;max-width:100%;height:auto;background:#fff;border-radius:12px;margin:16px 0}#mfaSecret,#mfaRecovery{overflow-wrap:anywhere;white-space:pre-wrap}#mfaEnrollment label{display:block;margin:14px 0}#mobileCodeField{min-width:0}.login-row{flex-wrap:wrap}@media(max-width:600px){.login-row>input,.login-row>label,.login-row>button{width:100%}.editor-fields{display:flex;flex-direction:column;align-items:stretch}.topbar{flex-wrap:wrap}input,select{font-size:16px}}

#mobileCodeField input{width:100%}
