:root {
  color-scheme: dark;
  --bg: #080a0d;
  --panel: #111419;
  --panel-2: #161a20;
  --line: #252b34;
  --muted: #808894;
  --text: #f2f4f7;
  --accent: #e9ff60;
  --accent-soft: rgba(233, 255, 96, .1);
  --danger: #ff6e76;
  --success: #64e8aa;
  --sidebar: 248px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .5; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 9px; color: var(--accent); font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; }
.muted { color: var(--muted); }

.auth-shell { display: grid; grid-template-columns: minmax(420px, 1.08fr) minmax(440px, .92fr); min-height: 100vh; }
.brand-panel { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 52px 64px; overflow: hidden; border-right: 1px solid var(--line); background: radial-gradient(circle at 80% 20%, rgba(233,255,96,.1), transparent 35%), linear-gradient(145deg, #0d1014, #08090c); }
.brand-panel::before { content: ""; position: absolute; width: 480px; height: 480px; right: -220px; bottom: -170px; border: 1px solid rgba(233,255,96,.22); border-radius: 50%; box-shadow: 0 0 0 68px rgba(233,255,96,.025), 0 0 0 136px rgba(233,255,96,.018); }
.brand-panel::after { content: ""; position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(to bottom, black, transparent 75%); }
.brand-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--accent); color: var(--accent); font: 800 15px/1 ui-monospace, monospace; letter-spacing: .1em; }
.brand-copy { position: relative; z-index: 1; max-width: 680px; }
.brand-copy h1 { margin: 0; font-size: clamp(48px, 5.6vw, 88px); line-height: .99; letter-spacing: -.06em; font-weight: 650; }
.brand-copy h1 span { color: var(--accent); }
.brand-copy > p:last-child { max-width: 520px; margin: 32px 0 0; color: #9da5b0; font-size: 16px; line-height: 1.8; }
.privacy-note { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; color: #6f7782; font-size: 12px; }
.privacy-note span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(100,232,170,.1); }

.auth-panel { display: grid; place-items: center; padding: 48px; background: #0b0d10; }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { margin: 0; font-size: 34px; letter-spacing: -.035em; }
.auth-card > .muted { margin: 10px 0 32px; font-size: 14px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.auth-tab { padding: 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.auth-tab.active { background: #262c34; color: var(--text); }
.auth-form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #afb6bf; font-size: 12px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: #0c0f13; color: var(--text); padding: 13px 14px; transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus, select:focus { border-color: rgba(233,255,96,.7); box-shadow: 0 0 0 3px rgba(233,255,96,.07); }
textarea { resize: vertical; min-height: 170px; line-height: 1.7; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #89919c 50%), linear-gradient(135deg, #89919c 50%, transparent 50%); background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 13px) calc(50% - 2px); background-size: 5px 5px; background-repeat: no-repeat; }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 17px; margin-top: 5px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #151800; font-weight: 750; }
.primary-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: wait; transform: none; }
.primary-button span { font-size: 18px; }
.primary-button.compact { width: auto; min-width: 160px; gap: 28px; }
.form-hint { margin: -4px 0 0; color: #6f7782; font-size: 11px; line-height: 1.6; }
.notice { margin-top: 18px; border: 1px solid rgba(100,232,170,.25); border-radius: 8px; background: rgba(100,232,170,.07); color: var(--success); padding: 12px 14px; font-size: 12px; line-height: 1.55; }
.notice.error { border-color: rgba(255,110,118,.3); background: rgba(255,110,118,.07); color: #ff9ca2; }

.workspace { min-height: 100vh; }
.sidebar { position: fixed; z-index: 5; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar); padding: 25px 18px 18px; border-right: 1px solid var(--line); background: #0b0d10; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 7px 27px; border-bottom: 1px solid var(--line); }
.sidebar-brand > span { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--accent); color: var(--accent); font: 800 12px/1 monospace; }
.sidebar-brand div { display: grid; gap: 2px; }
.sidebar-brand strong { font-size: 13px; letter-spacing: .09em; }
.sidebar-brand small { color: #676f79; font: 9px/1.2 monospace; letter-spacing: .14em; }
.sidebar nav { display: grid; gap: 6px; margin-top: 26px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 13px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #7c8590; text-align: left; }
.nav-item i { color: #666f7a; font-style: normal; }
.nav-item.active { border-color: #2a3038; background: #171b20; color: var(--text); }
.nav-item.active i { color: var(--accent); }
.nav-item b { margin-left: auto; min-width: 20px; padding: 2px 5px; border-radius: 9px; background: var(--danger); color: white; font-size: 9px; text-align: center; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 15px 6px 0; border-top: 1px solid var(--line); }
.account-chip { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.account-chip > span { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #171900; font-weight: 800; }
.account-chip div { display: grid; min-width: 0; gap: 2px; }
.account-chip strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-chip small { color: var(--muted); font-size: 9px; }
.icon-button, .text-button { border: 0; background: transparent; color: var(--muted); }
.icon-button { padding: 8px; font-size: 17px; }
.text-button { padding: 6px; color: #9da5ae; font-size: 11px; }
.text-button:hover { color: var(--accent); }

.content { min-height: 100vh; margin-left: var(--sidebar); padding: 0 36px 46px; background: radial-gradient(circle at 94% 0, rgba(233,255,96,.035), transparent 25%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 104px; border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 25px; letter-spacing: -.035em; }
.provider-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #39302b; border-radius: 999px; background: rgba(255,166,91,.05); color: #d3a078; font-size: 10px; }
.provider-pill span { width: 6px; height: 6px; border-radius: 50%; background: #ff9c4a; }
.provider-pill.ready { border-color: rgba(100,232,170,.22); background: rgba(100,232,170,.05); color: var(--success); }
.provider-pill.ready span { background: var(--success); }
.view { padding-top: 30px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.metric-card { position: relative; min-height: 145px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.metric-card::after { content: ""; position: absolute; width: 90px; height: 90px; right: -50px; top: -50px; border: 1px solid #2d333c; border-radius: 50%; }
.metric-card.accent { border-color: rgba(233,255,96,.32); background: linear-gradient(145deg, rgba(233,255,96,.09), var(--panel) 60%); }
.metric-card small { display: block; margin-bottom: 20px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.metric-card strong { margin-right: 8px; font-size: 38px; font-weight: 570; letter-spacing: -.05em; }
.metric-card > span { color: #69717b; font-size: 11px; }
.meter { position: absolute; left: 20px; bottom: 18px; width: calc(100% - 40px); height: 3px; overflow: hidden; border: 0; border-radius: 4px; background: #292f36; appearance: none; }
.meter::-webkit-progress-bar { background: #292f36; }
.meter::-webkit-progress-value { background: var(--accent); }
.meter::-moz-progress-bar { background: var(--accent); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 21px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.step-label { color: #606873; font: 9px/1.2 monospace; letter-spacing: .1em; }
.compose-panel form { display: grid; gap: 18px; padding: 22px; }
.form-row { display: grid; grid-template-columns: 1.35fr .65fr; gap: 14px; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.submit-row p { max-width: 380px; margin: 0; color: #69717b; font-size: 10px; line-height: 1.5; }
.compose-panel > .notice { margin: 0 22px 22px; }
.job-list { max-height: 583px; overflow: auto; }
.job-item { display: flex; align-items: flex-start; gap: 12px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.job-item:last-child { border-bottom: 0; }
.job-icon { display: grid; flex: 0 0 34px; place-items: center; width: 34px; height: 34px; border: 1px solid #303741; border-radius: 6px; background: #171b21; color: var(--accent); font: 700 11px/1 monospace; }
.job-copy { display: grid; min-width: 0; flex: 1; gap: 4px; }
.job-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.job-copy small { color: #6d7580; font-size: 9px; }
.job-copy p { margin: 4px 0 0; color: #c97f84; font-size: 9px; line-height: 1.4; }
.status { display: inline-flex; align-items: center; width: max-content; padding: 4px 7px; border: 1px solid #3a414b; border-radius: 999px; color: #9ba3ad; font-size: 8px; font-style: normal; white-space: nowrap; }
.status.active, .status.completed, .status.submitted { border-color: rgba(100,232,170,.25); background: rgba(100,232,170,.06); color: var(--success); }
.status.pending, .status.submitting { border-color: rgba(233,255,96,.25); background: rgba(233,255,96,.05); color: var(--accent); }
.status.suspended, .status.failed { border-color: rgba(255,110,118,.25); background: rgba(255,110,118,.05); color: #ff9399; }
.empty { margin: 0; padding: 36px 20px; color: #646c76; font-size: 11px; text-align: center; }

.range-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.range-bar > div { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.range-button { padding: 7px 12px; border: 0; border-radius: 5px; background: transparent; color: #707985; font-size: 9px; }
.range-button.active { background: #292f36; color: var(--text); }
.admin-metrics { grid-template-columns: repeat(4, 1fr); }
.admin-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); gap: 18px; margin-bottom: 18px; }
.usage-panel, .users-panel { min-height: 430px; }
.usage-chart { min-height: 345px; padding: 24px 24px 17px; overflow-x: auto; }
.bars { display: flex; align-items: stretch; gap: 8px; height: 255px; }
.bar-column { display: flex; min-width: 14px; flex: 1; flex-direction: column; align-items: center; gap: 9px; }
.bar-track { position: relative; width: 100%; height: 225px; border-bottom: 1px solid #2c333b; background: linear-gradient(to top, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 100% 25%; }
.bar-track i { position: absolute; right: 16%; bottom: 0; left: 16%; min-height: 5px; border-radius: 4px 4px 1px 1px; background: linear-gradient(to top, #9fb33c, var(--accent)); }
.bar-h-5 { height: 5%; }
.bar-h-10 { height: 10%; }
.bar-h-15 { height: 15%; }
.bar-h-20 { height: 20%; }
.bar-h-25 { height: 25%; }
.bar-h-30 { height: 30%; }
.bar-h-35 { height: 35%; }
.bar-h-40 { height: 40%; }
.bar-h-45 { height: 45%; }
.bar-h-50 { height: 50%; }
.bar-h-55 { height: 55%; }
.bar-h-60 { height: 60%; }
.bar-h-65 { height: 65%; }
.bar-h-70 { height: 70%; }
.bar-h-75 { height: 75%; }
.bar-h-80 { height: 80%; }
.bar-h-85 { height: 85%; }
.bar-h-90 { height: 90%; }
.bar-h-95 { height: 95%; }
.bar-h-100 { height: 100%; }
.bar-track i span { position: absolute; top: -17px; left: 50%; color: #858d97; font: 8px/1 monospace; transform: translateX(-50%); }
.bar-column small { color: #666e78; font: 8px/1 monospace; }
.chart-legend { display: flex; justify-content: space-between; margin-top: 18px; color: #6e7681; font-size: 9px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 6px; height: 6px; border-radius: 1px; background: var(--accent); }
.chart-legend b { font-weight: 500; }
.user-list { max-height: 520px; overflow: auto; }
.user-card { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.user-main { display: flex; align-items: center; gap: 10px; }
.user-main > span { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #2a3037; color: var(--accent); font-size: 11px; font-weight: 750; }
.user-main > div { display: grid; min-width: 0; flex: 1; gap: 3px; }
.user-main strong { font-size: 11px; }
.user-main small { color: #69717b; font-size: 8px; }
.user-usage { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 0 42px; color: var(--muted); font-size: 10px; }
.user-usage b { color: var(--text); font-weight: 600; }
.quota-edit { display: flex; align-items: flex-end; gap: 8px; margin: 13px 0 0 42px; }
.quota-edit label { gap: 4px; color: #626a74; font-size: 8px; }
.quota-edit input { width: 62px; padding: 7px 8px; font-size: 9px; }
.small-button { padding: 8px 10px; border: 1px solid #3b424c; border-radius: 6px; background: #242a31; color: #c4c9cf; font-size: 8px; }
.small-button.approve { border-color: var(--accent); background: var(--accent); color: #171900; }
.small-button.danger { border-color: rgba(255,110,118,.25); background: transparent; color: #ff9298; }
.small-button.ghost { background: transparent; }
.self-label { margin-left: auto; padding-bottom: 8px; color: #666e78; font-size: 8px; }
.audit-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 9px; }
th { padding: 11px 14px; border-bottom: 1px solid var(--line); background: #14181d; color: #68717b; text-align: left; font-weight: 500; white-space: nowrap; }
td { max-width: 280px; padding: 13px 14px; border-bottom: 1px solid #20262d; color: #949ca6; vertical-align: top; }
td strong { display: block; color: #c7ccd2; font-size: 10px; }
td small { display: block; margin-top: 3px; color: #5f6872; font-size: 8px; }
.action-tag { color: var(--accent); }

.settings-intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0 0 22px; }
.settings-intro h3 { margin: 0 0 8px; font-size: 18px; }
.settings-intro p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.settings-intro > button { flex-shrink: 0; padding: 11px 15px; font-size: 11px; }
.provider-settings-grid { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.provider-list { max-height: 850px; overflow: auto; }
.provider-card { padding: 20px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.provider-card:last-child { border-bottom: 0; }
.provider-card.selected { border-left-color: var(--accent); background: rgba(233,255,96,.025); }
.provider-card-head, .provider-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.provider-card-head strong { overflow-wrap: anywhere; font-size: 13px; }
.provider-card p { color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.provider-endpoint { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #0c0f13; color: #9099a4; font: 10px/1.6 ui-monospace, monospace; overflow-wrap: anywhere; }
.provider-card-foot { margin-top: 15px; }
.provider-card-foot small { color: var(--muted); font-size: 9px; line-height: 1.6; }
.provider-card-foot button { flex-shrink: 0; font-size: 10px; }
.provider-editor form, .settings-form { display: grid; gap: 18px; padding: 22px; }
.provider-editor > .notice, .account-panel > .notice { margin: 0 22px 22px; }
.form-row.equal { grid-template-columns: 1fr 1fr; }
.check-label { display: flex; align-items: center; gap: 10px; font-size: 11px; line-height: 1.7; }
.check-label input { width: 16px; height: 16px; flex-shrink: 0; padding: 0; accent-color: var(--accent); }
.advanced-settings { padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.advanced-settings summary { color: #a6aeb8; font-size: 11px; cursor: pointer; }
.advanced-fields { display: grid; gap: 16px; margin-top: 18px; }
.advanced-fields input, .advanced-fields select { padding: 11px; font-size: 11px; }
.form-actions { display: flex; align-items: center; gap: 16px; }
.account-panel { max-width: 580px; }

@media (max-width: 1050px) {
  .auth-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 46vh; padding: 38px; }
  .brand-copy h1 { font-size: 52px; }
  .auth-panel { padding: 52px 28px; }
  .dashboard-grid, .admin-grid, .provider-settings-grid { grid-template-columns: 1fr; }
  .admin-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  :root { --sidebar: 68px; }
  .brand-panel { min-height: 390px; padding: 28px; }
  .brand-copy h1 { font-size: 42px; }
  .brand-copy > p:last-child { margin-top: 20px; font-size: 13px; }
  .sidebar { padding: 20px 10px 12px; }
  .sidebar-brand { justify-content: center; padding: 0 0 20px; }
  .sidebar-brand div, .nav-item span, .sidebar-foot .account-chip div { display: none; }
  .sidebar-foot { flex-direction: column; }
  .nav-item { justify-content: center; padding: 12px; }
  .account-chip { justify-content: center; }
  .content { padding: 0 16px 30px; }
  .topbar { min-height: 88px; }
  .provider-pill b { display: none; }
  .metric-grid, .admin-metrics { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 128px; }
  .metric-card strong { font-size: 31px; }
  .form-row, .form-row.equal { grid-template-columns: 1fr; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .primary-button.compact { width: 100%; }
  .quota-edit { margin-left: 0; flex-wrap: wrap; }
  .user-usage { margin-left: 0; }
  .settings-intro { align-items: flex-start; flex-direction: column; gap: 14px; }
  .form-actions { align-items: stretch; flex-direction: column; gap: 8px; }
}

@media (max-width: 460px) {
  .auth-panel { padding: 40px 20px; }
  .metric-grid, .admin-metrics { grid-template-columns: 1fr; }
  .topbar h2 { font-size: 20px; }
}
