/* Shared Material-inspired surfaces, typography and controls. */
:root {
  --bg:#f5f7fc; --bg-alt:#fff; --bg-accent:#edf1fa;
  --border:#dce2ed; --border-strong:#bac4d6; --text:#1b2437; --text-dim:#526078;
  --primary:#315da8; --primary-accent:#244a89; --primary-fg:#fff;
  --selected:#dbe7ff; --selected-text:#193c74;
  --radius-sm:12px; --radius:20px;
  --shadow:0 2px 8px #1c2d4e0f,0 12px 32px #1c2d4e0a;
}
:root[data-theme='dark'] {
  --bg:#10141c; --bg-alt:#191f2b; --bg-accent:#222b3a;
  --border:#354054; --border-strong:#65738c; --text:#e5eaf5; --text-dim:#b3bfd3;
  --primary:#acc8ff; --primary-accent:#c6daff; --primary-fg:#123264;
  --selected:#2a426a; --selected-text:#dce8ff;
}
body { font-family:"Segoe UI",Roboto,system-ui,sans-serif; line-height:1.5; }
button,input,select,textarea { font:inherit; }
button { min-height:42px; padding:10px 20px; border:1px solid var(--border-strong); border-radius:24px; background:var(--bg-alt); color:var(--primary); font-size:.875rem; font-weight:600; cursor:pointer; transition:background .18s,box-shadow .18s,transform .18s; }
button:hover:not(:disabled) { background:var(--selected); box-shadow:0 2px 5px #142b4c12; }
button:active:not(:disabled) { transform:translateY(1px); }
button.primary { background:var(--primary); border-color:transparent; color:var(--primary-fg); }
button.primary:hover:not(:disabled) { background:var(--primary-accent); }
button:disabled { cursor:not-allowed; opacity:.45; box-shadow:none; }
button.danger { background:transparent; color:var(--danger); border-color:var(--danger); }
button:focus-visible,a:focus-visible { outline:3px solid var(--primary); outline-offset:3px; }
.sidebar { width:264px; padding:16px; gap:20px; background:var(--bg-accent); border:none; }
.brand { padding:12px 8px 20px; border-color:var(--border); }
.nav { gap:6px; }
.nav-item { min-height:48px; border-radius:28px; padding:12px 20px; font-size:.9rem; letter-spacing:0; border:0; }
.nav-item.active,.nav-item:hover { background:var(--selected); color:var(--selected-text); }
.nav-item#logoutBtn,.nav-item#restartBtn { border:none; font-weight:500; }
.nav-sep { margin:8px 12px; }
.main { margin-left:264px; max-width:none; }
.panels { padding:36px 40px 48px; }
.panel { max-width:1100px; width:100%; }
.panel h1 { display:flex; align-items:center; flex-wrap:wrap; gap:12px; font-size:1.8rem; font-weight:500; letter-spacing:-.6px; margin-bottom:28px; }
.panel h2 { font-size:1.1rem; font-weight:600; letter-spacing:0; }
.field { margin-bottom:24px; }
.field label { font-size:.875rem; font-weight:600; text-transform:none; letter-spacing:0; color:var(--text); gap:8px; }
.field input[type=text],.field input[type=password],.field input[type=number],.field textarea,.field select,.quality-json,.json-adv { background-color:var(--bg-alt); color:var(--text); border:1px solid var(--border-strong); border-radius:8px; padding:14px 16px; font-size:.9375rem; min-height:52px; max-width:100%; }
.field input:focus,.field textarea:focus,.field select:focus,.quality-json:focus,.json-adv:focus { border-color:var(--primary); outline:2px solid var(--primary); outline-offset:-2px; }
.field select { background-position:calc(100% - 20px) 24px,calc(100% - 14px) 24px; padding-right:38px; }
input[type=checkbox],input[type=radio] { accent-color:var(--primary); width:18px; height:18px; flex-shrink:0; }
.hint { font-size:.8rem; font-weight:400; letter-spacing:0; opacity:1; line-height:1.6; }
.status-grid { gap:20px; grid-template-columns:minmax(0,1fr); }
.status-block { border:1px solid var(--border); border-radius:24px; background:var(--bg-alt); padding:24px; box-shadow:var(--shadow); min-width:0; }
.status-block h2 { margin-bottom:20px; }
pre { border-radius:12px; font-size:.8rem; line-height:1.7; }
.providers-table { overflow-x:auto; font-size:.8rem; padding-bottom:4px; }
.prov-row { min-width:650px; padding:12px; gap:12px; border-radius:12px; background:var(--bg); }
.prov-row.header { background:var(--selected); color:var(--selected-text); border:0; font-size:.72rem; }
.badge { border-radius:8px; padding:4px 8px; }
.prov-item,.quality-presets label,.codec-presets .c-item,.codec-toggles label.codec-item { min-height:44px; border-radius:12px; font-size:.75rem; letter-spacing:0; text-transform:none; box-shadow:none; }
.prov-item:has(input:checked),.quality-presets label:has(input:checked),.codec-presets .c-item:has(input:checked),.codec-toggles label:has(input:checked) { background:var(--selected); color:var(--selected-text); border-color:var(--primary); }
.actions-bar { padding:16px 40px; gap:12px; flex-wrap:wrap; background:var(--bg-alt); box-shadow:0 -4px 20px #142b4c08; }
.alert { margin:24px 40px 0; border-radius:16px; font-size:.85rem; letter-spacing:0; }
.modal .modal-window { border-radius:28px; padding:28px; box-shadow:0 20px 80px #0004; }
.modal .modal-window h3 { font-size:1.4rem; font-weight:500; }
.modal .modal-text,.modal .modal-list,.modal .modal-opt { font-size:.9rem; line-height:1.6; }
.console-log-output { border-radius:16px; padding:20px; }
.burger { border-radius:16px; min-width:48px; min-height:48px; }
.login-page { display:grid; place-items:center; padding:32px 20px; height:auto; min-height:100dvh; overflow:auto; background:var(--bg); }
.login-card { width:100%; max-width:460px; border:1px solid var(--border); border-radius:28px; padding:40px; background:var(--bg-alt); box-shadow:var(--shadow); }
.login-brand { display:flex; align-items:center; gap:14px; margin-bottom:36px; }
.login-card h1 { font-size:2rem; font-weight:500; letter-spacing:-.7px; margin:0 0 8px; }
.login-description { margin:0 0 32px; color:var(--text-dim); font-size:.95rem; }
.login-card .field label { margin-bottom:8px; }
.login-card .field input { display:block; width:100%; font-family:inherit; }
.login-card #loginBtn { width:100%; min-height:48px; }
.login-card .status { display:block; margin-top:16px; min-height:24px; font-size:.875rem; }
.login-card .error { color:var(--danger); }
.login-card .success { color:#237343; }
#panel-outbound .moviebox-proxy-card {
  overflow:hidden; margin:0 0 28px; border:1px solid var(--border); border-radius:20px;
  background:var(--bg-alt); box-shadow:var(--shadow);
}
#panel-outbound .moviebox-proxy-card__top {
  display:flex; align-items:center; justify-content:space-between; gap:24px; padding:24px;
}
#panel-outbound .moviebox-proxy-card__intro { display:flex; align-items:flex-start; gap:16px; min-width:0; }
#panel-outbound .moviebox-proxy-card__icon {
  display:grid; place-items:center; flex:0 0 48px; width:48px; height:48px; border-radius:15px;
  background:var(--selected); color:var(--selected-text); font-size:1.35rem;
}
#panel-outbound .moviebox-proxy-card__eyebrow {
  margin:0 0 4px; color:var(--text-dim); font-size:.7rem; font-weight:700;
  letter-spacing:.08em; text-transform:uppercase;
}
#panel-outbound .moviebox-proxy-card__top h3 { margin:0 0 6px; color:var(--text); font-size:1.05rem; font-weight:650; }
#panel-outbound .moviebox-proxy-card__description { max-width:620px; margin:0; color:var(--text-dim); font-size:.84rem; line-height:1.55; }
.moviebox-proxy-toggle {
  display:flex; align-items:center; gap:10px; flex:0 0 auto; padding:10px 12px;
  border:1px solid var(--border); border-radius:14px; background:var(--bg);
  color:var(--text); cursor:pointer; font-size:.82rem; font-weight:600; white-space:nowrap;
}
.moviebox-proxy-toggle input {
  position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap;
}
.moviebox-proxy-toggle__track {
  position:relative; width:38px; height:22px; border-radius:999px; background:var(--border-strong);
  transition:background .18s ease;
}
.moviebox-proxy-toggle__track::after {
  position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%;
  background:#fff; content:""; box-shadow:0 1px 3px #0003; transition:transform .18s ease;
}
.moviebox-proxy-toggle:has(input:checked) .moviebox-proxy-toggle__track { background:var(--primary); }
.moviebox-proxy-toggle:has(input:checked) .moviebox-proxy-toggle__track::after { transform:translateX(16px); }
.moviebox-proxy-toggle input:focus-visible + .moviebox-proxy-toggle__track { outline:3px solid var(--primary); outline-offset:3px; }
#panel-outbound .moviebox-proxy-card__source {
  display:grid; grid-template-columns:minmax(0,1fr) minmax(260px,.75fr); align-items:center;
  gap:24px; padding:20px 24px; border-top:1px solid var(--border); background:var(--bg);
}
#panel-outbound .moviebox-proxy-card__link {
  display:inline-flex; align-items:center; gap:7px; margin-bottom:6px; color:var(--primary);
  font-size:.93rem; font-weight:650; text-decoration:none;
}
#panel-outbound .moviebox-proxy-card__link:hover { text-decoration:underline; }
#panel-outbound .moviebox-proxy-card__source-copy .moviebox-proxy-toggle { width:max-content; max-width:100%; margin-top:14px; }
#panel-outbound .moviebox-proxy-card__actions { display:flex; flex-direction:column; align-items:flex-start; gap:12px; }
#panel-outbound .moviebox-proxy-status {
  width:100%; margin:0; padding:10px 12px; border:1px solid var(--border); border-radius:10px;
  background:var(--bg-alt); color:var(--text-dim); font-size:.78rem; line-height:1.5; overflow-wrap:anywhere;
}
#panel-outbound .moviebox-proxy-download { display:inline-flex; align-items:center; justify-content:center; gap:9px; }
#panel-outbound .moviebox-proxy-card__footer {
  display:flex; justify-content:flex-end; align-items:center; gap:16px; padding:14px 24px;
  border-top:1px solid var(--border);
}
#panel-outbound .moviebox-proxy-card__footer .hint { margin:0 auto 0 0; }
.proxy-automation-controls { grid-template-columns:minmax(220px,.6fr) !important; }
.proxy-automation-field { display:flex; flex-direction:column; gap:8px; color:var(--text); font-size:.85rem; font-weight:600; }
.proxy-automation-field select { min-height:42px; width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:10px; background:var(--bg-alt); color:var(--text); font:inherit; }
@media(max-width:680px) {
  #panel-outbound .moviebox-proxy-card__top { align-items:flex-start; flex-direction:column; gap:18px; padding:20px; }
  #panel-outbound .moviebox-proxy-card__source { grid-template-columns:minmax(0,1fr); gap:18px; padding:18px 20px; }
  #panel-outbound .proxy-automation-controls { grid-template-columns:minmax(0,1fr) !important; }
  #panel-outbound .moviebox-proxy-card__actions { width:100%; }
  #panel-outbound .moviebox-proxy-download { width:100%; }
  #panel-outbound .moviebox-proxy-card__footer { align-items:stretch; flex-direction:column; padding:16px 20px; }
  #panel-outbound .moviebox-proxy-card__footer .hint { margin:0; }
}
@media (min-width:1500px) { .status-grid { grid-template-columns:minmax(280px,.75fr) minmax(650px,1.6fr); } }
@media (max-width:880px) {
  .main { margin-left:0; width:100%; }
  .panels { padding:80px 20px 32px; }
  .panel h1 { font-size:1.5rem; }
  .actions-bar { padding:16px 20px; }
  .status-block { padding:18px; border-radius:20px; }
  .alert { margin:76px 20px 0; }
  .alert + .alert { margin-top:12px; }
}
@media (max-width:480px) {
  .login-page { padding:20px 16px; }
  .login-card { padding:28px 24px; border-radius:24px; }
  .login-card h1 { font-size:1.75rem; }
  .actions-bar button { padding:10px 14px; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; } }

