:root {
  --bg: #111315;
  --panel: #191c1f;
  --panel-2: #23272b;
  --line: #32373d;
  --line-bright: #474d54;
  --text: #f1f3f4;
  --muted: #a1a7ae;
  --accent: #55c69f;
  --accent-dim: #17382e;
  --cyan: #8fc1f5;
  --danger: #ff8383;
  --warning: #efbd63;
  --radius: 8px;
  --sidebar: 224px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="light"] {
  --bg: #f5f6f7;
  --panel: #ffffff;
  --panel-2: #eef0f2;
  --line: #dfe2e6;
  --line-bright: #c5cad0;
  --text: #17191c;
  --muted: #6b7078;
  --accent: #087f5b;
  --accent-dim: #e5f4ef;
  --cyan: #2766a8;
  --danger: #c43636;
  --warning: #996515;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
code { color: var(--accent); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 18px 14px; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; padding: 0 6px 18px; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand small { color: var(--muted); text-transform: uppercase; font-size: 9px; letter-spacing: .18em; }
.brand-mark { width: 34px; height: 34px; border: 0; border-radius: 7px; display: flex; gap: 3px; padding: 8px; align-items: end; background: var(--text); }
.brand-mark span { display: block; width: 4px; background: var(--accent); border-radius: 3px; }
.brand-mark span:nth-child(1) { height: 8px; }
.brand-mark span:nth-child(2) { height: 15px; }
.brand-mark span:nth-child(3) { height: 11px; }
.sidebar nav { display: grid; gap: 3px; }
.nav-item { min-height: 34px; border: 1px solid transparent; background: transparent; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--muted); cursor: pointer; transition: .16s ease; }
.nav-item span { display: inline-block; width: 33px; font: 600 9px/1 ui-monospace, monospace; color: #596572; }
.nav-item:hover { color: var(--text); background: var(--panel-2); }
.nav-item.active { color: var(--text); background: var(--panel-2); font-weight: 750; }
.nav-item.active span { color: var(--accent); }
.sidebar-foot { margin-top: auto; display: grid; gap: 16px; }
.api-indicator { display: flex; gap: 10px; align-items: center; padding: 12px; background: #13171c; border: 1px solid var(--line); border-radius: 12px; }
.api-indicator > span { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 4px #3b1820; }
.api-indicator.online > span { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
.api-indicator strong, .api-indicator small { display: block; font-size: 11px; }
.api-indicator small { color: var(--muted); margin-top: 2px; }
.link-button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 6px; font-size: 12px; }
.link-button:hover { color: var(--text); }

.workspace { margin-left: var(--sidebar); padding: 26px clamp(20px, 3vw, 46px) 50px; max-width: 1680px; }
.topbar { min-height: 58px; display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.theme-toggle { margin-left: auto; }
.topbar h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.025em; margin: 2px 0 0; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 750; margin: 0 0 5px; }
.selection-pill { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.menu-toggle { display: none; border: 0; background: none; font-size: 24px; cursor: pointer; }

.section { display: none; animation: fade-in .2s ease; }
.section.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }

.config-banner { border: 1px solid #735522; background: #211a0f; color: #ffe6ad; padding: 14px 18px; border-radius: 13px; margin-bottom: 22px; }
.config-banner strong, .config-banner span { display: block; }
.config-banner span { font-size: 12px; margin-top: 4px; color: #c9b37f; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-card { padding: 14px 16px; min-height: 104px; display: flex; flex-direction: column; box-shadow: 0 1px 2px rgb(20 24 28 / 6%); }
.stat-card.accent { background: var(--panel); color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: inset 3px 0 var(--accent); }
.stat-card p { color: var(--muted); font-size: 12px; margin: 0; }
.stat-card.accent p, .stat-card.accent span { color: var(--muted); }
.stat-card strong { margin: auto 0 4px; font-size: 28px; letter-spacing: -.04em; line-height: 1; }
.stat-card span { color: var(--muted); font-size: 11px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); gap: 14px; }
.panel { padding: 18px; box-shadow: 0 1px 2px rgb(20 24 28 / 6%); }
.panel-head, .section-lead, .table-tools { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel h2, .section-lead h2 { margin: 0; letter-spacing: -.035em; }
.panel h2 { font-size: 20px; }
.section-lead { margin-bottom: 12px; }
.section-lead h2 { font-size: 28px; }
.section-lead p:not(.eyebrow) { color: var(--muted); margin: 7px 0 0; font-size: 13px; max-width: 650px; }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 28px; }
.quick-card { text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; min-height: 120px; padding: 14px; cursor: pointer; transition: .16s ease; display: flex; flex-direction: column; }
.quick-card:hover { transform: translateY(-2px); border-color: var(--line-bright); background: #1b2027; }
.quick-card strong { margin: auto 0 5px; }
.quick-card small { color: var(--muted); }
.quick-number { color: var(--accent); font: 700 10px/1 ui-monospace, monospace; }
.activity-list { margin-top: 20px; display: grid; gap: 8px; }
.activity-item { border-top: 1px solid var(--line); padding: 12px 0 4px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.activity-item:first-child { border-top: 0; }
.activity-dot { width: 7px; height: 7px; background: var(--warning); border-radius: 50%; }
.activity-dot.completed { background: var(--accent); }
.activity-dot.failed, .activity-dot.cancelled { background: var(--danger); }
.activity-item strong { display: block; font-size: 12px; }
.activity-item small { color: var(--muted); font-size: 10px; }
.status-badge { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; font-size: 9px; text-transform: uppercase; }
.status-badge.audit-status { display: inline-block; margin-bottom: 6px; }
.status-badge.audit-status.completed { color: var(--accent); border-color: #536c26; }
.status-badge.audit-status.failed { color: #ffc4cf; border-color: #813545; }
.loading-lines span { height: 40px; display: block; border-radius: 8px; background: linear-gradient(90deg, #171b20, #20252c, #171b20); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.button { min-height: 34px; border: 1px solid transparent; border-radius: 6px; padding: 6px 11px; cursor: pointer; font-weight: 650; font-size: 12px; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: wait; transform: none; }
.button.primary { background: var(--accent); color: #fff; }
.button.subtle { background: var(--panel-2); border-color: var(--line); }
.button.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.button.wide { width: 100%; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; cursor: pointer; font-size: 18px; }
.inline-actions { display: flex; gap: 8px; }
.account-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.account-summary-grid article { min-height: 82px; display: grid; align-content: space-between; gap: 8px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.account-summary-grid span { color: var(--muted); font-size: 10px; }
.account-summary-grid strong { font-size: 24px; letter-spacing: -.04em; }
.account-tools { display: grid; grid-template-columns: minmax(220px, 1fr) 150px 180px auto; }
.bulk-account-actions { display: flex; align-items: center; gap: 7px; }
.bulk-account-actions span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.bulk-account-actions select { min-width: 135px; padding: 9px; }
.accounts-table td { vertical-align: middle; }
.account-row { cursor: pointer; }
.account-row:hover td { background: color-mix(in srgb, var(--panel-2) 68%, transparent); }
.accounts-table select { min-width: 145px; padding: 8px 9px; font-size: 10px; }
.account-identity { color: var(--text); font-size: 11px; font-weight: 750; }
.account-identity + small { display: block; margin-top: 4px; }
.platform-pill { display: inline-flex; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 9px; font-weight: 740; }
.platform-pill.tiktok { color: #9ee9ff; border-color: #315d69; }
.platform-pill.instagram { color: #ffc2e1; border-color: #6d3654; }
.platform-pill.youtube { color: #ff9c9c; border-color: #713a3a; }
.account-status-select { font-weight: 720; transition: border-color .15s ease, background-color .15s ease, color .15s ease; }
.account-status-select.status-new { color: #c5ced8; border-color: #46515e; background: #171d24; }
.account-status-select.status-ready { color: #a7ebff; border-color: #326577; background: #10232b; }
.account-status-select.status-login_pending { color: #d4b9ff; border-color: #654b8d; background: #211831; }
.account-status-select.status-active { color: #dfff9f; border-color: #57732c; background: #18220f; }
.account-status-select.status-warming { color: #ffd190; border-color: #7b5830; background: #2b2013; }
.account-status-select.status-checkpoint { color: #ffe889; border-color: #796a2e; background: #29240f; }
.account-status-select.status-restricted { color: #ffba92; border-color: #815034; background: #2c1c13; }
.account-status-select.status-banned, .account-status-select.status-login_failed { color: #ffc0ca; border-color: #863747; background: #30151c; }
.account-status-select.status-archived { color: #89939e; border-color: #373f49; background: #12161a; }
.row-actions { display: flex; flex-wrap: wrap; gap: 5px; max-width: 280px; }
.row-actions button { border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; background: #171c22; color: #cbd2d9; font-size: 9px; cursor: pointer; }
.row-actions button:hover:not(:disabled) { border-color: var(--line-bright); color: var(--text); }
.row-actions button:disabled { opacity: .35; cursor: not-allowed; }
.row-actions .danger-action { color: #ffadba; border-color: #61313a; }
.table-panel { padding: 0; overflow: hidden; }
.table-tools { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.search-field input { width: min(340px, 60vw); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 16px; text-align: left; color: #768290; font: 700 9px/1 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; background: #101318; }
td { padding: 15px 16px; border-top: 1px solid var(--line); color: #cdd3da; white-space: nowrap; }
td strong { color: var(--text); display: block; }
td small { color: var(--muted); }
.empty-cell { text-align: center; color: var(--muted); padding: 50px; }
.device-check, input[type="checkbox"] { accent-color: var(--accent); }
.device-status { display: inline-flex; gap: 7px; align-items: center; }
.device-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.device-status.running::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.device-status.starting::before { background: var(--warning); }

.form-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .65fr); gap: 14px; align-items: start; }
.form-layout.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(270px, .55fr); }
.form-panel { display: grid; gap: 18px; }
.template-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.group-settings { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 13px; display: grid; gap: 14px; background: #101318; }
.group-settings legend { padding: 0 7px; color: var(--accent); font: 730 10px/1 ui-monospace, SFMono-Regular, monospace; letter-spacing: .06em; text-transform: uppercase; }
.group-auto-note { margin: -2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.timing-controls { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(280px, 1.35fr) minmax(180px, .8fr); gap: 12px; align-items: end; }
.spread-control { min-width: 0; display: grid; gap: 9px; }
.control-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #c8d0d8; font-size: 12px; font-weight: 650; }
.control-heading output { color: var(--accent); font: 750 11px/1 ui-monospace, SFMono-Regular, monospace; white-space: nowrap; }
.timing-range { height: 10px; padding: 0; border: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--range-progress, 2%), #28303a var(--range-progress, 2%)); accent-color: var(--accent); cursor: pointer; }
.timing-range::-webkit-slider-thumb { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #0e1115; background: var(--accent); box-shadow: 0 0 0 1px #617b27, 0 3px 10px #0008; appearance: none; }
.timing-range::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; border: 3px solid #0e1115; background: var(--accent); box-shadow: 0 0 0 1px #617b27, 0 3px 10px #0008; }
.timing-presets { display: flex; gap: 5px; flex-wrap: wrap; }
.timing-presets button { flex: 1; min-width: 54px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 7px; background: #171b21; color: var(--muted); font-size: 9px; cursor: pointer; }
.timing-presets button:hover:not(:disabled), .timing-presets button.active { border-color: #637a31; color: var(--text); background: #202a16; }
.timing-presets button:disabled { opacity: .28; cursor: not-allowed; }
.timing-summary { min-height: 58px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid #35451f; border-radius: 11px; background: #12180d; }
.timing-summary > span { align-self: start; margin-top: 1px; color: var(--accent); border: 1px solid #52682b; border-radius: 999px; padding: 4px 6px; font: 760 8px/1 ui-monospace, SFMono-Regular, monospace; letter-spacing: .08em; }
.timing-summary strong, .timing-summary small { display: block; }
.timing-summary strong { font-size: 11px; }
.timing-summary small { color: #98a28d; font-size: 9px; line-height: 1.5; margin-top: 4px; }
.timing-summary.invalid { border-color: #813545; background: #211116; }
.timing-summary.invalid > span { color: #ffc4cf; border-color: #813545; }
.timing-summary.invalid small { color: #d7a4ae; }
.recurrence-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) minmax(90px, .6fr) minmax(120px, .8fr); gap: 10px; align-items: end; }
.recurrence-row.is-single label:not(:first-child) { opacity: .45; }
label { display: grid; gap: 7px; color: #c8d0d8; font-size: 12px; }
label > span { font-weight: 650; }
label small { color: var(--muted); font-size: 10px; }
input, select, textarea { width: 100%; min-height: 36px; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 6px; padding: 7px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #71852f; box-shadow: 0 0 0 3px #c7ff3c12; }
textarea { resize: vertical; min-height: 110px; }
select[multiple] { min-height: 118px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.warmup-range-fields { display: grid; grid-template-columns: minmax(190px, 1.3fr) repeat(2, minmax(120px, .7fr)); gap: 12px; align-items: end; }
.segmented { display: flex; background: var(--panel-2); border: 1px solid var(--line); padding: 3px; border-radius: 6px; gap: 3px; }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { text-align: center; padding: 9px 12px; border-radius: 8px; color: var(--muted); }
.segmented input:checked + span { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 7px #0006; }
.segmented.compact { width: auto; }
.segmented.compact label { min-width: 70px; }
.segmented.compact span { padding: 7px 9px; font-size: 10px; }
.check-label { grid-template-columns: auto 1fr; align-items: center; align-self: center; cursor: pointer; }
.check-label input { width: 16px; height: 16px; }
.guidance-panel { background: #10140d; border-color: #29351c; }
.guidance-panel h3 { margin: 22px 0 8px; font-size: 24px; letter-spacing: -.04em; }
.guidance-panel p:not(.eyebrow), .guidance-panel li { color: #98a28d; font-size: 12px; line-height: 1.6; }
.guidance-panel ul { padding-left: 18px; margin: 24px 0 0; }
.upload-box { border: 1px dashed var(--line-bright); border-radius: 13px; padding: 15px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; background: #0e1115; }
.drop-label strong, .drop-label span { display: block; }
.drop-label span { color: var(--muted); font-size: 10px; margin-top: 3px; }
.upload-box input[type="file"] { grid-column: 1 / -1; padding: 8px; }
.upload-status { grid-column: 1 / -1; min-height: 2px; color: var(--accent); font-size: 10px; }
.phone-preview { margin-top: 22px; border: 1px solid var(--line); border-radius: 18px; padding: 10px; background: #0d1014; }
.phone-media { aspect-ratio: 9/13; border-radius: 12px; background: radial-gradient(circle at 65% 20%, #2f3842 0, #171c22 36%, #0b0e11 78%); display: grid; place-items: center; color: #66717d; border: 1px solid #222831; overflow: hidden; }
.phone-media span { border: 1px solid #3b444e; padding: 7px 9px; border-radius: 99px; font: 700 9px/1 ui-monospace, monospace; }
.phone-media video { width: 100%; height: 100%; object-fit: cover; background: #050607; }
.phone-preview > div:last-child { padding: 12px 6px 5px; }
.phone-preview p { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.storage-note { display: grid; gap: 4px; margin-top: 14px; padding: 13px; border-radius: 12px; background: #171b21; }
.storage-note strong { font-size: 11px; }
.storage-note span { color: var(--muted); font-size: 10px; }
.app-dialog { width: min(720px, calc(100vw - 28px)); max-height: calc(100vh - 30px); padding: 0; border: 1px solid var(--line-bright); border-radius: 17px; background: var(--panel); color: var(--text); box-shadow: 0 28px 90px #000c; }
.app-dialog::backdrop { background: #05070acc; backdrop-filter: blur(4px); }
.dialog-card { display: grid; gap: 16px; padding: 22px; max-height: calc(100vh - 32px); overflow: auto; }
.compact-dialog { width: min(520px, 100%); margin: auto; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 22px; letter-spacing: -.035em; }
.dialog-head small { display: block; color: var(--muted); margin-top: 5px; }
.dialog-close { width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; background: #151a20; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.notice-box, .import-columns { display: grid; gap: 5px; padding: 13px 14px; border: 1px solid #3b4825; border-radius: 11px; background: #12180e; color: #b9c4a6; font-size: 10px; line-height: 1.5; }
.import-columns span { color: var(--text); font: 10px/1.5 ui-monospace, SFMono-Regular, monospace; overflow-wrap: anywhere; }
.import-columns small { color: var(--muted); }
.import-result { min-height: 4px; display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
.import-result strong { color: var(--accent); }
.import-result pre { max-height: 180px; overflow: auto; white-space: pre-wrap; }
.history-dialog { width: min(920px, calc(100vw - 28px)); }
.history-list { display: grid; gap: 8px; }
.history-item { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(180px, .8fr) minmax(220px, 1.3fr); gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #11151a; }
.history-item strong, .history-item small, .history-item span, .history-item code { display: block; }
.history-item strong { margin: 7px 0 3px; }
.history-item small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.history-item code { margin-top: 7px; color: #87919d; font-size: 9px; overflow-wrap: anywhere; }
.history-item details { min-width: 0; }
.history-item summary { color: var(--muted); font-size: 9px; cursor: pointer; }
.history-item pre { max-height: 180px; margin: 8px 0 0; padding: 9px; overflow: auto; border-radius: 7px; background: #090b0e; color: #98a3af; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 8px; }
.add-account-panel { margin-bottom: 14px; padding: 14px; display: grid; grid-template-columns: minmax(220px, .7fr) minmax(360px, 1.3fr); align-items: end; gap: 18px; }
.add-account-copy { display: grid; gap: 4px; }
.add-account-copy small { color: var(--muted); line-height: 1.45; }
.inline-form { display: grid; grid-template-columns: 150px 1fr 1fr auto; gap: 9px; }
.connect-form { grid-template-columns: minmax(260px, 1fr) auto; }
.copy-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 10px; }
.copy-result input { color: var(--muted); font: 10px/1.4 ui-monospace, SFMono-Regular, monospace; }
.analytics-import-panel { margin-bottom: 14px; display: grid; grid-template-columns: minmax(220px, .65fr) minmax(360px, 1.2fr); align-items: end; gap: 16px; }
.analytics-import-panel > div strong, .analytics-import-panel > div small { display: block; }
.analytics-import-panel > div small { color: var(--muted); margin-top: 4px; line-height: 1.45; }
.analytics-import-panel > span { grid-column: 1 / -1; }
.project-label { display: inline-flex; max-width: 180px; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; color: var(--text); background: var(--panel-2); font-size: 9px; }
.table-link { color: inherit; text-decoration: none; }
.table-link:hover { color: var(--accent); text-decoration: underline; }
.account-card-dialog { width: min(980px, calc(100vw - 28px)); }
.account-card-content { display: grid; gap: 16px; }
.account-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.account-card-field { min-width: 0; display: grid; gap: 6px; }
.account-card-field > span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.account-card-field > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.account-card-field input { min-width: 0; font: 10px/1.4 ui-monospace, SFMono-Regular, monospace; }
.copy-button { border: 1px solid var(--line); border-radius: 9px; padding: 0 11px; background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 9px; }
.copy-button:disabled { opacity: .4; cursor: not-allowed; }
.account-card-notes { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); }
.account-card-notes p { margin: 7px 0 0; color: var(--muted); white-space: pre-wrap; }
.account-card-history { border-top: 1px solid var(--line); padding-top: 12px; }
.account-card-history summary { cursor: pointer; color: var(--text); font-weight: 700; }
.account-card-history > div { display: grid; gap: 7px; margin-top: 10px; }
.account-card-history pre { max-height: 240px; overflow: auto; padding: 12px; border-radius: 9px; background: var(--panel-2); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.account-card-history article { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; }
.account-card-history article strong, .account-card-history article small { display: block; }
.account-card-history article small { color: var(--muted); margin-top: 3px; }
.settings-form { display: grid; gap: 18px; max-width: 980px; }
.settings-group { display: grid; grid-template-columns: minmax(180px, .65fr) repeat(2, minmax(220px, 1fr)); gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); align-items: end; }
.settings-group > div strong, .settings-group > div small { display: block; }
.settings-group > div small { color: var(--muted); margin-top: 5px; line-height: 1.45; }

[data-theme="light"] .sidebar { background: #ffffff; }
[data-theme="light"] .nav-item:hover { background: #eef2f5; }
[data-theme="light"] .nav-item.active { color: #172000; }
[data-theme="light"] .api-indicator,
[data-theme="light"] .group-settings,
[data-theme="light"] .analytics-tabs,
[data-theme="light"] .heatmap-title,
[data-theme="light"] .schedule-day-head,
[data-theme="light"] .scheduler-task-tools,
[data-theme="light"] .task-group-card,
[data-theme="light"] .group-template-chip,
[data-theme="light"] .history-item,
[data-theme="light"] .dialog-close,
[data-theme="light"] .upload-box,
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea { background: #f7f9fa; }
[data-theme="light"] th { background: #eef2f5; color: #66727f; }
[data-theme="light"] .heatmap-table td:first-child { background: #ffffff; }
[data-theme="light"] .heatmap-empty { background: #eef2f5; color: #778390; }
[data-theme="light"] .guidance-panel,
[data-theme="light"] .timing-summary,
[data-theme="light"] .notice-box,
[data-theme="light"] .import-columns { background: #f5fae9; }
[data-theme="light"] .phone-preview,
[data-theme="light"] .phone-media { background: #e7ebef; }
[data-theme="light"] .login-body { background: radial-gradient(circle at 30% 20%, #e5f2c9 0, var(--bg) 42%); }
[data-theme="light"] .login-card { background: #ffffffee; box-shadow: 0 30px 90px #33415524; }
[data-theme="light"] .audit-details pre,
[data-theme="light"] .history-item pre { background: #eef2f5; color: #40505e; }
.analytics-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.analytics-refresh { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.analytics-tabs { display: inline-flex; gap: 2px; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.analytics-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: 9px 13px; font-size: 11px; font-weight: 720; cursor: pointer; }
.analytics-tabs button:hover { color: var(--text); }
.analytics-tabs button.active { color: var(--text); background: transparent; border-bottom-color: var(--accent); box-shadow: none; }
.analytics-pane { display: none; }
.analytics-pane.active { display: block; }
.heatmap-panel { padding: 0; overflow: hidden; margin-bottom: 14px; }
.heatmap-head { padding: 20px 22px; align-items: end; }
.heatmap-head p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 6px 0 0; max-width: 720px; }
.heatmap-metric-control { width: 185px; flex: 0 0 auto; }
.heatmap-metric-control select { padding: 9px 11px; }
.heatmap-legend { min-height: 42px; padding: 10px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; }
.heatmap-legend small { margin-left: auto; }
.heatmap-gradient { width: 150px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, hsl(215 45% 16%), hsl(145 63% 42%), hsl(75 80% 68%)); box-shadow: inset 0 0 0 1px #ffffff18; }
.analytics-heatmaps { display: grid; }
.heatmap-block { min-width: 0; border-top: 1px solid var(--line); }
.heatmap-title { padding: 15px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #101318; }
.heatmap-title strong, .heatmap-title small { display: block; }
.heatmap-title strong { font-size: 14px; }
.heatmap-title small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.heatmap-title > span { color: var(--accent); font: 700 11px/1.2 ui-monospace, SFMono-Regular, monospace; text-align: right; }
.heatmap-scroll { max-height: 420px; }
.heatmap-table { width: max-content; min-width: 100%; }
.heatmap-table th { min-width: 78px; padding: 11px 10px; text-align: right; position: sticky; top: 0; z-index: 3; }
.heatmap-table th:first-child { min-width: 220px; width: 220px; text-align: left; left: 0; z-index: 5; }
.heatmap-table th:nth-child(2) { min-width: 96px; left: 220px; z-index: 4; box-shadow: 10px 0 18px #0005; }
.heatmap-table td { min-width: 78px; height: 54px; padding: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.heatmap-table td:first-child { min-width: 220px; width: 220px; text-align: left; position: sticky; left: 0; z-index: 2; background: var(--panel); }
.heatmap-table td:nth-child(2) { min-width: 96px; position: sticky; left: 220px; z-index: 1; box-shadow: 10px 0 18px #0005; }
.heatmap-value { font-weight: 760; color: var(--text); transition: filter .15s ease, transform .15s ease; }
.heatmap-value:hover { filter: brightness(1.14); outline: 1px solid #ffffff38; outline-offset: -1px; }
.heatmap-empty { background: #101318; color: #55606b; font-weight: 500; }
.heatmap-identity strong { overflow: hidden; text-overflow: ellipsis; max-width: 195px; }
.heatmap-identity small { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 195px; margin-top: 4px; }
.heatmap-total-cell { border-left: 1px solid #ffffff1c; }
.heatmap-total-row td { border-top: 2px solid var(--line-bright); font-weight: 780; }
.heatmap-total-row td:first-child { background: #171c21; }
.heatmap-total-row-cell { border-top: 2px solid var(--line-bright); }
.heatmap-combined .heatmap-table { width: 100%; }
.combined-table th, .combined-table td { min-width: 130px; }
.combined-table th:first-child, .combined-table td:first-child { min-width: 260px; width: auto; }
.combined-table th:nth-child(2), .combined-table td:nth-child(2) { position: static; box-shadow: none; }
.table-title, .table-subtitle { display: block; }
.table-title { font-size: 12px; color: var(--text); }
.table-subtitle { color: var(--muted); font-size: 9px; margin-top: 3px; }
.target-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.target-heading strong, .target-heading small { display: block; }
.target-heading small, .account-discovery-note { color: var(--muted); font-size: 10px; margin-top: 4px; }
.target-table-wrap { overflow: auto; max-height: 410px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.target-table th { position: sticky; top: 0; z-index: 2; }
.target-table td { vertical-align: top; white-space: normal; }
.target-table th:first-child, .target-table td:first-child { min-width: 170px; }
.target-table th:not(:first-child), .target-table td:not(:first-child) { min-width: 220px; }
.target-all { display: flex; grid-template-columns: none; flex-direction: row; align-items: center; gap: 7px; cursor: pointer; }
.target-all input { width: 15px; height: 15px; }
.target-cell { display: grid; gap: 8px; }
.target-check { display: flex; grid-template-columns: none; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.target-check input { width: 16px; height: 16px; }
.target-cell select { padding: 8px 9px; font-size: 10px; }
.account-badges { display: flex; flex-wrap: wrap; gap: 5px; max-width: 270px; }
.account-badge { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 4px 7px; color: var(--muted); font-size: 9px; }
.account-badge.known { font-weight: 700; }
.account-badge.known.status-new { border-color: #46515e; background: #171d24; color: #c5ced8; }
.account-badge.known.status-ready { border-color: #326577; background: #10232b; color: #a7ebff; }
.account-badge.known.status-login_pending { border-color: #654b8d; background: #211831; color: #d4b9ff; }
.account-badge.known.status-active { border-color: #57732c; background: #18220f; color: #dfff9f; }
.account-badge.known.status-warming { border-color: #7b5830; background: #2b2013; color: #ffd190; }
.account-badge.known.status-banned, .account-badge.known.status-login_failed { border-color: #813545; background: #2b141a; color: #ffc0ca; }
.account-badge.known.status-checkpoint { border-color: #796a2e; background: #29240f; color: #ffe889; }
.account-badge.known.status-restricted { border-color: #815034; background: #2c1c13; color: #ffba92; }
.account-badge.known.status-archived { border-color: #3b444f; background: #14181d; color: #89939e; }
.account-discovery-note { margin: -8px 0 0; line-height: 1.5; }
.scheduler-lead { min-height: 46px; }
.scheduler-lead p { margin: 0 !important; }
.scheduler-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.schedule-stat { min-height: 90px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); display: flex; flex-direction: column; justify-content: space-between; }
.schedule-stat span { color: var(--muted); font-size: 10px; }
.schedule-stat strong { font-size: 28px; line-height: 1; letter-spacing: -.05em; }
.scheduler-panel { padding: 0; overflow: hidden; }
.scheduler-tools { min-height: 64px; padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.scheduler-tools #refresh-scheduler { margin-left: auto; }
.scheduler-view-tabs { width: auto; }
.scheduler-pane { display: none; }
.scheduler-pane.active { display: block; }
.scheduler-task-tools { min-height: 58px; padding: 10px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: #11151a; }
.compact-tabs button { padding: 8px 12px; font-size: 10px; }
.scheduler-scope { width: 220px; margin-left: auto; }
.scheduler-scope select { padding: 9px 11px; }
.scheduler-list { display: grid; }
.scheduler-subhead { min-height: 50px; padding: 13px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: #0e1115; }
.scheduler-subhead strong, .scheduler-subhead small { display: block; }
.scheduler-subhead strong { font-size: 12px; }
.scheduler-subhead small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.task-groups-list { padding: 14px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.task-group-card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 13px; background: #11151a; display: grid; gap: 11px; }
.task-group-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.task-group-card-head strong, .task-group-card-head small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-group-card-head strong { font-size: 12px; }
.task-group-card-head small { color: var(--muted); font-size: 9px; margin-top: 4px; }
.task-group-card dl { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.task-group-card dl div { min-width: 0; padding: 8px; border-radius: 8px; background: #0d1014; }
.task-group-card dt { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.task-group-card dd { margin: 5px 0 0; color: var(--text); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-templates-list { min-height: 58px; padding: 12px 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.group-template-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 10px; background: #11151a; }
.group-template-chip span { font-size: 10px; }
.group-template-chip button { border: 0; border-radius: 999px; color: var(--muted); background: #222932; cursor: pointer; padding: 4px 7px; font-size: 9px; }
.group-template-chip button:hover { color: var(--text); }
.schedule-day { border-top: 1px solid var(--line); }
.schedule-day:first-child { border-top: 0; }
.schedule-day-head { min-height: 48px; padding: 13px 20px; display: flex; align-items: center; justify-content: space-between; gap: 15px; background: #101318; }
.schedule-day-head strong { font-size: 13px; text-transform: capitalize; }
.schedule-day-head span { color: var(--muted); font-size: 10px; }
.schedule-day-items { display: grid; padding: 0 20px; }
.schedule-item { min-height: 76px; display: grid; grid-template-columns: 54px 78px minmax(0, 1fr) auto; gap: 13px; align-items: center; border-top: 1px solid var(--line); }
.schedule-item:first-child { border-top: 0; }
.schedule-item time { color: var(--text); font: 760 14px/1 ui-monospace, SFMono-Regular, monospace; }
.schedule-kind { justify-self: start; border: 1px solid #3c5360; color: var(--cyan); border-radius: 999px; padding: 5px 8px; font-size: 9px; text-transform: uppercase; }
.schedule-kind.warmup { color: var(--accent); border-color: #52682b; }
.schedule-item-main { min-width: 0; }
.schedule-item-main strong, .schedule-item-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-item-main strong { font-size: 12px; }
.schedule-item-main small { color: var(--muted); font-size: 10px; margin-top: 5px; }
.schedule-error { display: block; margin-top: 5px; color: #ffc4cf; font-size: 10px; white-space: normal; }
.schedule-item.completed .schedule-status { color: var(--accent); border-color: #536c26; }
.schedule-item.failed .schedule-status, .schedule-item.partial .schedule-status { color: #ffc4cf; border-color: #813545; }
.schedule-item.cancelled .schedule-status { color: var(--muted); }
.scheduler-empty { min-height: 280px; padding: 44px 20px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; }
.scheduler-empty strong { font-size: 18px; }
.scheduler-empty span { color: var(--muted); font-size: 11px; }
.scheduler-empty > div { display: flex; gap: 8px; margin-top: 12px; }
.muted { color: var(--muted); font-size: 11px; }
.audit-filters { justify-content: flex-start; }
.audit-filters select { width: auto; min-width: 160px; }
.audit-filters .muted { margin-left: auto; }
.audit-error { display: block; max-width: 420px; margin-top: 6px; color: #ffc4cf; white-space: normal; }
.audit-details summary { color: var(--accent); cursor: pointer; }
.audit-details pre { width: min(560px, 70vw); max-height: 330px; overflow: auto; margin: 10px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #0b0e11; color: #b9c3cc; font: 10px/1.55 ui-monospace, SFMono-Regular, monospace; white-space: pre-wrap; word-break: break-word; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.toast-region { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 9px; z-index: 100; }
.toast { width: min(360px, calc(100vw - 44px)); padding: 13px 15px; border-radius: 12px; background: #1c2229; border: 1px solid var(--line-bright); box-shadow: 0 18px 40px #0008; font-size: 12px; animation: toast-in .22s ease; }
.toast.error { border-color: #813545; color: #ffc4cf; }
.toast.success { border-color: #536c26; color: #ddffa0; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.login-body { display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #1b2414 0, var(--bg) 38%); padding: 24px; }
.login-shell { width: min(880px, 100%); display: grid; grid-template-columns: 1fr 390px; align-items: center; gap: clamp(30px, 8vw, 100px); }
.login-brand h1 { font-size: clamp(50px, 8vw, 82px); line-height: .85; letter-spacing: -.075em; margin: 20px 0; }
.login-brand > p:last-child { color: var(--muted); max-width: 390px; line-height: 1.6; }
.login-card { border: 1px solid var(--line); border-radius: 22px; background: #11151aee; padding: 28px; display: grid; gap: 20px; box-shadow: 0 30px 90px #0008; }
.login-card h2 { margin: 0; letter-spacing: -.04em; }
.alert { padding: 10px 12px; border-radius: 9px; font-size: 12px; }
.alert.error { color: #ffc4cf; background: #35151c; border: 1px solid #68303d; }

@media (max-width: 1000px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid, .form-layout, .form-layout.wide-left { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .guidance-panel { display: none; }
  .preview-panel { max-width: 440px; }
  #devices .section-lead { align-items: flex-start; flex-direction: column; }
  #devices .inline-actions { flex-wrap: wrap; }
  .account-tools { grid-template-columns: 1fr 150px 180px; }
  .bulk-account-actions { grid-column: 1 / -1; }
}

@media (max-width: 740px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 18px 0 45px #0009; }
  body.menu-open .sidebar { transform: translateX(0); }
  .workspace { margin-left: 0; padding: 20px 16px 44px; }
  .menu-toggle { display: block; }
  .topbar { align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 125px; padding: 16px; }
  .quick-actions { grid-template-columns: 1fr; }
  .quick-card { min-height: 110px; }
  .form-row, .warmup-range-fields, .inline-form, .add-account-panel, .analytics-import-panel, .template-picker, .recurrence-row, .timing-controls, .settings-group, .account-card-grid { grid-template-columns: 1fr; }
  .account-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-tools { display: flex; flex-direction: column; align-items: stretch; }
  .account-tools .search-field input, .account-tools select { width: 100%; }
  .bulk-account-actions { display: grid; grid-template-columns: 1fr auto; }
  .bulk-account-actions span { grid-column: 1 / -1; }
  .history-item { grid-template-columns: 1fr; }
  .dialog-card { padding: 17px; }
  .copy-result { grid-template-columns: 1fr; }
  .section-lead { align-items: flex-start; flex-direction: column; }
  .analytics-toolbar, .scheduler-tools, .scheduler-task-tools { align-items: stretch; flex-direction: column; }
  .analytics-tabs { width: 100%; }
  .analytics-tabs button { flex: 1; }
  .scheduler-tools #refresh-scheduler { width: 100%; margin-left: 0; }
  .scheduler-scope { width: 100%; margin-left: 0; }
  .scheduler-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-item { grid-template-columns: 48px 70px minmax(0, 1fr); padding: 12px 0; }
  .schedule-status { grid-column: 3; justify-self: start; }
  .table-tools { align-items: flex-start; flex-wrap: wrap; }
  .heatmap-head { align-items: flex-start; flex-direction: column; }
  .heatmap-metric-control { width: 100%; }
  .heatmap-legend { flex-wrap: wrap; }
  .heatmap-legend small { width: 100%; margin-left: 0; }
  .audit-filters select { width: 100%; }
  .audit-filters .muted { margin-left: 0; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}
