:root {
  color-scheme: light;
  --ink: #1e3347;
  --muted: #718196;
  --line: rgba(72, 103, 133, .16);
  --blue: #247fc4;
  --green: #15966f;
  --red: #c84858;
  --card: rgba(255, 255, 255, .82);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: radial-gradient(circle at 8% 0%, rgba(64, 172, 220, .14), transparent 32%), radial-gradient(circle at 95% 8%, rgba(40, 186, 147, .12), transparent 28%), #f4f7fb; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.admin-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 70px; }
.admin-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.back-link { color: #517089; font-size: 13px; font-weight: 750; text-decoration: none; }
.eyebrow, .section-kicker { margin: 22px 0 5px; color: #2685b1; font-size: 10px; font-weight: 900; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(31px, 5vw, 48px); letter-spacing: -.04em; }
h2 { margin-bottom: 7px; font-size: 20px; }
.intro, .auth-card p, .section-heading p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.connection-state { display: flex; min-width: 132px; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.7); font-size: 12px; }
.connection-state span { width: 8px; height: 8px; border-radius: 50%; background: #a9b3bd; }
.connection-state.connected span { background: var(--green); box-shadow: 0 0 0 5px rgba(21,150,111,.1); }
.auth-card, .proxy-section { border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: 0 22px 60px rgba(31, 61, 88, .08), inset 0 1px rgba(255,255,255,.9); backdrop-filter: blur(20px); }
.auth-card { display: grid; grid-template-columns: minmax(260px,.75fr) minmax(420px,1.25fr); gap: 28px; padding: 22px; }
.auth-card .section-kicker, .section-heading .section-kicker { margin-top: 0; }
.auth-form { display: grid; align-content: center; gap: 8px; }
.auth-form label { display: grid; gap: 6px; color: #4e6478; font-size: 11px; font-weight: 850; }
.credentials-row { display: grid; grid-template-columns: minmax(150px,.8fr) minmax(190px,1fr) auto; align-items: end; gap: 8px; }
.login-actions { display: flex; gap: 8px; }
input, textarea { width: 100%; border: 1px solid rgba(72,103,133,.22); outline: 0; color: var(--ink); background: rgba(250,253,255,.92); transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus { border-color: rgba(36,127,196,.55); box-shadow: 0 0 0 4px rgba(36,127,196,.09); }
input { min-height: 42px; padding: 0 12px; border-radius: 11px; }
.primary-button, .quiet-button, .test-button { min-height: 40px; padding: 0 15px; border-radius: 11px; font-size: 12px; font-weight: 850; white-space: nowrap; }
.primary-button { border: 1px solid rgba(36,127,196,.35); color: #fff; background: linear-gradient(135deg,#2a8bd2,#1876b8); box-shadow: 0 8px 18px rgba(36,127,196,.18); }
.primary-button:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }
.quiet-button, .test-button { border: 1px solid var(--line); color: #526a80; background: rgba(255,255,255,.82); }
.form-message, .save-message { min-height: 18px; margin: 0; color: var(--muted); font-size: 11px; }
.form-message.error, .save-message.error, .test-status.error { color: var(--red); }
.form-message.success, .save-message.success, .test-status.success { color: var(--green); }
.proxy-section { margin-top: 18px; padding: 22px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.save-button { min-width: 140px; }
.channel-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.channel-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: rgba(250,253,255,.7); }
.channel-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px; border-bottom: 1px solid var(--line); }
.channel-identity { display: flex; min-width: 0; align-items: center; gap: 11px; }
.country-badge { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(145deg,#368dd0,#275f9e); font-size: 11px; font-weight: 950; }
.channel-identity > span:last-child { display: grid; min-width: 0; gap: 3px; }
.channel-identity strong { font-size: 14px; }
.channel-identity small { overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.switch-label { display: flex; align-items: center; gap: 7px; color: #617389; font-size: 11px; font-weight: 800; }
.switch-label input { width: 17px; min-height: 17px; accent-color: var(--green); }
.channel-card-body { padding: 14px; }
.channel-card textarea { min-height: 132px; resize: vertical; padding: 11px; border-radius: 12px; font: 11.5px/1.55 ui-monospace, Consolas, monospace; }
.channel-meta { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 9px; }
.test-status { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.test-button { min-height: 31px; padding: 0 10px; font-size: 10.5px; }
.empty-state { grid-column: 1/-1; display: grid; min-height: 180px; place-items: center; border: 1px dashed rgba(72,103,133,.25); border-radius: 18px; color: var(--muted); font-size: 13px; }
.save-message { margin-top: 12px; text-align: right; }
.site-settings-grid { display: flex; align-items: end; gap: 12px; }
.site-settings-grid label { display: grid; min-width: 0; flex: 1; gap: 6px; color: #4e6478; font-size: 11px; font-weight: 850; }
.site-settings-grid label small { color: var(--muted); font-size: 9.5px; font-weight: 650; }
.purchase-cdk-preview { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 0 14px; border: 1px solid rgba(36,127,196,.25); border-radius: 11px; color: #247fc4; background: rgba(255,255,255,.8); font-size: 11px; font-weight: 850; text-decoration: none; white-space: nowrap; }
.code-generator { display: grid; grid-template-columns: 120px 150px 150px minmax(180px,1fr) auto; align-items: end; gap: 10px; }
.code-generator label { display: grid; gap: 6px; color: #4e6478; font-size: 11px; font-weight: 850; }
.code-generator label small { min-height: 13px; color: var(--muted); font-size: 9.5px; font-weight: 650; }
.code-generator input { min-height: 40px; }
.code-generator .code-note { align-self: end; }
.generated-codes { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; margin-top: 15px; padding: 14px; border: 1px solid rgba(21,150,111,.22); border-radius: 16px; background: rgba(231,252,245,.72); }
.generated-codes[hidden] { display: none; }
.generated-codes > div { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.generated-codes > div span { color: #637a72; font-size: 10.5px; }
.generated-codes textarea { min-height: 92px; resize: vertical; padding: 10px; border-radius: 11px; font: 12px/1.55 ui-monospace, Consolas, monospace; }
.code-editor { margin-top: 15px; padding: 15px; border: 1px solid rgba(36,127,196,.22); border-radius: 16px; background: rgba(238,248,255,.76); }
.code-editor[hidden] { display: none; }
.code-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.code-editor-heading > div { display: grid; gap: 3px; }
.code-editor-heading span { color: var(--muted); font-size: 10.5px; }
.code-editor-grid { display: grid; grid-template-columns: minmax(230px,1.25fr) minmax(190px,1fr) 130px 130px; align-items: end; gap: 10px; }
.code-editor-grid label { display: grid; gap: 6px; color: #4e6478; font-size: 11px; font-weight: 850; }
.code-editor-grid label small { min-height: 13px; color: var(--muted); font-size: 9.5px; font-weight: 650; }
.code-editor-grid .edit-code-note { grid-column: 1/4; }
.code-editor-grid .edit-code-enabled { display: flex; min-height: 42px; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.72); }
.code-editor-grid .edit-code-enabled input { width: 17px; min-height: 17px; accent-color: var(--green); }
.code-editor-grid #save-code-edit { grid-column: 4; }
.code-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 0 2px 9px; color: #40566c; font-size: 12px; }
.code-list-heading span { color: var(--muted); font-size: 10.5px; }
.code-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; background: rgba(250,253,255,.7); }
.code-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.code-table th, .code-table td { padding: 10px; border-bottom: 1px solid rgba(72,103,133,.1); text-align: left; white-space: nowrap; }
.code-table th { color: #63768a; background: rgba(237,245,250,.66); font-size: 10px; }
.code-table tr:last-child td { border-bottom: 0; }
.code-table code { color: #315d7e; font-size: 10.5px; }
.code-actions { display: flex; align-items: center; gap: 6px; }
.code-action.copy { color: #247fc4; }
.code-action:disabled { cursor: not-allowed; opacity: .45; }
.code-status { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.code-status.active { color: var(--green); background: rgba(21,150,111,.09); }
.code-status.disabled, .code-status.expired, .code-status.exhausted { color: var(--red); background: rgba(200,72,88,.08); }
.code-action { min-height: 29px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; color: #536b82; background: #fff; font-size: 10px; font-weight: 800; }
.table-empty { height: 80px; color: var(--muted); text-align: center !important; }
.toast-region { position: fixed; top: 18px; left: 50%; z-index: 20; display: grid; width: min(380px,calc(100% - 30px)); gap: 8px; transform: translateX(-50%); }
.toast { padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: rgba(255,255,255,.96); box-shadow: 0 16px 40px rgba(31,61,88,.16); font-size: 12px; }
.toast.success { color: var(--green); }.toast.error { color: var(--red); }
@media (max-width: 1080px) { .code-generator { grid-template-columns: repeat(3,minmax(0,1fr)); }.code-generator .code-note { grid-column: 1/3; }.code-editor-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }.code-editor-grid .edit-code-note, .code-editor-grid #save-code-edit { grid-column: auto; } }
@media (max-width: 920px) { .admin-header { align-items: flex-start; flex-direction: column; }.auth-card { grid-template-columns: 1fr; }.channel-grid { grid-template-columns: 1fr; }.credentials-row { grid-template-columns: 1fr 1fr; }.login-actions { grid-column: 1/-1; } }
@media (max-width: 560px) { .admin-shell { width: min(100% - 20px,1180px); padding-top: 20px; }.credentials-row, .code-generator, .code-editor-grid { grid-template-columns: 1fr; }.login-actions, .code-generator .code-note, .code-editor-grid .edit-code-note, .code-editor-grid #save-code-edit { grid-column: auto; }.section-heading { align-items: stretch; flex-direction: column; }.auth-card, .proxy-section { padding: 16px; border-radius: 18px; }.save-button { width: 100%; }.site-settings-grid { align-items: stretch; flex-direction: column; }.purchase-cdk-preview { width: 100%; }.generated-codes { grid-template-columns: 1fr; }.generated-codes > button { width: 100%; }.code-actions { flex-wrap: wrap; } }
