:root { color-scheme: light; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #172033; background: #f5f7fb; }
[data-theme="dark"] { color-scheme: dark; color: #e6edf8; background: #0c1422; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f5f7fb; color: #172033; transition: background .2s ease, color .2s ease; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; }
.app-shell { min-height: 100vh; }
.loading { padding: 48px; text-align: center; color: #65728a; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #dceaff, transparent 35%), #f5f7fb; }
.auth-card { width: min(440px, 100%); background: white; border: 1px solid #e5eaf2; border-radius: 18px; box-shadow: 0 16px 50px #25365b18; padding: 32px; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 26px; }
.auth-card .brand { justify-content: center; }
.brand-logo { width: 54px; height: 54px; border-radius: 14px; display: block; object-fit: cover; flex: 0 0 auto; }
.sidebar .brand-logo { width: 38px; height: 38px; border-radius: 10px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 23px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.muted { color: #738097; font-size: 13px; }
.field { display: grid; gap: 7px; margin: 15px 0; }
.field label { color: #46526a; font-size: 13px; font-weight: 600; }
input, textarea, select { width: 100%; border: 1px solid #dbe2ee; border-radius: 9px; padding: 10px 12px; outline: none; background: #fff; color: #172033; }
input:focus, textarea:focus, select:focus { border-color: #5b7cff; box-shadow: 0 0 0 3px #5b7cff20; }
textarea { min-height: 82px; resize: vertical; }
.btn { border-radius: 9px; padding: 10px 14px; font-weight: 650; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: #316dff; color: #fff; }
.btn-secondary { background: #eef2f8; color: #33415b; }
.btn-danger { background: #fff0f0; color: #d33d47; }
.btn-small { padding: 7px 10px; font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.error { background: #fff0f0; color: #c93642; border: 1px solid #ffd3d6; padding: 10px 12px; border-radius: 9px; font-size: 13px; margin: 12px 0; }
.notice { background: #eff8ff; color: #25638e; border: 1px solid #cae8fb; padding: 11px 13px; border-radius: 9px; font-size: 13px; margin: 12px 0; white-space: pre-wrap; word-break: break-word; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.sidebar { background: #111a2a; color: #d8e1f0; padding: 22px 14px; display: flex; flex-direction: column; }
.sidebar .brand { margin: 0 10px 30px; }
.nav { display: grid; gap: 5px; }
.nav button { text-align: left; color: #afbad0; background: transparent; border-radius: 8px; padding: 11px 12px; }
.nav button.active, .nav button:hover { background: #243452; color: #fff; }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; padding: 12px 10px 0; }
.sidebar-footer button { color: #aeb9ce; background: transparent; text-align: left; padding: 7px 0; }
.main { padding: 28px clamp(18px, 4vw, 50px); overflow: auto; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 23px; }
.topbar h1 { font-size: 25px; }
.gateway-endpoint { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: #56647d; font-size: 13px; }
.gateway-endpoint code { color: #1e5ee8; background: #eaf1ff; border: 1px solid #c9dcff; border-radius: 7px; padding: 6px 10px; font-size: 14px; font-weight: 750; letter-spacing: 0; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat, .panel, .channel-card { background: #fff; border: 1px solid #e6ebf3; border-radius: 14px; box-shadow: 0 4px 14px #25365b08; }
.stat { padding: 18px; }
.stat .number { font-size: 26px; font-weight: 750; margin-top: 6px; }
.panel { padding: 20px; margin-top: 17px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.channel-card { padding: 17px; }
.channel-card-active { border-color: #28b779; background: linear-gradient(135deg, #f4fffa 0%, #ffffff 72%); box-shadow: 0 0 0 2px #28b77928, 0 10px 26px #168a5520; }
.channel-card-active .channel-title h3 { color: #11794d; }
.channel-title { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.channel-title h3 { word-break: break-word; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; background: #eef2f8; color: #66738b; }
.badge-on { background: #e9f9ef; color: #18854a; }
.badge-off { background: #fff0f0; color: #c93642; }
.badge-running { background: #e9f9ef; color: #18854a; }
.badge-paused { background: #fff0f0; color: #c93642; }
.safety-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.switch { position: relative; display: inline-block; width: 48px; height: 27px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd3df; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px #1d2c4928; transition: .2s; }
.switch input:checked + span { background: #316dff; }
.switch input:checked + span::before { transform: translateX(21px); }
.error-row { color: #c93642; }
.channel-meta { display: grid; gap: 9px; margin: 18px 0; font-size: 13px; }
.meta-row { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #edf0f5; padding-bottom: 7px; }
.meta-row span:last-child { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 68%; }
.card-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 9px; border-bottom: 1px solid #edf0f5; vertical-align: top; white-space: nowrap; }
th { color: #6d7990; font-weight: 600; }
.empty { padding: 34px 12px; text-align: center; color: #7a869c; font-size: 13px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: #10203b75; display: grid; place-items: center; padding: 18px; }
.modal { background: #fff; border-radius: 15px; width: min(700px, 100%); max-height: 92vh; overflow: auto; padding: 23px; box-shadow: 0 20px 70px #10203b40; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; }
.modal-close { background: transparent; color: #758199; font-size: 24px; line-height: 1; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.checkbox-field { display: flex; gap: 8px; align-items: center; margin: 15px 0; font-size: 13px; }
.checkbox-field input { width: auto; }
.key-box { padding: 13px; background: #f7f9fd; border-radius: 9px; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
[data-theme="dark"] body, [data-theme="dark"] .main { background: #0c1422; color: #e6edf8; }
[data-theme="dark"] .auth-wrap { background: radial-gradient(circle at 20% 10%, #1b3152, transparent 35%), #0c1422; }
[data-theme="dark"] .auth-card, [data-theme="dark"] .stat, [data-theme="dark"] .panel, [data-theme="dark"] .channel-card, [data-theme="dark"] .modal { background: #151f30; border-color: #2b3a52; box-shadow: 0 8px 24px #00000035; }
[data-theme="dark"] .channel-card-active { background: linear-gradient(135deg, #15372f 0%, #152538 72%); border-color: #35d493; box-shadow: 0 0 0 2px #35d49338, 0 10px 30px #0abd7230; }
[data-theme="dark"] .channel-card-active .channel-title h3 { color: #85efbf; }
[data-theme="dark"] .muted, [data-theme="dark"] .gateway-endpoint { color: #9eacc3; }
[data-theme="dark"] .field label { color: #c1cde0; }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background: #0f1929; color: #e6edf8; border-color: #34445d; }
[data-theme="dark"] .btn-secondary { background: #26354c; color: #dbe6f7; }
[data-theme="dark"] .gateway-endpoint code { color: #8db8ff; background: #182d4d; border-color: #31588e; }
[data-theme="dark"] .badge { background: #26354c; color: #b7c5da; }
[data-theme="dark"] .badge-on, [data-theme="dark"] .badge-running { background: #153d32; color: #70dfae; }
[data-theme="dark"] .badge-off, [data-theme="dark"] .badge-paused { background: #49262f; color: #ff9ca5; }
[data-theme="dark"] .meta-row, [data-theme="dark"] th, [data-theme="dark"] td { border-color: #2a3850; }
[data-theme="dark"] th { color: #a8b6cb; }
[data-theme="dark"] .empty { color: #9aa9bf; }
[data-theme="dark"] .key-box { background: #0f1929; }
[data-theme="dark"] .notice { background: #17334a; color: #9fd4ff; border-color: #2b5e83; }
[data-theme="dark"] .error { background: #48252e; color: #ffabb2; border-color: #783b46; }
[data-theme="dark"] .modal-backdrop { background: #020713b8; }
[data-theme="dark"] .modal-close { color: #aebbd0; }
@media (max-width: 1280px) { .channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) { .three-col { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } .sidebar { padding: 12px; } .sidebar .brand { margin-bottom: 12px; } .nav { display: flex; overflow-x: auto; } .nav button { white-space: nowrap; } .sidebar-footer { display: flex; justify-content: space-between; } .main { padding: 20px 14px; } .grid-3, .two-col, .channel-grid { grid-template-columns: 1fr; } .topbar { flex-direction: column; } }
