:root{--bg:#f4f7fb;--panel:#fff;--text:#172033;--muted:#718096;--line:#e5eaf2;--blue:#2563eb;--blue2:#eff6ff;--danger:#b42318;--green:#087a55;--shadow:0 8px 30px rgba(31,45,61,.06)}*{box-sizing:border-box}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;background:var(--bg);color:var(--text)}a{color:inherit;text-decoration:none}.shell{min-height:100vh;display:grid;grid-template-columns:250px 1fr}.sidebar{position:sticky;top:0;height:100vh;background:#fff;border-right:1px solid var(--line);padding:22px 16px;display:flex;flex-direction:column}.brand,.login-brand{display:flex;align-items:center;gap:10px;font-size:21px;font-weight:800}.brand-mark{display:inline-flex;width:36px;height:36px;border-radius:10px;background:var(--blue);color:#fff;align-items:center;justify-content:center;font-weight:900}.role-label{font-size:12px;color:var(--muted);padding:12px 8px 18px}nav{display:flex;flex-direction:column;gap:5px}.nav-item{padding:11px 12px;border-radius:9px;font-size:14px}.nav-item.active{background:var(--blue2);color:var(--blue);font-weight:700}.nav-item.muted{color:#a0a9b8;cursor:default;display:flex;justify-content:space-between;gap:8px}.nav-item b{font-size:9px;text-transform:uppercase;font-weight:700}.sidebar-bottom{margin-top:auto;border-top:1px solid var(--line);padding:16px 10px 0}.user-name{font-weight:700;font-size:14px}.link-button{border:0;background:none;padding:7px 0;color:var(--muted);cursor:pointer}.content{padding:34px;max-width:1450px;width:100%}.page-head{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px}.page-head h1{font-size:30px;margin:0 0 5px}.page-head p,.subtle{margin:0;color:var(--muted)}.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:22px}.stat{background:var(--panel);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:14px;padding:20px;min-height:120px;display:flex;flex-direction:column;gap:6px}.stat span{color:var(--muted);font-size:13px}.stat strong{font-size:32px;line-height:1.1}.stat strong.version{font-size:20px;color:var(--blue);margin-top:5px}.stat small{font-size:11px;color:#a0a9b8}.grid{display:grid;gap:18px}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}.card{background:var(--panel);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:14px;padding:22px}.card h2{font-size:17px;margin:0 0 18px}.button{display:inline-flex;align-items:center;justify-content:center;border:1px solid #d5dce7;background:#fff;border-radius:9px;padding:10px 14px;font-weight:700;font-size:14px;cursor:pointer}.button.primary{background:var(--blue);border-color:var(--blue);color:#fff}.actions{display:grid;gap:9px}.action{padding:13px 14px;border:1px solid var(--line);border-radius:10px;font-weight:600;font-size:14px}.check-list,.roadmap{padding-left:20px;line-height:2;color:#4a5568}.table-card{padding:0;overflow:hidden}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:15px 17px;border-bottom:1px solid var(--line);font-size:13px;vertical-align:middle}th{background:#fafbfc;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.03em}.small{font-size:11px;color:var(--muted);margin-top:4px}.badge{display:inline-flex;border-radius:999px;padding:5px 9px;font-size:11px;font-weight:800}.badge.ok{background:#ecfdf3;color:var(--green)}.badge.off{background:#f2f4f7;color:#667085}.empty{text-align:center;color:var(--muted);padding:30px}.form-card{max-width:900px}.form-stack{display:grid;gap:15px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}label{display:grid;gap:7px;font-size:13px;font-weight:700}input,select,textarea{width:100%;border:1px solid #cfd7e3;border-radius:9px;padding:11px 12px;font:inherit;background:#fff;color:var(--text);outline:none}input:focus{border-color:#84aafc;box-shadow:0 0 0 3px #eaf1ff}.inline{display:flex;align-items:center;gap:10px}.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:22px}hr{border:0;border-top:1px solid var(--line);margin:24px 0}.alert{border-radius:10px;padding:12px 14px;margin-bottom:16px;font-size:13px}.alert.error{background:#fff1f0;color:var(--danger);border:1px solid #fecdca}.list{display:grid}.list-row{display:flex;justify-content:space-between;align-items:center;padding:13px 0;border-bottom:1px solid var(--line)}.details{display:grid;grid-template-columns:180px 1fr;gap:14px 20px;margin:0 0 22px}.details dt{color:var(--muted);font-size:13px}.details dd{margin:0;font-weight:700}.login-body{min-height:100vh;display:grid;place-items:center;padding:20px;background:radial-gradient(circle at top,#eaf1ff 0,#f5f7fb 45%)}.login-card{width:min(430px,100%);background:#fff;border:1px solid var(--line);box-shadow:0 20px 55px rgba(23,32,51,.12);border-radius:18px;padding:34px}.login-card h1{font-size:26px;margin:28px 0 5px}.login-card .subtle{margin-bottom:22px}@media(max-width:900px){.shell{grid-template-columns:1fr}.sidebar{position:static;height:auto}.sidebar nav{display:grid;grid-template-columns:repeat(2,1fr)}.sidebar-bottom{margin-top:14px}.content{padding:20px}.stats,.grid.two,.form-grid{grid-template-columns:1fr}.page-head{align-items:flex-start;flex-direction:column}.details{grid-template-columns:1fr}.details dd{margin-bottom:6px}}
.badge.danger,.status-failed{background:#fff1f0;color:#b42318}.badge.status-success,.status-success{background:#ecfdf3;color:#087a55}.status-queued{background:#eef4ff;color:#175cd3}.status-validating,.status-backing_up,.status-installing,.status-building,.status-migrating,.status-restarting,.status-health_check,.status-rollback{background:#fff6ed;color:#b54708}.status-rolled_back{background:#f4f3ff;color:#5925dc}.alert.warning{background:#fffaeb;color:#93370d;border:1px solid #fedf89}.alert.info{background:#eff8ff;color:#175cd3;border:1px solid #b2ddff}.alert.success{background:#ecfdf3;color:#067647;border:1px solid #abefc6}.button.danger{background:#b42318;color:#fff;border-color:#b42318}.button:disabled{opacity:.5;cursor:not-allowed}.update-note{margin-top:16px;line-height:1.6}.update-history{margin-top:18px}.table-head{display:flex;align-items:center;justify-content:space-between;padding:20px 22px;border-bottom:1px solid var(--line)}.table-head h2{margin:0}.text-link{color:var(--blue);font-weight:700}.log-card{margin-top:18px}.update-log{margin:0;background:#101828;color:#d0d5dd;border-radius:10px;padding:18px;min-height:260px;max-height:520px;overflow:auto;white-space:pre-wrap;word-break:break-word;font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.compact-details{grid-template-columns:170px 1fr}.update-grid code{background:#f2f4f7;padding:2px 5px;border-radius:5px}
.section-title{font-size:20px;margin:28px 0 14px}.connection-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.connection-card{display:flex;flex-direction:column;gap:18px}.connection-title{display:flex;justify-content:space-between;gap:14px;align-items:flex-start}.connection-title strong{font-size:20px}.status-active{background:#ecfdf3;color:#087a55}.status-expired{background:#fff6ed;color:#b54708}.status-inactive{background:#f2f4f7;color:#667085}.status-disabled{background:#fff1f0;color:#b42318}.compact-form{margin-top:auto}.field-help{font-size:11px;font-weight:400;color:var(--muted);line-height:1.45}.checkbox-label{display:flex;grid-template-columns:none;flex-direction:row;align-items:center;gap:9px;font-weight:600}.checkbox-label input{width:auto}.line-height{line-height:1.7}.wide-form{max-width:1000px}.tariffs-layout{margin-bottom:18px}.tariffs-table{margin-top:18px}.row-actions{display:flex;gap:7px;flex-wrap:wrap}.row-actions form{margin:0}.small-button{padding:7px 10px;font-size:12px}.danger-outline{color:#b42318;border-color:#f3b3ad}.placeholder-action{border:1px dashed #ccd4e0;background:#fafbfc;color:var(--muted);border-radius:10px;padding:13px;text-align:center;font-size:13px}.subscription-price{font-size:30px;font-weight:800;color:var(--blue)}.subscription-price span{font-size:12px;font-weight:500;color:var(--muted);margin-left:4px}.payment-platform-note{margin-top:18px}.account-summary{margin-bottom:6px}@media(max-width:1100px){.connection-grid{grid-template-columns:1fr}}

/* Stage 4.1 — persistent theme, sidebar version and live updater progress */
.hidden{display:none!important}
.sidebar-bottom{padding:14px 4px 0}
.sidebar-tools{display:grid;gap:10px;padding:0 6px 14px;border-bottom:1px solid var(--line);margin-bottom:14px}
.version-label{font:600 11px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:var(--muted);opacity:.82;letter-spacing:.02em}
.sidebar-user{padding:0 6px}
.theme-toggle{width:100%;display:flex;align-items:center;gap:8px;border:1px solid var(--line);background:var(--panel);color:var(--text);border-radius:10px;padding:8px 9px;cursor:pointer;font:600 12px/1.2 inherit;transition:border-color .18s ease,background .18s ease,color .18s ease}
.theme-toggle:hover{border-color:#aeb9c8}
.theme-icon{width:16px;text-align:center;font-size:15px;line-height:1}
.theme-icon-moon{display:none}.theme-toggle-text{flex:1;text-align:left}.theme-switch{position:relative;width:32px;height:18px;border-radius:999px;background:#d8dee8;transition:background .18s ease}.theme-switch span{position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(16,24,40,.25);transition:transform .18s ease}
html[data-theme="dark"] .theme-icon-sun{display:none}html[data-theme="dark"] .theme-icon-moon{display:inline-block}html[data-theme="dark"] .theme-switch{background:var(--blue)}html[data-theme="dark"] .theme-switch span{transform:translateX(14px)}

.update-progress-card{margin-bottom:18px;border-color:#b9cef9;overflow:hidden}
.update-progress-head{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;margin-bottom:18px}.update-progress-head h2{margin:2px 0 0;font-size:20px}.eyebrow{color:var(--blue);font-size:11px;text-transform:uppercase;letter-spacing:.07em;font-weight:800}
.progress-track{height:12px;background:#e8edf5;border-radius:999px;overflow:hidden}.progress-bar{height:100%;min-width:3px;background:linear-gradient(90deg,#3b82f6,#2563eb);border-radius:999px;transition:width .4s ease}.progress-bar.success{background:linear-gradient(90deg,#12b76a,#087a55)}.progress-bar.failed{background:linear-gradient(90deg,#f97066,#b42318)}
.progress-meta{display:flex;align-items:center;gap:14px;margin-top:11px}.progress-meta strong{font-size:15px;color:var(--blue)}.progress-meta span{font-size:13px;color:var(--muted)}
.update-connection-state{margin-top:14px;padding:10px 12px;border-radius:9px;background:#f8fafc;color:var(--muted);font-size:12px;border:1px solid var(--line)}.update-connection-state.online{background:#ecfdf3;color:#067647;border-color:#abefc6}.update-connection-state.reconnecting{background:#fffaeb;color:#93370d;border-color:#fedf89}
.live-log{margin-top:14px;border-top:1px solid var(--line);padding-top:13px}.live-log summary{cursor:pointer;color:var(--muted);font-size:12px;font-weight:700;margin-bottom:10px}.live-log .update-log{min-height:170px;max-height:360px}

/* Full dark theme. It uses the same layout/accents, but all surfaces, controls and status blocks are tuned for low-light use. */
html[data-theme="dark"]{color-scheme:dark;--bg:#0f1420;--panel:#171e2b;--text:#eef2f8;--muted:#97a3b6;--line:#2a3444;--blue:#6ea0ff;--blue2:#1b3155;--danger:#ff8b83;--green:#54d6a0;--shadow:0 10px 32px rgba(0,0,0,.24)}
html[data-theme="dark"] body{background:var(--bg);color:var(--text)}
html[data-theme="dark"] .sidebar{background:#121925;border-color:var(--line)}
html[data-theme="dark"] .brand-mark{background:#3978ed;color:#fff}
html[data-theme="dark"] .nav-item.active{background:#1a3156;color:#8bb2ff}
html[data-theme="dark"] .nav-item.muted{color:#667386}
html[data-theme="dark"] .card,html[data-theme="dark"] .stat{background:var(--panel);border-color:var(--line);box-shadow:var(--shadow)}
html[data-theme="dark"] .button{background:#1c2533;border-color:#364255;color:var(--text)}
html[data-theme="dark"] .button:hover{background:#222d3d}
html[data-theme="dark"] .button.primary{background:#3978ed;border-color:#3978ed;color:#fff}
html[data-theme="dark"] .button.danger{background:#b93d37;border-color:#b93d37;color:#fff}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea{background:#101722;border-color:#354154;color:var(--text)}
html[data-theme="dark"] input:focus,html[data-theme="dark"] select:focus,html[data-theme="dark"] textarea:focus{border-color:#5f8fe8;box-shadow:0 0 0 3px rgba(76,132,238,.17)}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#6e7a8c}
html[data-theme="dark"] th{background:#121925;color:#91a0b4}html[data-theme="dark"] th,html[data-theme="dark"] td{border-color:var(--line)}
html[data-theme="dark"] .action,html[data-theme="dark"] .list-row,html[data-theme="dark"] hr,html[data-theme="dark"] .table-head,html[data-theme="dark"] .live-log{border-color:var(--line)}
html[data-theme="dark"] .check-list,html[data-theme="dark"] .roadmap{color:#b5bfce}
html[data-theme="dark"] .placeholder-action{background:#121925;border-color:#3b4658;color:var(--muted)}
html[data-theme="dark"] .update-grid code{background:#101722;color:#cbd5e1}
html[data-theme="dark"] .update-log{background:#090e16;color:#ccd5e2;border:1px solid #263142}
html[data-theme="dark"] .progress-track{background:#263142}
html[data-theme="dark"] .update-connection-state{background:#121925;border-color:var(--line)}
html[data-theme="dark"] .alert.error{background:#391c20;color:#ffb4ad;border-color:#6c2b2b}
html[data-theme="dark"] .alert.warning,html[data-theme="dark"] .update-connection-state.reconnecting{background:#382b14;color:#ffd58a;border-color:#70511d}
html[data-theme="dark"] .alert.info{background:#142b47;color:#a8ceff;border-color:#28517e}
html[data-theme="dark"] .alert.success,html[data-theme="dark"] .update-connection-state.online{background:#123227;color:#8ee8bf;border-color:#245f49}
html[data-theme="dark"] .badge.ok,html[data-theme="dark"] .badge.status-success,html[data-theme="dark"] .status-success,html[data-theme="dark"] .status-active{background:#123227;color:#75dfb0}
html[data-theme="dark"] .badge.off,html[data-theme="dark"] .status-inactive{background:#252e3b;color:#a8b2c1}
html[data-theme="dark"] .badge.danger,html[data-theme="dark"] .status-failed,html[data-theme="dark"] .status-disabled{background:#3a1d22;color:#ff9d96}
html[data-theme="dark"] .status-queued{background:#182c4b;color:#93bbff}
html[data-theme="dark"] .status-validating,html[data-theme="dark"] .status-backing_up,html[data-theme="dark"] .status-installing,html[data-theme="dark"] .status-building,html[data-theme="dark"] .status-migrating,html[data-theme="dark"] .status-restarting,html[data-theme="dark"] .status-health_check,html[data-theme="dark"] .status-rollback,html[data-theme="dark"] .status-expired{background:#382b14;color:#ffc970}
html[data-theme="dark"] .status-rolled_back{background:#282347;color:#c4b5fd}
html[data-theme="dark"] .danger-outline{color:#ff9993;border-color:#74413f}
html[data-theme="dark"] .theme-toggle{background:#101722;border-color:#303b4d}
html[data-theme="dark"] .theme-toggle:hover{background:#182130;border-color:#46546a}
html[data-theme="dark"] .theme-switch span{background:#eaf0f8}

@media(max-width:900px){.sidebar-tools{padding-top:4px}.theme-toggle{max-width:240px}.update-progress-head,.progress-meta{align-items:flex-start}.progress-meta{flex-direction:column;gap:4px}}

/* 0.5.0 — MAX integration and moderation */
.settings-checks{display:grid;gap:10px;margin-top:14px}.connection-grid-main{grid-template-columns:2fr 1fr 1fr}.max-connection-card{gap:14px}.max-config-form{display:grid;gap:12px}.max-api-state{padding:10px 12px;border-radius:9px;border:1px solid var(--line);background:#f8fafc;font-size:12px}.max-api-state.api-ok{background:#ecfdf3;border-color:#abefc6;color:#067647}.max-api-state.api-error{background:#fff1f0;border-color:#fecdca;color:#b42318}.connection-error{color:var(--danger);word-break:break-word}.max-connection-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 16px;background:#f8fafc;border:1px solid var(--line);border-radius:10px;padding:12px}.max-connection-meta div{display:grid;gap:3px}.max-connection-meta span{font-size:11px;color:var(--muted)}.max-connection-meta strong{font-size:13px;word-break:break-word}.max-actions form{margin:0}.button.primary-soft{background:var(--blue2);border-color:#b9cef9;color:var(--blue)}.mode-help{margin-top:-3px}.mode-help code{padding:1px 4px;background:#f2f4f7;border-radius:4px}.connection-guide{margin-top:18px}.numbered-roadmap{padding-left:22px}.numbered-roadmap li{margin:8px 0}.table-wrap{overflow:auto}.table-card{padding:0}.table-card table{margin:0}.submission-text-cell{min-width:320px;max-width:580px}.submission-preview{max-height:74px;overflow:hidden;white-space:pre-wrap;line-height:1.45;margin-bottom:6px}.submission-status{white-space:nowrap}.status-submission-text_approved{background:#ecfdf3;color:#067647}.status-submission-manual_review,.status-submission-appeal_pending{background:#fffaeb;color:#93370d}.status-submission-ai_rejected,.status-submission-rejected,.status-submission-wrong_type{background:#fff1f0;color:#b42318}.status-submission-ai_checking,.status-submission-received,.status-submission-missing_contact{background:#eff8ff;color:#175cd3}.empty-state{padding:38px 22px;text-align:center;color:var(--muted)}.empty-state strong{display:block;color:var(--text);font-size:17px;margin-bottom:6px}
html[data-theme="dark"] .max-api-state,html[data-theme="dark"] .max-connection-meta{background:#121925;border-color:var(--line)}html[data-theme="dark"] .max-api-state.api-ok{background:#123227;border-color:#245f49;color:#8ee8bf}html[data-theme="dark"] .max-api-state.api-error{background:#391c20;border-color:#6c2b2b;color:#ffb4ad}html[data-theme="dark"] .mode-help code{background:#101722;color:#cbd5e1}html[data-theme="dark"] .button.primary-soft{background:#1a3156;border-color:#355b93;color:#8bb2ff}html[data-theme="dark"] .status-submission-text_approved{background:#123227;color:#75dfb0}html[data-theme="dark"] .status-submission-manual_review,html[data-theme="dark"] .status-submission-appeal_pending{background:#382b14;color:#ffc970}html[data-theme="dark"] .status-submission-ai_rejected,html[data-theme="dark"] .status-submission-rejected,html[data-theme="dark"] .status-submission-wrong_type{background:#3a1d22;color:#ff9d96}html[data-theme="dark"] .status-submission-ai_checking,html[data-theme="dark"] .status-submission-received,html[data-theme="dark"] .status-submission-missing_contact{background:#142b47;color:#a8ceff}
@media(max-width:1200px){.connection-grid-main{grid-template-columns:1fr}.max-connection-meta{grid-template-columns:1fr 1fr}}@media(max-width:700px){.max-connection-meta{grid-template-columns:1fr}.submission-text-cell{min-width:240px}}
