/* Реклама Ozon — layered on styles.css tokens. */
.nav-link-ext { text-decoration: none; }

.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 2px; }
.section-head h2 { font-size: 15px; }
.section-head .sub { color: var(--muted); font-size: 12.5px; }
.section-head .spacer { flex: 1; }

/* Campaign list */
.camp-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; }
.camp-actions { display: flex; gap: 8px; margin-left: auto; }
.selall { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); cursor: pointer; font-size: 13px; }

.camp-list { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.camp-search { width: 210px; }
/* Segmented (state) filter */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { font: inherit; font-size: 12.5px; font-weight: 550; border: none; background: transparent; color: var(--text-2); padding: 6px 12px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button .c { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.camp-row { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-top: 1px solid var(--line); }
.camp-row:first-child { border-top: none; }
.camp-row:hover { background: var(--surface-2); }
.camp-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--link); cursor: pointer; flex-shrink: 0; }
.camp-main { min-width: 0; flex: 1; }
.camp-title { font-weight: 550; display: flex; align-items: center; gap: 9px; }
.camp-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; margin-top: 2px; flex-wrap: wrap; }
.camp-id { font-variant-numeric: tabular-nums; }
.state-pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.state-pill .d { width: 7px; height: 7px; border-radius: 50%; }
.state-run { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.state-run .d { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.state-off { background: var(--surface-2); color: var(--text-2); }
.state-off .d { background: var(--muted); }
.camp-spend { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.camp-spend .lbl { display: block; font-size: 10px; font-weight: 400; color: var(--muted); }

/* KPI (reuses .tiles/.tile from styles.css) */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 800px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* Chart */
.chart-box { padding: 16px 18px 8px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-wrap { width: 100%; height: 160px; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 72%; max-width: 34px; background: linear-gradient(180deg, var(--link), color-mix(in srgb, var(--link) 55%, transparent)); border-radius: 5px 5px 0 0; min-height: 2px; position: relative; transition: opacity .15s; cursor: default; }
.bar:hover { opacity: .82; }
.bar.on { outline: 2px solid color-mix(in srgb, var(--good) 55%, transparent); }
.bar-x { font-size: 10px; color: var(--muted); white-space: nowrap; transform: rotate(-40deg); transform-origin: center; height: 26px; }
.bar-tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--surface); font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; margin-bottom: 6px; }
.bar:hover .bar-tip { opacity: 1; }

/* Timeline / events */
.timeline { display: flex; flex-direction: column; }
.tl-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.tl-row:first-child { border-top: none; }
.tl-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; flex-shrink: 0; }
.tl-start { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.tl-stop { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.tl-main { flex: 1; min-width: 0; }
.tl-when { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tl-src { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.tl-fail { color: var(--bad); font-size: 12px; }

/* Schedules */
.sched-list { display: flex; flex-direction: column; gap: 10px; }
.sched-card { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sched-card.pending { border-left: 3px solid var(--warn); }
.sched-card.running { border-left: 3px solid var(--good); }
.sched-when { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sched-when .big { font-weight: 550; }
.sched-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.sb-pending { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.sb-running { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(9,9,11,.5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 90; padding: 20px; animation: fade .18s ease; }
.modal { width: min(480px, 96vw); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lift); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { font-size: 17px; }
.modal .field { display: flex; flex-direction: column; gap: 5px; }
.modal .field label { font-size: 12px; color: var(--text-2); }
.modal .row { display: flex; gap: 10px; }
.modal .row > * { flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
/* Multi-day calendar in the timer modal */
.tm-cal { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; }
.tm-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tm-cal-title { font-weight: 600; }
.tm-nav { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; font-size: 15px; }
.tm-nav:hover { background: var(--surface-2); }
.tm-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 3px; }
.tm-dow span { text-align: center; font-size: 11px; color: var(--muted); }
.tm-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.tm-day { position: relative; aspect-ratio: 1/1; display: grid; place-items: center; border-radius: 8px; font-size: 13px; cursor: pointer; user-select: none; border: 1px solid transparent; }
.tm-day:not(.disabled):not(.oob):hover { background: var(--surface-2); }
.tm-day.oob { visibility: hidden; }
.tm-day.disabled { color: var(--muted); opacity: .35; cursor: default; }
.tm-day.today { border-color: var(--line-2); font-weight: 650; }
.tm-day.sel { background: var(--link); color: #fff; font-weight: 650; }
.tm-day.sel .ck { position: absolute; top: 1px; right: 3px; font-size: 9px; }
.tm-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tm-quick button { font: inherit; font-size: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); border-radius: 7px; padding: 5px 9px; cursor: pointer; }
.tm-quick button:hover { color: var(--text); border-color: var(--muted); }
.dur-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.dur-preset { font: inherit; font-size: 12.5px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); border-radius: 8px; padding: 6px 11px; cursor: pointer; }
.dur-preset.on { background: var(--accent); color: var(--surface); border-color: transparent; }
.modal .sel-summary { font-size: 12.5px; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs .tab { font: inherit; font-size: 14px; font-weight: 600; border: none; background: transparent; color: var(--text-2); padding: 10px 16px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; }
.tabs .tab:hover { color: var(--text); }
.tabs .tab.on { color: var(--link); border-bottom-color: var(--link); }
.view { display: flex; flex-direction: column; gap: 18px; }

/* Schedule table (Расписание) */
.sched-table-card { padding: 0; overflow: hidden; }
.sched-thead { padding: 16px 18px; gap: 10px; flex-wrap: wrap; }
.sched-table-wrap { overflow-x: auto; max-height: 72vh; border-top: 1px solid var(--line); }
.sched-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sched-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: 11px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.sched-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.sched-table tbody tr:hover { background: var(--surface-2); }
.sched-table .ta-r { text-align: right; }
.c-camp { max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-weight: 550; white-space: normal; }
.c-shop { color: var(--text-2); }
.c-id { font-variant-numeric: tabular-nums; color: var(--text-2); }
.c-dur { font-variant-numeric: tabular-nums; font-weight: 600; }
.c-date { color: var(--text); }
.c-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.c-time.c-late { color: var(--warn); font-weight: 650; }
.c-err { max-width: 240px; white-space: normal; }
.st-err { color: var(--bad); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-badge { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.st-badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-done { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.st-delay { background: color-mix(in srgb, var(--link) 15%, transparent); color: var(--link); }
.st-run { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.st-pending { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.st-fail { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.st-cancel { background: var(--surface-2); color: var(--text-2); }
.st-note { color: var(--muted); font-size: 11px; margin-top: 4px; white-space: nowrap; }
.sched-foot { padding: 12px 18px; border-top: 1px solid var(--line); }
.sch-empty { text-align: center; padding: 34px 20px; color: var(--muted); }

/* Monitor (watchdog) */
.mon-summary-card { padding: 0; }
.mon-summary { display: flex; align-items: center; gap: 22px; padding: 16px 20px; flex-wrap: wrap; }
.mon-when { font-size: 13px; color: var(--muted); line-height: 1.5; }
.mon-when b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.mon-kpi { text-align: center; min-width: 78px; }
.mon-kpi .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mon-kpi .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.mk-run .n { color: var(--good); }
.mk-off .n { color: var(--text-2); }
.mk-err .n { color: var(--bad); }
.mon-link { color: var(--link); cursor: pointer; font-weight: 550; }
.mon-link:hover { text-decoration: underline; }
.mon-hist { display: flex; flex-direction: column; gap: 2px; max-height: 55vh; overflow-y: auto; }
.mh-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.mh-row:first-child { border-top: none; }
.mh-when { color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 118px; }
.mh-err { color: var(--bad); font-size: 12px; }

/* Monitor timeline grid */
.mon-grid-card { padding: 0; overflow: hidden; }
.mon-daynav { display: inline-flex; align-items: center; gap: 8px; }
.mon-day-label { font-weight: 600; font-size: 13px; min-width: 130px; text-align: center; font-variant-numeric: tabular-nums; }
.tm-nav[disabled] { opacity: .35; cursor: default; }
.mon-grid-wrap { overflow: auto; max-height: 66vh; border-top: 1px solid var(--line); }
.mg-table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.mg-table th, .mg-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.mg-camp-h, .mg-camp { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 230px; max-width: 230px; text-align: left; padding: 8px 12px; }
.mg-camp-h { z-index: 3; background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; top: 0; }
.mg-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-weight: 650; }
.mg-time { min-width: 40px; padding: 8px 4px; text-align: center; font-variant-numeric: tabular-nums; font-size: 11px; }
.mg-camp .mon-link { display: flex; flex-direction: column; gap: 1px; }
.mg-shop { font-size: 10.5px; color: var(--muted); font-weight: 400; }
.mg-name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 205px; }
.mg-cell { width: 40px; min-width: 40px; height: 28px; padding: 0; }
.mg-cell.mg-run { background: var(--good); }
.mg-cell.mg-off { background: color-mix(in srgb, var(--muted) 22%, transparent); }
.mg-cell.mg-err { background: var(--bad); }
.mg-cell.mg-none { background: transparent; }
.mon-grid-wrap tbody tr:hover .mg-camp { background: var(--surface-2); }
.mon-legend { display: inline-flex; gap: 14px; margin-left: 14px; font-size: 12px; color: var(--muted); }
.mon-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.mon-legend .lg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mon-legend .mg-run { background: var(--good); }
.mon-legend .mg-off { background: color-mix(in srgb, var(--muted) 22%, transparent); }
.mon-legend .mg-err { background: var(--bad); }
.mon-legend .mg-none { background: transparent; border: 1px solid var(--line-2); }

.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line-2); border-top-color: var(--link); border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .nav-links { flex-direction: row; }
  .camp-actions { width: 100%; margin-left: 0; }
}
