:root {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  color-scheme: light dark;
  --bg: #f2f2f7;
  --card: #ffffff;
  --card2: #f7f7fa;
  --label: #1c1c1e;
  --label2: #636366;
  --label3: #8e8e93;
  --sep: rgba(60, 60, 67, .12);
  --sep2: rgba(60, 60, 67, .07);
  --fill: rgba(120, 120, 128, .16);
  --blue: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --sidebar: rgba(249, 249, 251, .82);
  --shadow-card: 0 .5px 1.5px rgba(0, 0, 0, .04);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .18);
  color: var(--label);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --card2: #2c2c2e;
    --label: #f2f2f7;
    --label2: #aeaeb2;
    --label3: #8e8e93;
    --sep: rgba(84, 84, 88, .45);
    --sep2: rgba(84, 84, 88, .3);
    --fill: rgba(120, 120, 128, .24);
    --blue: #0a84ff;
    --green: #30d158;
    --red: #ff453a;
    --sidebar: rgba(30, 30, 32, .8);
    --shadow-card: 0 .5px 1.5px rgba(0, 0, 0, .3);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
body { margin: 0; display: flex; min-width: 320px; min-height: 100vh; background: var(--bg); }
button, input, select { font: inherit; }
button { border: 0; border-radius: 10px; padding: 10px 16px; background: var(--blue); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: filter .12s; }
button:hover { filter: brightness(.95); }
button:disabled { opacity: .4; cursor: default; }
.secondary { background: var(--fill); color: var(--label); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 50%, transparent); outline-offset: 3px; }
::placeholder { color: var(--label3); }
aside { position: sticky; top: 0; height: 100vh; width: 250px; flex-shrink: 0; padding: 22px 14px; display: flex; flex-direction: column; background: var(--sidebar); -webkit-backdrop-filter: saturate(1.6) blur(20px); backdrop-filter: saturate(1.6) blur(20px); border-right: 1px solid var(--sep); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 24px; color: var(--label); text-decoration: none; }
.brand-mark { flex-shrink: 0; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(160deg, #0a84ff, #0055d4); color: #fff; font-size: 19px; font-weight: 700; box-shadow: 0 6px 14px rgba(0, 85, 212, .35); }
.brand strong { display: block; font-size: 16px; }
.brand small { display: block; color: var(--label3); font-size: 11px; margin-top: 2px; }
nav { display: grid; gap: 3px; }
.nav { padding: 9px 12px; text-align: left; font-size: 14px; font-weight: 500; border-radius: 9px; color: var(--label2); }
.nav.active { color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, transparent); font-weight: 600; }
.muted { color: var(--label3); }
.account { margin-top: auto; border-top: 1px solid var(--sep); padding: 16px 7px 0; display: flex; align-items: center; gap: 9px; font-size: 12px; }
.avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(160deg, #5e5ce6, #3634a3); color: #fff; font-weight: 600; }
.account strong, .account small { display: block; }
.account small { margin-top: 3px; line-height: 1.6; color: var(--label3); font-size: 11px; }
main { padding: 30px clamp(20px, 4vw, 56px) 60px; flex: 1; min-width: 0; }
header, .app-heading, .place-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
header { margin-bottom: 24px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-shrink: 0; }
.icon-button { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
@media (max-width: 500px) { main > header { flex-wrap: wrap; } .header-actions { margin-left: auto; } }
h1 { margin: 2px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -.6px; }
h2 { font-size: 20px; margin: 8px 0; letter-spacing: -.3px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
p { color: var(--label2); font-size: 13px; line-height: 1.6; }
header p { margin: 8px 0 0; }
.eyebrow { color: var(--label3); font-size: 11px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; }
#add-app { box-shadow: 0 4px 14px color-mix(in srgb, var(--blue) 30%, transparent); }
.notice { margin: 0 0 14px; padding: 10px 13px; border-radius: 10px; background: color-mix(in srgb, var(--blue) 8%, transparent); border: 1px solid color-mix(in srgb, var(--blue) 18%, transparent); color: var(--label2); font-size: 12px; line-height: 1.5; }
#status { min-height: 24px; font-size: 12px; color: var(--green); }
#status.error { color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(120px, 190px)); gap: 10px; margin-bottom: 18px; }
.metrics section { padding: 14px 16px; background: var(--card); border: 1px solid var(--sep2); border-radius: 12px; box-shadow: var(--shadow-card); }
.metrics small { color: var(--label3); font-size: 12px; font-weight: 500; }
.metrics strong { display: block; margin-top: 3px; font-size: 24px; font-weight: 700; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 3px; margin-bottom: 20px; background: var(--fill); border-radius: 11px; width: fit-content; max-width: 100%; }
.tabs button { padding: 6px 13px; background: var(--card); color: var(--label); box-shadow: 0 1px 4px rgba(0, 0, 0, .12), 0 0 0 .5px var(--sep2); border-radius: 8px; font-size: 13px; font-weight: 500; }
.tabs button.secondary { background: transparent; color: var(--label2); box-shadow: none; }
.app-heading { margin-bottom: 16px; }
.badge { display: inline-block; font-size: 10px; vertical-align: middle; border-radius: 6px; padding: 3px 8px; font-weight: 600; color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); }
article { padding: 20px; border-radius: 14px; background: var(--card); border: 1px solid var(--sep2); box-shadow: var(--shadow-card); margin-bottom: 18px; }
code { font-size: 12px; color: var(--label3); margin-right: 10px; overflow-wrap: anywhere; }
.subtle { font-size: 11px; color: var(--label3); }
.settings { display: flex; gap: 18px; margin: 20px 0; }
label { font-size: 13px; font-weight: 500; color: var(--label2); display: block; }
input, select { width: 100%; min-width: 0; border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; background: var(--fill); color: var(--label); font-size: 13px; transition: background .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; background: var(--card); border-color: var(--sep); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--blue) 25%, transparent); }
label > input, label > select { display: block; margin-top: 6px; }
.source { display: grid; grid-template-columns: 26px 160px minmax(100px, 1fr) 90px 62px 76px; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--sep2); }
.source[draggable] { cursor: grab; }
.rank { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--fill); font-size: 11px; color: var(--label2); font-variant-numeric: tabular-nums; }
.provider strong { font-size: 13px; font-weight: 500; }
.provider small { display: block; font-size: 11px; color: var(--label3); margin-top: 4px; }
.toggle { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.toggle input { width: auto; margin: 0; accent-color: var(--blue); }
.arrows { display: flex; gap: 4px; }
.arrows button { padding: 7px 10px; }
.hint { font-size: 12px; margin-bottom: 0; color: var(--label3); }
.empty { border: 1px solid var(--sep2); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-card); text-align: center; padding: 50px 25px; color: var(--label3); }
.empty p { max-width: 420px; margin: 14px auto; }
dialog { background: var(--card); color: var(--label); border: 1px solid var(--sep2); border-radius: 20px; width: min(420px, calc(100% - 32px)); padding: 28px; box-shadow: var(--shadow-pop); }
dialog::backdrop { background: rgba(0, 0, 0, .35); backdrop-filter: blur(4px); }
dialog label { margin: 20px 0; }
footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.danger-button { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
#delete-source { margin-right: auto; }
#delete-source-description { overflow-wrap: anywhere; }
.saving #workspace, .saving #add-app { pointer-events: none; opacity: .65; }
[hidden] { display: none !important; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 22px; font-size: 13px; color: var(--label3); }
.breadcrumbs a, .list-link { color: var(--blue); text-decoration: none; }
.breadcrumbs a:hover, .list-link:hover { text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--label2); overflow-wrap: anywhere; }
.app-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; font-size: 12px; color: var(--label3); }
.entity-list { background: var(--card); border: 1px solid var(--sep2); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-card); }
.entity-row { display: flex; align-items: center; gap: 14px; min-height: 82px; padding: 16px 20px; text-decoration: none; color: var(--label); border-bottom: 1px solid var(--sep2); transition: background .12s; }
.entity-row:last-child { border-bottom: 0; }
.entity-row:hover { background: var(--card2); }
.entity-icon { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); border-radius: 11px; font-size: 17px; font-weight: 650; }
.entity-description { flex: 1; min-width: 0; }
.entity-description strong { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.entity-description small { display: block; margin-top: 5px; color: var(--label3); font-size: 12px; overflow-wrap: anywhere; }
.entity-meta { color: var(--label3); font-size: 12px; }
.chevron { color: var(--label3); font-size: 24px; margin-left: 8px; }
@media (max-width: 760px) { .entity-row { padding: 14px; gap: 10px; } .entity-meta { display: none; } }
nav .nav { background: transparent; color: var(--label2); font-weight: 500; }
nav .nav:hover { background: var(--fill); }
.campaign-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.campaign-card { margin: 0; min-width: 0; }
.locale-add { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.locale-add select { flex: 1; min-width: 150px; }
.translation-card { margin: 22px 0; padding: 16px; border: 1px solid var(--sep); border-radius: 12px; min-width: 0; }
.translation-card legend { color: var(--blue); font-size: 13px; font-weight: 600; }
#targeting-form > label { margin-top: 20px; max-width: 480px; }
.locale-checklist { max-width: 640px; margin-top: 14px; border: 1px solid var(--sep); border-radius: 10px; padding: 10px; }
.locale-options { max-height: 220px; overflow-y: auto; margin-top: 8px; }
.locale-options label { display: flex; align-items: center; gap: 10px; padding: 8px; margin: 0; color: var(--label); }
.locale-options input { width: auto; accent-color: var(--blue); }
.locale-options small { color: var(--label3); margin-left: auto; }
.analytics-panel { margin-top: 24px; padding: 20px; border: 1px solid var(--sep2); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-card); }
.analytics-panel h2 { margin-top: 0; font-size: 18px; }
.analytics-period { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.analytics-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.analytics-kpis > div { padding: 14px; background: var(--card2); border-radius: 10px; }
.analytics-kpis small { color: var(--label3); font-size: 12px; }
.analytics-kpis strong { display: block; font-size: 24px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.analytics-scroll { overflow-x: auto; }
.analytics-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.analytics-table th, .analytics-table td { padding: 12px; text-align: right; border-bottom: 1px solid var(--sep2); font-variant-numeric: tabular-nums; }
.analytics-table th:first-child { text-align: left; min-width: 180px; }
.analytics-table thead th { color: var(--label3); font-size: 11px; }
.analytics-table th small { display: block; color: var(--label3); font-weight: 400; margin-top: 5px; overflow-wrap: anywhere; }
.analytics-group { margin-top: 10px; border: 1px solid var(--sep2); border-radius: 10px; overflow: hidden; }
.analytics-group summary { cursor: pointer; padding: 14px; background: var(--card2); font-size: 13px; }
.analytics-group summary > span { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--label2); font-size: 12px; }
.analytics-group summary strong { overflow-wrap: anywhere; }
.analytics-children { padding: 0 12px 12px; }
@media (max-width: 760px) { .analytics-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .analytics-panel { padding: 16px; } .analytics-children { padding: 0 6px 6px; } }
.campaign-group { margin-bottom: 28px; }
.campaign-group > h2 { margin: 0 0 14px; font-size: 17px; }
.campaign-card h3 { overflow-wrap: anywhere; }
.creative-preview { padding: 20px; margin: 18px 0; background: var(--card2); border: 1px solid var(--sep2); border-radius: 12px; }
.creative-preview h2, .creative-preview p { overflow-wrap: anywhere; white-space: pre-wrap; }
.preview-cta { display: inline-block; padding: 8px 12px; background: var(--blue); color: #fff; border-radius: 9px; font-size: 13px; }
.campaign-url { overflow-wrap: anywhere; font-size: 12px; color: var(--label3); }
#campaign-editor { width: min(580px, calc(100% - 32px)); max-height: calc(100vh - 48px); }
textarea { display: block; width: 100%; margin-top: 6px; resize: vertical; font: inherit; font-size: 13px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--sep); background: var(--fill); color: var(--label); }
.form-error { font-size: 12px; color: var(--red); }
.source > select[data-field=unitId] { min-width: 0; }
.source-heading { margin: 0 0 18px; flex-wrap: wrap; gap: 12px 20px; }
.source-heading h3 { margin: 0; }
.source-heading [data-add-source] { flex-shrink: 0; margin-left: auto; max-width: 100%; white-space: normal; }
.sources .source { grid-template-columns: 26px 160px minmax(0, 1fr) auto 76px; }
.source-summary { min-width: 0; font-size: 12px; }
.source-summary span { display: block; overflow-wrap: anywhere; }
.source-summary small { display: block; color: var(--label3); margin-top: 5px; }
.sources .arrows { grid-column: auto; grid-row: auto; }
#source-form .toggle { margin: 20px 0; }
#source-editor { width: min(560px, calc(100% - 32px)); }
.provider-picker { min-width: 0; border: 0; padding: 0; margin: 24px 0; }
.provider-picker legend { color: var(--label2); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.provider-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.provider-option { position: relative; margin: 0; cursor: pointer; }
.provider-option > input { position: absolute; opacity: 0; width: 1px; height: 1px; padding: 0; margin: 0; }
.provider-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; height: 100%; min-height: 146px; padding: 18px 12px 14px; border: 1.5px solid var(--sep); border-radius: 14px; background: var(--card2); transition: border-color .15s, background .15s, box-shadow .15s; }
.provider-tile strong { margin-top: 8px; font-size: 13px; color: var(--label); }
.provider-tile small { color: var(--label3); font-size: 10px; }
.provider-logo { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; }
.yandex-logo { background: #fc3f1d; color: #fff; border-radius: 10px; font: 500 28px Arial, sans-serif; }
.house-logo { background: linear-gradient(160deg, #0a84ff, #0055d4); color: #fff; border-radius: 10px; font-size: 22px; font-weight: 700; }
.provider-check { position: absolute; top: 10px; right: 10px; display: none; width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background: var(--blue); font-size: 11px; }
.provider-option input:checked + .provider-tile { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 7%, var(--card)); box-shadow: 0 0 0 1px var(--blue); }
.provider-option input:checked + .provider-tile .provider-check { display: flex; }
.provider-option input:focus-visible + .provider-tile { outline: 3px solid color-mix(in srgb, var(--blue) 40%, transparent); outline-offset: 3px; }
.provider-option input:not(:disabled):not(:checked) + .provider-tile:hover { background: var(--fill); }
.provider-option input:disabled + .provider-tile { cursor: default; }
.provider-option input:disabled:not(:checked) + .provider-tile { opacity: .45; }
@media (max-width: 400px) { .provider-options { grid-template-columns: 1fr; } .provider-tile { min-height: 90px; } }
@media (max-width: 900px) {
  .sources .source { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .source-summary { grid-column: 2 / 4; }
  .sources [data-edit-source] { grid-column: 2; }
  .sources .arrows { grid-column: 3; grid-row: 1; }
}
@media (max-width: 760px) { .source > select[data-field=unitId] { grid-column: 2 / 4; } }

@media (max-width: 1100px) {
  aside { width: 220px; }
  .source { grid-template-columns: 26px 150px minmax(100px, 1fr) 90px; }
  .toggle, .arrows { grid-row: 2; }
  .arrows { grid-column: 4; }
  .toggle { grid-column: 3; }
}

@media (max-width: 760px) {
  body { display: block; }
  aside { position: static; height: auto; width: 100%; padding: 16px 20px; border-right: 0; border-bottom: 1px solid var(--sep); }
  .brand { padding: 0 0 14px; }
  nav { display: flex; overflow-x: auto; }
  .nav { font-size: 12px; white-space: nowrap; }
  .account { display: none; }
  main { padding: 24px 16px 40px; }
  header { align-items: flex-start; gap: 12px; }
  h1 { font-size: 24px; }
  #add-app { padding: 10px 12px; font-size: 12px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .metrics section { padding: 12px; }
  .metrics small { font-size: 11px; }
  .metrics strong { font-size: 23px; }
  article { padding: 16px; }
  .source { grid-template-columns: 26px minmax(0, 1fr) 80px; }
  .source > input[data-field=unitId] { grid-column: 2 / 4; }
  .source > input[data-field=timeoutMs] { grid-column: 2; }
  .toggle { grid-column: 3; grid-row: auto; }
  .arrows { grid-column: 3; grid-row: 1; }
  .settings { flex-direction: column; }
  .app-heading { align-items: flex-start; }
  .app-heading p { overflow-wrap: anywhere; }
  .app-heading button { font-size: 12px; padding: 10px; }
  .subtle { display: none; }
}
.ads-sentinel { --arkasty-assets: css-ok; position: absolute; left: -9999px; }
.blocker-notice { margin: 0; padding: 16px 20px; background: #fff3cd; color: #5c4a00; border-bottom: 1px solid #e0c56a; font-size: 14px; line-height: 1.5; position: sticky; top: 0; z-index: 9999; width: 100%; }
.blocker-notice small { display: block; margin-top: 4px; opacity: .8; font-size: 12px; }
@media (prefers-color-scheme: dark) { .blocker-notice { background: #3a2e00; color: #ffd76a; border-bottom-color: #6b5a1e; } }
