:root {
  --bg: #0e1116;
  --panel: #161b22;
  --line: #262c36;
  --text: #e6e9ef;
  --muted: #8a93a3;
  --accent: #4fd1a5;
  --accent-dim: #2b7a5c;
  --warn: #e8a33d;
  --danger: #e8636b;
  --mono: "SF Mono", "IBM Plex Mono", Menlo, Consolas, monospace;
  --sans: Inter, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
a { color: var(--accent); text-decoration: none; }
code { font-family: var(--mono); background: #1d222b; padding: 1px 6px; border-radius: 4px; font-size: 12px; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 20px; min-height: 56px; height: auto;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line); background: #12161c;
  position: sticky; top: 0; z-index: 200;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(79, 209, 165, 0.16); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 0; flex: 1 1 240px; }
.topbar nav a {
  color: var(--muted); padding: 6px 9px; border-bottom: 2px solid transparent;
  white-space: nowrap; font-size: 13px;
}
.topbar nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.topbar-meta {
  margin-left: auto; color: var(--muted); font-size: 12px; font-family: var(--mono);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.user-chip { color: var(--text); font-family: var(--sans); padding: 6px 10px; border-radius: 8px; }
.user-chip:hover, .user-chip.active { background: #1d222b; color: var(--text); }
.profile-form { max-width: 420px; }
.profile-form input { width: 100%; }
.profile-form input[readonly] { opacity: 0.9; cursor: default; }

.page { padding: 28px 32px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
h1 { margin: 0 0 4px; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
h2 { margin: 0 0 10px; font-size: 15px; }
.hint { color: var(--muted); max-width: 640px; margin: 0; }
.meta { color: var(--muted); font-family: var(--mono); font-size: 12px; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 16px;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.tight { margin: 10px 0; }
.users-table { overflow: visible; }
.users-table td { overflow: visible; vertical-align: middle; }
.user-group-cell { min-width: 190px; position: relative; overflow: visible; }
.users-table tr:has(.msel-panel.open) { position: relative; z-index: 20; }
.user-group-msel .msel-btn { min-width: 180px; }
.setup-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 8px; }
.setup-head .hint { display: block; margin-top: 4px; }

input, select, textarea {
  background: #0b0e13; border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: 6px; font: 13px var(--sans);
}
input[type="search"] { min-width: 200px; }

.btn {
  background: #1d222b; border: 1px solid var(--line); color: var(--text);
  padding: 9px 14px; border-radius: 6px; cursor: pointer; font: 13px/1.2 var(--sans);
}
.btn.primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #eafbf3; }
.btn.primary:hover { background: var(--accent); color: #06231a; }
.btn.small { padding: 4px 10px; font-size: 12px; color: var(--muted); }
.btn.small.on { background: rgba(79,209,165,0.15); color: var(--accent); border-color: transparent; }
.btn.small.off { color: var(--muted); }
.btn.small.danger, .btn.danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn.ghost { background: none; border: none; color: var(--muted); padding: 0 6px; cursor: pointer; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px;
  position: relative; z-index: 30; overflow: visible;
}
.text-filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px;
  position: relative; z-index: 0; overflow: visible;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; position: relative; z-index: 1; }
.filter-group:has(.msel-panel.open),
.filter-group:has(.cal-popup.open) { z-index: 40; }
.filter-group label { font-size: 11px; color: var(--muted); }

.msel { position: relative; }
.msel:has(.msel-panel.open),
.msel:has(.cal-popup.open) { z-index: 40; }
.msel-btn {
  background: #0b0e13; border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: 6px; min-width: 150px; text-align: left;
  display: flex; justify-content: space-between; gap: 8px; cursor: pointer; font-size: 13px;
}
.msel-btn:after { content: "▾"; color: var(--muted); font-size: 10px; }
.msel-panel, .cal-popup {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  background: #161b22; border: 1px solid var(--line); border-radius: 8px;
  display: none; box-shadow: 0 12px 32px rgba(0,0,0,0.55);
  pointer-events: auto; isolation: isolate;
}
.msel-panel { min-width: 220px; width: max(100%, 240px); max-width: min(360px, calc(100vw - 48px)); max-height: 320px; overflow: auto; padding: 8px; }
.msel-search {
  position: sticky; top: 0; z-index: 1;
  width: 100%; margin-bottom: 6px; padding: 8px 10px;
  background: #0b0e13; border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font-size: 13px;
}
.msel-search:focus { outline: none; border-color: var(--accent-dim); }
.metric-panel { min-width: 280px; max-height: 360px; }
.metric-group-title {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; padding: 8px 8px 2px;
}
.cal-popup {
  padding: 14px;
  width: max-content;
  min-width: 460px;
  max-width: none;
  overflow: visible;
}
.msel-panel.open, .cal-popup.open { display: block; }
.msel-option { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px; cursor: pointer; }
.msel-option:hover { background: #1d222b; }
.msel-actions { display: flex; justify-content: space-between; padding: 6px 8px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.msel-actions button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 11px; }

.cal-dual { display: flex; flex-wrap: nowrap; gap: 18px; }
.cal-dual > * { flex: 0 0 auto; }
.cal-manual { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.cal-header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 28px); gap: 2px; }
.cal-grid .dow { color: var(--muted); font-size: 10px; text-align: center; padding: 4px 0; }
.cal-day { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 5px; font-size: 12px; cursor: pointer; }
.cal-day:hover { background: #1d222b; }
.cal-day.in-range { background: rgba(79,209,165,0.15); border-radius: 0; }
.cal-day.range-start, .cal-day.range-end { background: var(--accent); color: #06231a; font-weight: 600; }
.cal-day.disabled { color: #3a414d; cursor: default; }
.cal-footer { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); }

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.stat-card .label { color: var(--muted); font-size: 12px; }
.stat-card .value { font-family: var(--mono); font-size: 22px; font-weight: 600; }
#chartWrap { height: 240px; margin-bottom: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid #1d222b; }
td.num, th.num { text-align: right; font-family: var(--mono); }
td.name { white-space: normal; max-width: 320px; font-weight: 500; }
.account-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.account-header h2 { margin: 0; }
.tag { color: var(--muted); font-size: 11px; font-family: var(--mono); margin-left: 8px; }
.spend { font-family: var(--mono); color: var(--accent); }

.status-badge { display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: 11px; font-family: var(--mono); }
.status-active { background: rgba(79,209,165,0.15); color: var(--accent); }
.status-disabled { background: rgba(232,163,61,0.18); color: var(--warn); }
.status-blocked { background: rgba(232,99,107,0.15); color: var(--danger); }
.status-unknown { background: rgba(138,147,163,0.18); color: var(--muted); }
.status-paused { background: rgba(138,147,163,0.18); color: var(--muted); }
.status-review { background: rgba(232,163,61,0.18); color: var(--warn); }
.status-processing { background: rgba(110,168,254,0.18); color: #8ec0ff; }
.status-rejected { background: rgba(232,99,107,0.18); color: var(--danger); }
.status-issues { background: rgba(232,163,61,0.18); color: var(--warn); }
.delivery-cell { display: flex; flex-direction: column; gap: 4px; max-width: 280px; }
.status-reason { font-size: 11px; color: var(--muted); font-weight: 400; line-height: 1.35; white-space: normal; }
.status-badge.status-mix {
  position: relative;
  overflow: hidden;
  background: #1d222b;
  color: #fff;
  padding: 0;
  min-width: 118px;
  vertical-align: middle;
}
.delivery-seg-row { position: absolute; inset: 0; display: flex; }
.delivery-seg { min-width: 0; }
.delivery-mix-text {
  position: relative;
  z-index: 1;
  display: block;
  padding: 2px 10px;
  text-shadow: 0 1px 2px rgba(0,0,0,.65);
  white-space: nowrap;
}
.limit-bar { height: 6px; border-radius: 4px; background: #1d222b; overflow: hidden; width: 120px; display: inline-block; vertical-align: middle; margin-left: 8px; }
.limit-bar-fill { height: 100%; background: var(--accent); }
.side-lists { display: flex; gap: 28px; flex-wrap: wrap; margin: 12px 0 16px; }
.side-list h3 { font-size: 12px; color: var(--muted); margin: 0 0 8px; font-weight: 500; }
.side-list ul { margin: 0; padding: 0; list-style: none; }
.side-list li { padding: 3px 0; }

.errbox { background: rgba(232,163,61,0.1); border: 1px solid var(--warn); color: var(--warn); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.empty { color: var(--muted); padding: 48px 0; text-align: center; }
.toast {
  position: fixed; bottom: 20px; right: 20px; max-width: 420px;
  background: #123c2e; border: 1px solid var(--accent-dim);
  padding: 12px 16px; border-radius: 10px; z-index: 400;
}
.toast.error { background: #3a1d1d; border-color: var(--danger); }

.add-setup input { flex: 1; min-width: 180px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #1d222b; border: 1px solid var(--line); border-radius: 100px;
  padding: 4px 8px 4px 12px; font-size: 12px;
}
.chip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.chip .type-tag { color: var(--muted); font-size: 10px; }

.steps { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.step-pill {
  padding: 8px 14px; border-radius: 100px; font-size: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  cursor: pointer; font-family: inherit;
}
.step-pill.active { color: var(--accent); border-color: var(--accent-dim); background: rgba(79,209,165,0.08); }
.step-pill.bad { color: var(--danger); border-color: var(--danger); background: rgba(232,99,107,0.12); }
.step-pill.bad.active { color: var(--danger); border-color: var(--danger); background: rgba(232,99,107,0.18); }
.launch-archive { margin-top: 4px; }
.launch-archive table { width: 100%; min-width: 0; }
.launch-archive th:first-child, .launch-archive td:first-child,
.launch-archive th:nth-child(2), .launch-archive td.name { position: static; background: transparent; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12px; color: var(--muted); }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 180px; }
.section-title { font-size: 12px; color: var(--muted); margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; color: var(--text); }
.opt-goal-card { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; cursor: pointer; font-size: 12px; }
.lifecycle-card {
  display: block; width: 100%; text-align: left; margin: 0 0 8px;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  background: var(--panel); color: var(--text); cursor: pointer; font-family: inherit;
}
.lifecycle-card strong { display: block; margin-bottom: 4px; font-size: 13px; }
.lifecycle-card .hint { margin: 0; }
.lifecycle-card.selected { border-color: var(--accent); background: rgba(79,209,165,0.08); }
.lifecycle-card:disabled { opacity: 0.5; cursor: not-allowed; }
.goal-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-error { background: rgba(232,99,107,0.1); border: 1px solid var(--danger); color: var(--danger); padding: 8px 12px; border-radius: 6px; font-size: 12px; margin-bottom: 14px; }
.okbox { background: rgba(79,209,165,0.08); border: 1px solid var(--accent); color: var(--accent); padding: 10px 14px; border-radius: 8px; margin-top: 12px; }
.account-tree { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #0b0e13; }
.account-tree .g-title { font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.account-tree label { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; }
.geo-results-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow-y: auto; margin-top: 4px; }
.geo-result-item { padding: 8px 12px; cursor: pointer; font-size: 13px; display: flex; justify-content: space-between; }
.geo-result-item:hover { background: #1d222b; }
.review-box { background: #0b0e13; border: 1px solid var(--line); border-radius: 8px; padding: 16px; font-size: 13px; }
.review-box dt { color: var(--muted); font-size: 11px; margin-top: 10px; }
.review-box dd { margin: 2px 0 0; }
textarea { background: #0b0e13; border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 9px 12px; font: 13px var(--sans); }

.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 1480px; }
.table-wrap th:first-child, .table-wrap td:first-child { position: sticky; left: 0; background: var(--panel); z-index: 2; }
.table-wrap th:nth-child(2), .table-wrap td.name { min-width: 260px; position: sticky; left: 48px; background: var(--panel); z-index: 1; }
.camp-hscroll {
  position: sticky; top: var(--topbar-h, 56px); z-index: 25;
  overflow-x: auto; overflow-y: hidden;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 12px; height: 18px;
}
.camp-hscroll-inner { height: 1px; }
.camp-table-wrap { overflow-x: auto; scrollbar-width: none; }
.camp-table-wrap::-webkit-scrollbar { display: none; }
.camp-table { table-layout: fixed; width: max-content; border-collapse: separate; border-spacing: 0; min-width: 0; }
.camp-table th, .camp-table td { overflow: hidden; vertical-align: top; }
.camp-table .col-switch {
  position: sticky; left: 0; z-index: 4;
  width: 52px; min-width: 52px; max-width: 52px;
  background: var(--panel);
}
.camp-table .col-name, .camp-table td.name {
  position: sticky; left: 52px; z-index: 3;
  background: var(--panel);
  box-shadow: 8px 0 10px -8px rgba(0,0,0,0.55);
  overflow: hidden;
}
.camp-table thead .col-switch, .camp-table thead .col-name { z-index: 5; background: var(--panel); }
.camp-table .row-adset .col-switch, .camp-table .row-adset td.name { background: #141920; }
.camp-table .row-ad .col-switch, .camp-table .row-ad td.name { background: #10141a; }
.camp-table .camp-lifetime .col-switch,
.camp-table .camp-lifetime td.name,
.camp-table .rule-panel-row .col-switch,
.camp-table .rule-panel-row td.name { background: #12161c; }
.col-resizer {
  position: absolute; top: 0; right: -4px; width: 9px; height: 100%;
  cursor: col-resize; z-index: 6;
}
.camp-table th.col-resize { position: relative; }
.camp-table th.col-resize.col-name { position: sticky; }
.switch {
  width: 36px; height: 20px; border-radius: 100px; border: none;
  background: #3a414d; position: relative; cursor: pointer; padding: 0; flex-shrink: 0;
}
.switch:after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px;
  border-radius: 50%; background: #c5cbd6; transition: 0.15s;
}
.switch.on { background: var(--accent-dim); }
.switch.on:after { left: 19px; background: #eafbf3; }
.archive-toggle { display: flex; align-items: center; gap: 8px; height: 38px; }
.camp-lifetime td {
  background: #12161c; color: var(--muted); font-size: 12px;
  padding-top: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.camp-lifetime strong { color: var(--text); font-family: var(--mono); font-weight: 600; }
.budget-input { width: 92px; padding: 4px 8px; text-align: right; font-family: var(--mono); font-size: 12px; }
.adset-budgets { margin-top: 6px; display: none; flex-direction: column; gap: 4px; }
.adset-budgets.open { display: flex; }
.adset-budgets label { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 100px; padding: 4px 8px 4px 12px; font-size: 12px; font-weight: 600;
}
.tag-red { background: rgba(232,99,107,0.18); color: #e8636b; }
.tag-green { background: rgba(79,209,165,0.18); color: var(--accent); }
.tag-yellow { background: rgba(232,163,61,0.18); color: var(--warn); }
.tag-purple { background: rgba(167,139,250,0.2); color: #c4b5fd; }
.color-picks { display: flex; gap: 8px; align-items: center; }
.color-dot {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
}
.color-dot.selected { border-color: #fff; }
.color-dot.red { background: #e8636b; }
.color-dot.green { background: #4fd1a5; }
.color-dot.yellow { background: #e8a33d; }
.color-dot.purple { background: #a78bfa; }
.tag-select { min-width: 110px; padding: 4px 8px; font-size: 12px; }
.tags-panel .hint { margin-bottom: 8px; }
.expand-btn {
  width: 22px; height: 22px; border: 1px solid var(--line); background: #1d222b; color: var(--muted);
  border-radius: 4px; cursor: pointer; margin-right: 8px; line-height: 20px; padding: 0;
}
.expand-btn.open { transform: rotate(90deg); color: var(--accent); border-color: var(--accent-dim); }
.preset-saved { margin: 0 0 22px; padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.preset-saved h2 { margin-top: 0; }
.camp-name { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
.camp-name > span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.camp-name-title { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.camp-name-title .expand-btn { flex-shrink: 0; margin-right: 0; margin-top: 1px; }
.camp-name-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rename-wrap { display: inline-flex; align-items: flex-start; gap: 4px; min-width: 0; flex: 1 1 auto; max-width: 100%; }
.rename-text {
  cursor: pointer; min-width: 0; flex: 1 1 auto;
  white-space: normal; overflow: visible; text-overflow: unset;
  overflow-wrap: anywhere; word-break: break-word; line-height: 1.35;
}
.rename-text:hover { color: var(--accent); }
.rename-input { flex: 1; min-width: 80px; width: 100%; padding: 4px 8px; font: 13px var(--sans); }
.row-adset td { background: #141920; }
.row-ad td { background: #10141a; }
.name.nested { padding-left: 36px; }
.name.nested-ad { padding-left: 52px; display: flex; align-items: flex-start; gap: 10px; }
.ad-creative { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; width: 96px; }
.ad-creative .btn { width: 100%; font-size: 11px; padding: 4px 6px; }
.adset-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.roi-pos { color: var(--accent); font-variant-numeric: tabular-nums; }
.roi-neg { color: var(--danger); font-variant-numeric: tabular-nums; }
.roi-badge { font-size: 12px; color: var(--muted); white-space: nowrap; }
.budget-apply {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted); white-space: nowrap; cursor: pointer; user-select: none;
}
.budget-apply input { accent-color: var(--accent); }
.creative-thumb {
  width: 96px; height: 96px; object-fit: cover; border-radius: 8px;
  background: #0b0e13; border: 1px solid var(--line); flex-shrink: 0;
}
.creative-thumb.empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--muted); text-align: center; padding: 6px;
}
.icon-btn {
  background: none; border: 1px solid var(--line); color: var(--muted);
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-dim); }
.icon-btn.spin { animation: spin 0.8s linear infinite; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.lang-slot {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
  background: #0b0e13;
}
.lang-picker { position: relative; }
.lang-picker-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  max-height: 240px; overflow: auto; margin-top: 4px;
  background: #0b0e13; border: 1px solid var(--line); border-radius: 8px;
}
.lang-picker-item {
  display: block; width: 100%; text-align: left; padding: 8px 12px;
  background: none; border: none; color: var(--text); cursor: pointer; font: inherit;
}
.lang-picker-item:hover { background: rgba(79,209,165,0.12); }
.lang-picker-empty { padding: 10px 12px; color: var(--muted); font-size: 12px; }
.lang-slot-img { max-width: 120px; max-height: 80px; border-radius: 6px; display: block; margin: 8px 0; object-fit: cover; }
.lang-preset-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; }
.lang-preset-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; background: #0b0e13; }
.lang-preset-card img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.folder-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; text-align: left; cursor: pointer; color: var(--text);
}
.folder-card:hover { border-color: var(--accent-dim); }
.dropzone {
  margin-top: 14px;
  padding: 22px 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #0b0e13;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.dropzone.dragover {
  border-color: var(--accent);
  color: var(--text);
  background: #121820;
}
.creative-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.creative-card { background: #0b0e13; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.creative-card img { width: 100%; height: 180px; object-fit: cover; border-radius: 8px; background: #12161c; }
.pick-creatives { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.creative-pick { width: 112px; display: flex; flex-direction: column; gap: 4px; font-size: 11px; cursor: pointer; }
.creative-pick img { width: 112px; height: 112px; object-fit: cover; border-radius: 8px; border: 2px solid var(--line); }
.creative-pick input:checked + img { border-color: var(--accent); }

.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.auth-card { width: 100%; max-width: 420px; margin: 0; }
.auth-card h1 { margin-top: 16px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.auth-form label { font-size: 12px; color: var(--muted); }
.mail-form { max-width: 960px; }
.account-bind-wrap { overflow-x: auto; margin: 8px 0 14px; }
.account-bind { width: 100%; min-width: 640px; }
.account-bind th, .account-bind td { padding: 8px 10px; vertical-align: top; }
.account-bind select { min-width: 160px; max-width: 280px; }
.pixel-pick { display: flex; align-items: center; gap: 8px; }
.pixel-pick select { flex: 1; min-width: 140px; }
.id-copy {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: #1d222b; border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px; cursor: pointer; white-space: nowrap; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis;
}
.id-copy:hover { color: var(--accent); border-color: var(--accent-dim); }
.os-version-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px 4px; align-items: center; }
.os-version-row select { min-width: 110px; }
.copy-url {
  background: none; border: 0; padding: 0; margin: 0; max-width: 420px;
  color: var(--accent); font: inherit; text-align: left; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block;
}
.copy-url:hover { color: var(--text); }
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 640px; max-height: 90vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
}
.color-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 18px; }
.autorule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.autorule-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: #12161c; border-left-width: 4px;
}
.autorule-card.tag-green { border-left-color: #4fd1a5; }
.autorule-card.tag-yellow { border-left-color: #e8a33d; }
.autorule-card.tag-red { border-left-color: #e8636b; }
.autorule-card.tag-purple { border-left-color: #a78bfa; }
.autorule-group h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cond-row { display: grid; grid-template-columns: 1.4fr 0.8fr 0.7fr 0.7fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 800px) { .cond-row { grid-template-columns: 1fr 1fr; } }
.autorule-pick { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.autorule-pick-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.autorule-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #0b0e13; color: var(--text);
  border-radius: 100px; padding: 5px 12px; cursor: pointer; font-size: 12px;
}
.autorule-chip input { margin: 0; }
.autorule-chip.on.tag-green { background: rgba(79,209,165,0.16); border-color: transparent; }
.autorule-chip.on.tag-yellow { background: rgba(232,163,61,0.16); border-color: transparent; }
.autorule-chip.on.tag-red { background: rgba(232,99,107,0.16); border-color: transparent; }
.autorule-chip.on.tag-purple { background: rgba(167,139,250,0.18); border-color: transparent; }
.rules-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mini-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mini-dot.green { background: #4fd1a5; }
.mini-dot.yellow { background: #e8a33d; }
.mini-dot.red { background: #e8636b; }
.mini-dot.purple { background: #a78bfa; }
.rule-panel-row td { background: #12161c; }
.rule-panel-row td.name { padding: 8px 10px 12px; }
.rule-panel { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.rule-line { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
.rule-line + .rule-line { border-top: 1px solid var(--line); }
