:root {
  color-scheme: dark;
  --bg: #07111f;
  --sidebar-bg: rgba(8, 20, 38, .92);
  --surface: #0d1726;
  --surface-2: #101b2d;
  --surface-3: #142238;
  --line: rgba(0, 255, 255, .08);
  --line-strong: rgba(25, 211, 255, .28);
  --text: #e5edf7;
  --muted: #8ea3b7;
  --faint: #5c7285;
  --accent: #19d3ff;
  --accent-strong: #6ce5ff;
  --accent-ink: #07111f;
  --ok: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar: 240px;
  --radius: 12px;
  --card-radius: 14px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image: radial-gradient(ellipse 80% 50% at 20% -10%, rgba(25, 211, 255, .06), transparent), radial-gradient(ellipse 60% 40% at 90% 110%, rgba(0, 229, 194, .05), transparent);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: wait; opacity: .58; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: rgba(25, 211, 255, .25); color: var(--text); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(25, 211, 255, .15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(25, 211, 255, .3); }
[hidden] { display: none !important; }
.skip { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }
.shell { display: flex; min-height: 100vh; }
.main-shell { flex: 1; min-width: 0; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex: 0 0 var(--sidebar);
  flex-direction: column;
  width: var(--sidebar);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #0ea5c9);
  box-shadow: 0 0 20px rgba(25, 211, 255, .24);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.brand strong { display: block; color: var(--text); font-size: 12px; font-weight: 800; letter-spacing: .015em; white-space: nowrap; }
.brand strong span { color: var(--accent); }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.sidebar-close { display: none; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; margin-left: auto; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 21px; line-height: 1; }
.nav-section { margin: 0; padding: 19px 20px 7px; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.nav { display: grid; flex: 1; align-content: start; gap: 4px; padding: 4px 10px 16px; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 10px 12px; border: 0; border-radius: var(--radius); color: var(--muted); font-size: 14px; transition: color .2s, background .2s, box-shadow .2s; }
.nav a:hover { background: rgba(25, 211, 255, .07); color: var(--text); }
.nav a.active { background: rgba(25, 211, 255, .1); box-shadow: inset 2px 0 var(--accent), 0 0 16px rgba(25, 211, 255, .08); color: var(--accent); }
.nav-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 auto; }
.nav-icon svg, .menu-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { padding: 14px 14px 18px; border-top: 1px solid var(--line); }
.back-link { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 11px; transition: .2s; }
.back-link:hover { border-color: var(--line-strong); background: rgba(25, 211, 255, .06); color: var(--accent); }
.sidebar-foot p { display: flex; align-items: center; gap: 7px; margin: 12px 4px 0; color: var(--faint); font-size: 10px; }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--ok); box-shadow: 0 0 9px rgba(34, 197, 94, .45); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(2, 7, 18, .72); backdrop-filter: blur(3px); }
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(8, 20, 38, .72); backdrop-filter: blur(16px); }
.menu-toggle { display: none; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: rgba(25, 211, 255, .04); color: var(--muted); }
.menu-toggle:hover { border-color: var(--line-strong); color: var(--accent); }
.appbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar-title > span { padding: 3px 7px; border: 1px solid rgba(25, 211, 255, .15); border-radius: 6px; color: var(--accent); font: 700 9px/1.4 Inter, system-ui, sans-serif; letter-spacing: .1em; }
.appbar-title strong { overflow: hidden; color: var(--text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.env-badge { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 5px 10px; border: 1px solid rgba(34, 197, 94, .14); border-radius: 999px; background: rgba(34, 197, 94, .05); color: #86d6a5; font-size: 11px; white-space: nowrap; }
.appbar-back { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.appbar-back:hover { border-color: var(--line-strong); color: var(--accent); }
.workspace { width: 100%; max-width: 1600px; min-height: calc(100vh - 64px); margin: 0 auto; padding: 26px 28px 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.topbar > div:first-child { display: flex; flex-direction: column; }
.context { order: 2; margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; letter-spacing: 0; }
.context span { color: var(--faint); }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { order: 1; margin: 0; color: var(--text); font-size: 24px; font-weight: 700; line-height: 1.3; letter-spacing: -.025em; }
h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
h3 { margin: 0; font-size: 14px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.view { display: none; }
.view.active { display: block; animation: enter .2s ease-out; }
@keyframes enter { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.btn { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-radius: var(--radius); font-size: 13px; font-weight: 600; line-height: 1.2; transition: background .2s, border-color .2s, color .2s, box-shadow .2s, transform .2s; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #0ea5c9); box-shadow: 0 0 18px rgba(25, 211, 255, .25); color: var(--accent-ink); }
.btn.primary:hover { box-shadow: 0 0 26px rgba(25, 211, 255, .4); transform: translateY(-1px); }
.btn.secondary { border-color: rgba(0, 255, 255, .1); background: rgba(25, 211, 255, .025); color: var(--muted); }
.btn.secondary:hover { border-color: rgba(25, 211, 255, .3); background: rgba(25, 211, 255, .07); color: var(--text); }
.btn.danger { border-color: rgba(239, 68, 68, .24); background: rgba(239, 68, 68, .08); color: #f87171; }
.btn.danger:hover { border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .13); }
.btn.small { min-height: 30px; padding: 5px 10px; border-radius: 8px; font-size: 11px; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font-size: 21px; line-height: 1; }
.icon-btn:hover { border-color: var(--line-strong); background: rgba(25, 211, 255, .06); color: var(--text); }
.intro, .panel, .metric, .quick-grid button, .legacy-grid a {
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: linear-gradient(145deg, rgba(16, 27, 45, .9), rgba(13, 23, 38, .95));
  box-shadow: 0 0 24px rgba(25, 211, 255, .04), inset 0 1px rgba(255, 255, 255, .03);
}
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 26px 28px; }
.intro > div { max-width: 790px; }
.intro h2 { font-size: clamp(19px, 2vw, 24px); font-weight: 650; }
.intro p { margin: 9px 0 0; color: var(--muted); }
.intro.compact { padding: 22px 24px; margin-bottom: 20px; }
.intro.compact h2 { font-size: 19px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 20px 0; }
.metric { min-height: 120px; padding: 20px; transition: border-color .25s, box-shadow .25s; }
.metric:hover { border-color: rgba(25, 211, 255, .22); box-shadow: 0 0 32px rgba(25, 211, 255, .09), inset 0 1px rgba(255, 255, 255, .04); }
.metric span { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.metric strong { display: block; margin-top: 10px; color: var(--text); font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -.04em; }
.metric small { display: block; margin-top: 8px; color: var(--faint); font-size: 10px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.quick-grid button { min-height: 116px; padding: 20px; color: var(--text); text-align: left; transition: border-color .2s, box-shadow .2s, transform .2s; }
.quick-grid button:hover { border-color: rgba(25, 211, 255, .25); box-shadow: 0 0 30px rgba(25, 211, 255, .09); transform: translateY(-2px); }
.quick-grid strong { display: block; color: var(--accent); font-size: 14px; }
.quick-grid span { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.panel { margin-top: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.toolbar.wrap { justify-content: flex-start; }
.search { display: flex; gap: 8px; width: min(520px, 100%); }
.search input { flex: 1; min-width: 0; }
input, select, textarea { width: 100%; border: 1px solid rgba(0, 255, 255, .1); border-radius: var(--radius); outline: none; background: rgba(7, 17, 31, .7); color: var(--text); transition: border-color .2s, box-shadow .2s; }
input, select { min-height: 40px; padding: 9px 12px; }
textarea { resize: vertical; min-height: 80px; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: rgba(25, 211, 255, .5); box-shadow: 0 0 0 3px rgba(25, 211, 255, .12); }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); }
select { appearance: auto; }
.toolbar > select { width: auto; min-width: 210px; max-width: 340px; }
.chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 34px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(25, 211, 255, .02); color: var(--muted); font-size: 12px; transition: .2s; }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active { border-color: rgba(25, 211, 255, .35); background: rgba(25, 211, 255, .1); color: var(--accent); }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 18px; background: rgba(8, 20, 38, .7); color: var(--faint); text-align: left; text-transform: uppercase; letter-spacing: .07em; font-size: 9px; font-weight: 700; white-space: nowrap; }
td { padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
tbody tr:hover td { background: rgba(25, 211, 255, .04); }
td strong { color: var(--text); font-weight: 600; }
td .sub { display: block; margin-top: 4px; color: var(--faint); font-size: 10px; }
th.right, td.right { text-align: right; }
.row-actions { display: inline-flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.empty { padding: 38px 20px !important; color: var(--faint); text-align: center; }
.loading { opacity: .55; pointer-events: none; }
.item-name { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.thumb { width: 34px; height: 44px; flex: 0 0 auto; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-3); }
.thumb.live { width: 42px; height: 32px; object-fit: contain; }
.thumb-placeholder { display: grid; place-items: center; color: var(--faint); font: 600 10px Inter, system-ui, sans-serif; }
.mono { color: #a9bdd0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.category-path { display: block; color: var(--text); }
.category-path.child { position: relative; padding-left: 22px; }
.category-path.child::before { content: "↳"; position: absolute; left: 3px; color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 23px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.badge.ok { border-color: rgba(34, 197, 94, .22); background: rgba(34, 197, 94, .07); color: #4ade80; }
.badge.off { border-color: rgba(239, 68, 68, .22); background: rgba(239, 68, 68, .07); color: #f87171; }
.badge.warn { border-color: rgba(245, 158, 11, .22); background: rgba(245, 158, 11, .07); color: #fbbf24; }
.badge.accent { border-color: rgba(25, 211, 255, .22); background: rgba(25, 211, 255, .07); color: var(--accent); }
.toast { position: fixed; z-index: 80; top: 78px; right: 24px; max-width: min(440px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid rgba(25, 211, 255, .25); border-radius: var(--radius); background: rgba(13, 23, 38, .98); box-shadow: 0 12px 40px rgba(0, 0, 0, .5), 0 0 22px rgba(25, 211, 255, .08); color: var(--text); font-size: 12px; }
.toast.error { border-color: rgba(239, 68, 68, .45); color: #fca5a5; }
.toast.success { border-color: rgba(34, 197, 94, .35); }
.legacy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.legacy-grid a { min-height: 110px; padding: 20px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.legacy-grid a:hover { border-color: rgba(25, 211, 255, .28); box-shadow: 0 0 30px rgba(25, 211, 255, .09); transform: translateY(-2px); }
.legacy-grid strong { display: block; color: var(--text); }
.legacy-grid span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.note-panel { padding: 23px; }
.note-panel p { max-width: 850px; color: var(--muted); }
.provision { margin-top: 18px; }
.provision pre { max-height: 330px; margin: 0; padding: 20px; overflow: auto; background: rgba(7, 17, 31, .9); color: #b7c9da; font: 11px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.dialog { width: min(680px, calc(100vw - 32px)); max-height: min(88vh, 900px); padding: 0; overflow: auto; border: 1px solid rgba(25, 211, 255, .2); border-radius: var(--card-radius); background: var(--surface); box-shadow: 0 30px 100px rgba(0, 0, 0, .7), 0 0 35px rgba(25, 211, 255, .08); color: var(--text); }
.dialog.small { width: min(540px, calc(100vw - 32px)); }
.dialog.wide { width: min(1050px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(2, 7, 18, .84); backdrop-filter: blur(4px); }
.dialog > form, .dialog > div { margin: 0; }
.dialog-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); background: rgba(8, 20, 38, .97); backdrop-filter: blur(14px); }
.dialog-head h2 { font-size: 19px; }
.dialog-head .context { margin: 0 0 4px; color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.dialog .form-body, .dialog form > label, .dialog form > .form-grid, .dialog form > .check { margin-right: 22px; margin-left: 22px; }
.dialog form > label:first-of-type { margin-top: 20px; }
.form-body { padding-top: 20px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialog label { display: block; margin-bottom: 15px; color: #b7c9da; font-size: 12px; }
.dialog label > input, .dialog label > select, .dialog label > textarea { display: block; margin-top: 6px; }
.dialog label small, .help { display: block; margin-top: 6px; color: var(--faint); font-size: 10px; }
.dialog .check { display: flex; align-items: center; gap: 8px; }
.dialog .check input { margin: 0; }
.dialog-actions { position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; padding: 16px 22px; border-top: 1px solid var(--line); background: rgba(8, 20, 38, .97); backdrop-filter: blur(14px); }
.field-title { margin: 20px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.check-list { max-height: 210px; overflow-y: auto; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(7, 17, 31, .7); }
.check-list .check { min-height: 33px; margin: 0; padding: 6px 3px; color: var(--muted); }
.check-list .check.child { padding-left: 25px; }
.check-list .check:hover { color: var(--text); }
.check-list .check input { flex: 0 0 auto; }
.help { margin: -3px 0 16px; line-height: 1.55; }
#seriesDialog > .toolbar { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); }
#seriesDialog > .table-wrap { max-height: 54vh; }
#seriesDialog th { position: sticky; top: 0; z-index: 2; }
.machine-address { color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.resource-line { min-width: 145px; }
.resource-line span { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; }
.sync-intro-badges { display: flex; align-items: flex-end; flex-direction: column; flex-wrap: wrap; gap: 8px; }
.sync-notice { margin-top: 16px; padding: 12px 16px; border: 1px solid rgba(245, 158, 11, .25); border-radius: var(--radius); background: rgba(245, 158, 11, .07); color: #fbbf24; font-size: 12px; }
.sync-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); align-items: start; gap: 18px; }
.sync-layout > .panel, .sync-side > .panel { margin-top: 18px; }
.sync-category-tools { display: grid; grid-template-columns: auto minmax(150px, 1fr) auto; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sync-category-tools .actions { flex-wrap: nowrap; }
.sync-category-tools input { min-height: 35px; font-size: 12px; }
.sync-selection-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.sync-selection-summary strong { color: var(--accent); font-size: 11px; }
.sync-category-list { max-height: 610px; padding: 7px 14px 14px; overflow-y: auto; }
.sync-provider-group h3 { padding: 15px 7px 7px; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.sync-provider-row { display: grid; grid-template-columns: 20px minmax(150px, 1fr) minmax(180px, .85fr); align-items: center; gap: 10px; min-height: 58px; padding: 9px 7px; border-top: 1px solid var(--line); }
.sync-provider-row:first-of-type { border-top: 0; }
.sync-provider-row:hover { background: rgba(25, 211, 255, .025); }
.sync-provider-row.unavailable { opacity: .58; }
.sync-provider-row input[type="checkbox"] { margin: 0; }
.sync-provider-row select { min-height: 35px; padding: 6px 9px; font-size: 11px; }
.sync-provider-name { min-width: 0; }
.sync-provider-name strong { display: block; color: var(--text); font-size: 12px; }
.sync-provider-name small { display: block; margin-top: 3px; color: var(--faint); font-size: 9px; }
.sync-provider-name .badge { margin-left: 5px; }
.sync-form-body { padding: 19px 20px 20px; }
.sync-form-body > label:not(.sync-schedule), #syncSeedWrap > label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 11px; }
.sync-form-body label > select { display: block; margin-top: 6px; }
.sync-schedule { display: flex; align-items: flex-start; gap: 11px; margin: 19px 0 15px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(25, 211, 255, .025); cursor: pointer; }
.sync-schedule input { flex: 0 0 auto; margin-top: 3px; }
.sync-schedule strong { display: block; color: var(--text); font-size: 12px; }
.sync-schedule small { display: block; margin-top: 5px; color: var(--faint); font-size: 10px; line-height: 1.55; }
.sync-saved { display: flex; justify-content: space-between; gap: 10px; margin: 12px 0; color: var(--faint); font-size: 10px; }
.sync-saved span:first-child { color: var(--muted); }
.sync-main-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sync-main-actions .btn { flex: 1 1 105px; padding-right: 10px; padding-left: 10px; font-size: 11px; }
.sync-safety-panel { padding: 20px 22px; }
.sync-safety-panel h3 { color: var(--accent); }
.sync-safety-panel ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.sync-progress-body { padding: 20px 22px; }
.sync-progress-meta { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 9px; color: var(--muted); font-size: 11px; }
.sync-progress-meta strong { color: var(--accent); }
.sync-progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(25, 211, 255, .07); }
.sync-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0ea5c9, var(--accent)); box-shadow: 0 0 14px rgba(25, 211, 255, .35); transition: width .25s ease; }
.sync-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.sync-count { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(7, 17, 31, .35); }
.sync-count strong { display: block; color: var(--text); font-size: 20px; }
.sync-count span { display: block; margin-top: 3px; color: var(--faint); font-size: 9px; }
.sync-errors { margin-top: 15px; padding: 12px 14px; border: 1px solid rgba(239, 68, 68, .2); border-radius: 10px; background: rgba(239, 68, 68, .05); color: #fca5a5; font-size: 10px; white-space: pre-wrap; }
.sync-preview-content { padding: 20px 22px; }
.sync-preview-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.sync-preview-categories { margin-top: 16px; }
.sync-preview-category { padding: 12px 0; border-top: 1px solid var(--line); }
.sync-preview-category strong { color: var(--text); }
.sync-preview-category p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.sync-preview-category small { display: block; margin-top: 5px; color: var(--faint); }
.sync-report-body { padding: 20px 22px 22px; }
.sync-report-actions { display: flex; flex-wrap: wrap; gap: 9px; }
#syncReportText { max-height: 52vh; margin: 12px 0 0; padding: 18px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(7, 17, 31, .8); color: #d9e8f4; font: 12px/1.7 Inter, system-ui, sans-serif; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 1180px) {
  .metrics, .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legacy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sync-layout { grid-template-columns: 1fr; }
  .sync-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .sync-side { margin-top: 0; }
  .sync-side > .panel { margin-top: 0; }
}
@media (max-width: 1023px) {
  body.nav-open { overflow: hidden; }
  .sidebar { position: fixed; left: 0; height: 100vh; height: 100dvh; transform: translateX(-100%); transition: transform .22s ease; }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 20px 0 60px rgba(0, 0, 0, .45); }
  .brand { gap: 9px; padding: 0 11px; }
  .brand-mark { width: 35px; height: 35px; border-radius: 10px; font-size: 12px; }
  .brand strong { font-size: 10.5px; }
  .brand small { font-size: 9px; }
  .sidebar-close { display: grid; }
  .menu-toggle { display: grid; }
  .appbar { gap: 11px; padding: 0 14px; }
  .appbar-back { display: none; }
  .workspace { padding: 22px 18px 42px; }
}
@media (max-width: 640px) {
  .appbar { padding: 0 12px; }
  .appbar-title { gap: 7px; }
  .appbar-title > span { display: none; }
  .appbar-title strong { font-size: 12px; }
  .env-badge { padding: 5px 8px; font-size: 10px; }
  .workspace { padding: 18px 12px 36px; }
  .topbar { align-items: stretch; flex-direction: column; gap: 15px; margin-bottom: 20px; }
  h1 { font-size: 21px; }
  .topbar .actions { width: 100%; }
  .topbar .actions .btn { flex: 1; }
  .intro { align-items: flex-start; flex-direction: column; padding: 20px; }
  .intro .btn { width: 100%; }
  .intro h2 { font-size: 19px; }
  .metrics { gap: 10px; margin: 14px 0; }
  .metric { min-height: 108px; padding: 15px 14px; }
  .metric span { font-size: 10px; }
  .metric strong { font-size: 23px; }
  .metric small { font-size: 9px; }
  .quick-grid, .legacy-grid { grid-template-columns: 1fr; }
  .quick-grid button { min-height: 96px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar > select { width: 100%; max-width: none; }
  .search { width: 100%; }
  .panel-head { align-items: flex-start; flex-wrap: wrap; padding: 17px; }
  th, td { padding-right: 12px; padding-left: 12px; }
  #view-categorias table { min-width: 720px; }
  .catalog-view table { min-width: 760px; }
  #view-maquinas table { min-width: 900px; }
  .form-grid.two { grid-template-columns: 1fr; gap: 0; }
  #seriesDialog > .toolbar .actions { width: 100%; }
  #seriesDialog > .toolbar .actions .btn { flex: 1; }
  .dialog, .dialog.small, .dialog.wide { width: calc(100vw - 24px); max-height: 90vh; max-height: 90dvh; }
  .dialog-head { padding: 16px; }
  .dialog .form-body, .dialog form > label, .dialog form > .form-grid, .dialog form > .check { margin-right: 16px; margin-left: 16px; }
  .dialog-actions { padding: 14px 16px; }
  .dialog-actions .btn { flex: 1; }
  .toast { top: 74px; right: 12px; left: 12px; max-width: none; }
  .sync-intro-badges { align-items: flex-start; flex-direction: row; }
  .sync-side { grid-template-columns: 1fr; }
  .sync-category-tools { grid-template-columns: 1fr; padding: 14px 16px; }
  .sync-category-tools .actions { width: 100%; }
  .sync-category-tools .actions .btn { flex: 1; }
  .sync-selection-summary { align-items: flex-start; flex-direction: column; padding: 11px 16px; }
  .sync-category-list { padding-right: 9px; padding-left: 9px; }
  .sync-provider-row { grid-template-columns: 20px minmax(0, 1fr); gap: 8px; padding: 11px 6px; }
  .sync-provider-row > label:last-child { grid-column: 2; }
  .sync-provider-row select { width: 100%; }
  .sync-main-actions { flex-direction: column; }
  .sync-main-actions .btn { width: 100%; flex-basis: auto; }
  .sync-counts, .sync-preview-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sync-progress-panel .panel-head .actions { width: 100%; }
  .sync-history-panel table { min-width: 760px; }
  .sync-report-actions { flex-direction: column; }
  .sync-report-actions .btn { width: 100%; }
  .sync-report-body { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Importação manual e substituição por fornecedor M3U */
.m3u-panel { margin-top: 18px; border-color: rgba(25, 211, 255, .2); }
.m3u-source-body { padding: 18px 20px 16px; }
.m3u-source-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.m3u-source-row label { color: var(--muted); font-size: 11px; }
.m3u-source-row input { display: block; margin-top: 6px; }
.m3u-source-row .btn { min-height: 40px; }
.m3u-paste { margin-top: 12px; color: var(--muted); font-size: 11px; }
.m3u-paste summary { cursor: pointer; color: var(--accent); }
.m3u-paste textarea { width: 100%; margin-top: 10px; resize: vertical; font-family: var(--mono, monospace); font-size: 11px; }
.m3u-source-body > .help { margin: 11px 0 0; }
.m3u-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.m3u-tools { border-top: 1px solid var(--line); }
.m3u-category-list { max-height: 650px; padding: 7px 14px 14px; overflow-y: auto; }
.m3u-provider-row { display: grid; grid-template-columns: 20px minmax(170px, 1fr) minmax(190px, .75fr) minmax(205px, .8fr); align-items: center; gap: 11px; min-height: 74px; padding: 10px 7px; border-top: 1px solid var(--line); }
.m3u-provider-row > label > select { width: 100%; min-height: 35px; padding: 6px 9px; font-size: 11px; }
.m3u-replace { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.m3u-replace input { flex: 0 0 auto; margin: 2px 0 0; }
.m3u-replace strong { display: block; color: var(--muted); font-size: 10px; }
.m3u-replace small { display: block; margin-top: 3px; color: var(--faint); font-size: 9px; line-height: 1.35; }
.m3u-replace.active { border-color: rgba(239, 68, 68, .38); background: rgba(239, 68, 68, .07); }
.m3u-replace.active strong { color: #f87171; }
.m3u-replace-warning { margin: 0 20px 15px; padding: 12px 14px; border: 1px solid rgba(239, 68, 68, .3); border-radius: 10px; background: rgba(239, 68, 68, .07); color: #fca5a5; font-size: 11px; line-height: 1.55; }
.m3u-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding: 0 20px 20px; }
.m3u-preview-replace { color: #f87171; font-weight: 700; }
@media (max-width: 1180px) {
  .m3u-provider-row { grid-template-columns: 20px minmax(160px, 1fr) minmax(190px, .8fr); }
  .m3u-replace { grid-column: 2 / -1; }
}
@media (max-width: 720px) {
  .m3u-source-row { grid-template-columns: 1fr; }
  .m3u-source-row .btn { width: 100%; }
  .m3u-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 16px; }
  .m3u-category-list { padding-right: 9px; padding-left: 9px; }
  .m3u-provider-row { grid-template-columns: 20px minmax(0, 1fr); padding: 12px 6px; }
  .m3u-provider-row > label, .m3u-replace { grid-column: 2; }
  .m3u-actions { flex-direction: column; padding-right: 16px; padding-left: 16px; }
  .m3u-actions .btn { width: 100%; }
  .m3u-replace-warning { margin-right: 16px; margin-left: 16px; }
}
