:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e9eefb;
  background: #07101f;
  font-synthesis: none;
  --surface: rgba(14, 27, 49, 0.82);
  --surface-strong: #111f38;
  --line: rgba(151, 176, 220, 0.16);
  --muted: #8fa2c3;
  --cyan: #54d7ff;
  --blue: #4a7dff;
  --green: #55d99f;
  --orange: #ffb15a;
  --red: #ff697d;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -20%, #19345d 0, #07101f 48%, #050b15 100%); }
button, input { font: inherit; }
button { cursor: pointer; }
.ambient { position: fixed; pointer-events: none; filter: blur(90px); opacity: .18; border-radius: 50%; }
.ambient-one { width: 420px; height: 420px; background: #3366ff; top: -180px; right: 10%; }
.ambient-two { width: 300px; height: 300px; background: #00d7c7; bottom: -160px; left: -70px; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 28px; position: relative; }
.topbar, .panel-heading, .dialog-heading, .top-actions, .brand, .user-main, .user-actions, footer { display: flex; align-items: center; }
.topbar { justify-content: space-between; margin-bottom: 26px; }
.brand { gap: 14px; }
.brand h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.brand p, .panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.logo-mark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 850; font-size: 20px; background: linear-gradient(145deg, var(--cyan), var(--blue)); color: #051020; box-shadow: 0 12px 34px rgba(64, 140, 255, .28); }
.logo-mark.large { width: 56px; height: 56px; border-radius: 18px; font-size: 25px; margin-bottom: 18px; }
.top-actions { gap: 10px; }
.badge { font-size: 12px; padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line); }
.badge.ok { color: var(--green); background: rgba(85, 217, 159, .09); }
.badge.pending { color: var(--orange); background: rgba(255, 177, 90, .09); }
.badge.error { color: var(--red); background: rgba(255, 105, 125, .09); }
.badge.neutral { color: var(--muted); background: rgba(143, 162, 195, .06); }
button { color: #eaf1ff; border: 1px solid var(--line); background: rgba(255,255,255,.04); border-radius: 11px; padding: 9px 14px; transition: .18s ease; }
button:hover { border-color: rgba(84,215,255,.46); background: rgba(84,215,255,.08); transform: translateY(-1px); }
button:disabled { opacity: .5; cursor: wait; transform: none; }
.primary { border: 0; color: #061020; font-weight: 750; background: linear-gradient(135deg, var(--cyan), #6d8dff); box-shadow: 0 8px 22px rgba(67, 139, 255, .2); }
.primary:hover { background: linear-gradient(135deg, #83e5ff, #89a2ff); }
.secondary { color: #c7d3e9; }
.danger { color: #ff8d9b; }
.icon-button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; font-size: 18px; }
.wide { width: 100%; padding: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card, .panel { border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(18px); box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.stat-card { border-radius: 17px; padding: 18px; min-height: 122px; display: flex; flex-direction: column; justify-content: center; }
.stat-card.accent { background: linear-gradient(145deg, rgba(41, 101, 190, .48), rgba(13, 35, 62, .84)); }
.stat-card span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.stat-card strong { font-size: 22px; margin: 10px 0 7px; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card small { color: #7f94b7; }
.panel { border-radius: 20px; padding: 22px; min-height: 330px; }
.panel-heading { justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .dialog-heading h2, .login-card h2 { margin: 2px 0 0; font-size: 20px; }
.eyebrow { color: var(--cyan) !important; font-size: 10px !important; letter-spacing: .18em; font-weight: 800; margin: 0 0 6px !important; }
.user-list { display: grid; gap: 10px; padding-top: 16px; }
.user-row { display: grid; grid-template-columns: minmax(170px, .9fr) minmax(180px, .9fr) minmax(190px, 1.1fr) minmax(260px, auto); gap: 18px; align-items: center; border: 1px solid var(--line); background: rgba(7,17,32,.48); border-radius: 15px; padding: 15px; }
.user-main { gap: 12px; min-width: 0; }
.user-avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--cyan); font-weight: 800; background: rgba(84,215,255,.09); border: 1px solid rgba(84,215,255,.15); }
.user-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-main small, .sub-cell small { display: block; color: var(--muted); margin-top: 4px; }
.sub-cell { min-width: 0; }
.sub-cell code { display: block; color: #aebddb; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row.limited { border-color: rgba(255,177,90,.34); background: rgba(59,34,17,.34); }
.user-row.limited .user-avatar { color: var(--orange); border-color: rgba(255,177,90,.28); background: rgba(255,177,90,.1); }
.quota-cell { min-width: 0; }
.quota-cell strong { display: block; color: #dce7fa; font-size: 12px; font-variant-numeric: tabular-nums; }
.quota-cell small { display: block; color: var(--muted); margin-top: 5px; }
.quota-progress { height: 5px; overflow: hidden; margin-top: 7px; border-radius: 999px; background: rgba(143,162,195,.13); }
.quota-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--blue)); }
.user-row.limited .quota-progress span { background: var(--orange); }
.quota-reset { color: var(--green); border-color: rgba(85,217,159,.22); }
.user-actions { gap: 7px; justify-content: flex-end; flex-wrap: wrap; }
.user-actions button { padding: 7px 9px; font-size: 12px; }
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty div { color: var(--cyan); font-size: 32px; }
.empty h3 { color: #e9eefb; margin: 12px 0 4px; }
.empty p { margin: 0; }
.error-banner { margin-top: 16px; border: 1px solid rgba(255,105,125,.3); background: rgba(255,105,125,.08); color: #ff9aa7; border-radius: 12px; padding: 12px 14px; }
footer { justify-content: center; gap: 22px; color: #627596; font-size: 11px; padding: 18px; }
.login-layer { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(4,10,20,.82); backdrop-filter: blur(18px); }
.login-layer.hidden { display: none; }
.login-card, .dialog-card, .reset-card { width: min(420px, 100%); border: 1px solid var(--line); border-radius: 22px; padding: 28px; background: #0d1a30; box-shadow: 0 28px 90px rgba(0,0,0,.5); }
.login-card > p { color: var(--muted); line-height: 1.6; }
label { display: grid; gap: 8px; margin: 18px 0; color: #a9b8d1; font-size: 12px; }
input { width: 100%; color: #eef3ff; border: 1px solid var(--line); background: #071222; border-radius: 11px; padding: 12px 13px; outline: none; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(84,215,255,.09); }
.form-error { min-height: 20px; color: var(--red) !important; font-size: 12px; margin: 12px 0 0 !important; }
dialog { border: 0; padding: 0; background: transparent; color: inherit; }
dialog::backdrop { background: rgba(3,8,16,.72); backdrop-filter: blur(8px); }
.dialog-card { width: min(460px, calc(100vw - 28px)); }
.subscription-card { width: min(560px, calc(100vw - 28px)); }
.dialog-heading { justify-content: space-between; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.55; }
.format-list { display: grid; gap: 10px; margin: 22px 0 16px; }
.format-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); background: #071222; border-radius: 13px; padding: 13px; }
.format-item strong, .format-item small { display: block; }
.format-item small { color: var(--muted); margin-top: 4px; }
.shadowrocket-format .qr-code { grid-column: 1 / -1; justify-self: center; }
.qr-code { width: min(240px, 100%); aspect-ratio: 1; padding: 10px; border-radius: 14px; background: white; }
.toast { position: fixed; z-index: 40; right: 24px; bottom: 24px; max-width: min(440px, calc(100vw - 48px)); color: #dff9ee; background: #12382d; border: 1px solid rgba(85,217,159,.28); border-radius: 13px; padding: 12px 16px; box-shadow: 0 16px 50px rgba(0,0,0,.35); }
.reset-body { display: grid; place-items: center; padding: 24px; }
.reset-card { text-align: center; }
.reset-card .logo-mark { margin: 0 auto 22px; }
.reset-card p { color: var(--muted); line-height: 1.6; }
.reset-card code { display: block; text-align: left; overflow-wrap: anywhere; color: var(--cyan); background: #071222; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 16px 0; }
.reset-card button { border: 0; color: #061020; font-weight: 750; background: linear-gradient(135deg, var(--cyan), #6d8dff); padding: 12px 20px; }
.nodes-panel { min-height: 0; margin-bottom: 18px; }
.node-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; padding-top: 16px; }
.node-card { min-height: 104px; text-align: left; display: grid; gap: 7px; align-content: center; background: rgba(7,17,32,.48); }
.node-card.active { border-color: var(--cyan); background: rgba(84,215,255,.1); box-shadow: inset 0 0 0 1px rgba(84,215,255,.12); }
.node-card strong, .node-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-card small { color: var(--muted); }
.node-card .badge { justify-self: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { min-width: 0; }
.checkbox { display: flex; align-items: center; gap: 10px; }
.checkbox input { width: auto; accent-color: var(--cyan); }
.credential { display: block; overflow-wrap: anywhere; color: var(--cyan); background: #071222; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 14px 0; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .user-row { grid-template-columns: 1fr; gap: 12px; }
  .user-actions { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 18px; }
  .topbar { align-items: flex-start; }
  .brand p, .top-actions .badge { display: none; }
  .stats-grid { gap: 9px; }
  .stat-card { min-height: 104px; padding: 14px; }
  .stat-card strong { font-size: 18px; }
  .panel { padding: 15px; }
  .panel-heading { align-items: flex-start; }
  .panel-heading > div > p:last-child { display: none; }
  footer { flex-wrap: wrap; gap: 8px 16px; }
}
