:root {
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e5e8ee; --line-soft: #eff1f5;
  --blue: #2563eb; --green: #15803d; --red: #dc2626; --amber: #b45309;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --w-label: 252px; --w-spark: 80px; --w-total: 88px; --w-prev: 88px; --w-delta: 92px; --w-col: 78px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #fff; color: var(--text); font: 13px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 12px; } .spacer { flex: 1; } .hidden { display: none !important; }
.good { color: var(--green); } .bad { color: var(--red); }
svg { flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 0; overflow: hidden; flex: none; background: #fbfbfd; border-right: 0 solid var(--line); transition: width .18s ease; }
.shell.side-open .side { width: 212px; border-right-width: 1px; }
.side-title { padding: 18px 20px 10px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 10px; margin: 2px 10px; padding: 9px 12px; border-radius: 9px; color: var(--text-2); text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav-item:hover { background: #f1f4f9; } .nav-item.active { background: #eaf0ff; color: var(--blue); font-weight: 700; }
.main { flex: 1; min-width: 0; padding: 0 16px 28px; }
.topbar { display: flex; align-items: center; gap: 12px; height: 56px; margin: 0 -16px 14px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; } .brand b { font-size: 15px; letter-spacing: .01em; }
.brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.api-badge { padding: 4px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; white-space: nowrap; }
.api-badge.ok { color: var(--green); background: #e8f8ee; } .api-badge.bad { color: #b91c1c; background: #fee2e2; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); padding: 0; }
.icon-btn:hover { background: #f1f4f9; color: var(--text); }
.icon-btn.alert { border: 1px solid var(--line); color: var(--faint); position: relative; width: 36px; height: 34px; }
.icon-btn.alert.problem { color: var(--amber); border-color: #fcd34d; background: #fffbeb; }
.user { color: var(--muted); white-space: nowrap; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; border: 0; background: none; color: var(--blue); font-weight: 600; }
.link-btn:hover { text-decoration: underline; } .link-btn:disabled { opacity: .6; cursor: default; text-decoration: none; }
.link-btn.busy svg { animation: spin 1s linear infinite; }

/* ---------- cards, buttons, forms */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.btn:hover { background: #f8fafc; border-color: #d4dae5; } .btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: #1d4ed8; }
.btn.wide { width: 100%; justify-content: center; height: 40px; }
.btn .count { color: var(--faint); font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0; }
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus, .dd:focus-visible, .btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; border-color: #93c5fd; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; } .field-label { font-weight: 600; color: var(--text-2); }
.form-error { color: var(--red); min-height: 18px; font-size: 12.5px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.banner { padding: 10px 14px; border-radius: 10px; margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.banner.info { background: #eff6ff; color: #1e40af; } .banner.warn { background: #fffbeb; color: #92400e; } .banner.bad { background: #fef2f2; color: #991b1b; }
.badge { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: #eef1f6; color: var(--muted); font-size: 11px; font-weight: 600; }
.badge.run { background: #e0ecff; color: var(--blue); } .badge.warn { background: #fef3c7; color: var(--amber); }

/* ---------- toolbar */
.toolbar { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.tb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-row + .tb-row { padding-top: 12px; border-top: 1px solid var(--line-soft); gap: 12px; }
.dd { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; height: 36px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-align: left; }
.dd:hover { border-color: #cbd5e1; } .dd-ph { color: var(--faint); }
.dd-val { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.dd-caret { display: inline-flex; color: var(--faint); }
.dd-photo { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; background: #f1f5f9; flex: none; }
.date-btn { display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.date-btn:hover { border-color: #cbd5e1; } .date-btn small { color: var(--faint); font-weight: 500; font-size: 12px; } .date-btn svg { color: var(--muted); }
.slice { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.slice small { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.note-sq { width: 8px; height: 8px; border-radius: 2px; background: #facc15; display: inline-block; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 999px; background: #eef0ff; color: #3730a3; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: #4f46e5; } .chip.plain { background: #f3f5f9; color: var(--text-2); padding-right: 12px; } .chip.plain i { background: var(--faint); }
.chip-x { display: inline-flex; border: 0; background: none; color: inherit; padding: 2px; border-radius: 50%; opacity: .7; } .chip-x:hover { opacity: 1; background: rgba(79, 70, 229, .12); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: #f1f3f7; }
.seg button { padding: 5px 11px; border: 0; border-radius: 8px; background: transparent; color: #475569; font-weight: 500; }
.seg button:hover { color: var(--text); } .seg button.active { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }
.period { color: var(--text-2); } .cmp { border-bottom: 1px dotted var(--faint); cursor: help; }
.funnel { color: var(--muted); } .funnel.partial { color: var(--amber); font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 8px; position: relative; cursor: pointer; font-weight: 500; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + .track { background: var(--blue); } .switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid #93c5fd; outline-offset: 2px; }

/* ---------- popovers, dropdown panel, modal, toasts */
.popover { position: absolute; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .06); }
.dd-panel { display: flex; flex-direction: column; max-height: 420px; }
.dd-search { margin: 10px 10px 6px; padding: 8px 10px; }
.dd-list { overflow: auto; padding: 0 6px 6px; flex: 1; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none; text-align: left; }
.dd-item:hover { background: #f4f6fb; } .dd-item.on { background: #eef2ff; }
.dd-box { width: 16px; height: 16px; border: 1.5px solid #cbd5e1; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.dd-box.on { background: var(--blue); border-color: var(--blue); } .dd-box svg { width: 11px; height: 11px; }
.dd-text { display: flex; flex-direction: column; min-width: 0; } .dd-label { font-weight: 600; }
.dd-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.dd-empty { padding: 14px; color: var(--muted); text-align: center; }
.dd-foot { display: flex; justify-content: space-between; padding: 8px 14px; border-top: 1px solid var(--line-soft); }
.link { border: 0; background: none; color: var(--blue); font-weight: 600; padding: 2px; } .link:hover { text-decoration: underline; }
.range-pop { width: 320px; padding: 14px 16px 12px; } .range-pop h4, .notes-pop h4, .state-pop h4 { margin: 0 0 6px; font-size: 14px; }
.notes-pop { width: 340px; padding: 14px 16px; } .notes-list { max-height: 220px; overflow: auto; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.note { padding: 8px 10px; border-radius: 8px; background: #fffbea; border: 1px solid #fde68a; }
.note-head { display: flex; align-items: center; gap: 8px; } .note-head .icon-btn { margin-left: auto; width: 24px; height: 24px; }
.note-text { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.state-pop { width: 420px; max-height: 70vh; overflow: auto; padding: 14px 16px; }
.lane-title { font-weight: 700; margin: 12px 0 4px; }
.job { display: grid; grid-template-columns: 14px 1fr auto; column-gap: 8px; padding: 3px 0; align-items: center; }
.job-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; } .job.fail .job-dot { background: #dc2626; }
.job-msg { grid-column: 2 / 4; word-break: break-word; }
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 23, 42, .45); }
.modal { display: flex; flex-direction: column; width: 100%; max-height: 90vh; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); } .modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 8px 20px 16px; overflow: auto; } .modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.tune-group { margin-top: 14px; } .tune-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; padding-bottom: 6px; }
.tune-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; padding-left: 26px; } .tune-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 14px; border-radius: 10px; background: #0f172a; color: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, .3); max-width: 360px; }
.toast.ok { background: #166534; } .toast.error { background: #991b1b; }

/* ---------- the table */
.tbl-card { margin-top: 12px; overflow: hidden; }
.tbl-wrap { overflow: auto; max-height: calc(100vh - 240px); min-height: 200px; position: relative; transition: opacity .15s; }
.tbl-wrap.loading { opacity: .5; }
table.rnp { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-variant-numeric: tabular-nums; }
.rnp th, .rnp td { height: 26px; padding: 0 10px; white-space: nowrap; border-bottom: 1px solid var(--line-soft); background: #fff; }
.rnp thead th { position: sticky; top: 0; z-index: 3; height: 46px; border-bottom: 1px solid var(--line); }
.rnp .s { position: sticky; z-index: 2; }
.rnp thead .s { z-index: 6; text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; color: var(--faint); }
.rnp .s0 { left: 0; width: var(--w-label); min-width: var(--w-label); max-width: var(--w-label); overflow: hidden; text-overflow: ellipsis; text-align: left; }
.rnp .s1 { left: var(--w-label); width: var(--w-spark); min-width: var(--w-spark); }
.rnp .s2 { left: calc(var(--w-label) + var(--w-spark)); width: var(--w-total); min-width: var(--w-total); text-align: right; }
.rnp .s3 { left: calc(var(--w-label) + var(--w-spark) + var(--w-total)); width: var(--w-prev); min-width: var(--w-prev); text-align: right; }
.rnp .s4 { left: calc(var(--w-label) + var(--w-spark) + var(--w-total) + var(--w-prev)); width: var(--w-delta); min-width: var(--w-delta); text-align: right; box-shadow: 10px 0 10px -10px rgba(15, 23, 42, .25); }
.rnp thead .s2, .rnp thead .s3, .rnp thead .s4 { text-align: right; }
.rnp .c { width: var(--w-col); min-width: var(--w-col); text-align: right; }
/* Trailing spring column: soaks up spare width so the fixed columns never stretch in the weekly view. */
.rnp .fill { width: auto; min-width: 0; padding: 0; }
.rnp thead .c { text-align: center; padding: 0 6px; }
.rnp thead .c b { display: block; font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.2; }
.rnp thead .c i { display: block; font-style: normal; font-size: 10px; font-weight: 500; color: var(--faint); line-height: 1.2; }
.rnp thead .weekend { background: #f6f7fa; }
.rnp thead .week { background: #eff5ff; box-shadow: inset 0 -2px 0 var(--blue); } .rnp thead .week b, .rnp thead .week i { color: var(--blue); }
.rnp thead .today b, .rnp thead .today i { color: var(--blue); font-style: italic; }
.rnp thead .current { background: #f5f3ff; box-shadow: inset 0 -2px 0 #7c3aed; } .rnp thead .current b, .rnp thead .current i { color: #6d28d9; }
.rnp td.week { font-weight: 700; background: #fafcff; box-shadow: inset 1px 0 0 #e1eafc, inset -1px 0 0 #e1eafc; }
.rnp td.today { color: var(--muted); font-style: italic; }
.rnp td.nil { color: #c3cad6; font-weight: 400; }
.rnp .strong { font-weight: 700; } .rnp .prev { color: var(--muted); }
.rnp .delta { font-size: 12px; font-weight: 600; color: var(--faint); } .rnp .delta.good { color: var(--green); } .rnp .delta.bad { color: var(--red); }
.rnp tr.row:hover td { background-color: #f7f9fc; } .rnp tr.row:hover td.week { background-color: #f1f6ff; }
.rnp td.c[style*="background"] { border-radius: 0; }
.rnp .lbl .name { font-weight: 500; vertical-align: middle; } .rnp .lbl .name.muted { font-weight: 400; }
.rnp .tip { display: inline-flex; margin-left: 6px; color: #c0c7d4; vertical-align: middle; cursor: help; } .rnp .tip:hover { color: var(--muted); }
.exp, .exp-gap { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; vertical-align: middle; margin-right: 2px; }
.exp { border: 0; background: none; color: var(--muted); border-radius: 5px; padding: 0; } .exp:hover { background: #eef1f6; }
.exp svg { transition: transform .15s; } tr.open .exp svg { transform: rotate(90deg); } .exp.busy { opacity: .4; }
.rnp tr.child td { background: #fcfcfe; } .rnp tr.child .name { color: var(--text-2); font-weight: 400; margin-left: 14px; }
.rnp tr.child:hover td { background-color: #f4f6fb; }
.spark { display: inline-block; vertical-align: middle; height: 18px; } .spark svg { display: block; } .spark.empty { width: 64px; border-bottom: 1px dashed #e2e6ee; height: 1px; }
.rnp tr.sec td { height: 30px; background: var(--tint); border-bottom: 1px solid var(--line-soft); }
.rnp .sec-cell { cursor: pointer; user-select: none; font-size: 13px; text-align: left; }
.rnp .sec-cell b { margin-right: 8px; } .rnp .sec-cell small { color: var(--muted); font-size: 12px; }
.rnp .dot, .tune-head .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.sec-caret { display: inline-flex; margin-right: 6px; color: var(--faint); vertical-align: middle; transition: transform .15s; } .sec-caret.closed { transform: rotate(-90deg); }
.sec-warn { color: var(--amber); font-style: normal; font-size: 11.5px; margin-left: 10px; }
.rnp tr.notes td { height: 30px; } .rnp tr.notes .c { text-align: center; }
.note-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px dashed #cdd3df; border-radius: 50%; background: #fff; color: #a0a9ba; font-size: 11px; font-weight: 700; }
.note-btn:hover { border-color: var(--blue); color: var(--blue); } .note-btn.has { background: #fde68a; border: 0; color: #92400e; }

/* ---------- login and secondary pages */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: #f6f7fb; }
.login-card { width: 100%; max-width: 360px; padding: 28px; display: flex; flex-direction: column; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(15, 23, 42, .08); }
.login-logo { font-size: 24px; font-weight: 800; letter-spacing: .02em; } .login-sub { margin: 0 0 6px; color: var(--muted); }
.login-card input { padding: 11px 12px; }
.login-card.wide { max-width: 440px; }
.login-card h2 { margin: 0; font-size: 18px; }
.login-card .stack { display: flex; flex-direction: column; gap: 12px; }
.login-links { display: flex; justify-content: space-between; font-size: 12.5px; }
.code-input { text-align: center; letter-spacing: .3em; font-size: 24px; font-weight: 700; padding: 12px; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: flex-start; gap: 8px; color: var(--text-2); cursor: pointer; line-height: 1.35; }
.check input { margin-top: 2px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.qr { display: block; margin: 4px auto; width: 190px; height: 190px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; image-rendering: pixelated; }
.manual { color: var(--text-2); } .manual summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.secret { margin: 6px 0; padding: 9px 11px; border-radius: 8px; background: #f1f4f9; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; word-break: break-all; user-select: all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.codes code { padding: 0; background: none; font-size: 14px; letter-spacing: .04em; }
.row-end.start { justify-content: flex-start; }
.plain.devices td { padding: 7px 10px; } .plain td.actions { text-align: right; }
.page h4 { margin: 16px 0 6px; font-size: 13px; color: var(--text-2); }
.page { max-width: 980px; margin: 0 auto; padding: 4px 0 40px; } .page h2 { margin: 6px 0 4px; font-size: 20px; } .page h3 { margin: 0 0 8px; font-size: 15px; }
.page .card { padding: 18px 20px; margin-top: 14px; } .page-loading { padding: 40px; color: var(--muted); text-align: center; }
.page .card.toolbar { padding: 14px 16px; }
.page .card.tbl-card { padding: 0; overflow: hidden; }
.tb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-row .field-label { margin-right: 2px; }
.tb-row input[type=number] { width: 210px; }
.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tbl-head { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.tbl-head .btn { margin-left: auto; }
.page .card.empty { padding: 26px 20px; color: var(--muted); text-align: center; }
.keyword-history { width: max-content; min-width: 100%; }
.keyword-history .s0 { width: 270px; min-width: 270px; max-width: 270px; }
.keyword-history .c { width: 72px; min-width: 72px; }
.keyword-history td.s0 { background: #fff; }
.keyword-history tbody tr:hover td { background-color: #f7f9fc; }
.keyword-history tbody tr:hover td.s0 { background-color: #f7f9fc; }
.kv { display: grid; grid-template-columns: 150px 1fr; row-gap: 8px; margin-bottom: 8px; } .kv span:nth-child(odd) { color: var(--muted); }
code { padding: 2px 6px; border-radius: 6px; background: #f1f4f9; font-size: 12px; }
table.plain { width: 100%; border-collapse: collapse; } .plain th { text-align: left; padding: 8px 10px; color: var(--muted); font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--line); }
.plain td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; } .plain td.ph { width: 52px; }
.plain td.ph img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; display: block; background: #f1f5f9; }
.plain td.title { max-width: 360px; color: var(--text-2); } .cost-cell { white-space: nowrap; } .cost-input { width: 120px; text-align: right; }
.unit { margin: 0 10px 0 6px; color: var(--muted); }

@media (max-width: 900px) {
  :root { --w-label: 160px; }
  .brand-sub, .user { display: none; }
  .rnp .s1, .rnp .s3, .rnp .s4 { display: none; }
  .rnp .s2 { left: var(--w-label); box-shadow: 10px 0 10px -10px rgba(15, 23, 42, .25); }
  .grid2, .tune-rows { grid-template-columns: 1fr; }
  .tbl-wrap { max-height: calc(100vh - 300px); }
}

/* ---------- photo A/B tests */
.ab-page { max-width: 1240px; margin: 0 auto; padding: 4px 0 48px; }
.ab-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 6px 0 2px; } .ab-head h2 { margin: 0; font-size: 20px; }
.ab-note { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 12px 16px; border: 1px solid var(--line); border-left: 4px solid #7c3aed; border-radius: 12px; background: #faf8ff; color: var(--text-2); }
.btn.violet { background: #6d28d9; border-color: #6d28d9; color: #fff; } .btn.violet:hover { background: #5b21b6; border-color: #5b21b6; }
.banner.ok { background: #ecfdf3; color: #166534; }
.ab-list { margin-top: 12px; overflow: hidden; }
.ab-row { display: grid; grid-template-columns: minmax(210px, 1.2fr) minmax(240px, 1.6fr) 140px minmax(170px, 1fr) 110px; gap: 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); color: inherit; text-decoration: none; }
.ab-row:last-child { border-bottom: 0; } .ab-row:hover { background: #fafbfe; }
.ab-prod { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ab-thumbs { display: flex; flex: none; padding-left: 8px; }
.ab-thumbs img { width: 34px; height: 44px; margin-left: -8px; object-fit: cover; border-radius: 6px; border: 2px solid #fff; background: #f1f5f9; box-shadow: 0 0 0 1px var(--line); }
.ab-result { margin-top: 4px; line-height: 1.35; } .ab-prog b { font-size: 15px; } .ab-when { text-align: right; }
.st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e6f0ff; color: #1d4ed8; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.run { background: #ede9fe; color: #6d28d9; } .st.finishing { background: #fef3c7; color: #92400e; } .st.stopped { background: #f1f5f9; color: #475569; } .st.failed { background: #fee2e2; color: #b91c1c; }
.ab-empty { margin-top: 12px; padding: 28px 24px; text-align: center; } .ab-empty p { max-width: 560px; margin: 6px auto 0; }
.ab-top { display: flex; align-items: center; gap: 14px; margin: 6px 0 12px; }
.ab-back { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); text-decoration: none; font-size: 12.5px; white-space: nowrap; }
.ab-card-photo { width: 40px; height: 52px; object-fit: cover; border-radius: 8px; background: #f1f5f9; }
.ab-summary { display: flex; align-items: center; gap: 22px; padding: 14px 18px; } .ab-sum-text { flex: 1; min-width: 0; color: var(--text-2); }
.ab-stat { padding-left: 20px; border-left: 1px solid var(--line); white-space: nowrap; } .ab-stat small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.icon-btn.bordered { border: 1px solid var(--line); }
.ab-vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 14px; }
.ab-var { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); } .ab-var.lead { border: 2px solid #a78bfa; }
.ab-pic { position: relative; aspect-ratio: 3 / 4; background: #f1f5f9; } .ab-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ab-tags { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .92); font-size: 11px; font-weight: 700; color: var(--text-2); } .tag.green { background: #15803d; color: #fff; } .tag.gold { background: #fef3c7; color: #92400e; }
.ab-var-body { padding: 12px 14px 14px; }
.ab-var-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ab-var-name i, .ab-legend i, .ab-chip i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); flex: none; }
.ab-ctr { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 6px; } .ab-ctr b { font-size: 22px; letter-spacing: -.01em; } .ab-ctr small { color: var(--muted); }
.ab-range { position: relative; height: 12px; margin: 2px 0 10px; } .ab-range::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: #e8ebf3; border-radius: 2px; }
.ab-range .band { position: absolute; top: 4px; height: 4px; border-radius: 3px; background: var(--c); opacity: .35; }
.ab-range .dot { position: absolute; top: 1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--c); }
.ab-kv { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); font-size: 12px; } .ab-kv b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ab-time { height: 4px; margin: 8px 0 10px; border-radius: 3px; background: #eef1f6; overflow: hidden; } .ab-time i { display: block; height: 100%; background: var(--c); }
.ab-apply { width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: #eef2ff; color: #4338ca; font-weight: 600; } .ab-apply:hover { background: #e0e7ff; }
.ab-stop-variant { width: 100%; margin-top: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text-2); font-weight: 600; transition: background .2s ease, border-color .2s ease; }
.ab-stop-variant:hover { background: #fffbeb; border-color: #fcd34d; }
.ab-stop-variant:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.ab-var.excluded { opacity: .78; }
.ab-tags .tag.stopped { background: #f1f5f9; color: #475569; }
.ab-stop-hint { margin: 8px 2px 0; }
.ab-block { margin-top: 14px; padding: 16px 18px; } .ab-block h3 { margin: 0 0 10px; font-size: 14.5px; } .ab-block h3 .small { font-weight: 400; margin-left: 6px; }
.ab-chart { width: 100%; height: auto; display: block; } .ab-chart .grid { stroke: #eef0f5; stroke-width: 1; } .ab-chart .tick { fill: #94a3b8; font-size: 11px; font-family: var(--font); }
.ab-chart-empty { padding: 28px 0; text-align: center; }
.ab-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 8px; color: var(--text-2); } .ab-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ab-slots { overflow: auto; max-height: 420px; } .ab-slots td, .ab-slots th { white-space: nowrap; }
.plain .num { text-align: right; font-variant-numeric: tabular-nums; } .plain th.num { text-align: right; } .plain .blue { color: var(--blue); } .nowrap { white-space: nowrap; }
.ab-chip { display: inline-flex; align-items: center; gap: 8px; } .ab-chip img { width: 22px; height: 29px; object-fit: cover; border-radius: 4px; background: #f1f5f9; }
.ab-set-head { display: flex; align-items: center; justify-content: space-between; } .ab-settings { margin: 0; line-height: 1.55; }
.menu { display: flex; flex-direction: column; min-width: 240px; padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; color: var(--text-2); } .menu-item:hover { background: #f4f6fb; } .menu-item.danger { color: var(--red); }
.ab-log td { vertical-align: top; } .ab-log tr.warn td:last-child { color: var(--amber); } .ab-log tr.error td:last-child { color: var(--red); }
.ab-new { display: flex; flex-direction: column; }
.ab-sec { padding: 12px 0; border-bottom: 1px solid var(--line-soft); } .ab-sec h4 { margin: 0 0 8px; font-size: 14px; color: var(--text); } .ab-sec h4 .small { font-weight: 400; }
.ab-search { width: 100%; margin-bottom: 8px; }
.ab-products { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.ab-prod-row { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; } .ab-prod-row:last-child { border-bottom: 0; }
.ab-prod-row:hover { background: #fafbfe; } .ab-prod-row.on { background: #f5f3ff; } .ab-prod-row.off { opacity: .55; cursor: default; }
.ab-prod-main { display: flex; align-items: center; gap: 12px; } .ab-prod-main img, .ab-noimg { width: 36px; height: 46px; object-fit: cover; border-radius: 6px; background: #f1f5f9; flex: none; }
.ab-prod-info { flex: 1; min-width: 0; } .ab-rate { white-space: nowrap; }
.ab-camps { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 2px 48px; } .warn-text { color: var(--amber); } .ab-none { padding: 16px; text-align: center; }
.ab-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; border: 2px dashed #cdd3df; border-radius: 12px; color: var(--text-2); text-align: center; cursor: pointer; }
.ab-drop:hover, .ab-drop.over { border-color: #7c3aed; background: #faf8ff; } .ab-drop svg { color: var(--muted); }
.ab-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 10px 0; } .ab-tiles:empty { display: none; }
.ab-tile { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; } .ab-tile.bad { border-color: #fecaca; background: #fef2f2; }
.ab-tile img, .ab-tile .ab-noimg { width: 38px; height: 50px; object-fit: cover; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.ab-tile-info { flex: 1; min-width: 0; display: flex; flex-direction: column; } .ab-tile-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; } .ab-tile-info small.bad { color: var(--red); }
.ab-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.ab-mode { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.ab-mode.on { border: 2px solid #8b5cf6; background: #faf8ff; padding: 11px; } .ab-mode p { margin: 4px 0 0; line-height: 1.4; } .ab-mode input { margin-top: 3px; }
.ab-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; } .ab-grid .field { margin: 8px 0; } .ab-grid input[type=number], .ab-grid input[type=time] { width: 100%; }
.ab-sure { margin-top: 10px; padding: 12px; border-radius: 10px; background: #fffbeb; color: #92400e; }
.modal-foot .form-error { margin-right: auto; align-self: center; }
@media (max-width: 900px) {
  .ab-row { grid-template-columns: 1fr 1fr; } .ab-when { text-align: left; }
  .ab-summary { flex-wrap: wrap; gap: 12px 22px; } .ab-sum-text { flex: 1 1 100%; } .ab-stat { padding-left: 0; border-left: 0; }
  .ab-modes, .ab-grid { grid-template-columns: 1fr; } .ab-note { flex-direction: column; align-items: flex-start; }
  .ab-top { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .ab-row { grid-template-columns: 1fr; gap: 8px; }
  .ab-vars { grid-template-columns: repeat(2, 1fr); gap: 10px; } .ab-var-body { padding: 10px 10px 12px; } .ab-ctr b { font-size: 18px; }
  .ab-prod-main { flex-wrap: wrap; } .ab-camps { padding-left: 0; }
}

/* ---------- advertising management */
.ads-page { max-width: 1680px; margin: 0 auto; padding: 4px 0 48px; }
.ads-page.loading .ads-kpis, .ads-page.loading .ads-block { opacity: .55; transition: opacity .15s; }
.ads-toolbar { margin-top: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ads-period { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .ads-partial { color: var(--amber); font-weight: 600; }
.ads-stamp { white-space: nowrap; }
.btn.busy svg, .link-btn.busy svg { animation: spin 1s linear infinite; }
.ads-banners:empty { display: none; }
.ads-account { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.ads-account-title { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.ads-chip { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: help; }
.ads-chip small { color: var(--muted); } .ads-chip b { font-variant-numeric: tabular-nums; }
.ads-searchbox { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); }
.ads-searchbox:focus-within { border-color: #93c5fd; outline: 2px solid #bfdbfe; }
.ads-searchbox input { border: 0; outline: 0; padding: 0; min-width: 190px; background: transparent; color: var(--text); }
.ads-searchbox input:focus { outline: 0; }
.ads-select { height: 34px; padding: 0 8px; border-radius: 9px; max-width: 280px; }
.ads-page .seg { flex-wrap: wrap; max-width: 100%; } .ads-page .seg button { white-space: nowrap; }
.seg .count { color: var(--faint); font-weight: 500; } .seg button.active .count { color: var(--muted); }

.ads-kpi-host { margin-top: 12px; }
.ads-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ads-kpi { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); min-width: 0; }
.ads-kpi small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; cursor: help; }
.ads-kpi b { display: block; font-size: 20px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ads-kpis.cols-10 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ads-kpis.small { margin-top: 12px; } .ads-kpis.small { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; } .ads-kpis.small .ads-kpi { padding: 8px 12px; box-shadow: none; } .ads-kpis.small .ads-kpi b { font-size: 16px; }
.ads-delta { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--faint); min-height: 16px; white-space: nowrap; }
.ads-delta.good { color: var(--green); } .ads-delta.bad { color: var(--red); }

.ads-table-card { margin-top: 12px; overflow: hidden; transition: opacity .15s; } .ads-table-card.loading { opacity: .5; }
.ads-scroll { overflow: auto; }
.ads-keys .ads-scroll { max-height: 640px; border: 1px solid var(--line-soft); border-radius: 10px; }
.ads-days { max-height: 300px; margin-top: 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
table.ads-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.ads-table th { position: sticky; top: 0; z-index: 3; background: #fff; white-space: nowrap; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.ads-table td { white-space: nowrap; padding: 9px 10px; background: #fff; vertical-align: middle; }
.ads-table th.sortable { cursor: pointer; user-select: none; } .ads-table th.sortable:hover { color: var(--text); } .ads-table th.sorted { color: var(--text); }
.ads-table .arr { margin-left: 4px; font-size: 8px; font-style: normal; color: var(--blue); vertical-align: middle; }
.ads-table tr.clickable { cursor: pointer; } .ads-table tr.clickable:hover td { background: #fafbfe; }
.ads-table tr.dim td { color: var(--muted); } .ads-table tr.dim .ads-thumbs img { opacity: .6; }
.ads-table tr.error td { color: var(--red); }
.ads-table tfoot td { position: sticky; bottom: 0; z-index: 2; background: #f8fafc; font-weight: 700; border-top: 1px solid var(--line); }
.ads-table .ads-c-name { position: sticky; left: 0; z-index: 2; min-width: 300px; max-width: 360px; } .ads-table th.ads-c-name { z-index: 4; }
.ads-table .ads-c-key { position: sticky; left: 0; z-index: 2; min-width: 240px; max-width: 360px; white-space: normal; } .ads-table th.ads-c-key { z-index: 4; }
.ads-table .ads-c-menu { width: 44px; text-align: right; } .ads-table .ads-c-share { min-width: 110px; }
.ads-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ads-thumbs { display: inline-flex; flex: none; padding-left: 6px; }
.ads-thumbs img, .ads-thumbs .ads-noimg { width: 30px; height: 40px; margin-left: -6px; object-fit: cover; border-radius: 6px; border: 2px solid #fff; background: #f1f5f9; box-shadow: 0 0 0 1px var(--line); }
.ads-pimg, .ads-name > .ads-noimg { width: 34px; height: 44px; object-fit: cover; border-radius: 6px; background: #f1f5f9; flex: none; }
.ads-noimg { display: inline-block; }
.ads-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ads-link { color: var(--text); font-weight: 700; text-decoration: none; } .ads-link:hover { color: var(--blue); text-decoration: underline; }
.ads-lock { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: #ede9fe; color: #6d28d9; font-weight: 600; text-decoration: none; } .ads-lock:hover { background: #ddd6fe; }
.ads-status { display: flex; align-items: center; gap: 8px; }
.ads-pending { color: var(--amber); font-weight: 600; cursor: help; }
.ads-toggle { width: 28px; height: 28px; } .ads-plus { width: 26px; height: 26px; }
.ads-budget { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.st.active { background: #dcfce7; color: #166534; } .st.paused { background: #fef3c7; color: #92400e; }
.st.ready { background: #e0ecff; color: #1d4ed8; } .st.over { background: #f1f5f9; color: #475569; }
.ads-empty { padding: 28px 24px; text-align: center; } .ads-empty p { max-width: 560px; margin: 6px auto 0; }
.ads-fail { margin: 14px; } .ads-foot { margin: 10px 4px 0; }
.ads-nodata { padding: 28px 0; text-align: center; }
.btn.go { background: #15803d; border-color: #15803d; color: #fff; } .btn.go:hover { background: #166534; border-color: #166534; }
.btn.danger { color: var(--red); border-color: #fecaca; } .btn.danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn svg { flex: none; }

.ads-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 8px 0 0; }
.ads-head-main { min-width: 0; }
.ads-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .ads-title h2 { margin: 0; font-size: 21px; overflow-wrap: anywhere; }
.ads-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ads-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.ads-fact { padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.page .ads-fact { margin-top: 0; }
.ads-fact small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.ads-fact b { font-size: 22px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; } .ads-fact .link { margin-top: 6px; padding-left: 0; }
.ads-two { display: grid; grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr); gap: 14px; margin-top: 14px; } .ads-two > .ads-block { margin-top: 0; } .ads-two > * { min-width: 0; }
.ads-block { margin-top: 14px; padding: 16px 18px; }
.ads-block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ads-block h3, .ads-subblock h4 { margin: 0; font-size: 14.5px; } .ads-block h3 .small { font-weight: 400; margin-left: 4px; }
.ads-block > h3 { margin-bottom: 12px; }
.ads-subblock h4 { margin: 0 0 10px; }
.ads-chart-wrap { width: 100%; min-height: 170px; } .ads-chart { max-width: 100%; height: auto; display: block; } .ads-chart .grid { stroke: #eef0f5; stroke-width: 1; } .ads-chart .tick { fill: #94a3b8; font-size: 11px; font-family: var(--font); }

.ads-funnel { display: flex; flex-direction: column; }
.ads-fun-stage { display: grid; grid-template-columns: 110px minmax(0, 1fr) 84px; align-items: center; gap: 10px; }
.ads-fun-name { font-weight: 600; } .ads-fun-name small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.ads-fun-bar { height: 32px; border-radius: 8px; background: #f1f5fb; overflow: hidden; }
.ads-fun-bar i { display: block; width: var(--w); height: 100%; border-radius: 8px; background: linear-gradient(90deg, #2563eb, #60a5fa); }
.ads-fun-num { text-align: right; font-size: 16px; font-variant-numeric: tabular-nums; }
.ads-fun-link { display: flex; justify-content: space-between; gap: 12px; padding: 5px 4px 5px 120px; color: var(--muted); font-size: 12px; }
.ads-fun-rate b { color: var(--text); } .ads-fun-cost { white-space: nowrap; }
.ads-fun-per { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }

.ads-keys-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.ads-keys-count { margin: 0 0 8px; } .ads-more { text-align: center; margin: 12px 0 4px; }
.ads-keyname { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ads-share { display: flex; align-items: center; gap: 8px; } .ads-share i { display: block; height: 8px; min-width: 2px; border-radius: 4px; background: #a78bfa; } .ads-share span { color: var(--muted); font-size: 12px; min-width: 32px; }
.ads-table .ads-c-key { min-width: 300px; }
.ads-keycell { display: flex; align-items: flex-start; gap: 10px; }
.ads-keymain { flex: 1; min-width: 0; } .ads-keytext { overflow-wrap: anywhere; }
.ads-keycell .ads-match-btn { width: 28px; height: 28px; flex: none; margin-left: auto; color: var(--faint); } .ads-keycell .ads-match-btn:hover { color: var(--blue); }
.ads-queue { padding: 0; margin-top: 2px; font-size: 12px; }
.ads-queue-note { margin: 0 0 10px; }
.ads-switch { flex: none; position: relative; width: 34px; height: 20px; margin-top: 1px; padding: 0; border: 0; border-radius: 999px; background: #cbd5e1; cursor: pointer; transition: background .15s; }
.ads-switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .3); transition: transform .15s; }
.ads-switch.on { background: #16a34a; } .ads-switch.on i { transform: translateX(14px); }
.ads-switch:disabled { opacity: .55; cursor: progress; } .ads-switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.ads-match-lead { margin: 0 0 12px; }
.ads-match-product { padding: 14px 0; border-top: 1px solid var(--line-soft); } .ads-match-product:first-of-type { border-top: 0; padding-top: 0; }
.ads-match-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ads-match-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ads-match-pill { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: #f1f5f9; color: #475569; }
.ads-match-pill.good { background: #dcfce7; color: #166534; } .ads-match-pill.mid { background: #fef3c7; color: #92400e; } .ads-match-pill.bad { background: #fee2e2; color: #b91c1c; }
.ads-match-product .banner { margin: 8px 0 0; }
.ads-match-words { width: 100%; margin: 12px 0; } .ads-match-words td, .ads-match-words th { padding: 6px 10px; vertical-align: top; }
.ads-match-words td:first-child { width: 160px; }
.ads-place { display: inline-block; margin: 0 6px 4px 0; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: #e0ecff; color: #1d4ed8; }
.ads-place.form { background: #ede9fe; color: #6d28d9; } .ads-place.none { background: #fee2e2; color: #b91c1c; }
.ads-match-fields { display: flex; flex-direction: column; gap: 8px; }
.ads-match-field { padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.ads-match-field p { margin: 3px 0 0; overflow-wrap: anywhere; line-height: 1.5; }
.ads-match-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ads-all { margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: #dcfce7; color: #166534; text-transform: none; letter-spacing: 0; font-weight: 600; }
mark.hit { padding: 0 2px; border-radius: 3px; color: inherit; } mark.hit.exact { background: #fde68a; } mark.hit.form { background: #ddd6fe; }
.ads-keymodal .ads-two { margin-top: 16px; } .ads-key-meta { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.ads-subblock { min-width: 0; }

.ads-name-input { width: 100%; padding: 10px 12px; font-size: 15px; }
.ads-topup-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 0 4px; }
.ads-topup h4 { margin: 14px 0 8px; font-size: 13px; }
.ads-sources { display: flex; flex-direction: column; gap: 8px; }
.ads-source { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; } .ads-source.on { border-color: #93c5fd; background: #f5f9ff; }
.ads-source input { margin-top: 3px; } .ads-source small { display: block; }
.ads-amount { width: 200px; font-size: 16px; padding: 9px 12px; }
.ads-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip-btn { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text-2); font-weight: 600; } .chip-btn:hover { border-color: #93c5fd; background: #f5f9ff; }
.ads-summary { padding: 11px 14px; border-radius: 10px; background: #f8fafc; color: var(--text-2); line-height: 1.45; } .ads-summary.bad { background: #fef2f2; color: #991b1b; }
.ads-limit-switch { margin: 14px 0 6px; } .ads-limit-fields { padding-left: 24px; } .ads-limit-fields.off { opacity: .5; }

@media (max-width: 1100px) {
  .ads-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .ads-kpis.cols-10 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ads-two { grid-template-columns: minmax(0, 1fr); } .ads-head { flex-direction: column; } .ads-actions { justify-content: flex-start; }
  .ads-fun-link { padding-left: 0; }
}
@media (max-width: 700px) {
  .ads-table .ads-c-name, .ads-table .ads-c-key { position: static; min-width: 220px; }
  .ads-searchbox { width: 100%; } .ads-searchbox input { min-width: 0; width: 100%; }
  .ads-fun-stage { grid-template-columns: 78px minmax(0, 1fr) 70px; gap: 8px; }
  /* the list of campaigns turns into cards: every campaign is a small grid of numbers */
  .ads-list, .ads-list tbody { display: block; } .ads-list thead, .ads-list tfoot { display: none; }
  .ads-list tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
  .ads-list tr:last-child { border-bottom: 0; }
  .ads-list td { display: block; padding: 0; min-width: 0; border: 0; background: transparent; white-space: normal; text-align: left; }
  .ads-list td.num { text-align: left; }
  .ads-list td::before { content: attr(data-label); display: block; margin-bottom: 1px; color: var(--muted); font-size: 11px; }
  .ads-list td.ads-c-name { grid-column: 1 / -1; min-width: 0; max-width: none; padding-right: 36px; }
  .ads-list td.ads-c-name::before, .ads-list td.ads-c-menu::before, .ads-list td[data-key=status]::before { content: none; }
  .ads-list td[data-key=status] { grid-column: 1 / 3; align-self: center; } .ads-list td[data-key=budget] { grid-column: 3; }
  .ads-list td.ads-c-menu { position: absolute; top: 8px; right: 6px; width: auto; }
  .ads-list .ads-budget { justify-content: flex-start; }
  .ads-list tr.clickable:hover td { background: transparent; } .ads-list tr.clickable:active { background: #fafbfe; }
}
@media (max-width: 520px) {
  .ads-facts { grid-template-columns: 1fr; } .ads-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ads-kpi b { font-size: 17px; }
  .ads-amount { width: 100%; } .ads-limit-fields { padding-left: 0; }
}

.ads-addqueue { margin: 10px 0 4px; border: 1px solid var(--border, #e3e6ee); border-radius: 10px; padding: 8px 12px; }
.ads-addqueue > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.ads-addqueue p { margin: 8px 0; }
.ads-queue-input { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--border, #d5d9e4); border-radius: 8px; resize: vertical; background: transparent; color: inherit; }
.ads-addqueue-bar { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- campaign overview and detail tabs */
.ads-overview-chart { margin-top: 12px; padding: 14px 16px 10px; }
.ads-overview-chart .ads-block-head { margin-bottom: 4px; }
.ads-overview-chart h3 { margin: 0; font-size: 14.5px; }
.ads-chart-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.ads-metric-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 12px; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.ads-metric-chip:hover { border-color: var(--series-color); color: var(--text); }
.ads-metric-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--series-color); opacity: .38; }
.ads-metric-chip.on { border-color: color-mix(in srgb, var(--series-color) 42%, white); background: color-mix(in srgb, var(--series-color) 7%, white); color: var(--text); }
.ads-metric-chip.on i { opacity: 1; }
.ads-multi-chart { min-height: 150px; }
.ads-selection-note { white-space: nowrap; }
.ads-clear-selection { white-space: nowrap; }
.ads-table .ads-c-select { position: sticky; left: 0; z-index: 2; width: 38px; min-width: 38px; padding-left: 10px; padding-right: 8px; text-align: center; background: #fff; }
.ads-table th.ads-c-select { z-index: 5; }
.ads-list .ads-c-name { left: 38px; }
.ads-list .ads-c-select input { width: 16px; height: 16px; vertical-align: middle; accent-color: var(--blue); }
.ads-detail-tabs { display: flex; align-items: center; gap: 20px; overflow-x: auto; margin-top: 14px; padding: 0 4px; border-bottom: 1px solid var(--line); }
.ads-detail-tab { position: relative; min-height: 42px; padding: 8px 2px; border: 0; background: transparent; color: var(--muted); white-space: nowrap; transition: color .16s ease; }
.ads-detail-tab:hover, .ads-detail-tab.active { color: var(--text); }
.ads-detail-tab.active { font-weight: 700; }
.ads-detail-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; border-radius: 2px; background: var(--blue); content: ""; }
.ads-detail-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 5px; }
.ads-detail-pane { min-width: 0; }
.ads-detail-pane > .ads-block { margin-top: 14px; }
.ads-daily-table { max-height: 460px; border: 1px solid var(--line-soft); border-radius: 10px; }
.ads-campaign-days td, .ads-campaign-days th { white-space: nowrap; }
.ads-export { min-height: 34px; }
.ads-keys-bar { align-items: center; }
.ads-key-filter { flex-wrap: nowrap !important; overflow-x: auto; }
.ads-key-filter button { min-height: 32px; }
.ads-position-note { margin: 3px 0 0; }
.ads-position-actions { display: flex; gap: 8px; align-items: center; }
.ads-position-table-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.ads-position-scroll { max-height: 650px; border: 1px solid var(--line-soft); border-radius: 10px; }
.ads-position-table { width: max-content !important; min-width: 100%; }
.ads-position-table th, .ads-position-table td { min-width: 48px; padding: 7px 8px; text-align: center; }
.ads-position-table th.ads-c-key, .ads-position-table td.ads-c-key { min-width: 260px; max-width: 340px; text-align: left; }
.ads-position-table th.ads-c-key { left: 0; z-index: 5; }
.ads-position-table td.ads-c-key { left: 0; background: #fff; }
.ads-position-table .ads-c-position-organic { border-left: 1px solid var(--line); }
.ads-position-day-head { display: inline-flex; flex-direction: column; line-height: 1.1; }
.ads-position-day-head small { color: var(--muted); font-size: 10px; font-weight: 500; }
.ads-position-query { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ads-position-value { display: inline-flex; align-items: center; justify-content: center; min-width: 35px; padding: 3px 5px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.ads-position-value.top { background: #e4f6eb; color: #166534; }
.ads-position-value.mid { background: #f1edff; color: #5b21b6; }
.ads-position-value.low { background: #fff3e8; color: #9a3412; }
.ads-position-empty { color: var(--faint); }
.ads-position-table .st { font-size: 11px; padding: 2px 7px; }
.ads-keys .ads-position-table-head .ads-keys-count { margin: 0; }
.ads-keys .ads-position-table-head { margin: 4px 0 8px; }
.ads-keytable th, .ads-keytable td { white-space: nowrap; }
.ads-keys .ads-block-head { margin-bottom: 8px; }
.ads-bid-cell { display: flex; align-items: center; gap: 6px; min-width: 88px; }
.ads-bid-editor { display: flex; align-items: center; gap: 4px; }
.ads-bid-input { width: 76px; min-height: 30px; padding: 4px 6px; border: 1px solid var(--line-soft); border-radius: 6px; font: inherit; text-align: right; }
.ads-bid-save { min-height: 28px; padding: 3px 7px; white-space: nowrap; }
.ads-bid-edit { min-height: 28px; padding: 3px 4px; white-space: nowrap; }
.ads-bid-pending { color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; }
.ads-bid-note { margin: 4px 0; }

@media (max-width: 700px) {
  .ads-list .ads-c-name { left: auto; }
  .ads-list td.ads-c-select { position: absolute; top: 19px; left: 12px; width: auto; min-width: 0; padding: 0; background: transparent; }
  .ads-list td.ads-c-select::before { content: none; }
  .ads-list td.ads-c-name { padding-left: 28px; }
  .ads-overview-chart .ads-block-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .ads-detail-tabs { gap: 16px; margin-right: -16px; padding-right: 16px; }
  .ads-detail-tab { min-height: 44px; }
  .ads-position-table-head { align-items: flex-start; flex-direction: column; }
  .ads-selection-note { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .ads-metric-chip, .ads-detail-tab { transition: none; }
}
