:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --ink: #14211c;
  --muted: #6d7772;
  --line: #dfe5e1;
  --green: #0f7b5b;
  --green-dark: #095842;
  --green-soft: #e4f2ec;
  --lime: #b8e35c;
  --red: #c54343;
  --shadow: 0 16px 50px rgba(20, 33, 28, .08);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; color: var(--green); }
.muted { color: var(--muted); }
.toast { position: fixed; z-index: 100; left: 50%; top: 20px; opacity: 0; transform: translate(-50%, -12px); pointer-events: none; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: white; box-shadow: var(--shadow); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #7e2424; }
.primary, .secondary, .ghost { border-radius: 10px; border: 1px solid transparent; padding: 10px 15px; font-weight: 700; transition: .16s ease; }
.primary { background: var(--green); color: white; box-shadow: 0 6px 16px rgba(15, 123, 91, .18); }
.primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.secondary { background: var(--green-soft); border-color: #cbe2d8; color: var(--green-dark); }
.secondary:hover { background: #d6ebdf; }
.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.ghost:hover { background: #f2f5f3; }
.wide { width: 100%; }
button:disabled { opacity: .55; cursor: wait; }
label { display: grid; gap: 7px; color: #44504a; font-size: 13px; font-weight: 650; }
input, select { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid #d3dad6; border-radius: 10px; background: #fbfcfb; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 123, 91, .12); }
label small { color: var(--muted); font-weight: 400; }

/* Login */
.login-body { display: grid; place-items: center; padding: 28px; background: #e9eee9; }
.login-shell { width: min(1080px, 100%); min-height: 650px; display: grid; grid-template-columns: 1.16fr .84fr; border-radius: 28px; overflow: hidden; box-shadow: 0 30px 90px rgba(20,33,28,.16); background: var(--surface); }
.brand-panel { position: relative; overflow: hidden; padding: 64px; background: #102d23; color: white; }
.brand-panel::before { content: ""; position: absolute; width: 460px; height: 460px; border: 1px solid rgba(184,227,92,.2); border-radius: 50%; left: -190px; bottom: -220px; box-shadow: 0 0 0 70px rgba(184,227,92,.04), 0 0 0 140px rgba(184,227,92,.03); }
.brand-panel::after { content: ""; position: absolute; inset: 0; opacity: .16; background-image: linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(to bottom right, transparent 10%, black 100%); }
.brand-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 70px; border: 1px solid rgba(255,255,255,.28); border-radius: 15px; font-weight: 850; color: var(--lime); }
.brand-panel .eyebrow { position: relative; z-index: 1; color: var(--lime); }
.brand-panel h1 { position: relative; z-index: 1; margin: 0; font-size: clamp(42px, 5vw, 70px); line-height: 1.04; letter-spacing: -.045em; }
.brand-copy { position: relative; z-index: 1; max-width: 430px; margin-top: 28px; color: #b8c8c1; font-size: 17px; line-height: 1.8; }
.signal-grid { position: absolute; z-index: 2; right: 54px; bottom: 50px; height: 96px; display: flex; align-items: end; gap: 9px; }
.signal-grid span { display: block; width: 9px; border-radius: 8px; background: var(--lime); opacity: .9; }
.signal-grid span:nth-child(1) { height: 22%; }.signal-grid span:nth-child(2) { height: 42%; }.signal-grid span:nth-child(3) { height: 66%; }.signal-grid span:nth-child(4) { height: 88%; }.signal-grid span:nth-child(5) { height: 58%; }.signal-grid span:nth-child(6) { height: 32%; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 64px; }
.login-heading { display: flex; gap: 9px; align-items: center; margin-bottom: 44px; color: var(--muted); font-size: 13px; font-weight: 750; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #24a874; box-shadow: 0 0 0 5px rgba(36,168,116,.12); }
.login-card h2 { margin: 0; font-size: 34px; letter-spacing: -.035em; }
.login-card > p { margin: 12px 0 32px; color: var(--muted); line-height: 1.6; }
.login-card form { display: grid; gap: 18px; }
.login-card input { padding: 13px 14px; }
.form-error { min-height: 18px; margin: -2px 0 -4px; color: var(--red); font-size: 13px; }
.login-switch { margin-top: 28px; text-align: center; color: var(--green); font-weight: 700; font-size: 13px; }

/* Shared app */
.topbar { position: sticky; top: 0; z-index: 20; height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1400px)/2)); background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.wordmark span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: var(--lime); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.live-pill { display: flex; align-items: center; gap: 8px; margin-right: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: #1fa46f; box-shadow: 0 0 0 4px rgba(31,164,111,.12); }
.live-pill.offline i { background: #d09536; box-shadow: 0 0 0 4px rgba(208,149,54,.12); }
.page { width: min(1400px, calc(100% - 48px)); margin: 0 auto; padding: 44px 0 72px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.1; letter-spacing: -.045em; }
.page-heading > p { margin: 0; font-size: 13px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 28px rgba(20,33,28,.035); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .table-tools h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.secure-chip { padding: 6px 9px; border: 1px solid #cde2d8; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 850; letter-spacing: .08em; }

/* User */
.hero-stats { display: grid; grid-template-columns: 1.7fr repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.usage-card, .metric-card { min-height: 174px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.usage-card { color: white; border-color: #12392d; background: linear-gradient(135deg, #102d23, #174b3b); box-shadow: 0 16px 40px rgba(16,45,35,.16); }
.card-label, .metric-card > span { color: #a9b9b3; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.usage-number { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 17px; }
.usage-number strong { font-size: 30px; letter-spacing: -.04em; }.usage-number span { color: #a9b9b3; font-size: 14px; }
.progress { width: 100%; height: 7px; overflow: hidden; border-radius: 6px; background: rgba(255,255,255,.12); }.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--lime); transition: width .35s ease; }
.split-meta { display: flex; gap: 20px; margin-top: 14px; color: #9fb2aa; font-size: 12px; }.split-meta b { color: white; font-weight: 650; }
.metric-card { display: flex; flex-direction: column; justify-content: space-between; }
.metric-card > span { color: var(--muted); }
.metric-card strong { font-size: 27px; letter-spacing: -.04em; }.metric-card small { color: var(--muted); line-height: 1.5; }
.state-ok { color: var(--green); }.state-bad { color: var(--red); }
.section-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.subscription-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px; padding: 20px 26px; border-bottom: 1px solid var(--line); }
.subscription-item h3 { margin: 0 0 5px; font-size: 15px; }.subscription-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.client-icon { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; font-size: 12px; font-weight: 850; }
.client-icon.clash { background: #e6ecff; color: #4c62c7; }.client-icon.rocket { background: #e9f2f9; color: #2274a4; }
.notice { margin: 20px 26px 24px; padding: 12px 14px; border-radius: 10px; background: #f2f6f3; color: var(--muted); font-size: 12px; line-height: 1.6; }
.secret-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 20px 24px; padding: 13px; border: 1px dashed #cbd5d0; border-radius: 12px; background: #fafcfa; font-size: 12px; }.secret-row code { overflow: hidden; text-overflow: ellipsis; color: var(--green-dark); }.text-button { padding: 0; border: 0; background: none; color: var(--green); font-weight: 750; }
.setting-row { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 17px 24px; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); }.setting-row:hover { background: #fafcfa; }.setting-row span { display: grid; gap: 4px; }.setting-row small { color: var(--muted); }.setting-row i { color: #9aa59f; font-size: 24px; font-style: normal; }.danger-text b { color: var(--red); }

/* Admin */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-grid article { padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }.summary-grid span { color: var(--muted); font-size: 12px; }.summary-grid strong { display: block; margin-top: 8px; font-size: 28px; letter-spacing: -.04em; }
.table-panel { overflow: hidden; }
.table-tools { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }.table-tools p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }.table-tools input { width: 260px; background: #f7f9f7; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1050px; }
th { padding: 13px 16px; text-align: left; background: #f6f8f6; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
td { padding: 16px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
tbody tr:hover { background: #fbfcfb; }.right { text-align: right; }
.empty { padding: 48px; text-align: center; color: var(--muted); }
.user-cell { display: flex; align-items: center; gap: 10px; }.user-cell > div { display: grid; gap: 3px; }.user-cell small, .cell-note { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 11px; white-space: nowrap; }
.user-status { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #a8b1ac; }.user-status.online { background: #20a66f; box-shadow: 0 0 0 4px rgba(32,166,111,.12); }.user-status.active { background: #6aa693; }.user-status.blocked { background: #d45a5a; }
.table-usage { display: grid; gap: 7px; min-width: 150px; }.table-usage > div { height: 5px; overflow: hidden; border-radius: 5px; background: #e8ece9; }.table-usage i { display: block; height: 100%; background: var(--green); }
.device-badge { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 9px; background: #f0f4f1; font-weight: 750; }
.tier { padding: 5px 8px; border-radius: 7px; font-size: 11px; font-weight: 750; }.tier.conservative { color: #427275; background: #e5f0f0; }.tier.standard { color: var(--green-dark); background: var(--green-soft); }.tier.aggressive { color: #896421; background: #f8efd9; }
.row-actions { display: flex; justify-content: end; gap: 5px; }.row-actions button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #405049; font-size: 11px; font-weight: 700; }.row-actions button:hover { border-color: #b3c0b9; background: #f5f8f6; }

/* Dialogs */
dialog { width: min(480px, calc(100% - 30px)); max-height: 88vh; padding: 0; overflow: auto; border: 0; border-radius: 20px; box-shadow: 0 30px 100px rgba(10,25,18,.28); color: var(--ink); }
dialog::backdrop { background: rgba(9,24,18,.56); backdrop-filter: blur(4px); }
.dialog-card { display: grid; gap: 17px; padding: 25px; background: white; }.wide-dialog { width: min(680px, 100%); }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }.dialog-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; }.dialog-heading .eyebrow { margin-bottom: 5px; }
.icon-button { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #f7f9f7; color: var(--muted); font-size: 22px; line-height: 1; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; padding-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }.form-grid .full { grid-column: 1 / -1; }
.copy-field { display: grid; grid-template-columns: 1fr auto; gap: 8px; }.copy-field input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.credential-box, .credential-list > div { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; padding: 13px; border-radius: 10px; background: #f2f6f3; }.credential-box span, .credential-list span { color: var(--muted); font-size: 12px; }.credential-box code, .credential-list code { overflow-wrap: anywhere; color: var(--green-dark); }.credential-list { display: grid; gap: 8px; }

@media (max-width: 1000px) {
  .login-shell { grid-template-columns: 1fr; min-height: 0; }.brand-panel { min-height: 330px; padding: 42px; }.brand-mark { margin-bottom: 40px; }.brand-copy { margin-bottom: 20px; }.login-card { padding: 45px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }.usage-card { grid-column: 1 / -1; }.section-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .login-body { padding: 0; background: white; }.login-shell { border-radius: 0; box-shadow: none; }.brand-panel { min-height: 300px; padding: 30px; }.brand-panel h1 { font-size: 41px; }.brand-copy { font-size: 14px; }.brand-mark { margin-bottom: 28px; }.signal-grid { right: 28px; bottom: 24px; height: 70px; }.login-card { padding: 34px 28px 50px; }
  .topbar { padding: 0 16px; }.live-pill { display: none; }.top-actions .ghost { padding: 8px 9px; font-size: 12px; }.wordmark { font-size: 14px; }
  .page { width: min(100% - 28px, 1400px); padding-top: 28px; }.page-heading { align-items: start; }.page-heading > p { display: none; }
  .hero-stats { grid-template-columns: 1fr; }.usage-card { grid-column: auto; }.metric-card { min-height: 130px; }.summary-grid { grid-template-columns: 1fr 1fr; }
  .subscription-item { grid-template-columns: auto 1fr; padding: 18px; }.subscription-item .secondary { grid-column: 1 / -1; width: 100%; }.panel-heading { padding: 20px; }.notice { margin: 18px 20px; }
  .table-tools { align-items: stretch; flex-direction: column; gap: 14px; }.table-tools input { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }.form-grid .full { grid-column: auto; }.dialog-card { padding: 21px; }
}