/* --- Cloudflare WARP control (Outbound panel) --- */
.warp-state {
  display:flex; align-items:center; gap:10px; margin:0 0 6px;
  color:var(--text); font-size:.95rem; font-weight:600;
}
.warp-led {
  flex:0 0 auto; width:11px; height:11px; border-radius:50%;
  background:var(--border-strong); box-shadow:0 0 0 3px rgba(120,140,170,.20);
  transition:background .2s ease, box-shadow .2s ease;
}
.warp-led.is-on {
  background:#22c55e;
  box-shadow:0 0 0 3px rgba(34,197,94,.20), 0 0 9px rgba(34,197,94,.55);
}
.warp-led.is-off { background:var(--border-strong); box-shadow:0 0 0 3px rgba(120,140,170,.20); }
.warp-led.is-pending {
  background:#f59e0b; box-shadow:0 0 0 3px rgba(245,158,11,.22);
  animation:warp-led-pulse 1.1s ease-in-out infinite;
}
.warp-led.is-error { background:#ef4444; box-shadow:0 0 0 3px rgba(239,68,68,.22); }
@keyframes warp-led-pulse { 0%,100% { opacity:1; } 50% { opacity:.35; } }

/* --- Cloudflare WARP card on the Server Status dashboard --- */
.warp-card {
  display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap;
  margin:0 0 24px; padding:18px 22px; border:1px solid var(--border); border-radius:20px;
  background:var(--bg-alt); box-shadow:var(--shadow);
}
.warp-card__main { display:flex; align-items:center; gap:15px; min-width:0; }
.warp-card__icon {
  display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; border-radius:14px;
  background:var(--selected); color:var(--selected-text); font-size:1.25rem;
}
.warp-card__copy { min-width:0; }
.warp-card__eyebrow {
  margin:0 0 3px; color:var(--text-dim); font-size:.7rem; font-weight:700;
  letter-spacing:.08em; text-transform:uppercase;
}
.warp-card .warp-state { margin:0 0 3px; font-size:.95rem; }
.warp-card .hint { margin:0; }
.warp-card__actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
@media(max-width:680px) {
  .warp-card { align-items:stretch; flex-direction:column; padding:16px 18px; }
  .warp-card__actions { width:100%; }
}
