:root {
  color-scheme: dark;
  --bg: #0d1512;
  --surface: #141f1a;
  --field: #101a15;
  --surface-hover: #1a2921;
  --ink: #eef5ef;
  --muted: #a7bbad;
  --line: #2c3e33;
  --accent: #5be39a;
  --accent-soft: #1c392c;
  --primary: #5be39a;
  --primary-ink: #092218;
  --danger: #ffaaa3;
  --warn-soft: #35291e;
  --drop: #a5e8bf;
  --radius: 14px;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--line); padding: 1px 5px; border-radius: 4px; }
h1 { font-size: clamp(1.75rem, 2.6vw, 2.5rem); line-height: 1.15; margin: 0 0 16px; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 12px; overflow-wrap: anywhere; }
.wrap { width: 100%; max-width: 1376px; margin-inline: auto; padding-inline: clamp(16px, 3vw, 36px); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.listing-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.r { text-align: right; }

/* Навигация */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: inline-flex; flex: none; align-items: center; gap: 10px; font-size: .95rem; font-weight: 700; text-decoration: none; }
.brand-mark, .brand-mark img { display: block; width: 32px; height: 32px; }
.main-nav, .header-actions { display: flex; align-items: center; gap: 4px; }
.main-nav { margin-inline-start: auto; flex-wrap: wrap; }
.header-actions { flex-shrink: 0; }
.main-nav a, .header-menu summary, .header-menu-panel a, .header-menu-panel button {
  display: block; border-radius: 8px; padding: 9px 10px; text-decoration: none;
  color: var(--muted); font-size: .875rem; line-height: 1.4; white-space: nowrap;
}
.main-nav a:hover, .header-menu summary:hover, .header-menu-panel a:hover, .header-menu-panel button:hover,
.header-menu[open] summary { background: var(--surface-hover); color: var(--ink); }
.main-nav a.on, .header-menu summary.on, .header-menu-panel a.on { color: var(--accent); background: var(--accent-soft); }
.header-menu { position: relative; }
.header-menu summary { list-style: none; cursor: pointer; }
.header-menu summary::-webkit-details-marker { display: none; }
.header-menu summary::after { content: ""; display: inline-block; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); vertical-align: 3px; margin-left: 9px; }
.header-menu-panel {
  position: absolute; z-index: 5; inset: calc(100% + 6px) 0 auto auto; min-width: 188px;
  width: max-content; max-width: min(260px, calc(100vw - 32px)); padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 30px #050a0780;
}
.header-menu-panel button { background: none; border: 0; font-family: inherit; cursor: pointer; width: 100%; text-align: left; }
.account-name { display: block; color: var(--ink); padding: 8px 10px; font-size: .8125rem; overflow-wrap: anywhere; }
.skip-link { position: absolute; z-index: 10; top: 8px; left: 8px; padding: 10px; background: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
main.wrap { min-width: 0; padding-top: clamp(22px, 3vw, 38px); padding-bottom: 44px; }

@media (max-width: 1040px) {
  .top-inner { flex-wrap: wrap; gap: 10px; padding-block: 12px; min-height: 0; }
  .main-nav { order: 1; flex-basis: 100%; margin: 0; }
  .header-actions { margin-inline-start: auto; }
}
@media (max-width: 480px) {
  .top-inner { padding-inline: 12px; }
  .brand { gap: 6px; font-size: .8125rem; }
  .brand-mark, .brand-mark img { width: 26px; height: 26px; }
  .header-actions { gap: 0; }
  .header-menu summary { font-size: .77rem; padding-inline: 6px; }
  .header-menu summary::after { margin-left: 5px; }
  .main-nav a { padding-inline: 8px; }
}

main h2 { margin-top: 4px; }
section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.count { color: var(--muted); font-weight: 500; margin-left: 4px; }
.crumbs { margin: 0; font-size: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }

/* сообщения */
.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; white-space: pre-line; border: 1px solid; overflow-wrap: anywhere; }
.flash-ok { background: var(--accent-soft); border-color: #365b49; }
.flash-error { background: #352420; border-color: #6b413a; color: #ffd3cc; }

/* статус */
.status {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot-ok { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot-busy { background: #e0a100; animation: pulse 1.2s infinite; }
.dot-off { background: var(--muted); }
@keyframes pulse { 50% { opacity: .35; } }

/* карточки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.2vw, 26px); box-shadow: var(--shadow); }
.add p { margin: 0 0 12px; }
.add-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px; }
@media (max-width: 720px) { .add-form { grid-template-columns: 1fr; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }
.watch {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
}
.watch.paused { opacity: .6; }
.watch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.watch-name { font-weight: 650; font-size: 16px; text-decoration: none; line-height: 1.3; }
.nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.nums dt { font-size: 12px; color: var(--muted); }
.nums dd { margin: 0; font-size: 18px; font-weight: 600; }
.nums dd.accent { color: var(--accent); }
.conds { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); }
.chip-dim { background: var(--bg); color: var(--muted); }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--muted); white-space: nowrap; }
.tag-drop { background: transparent; border: 1px solid var(--drop); color: var(--drop); margin-left: 4px; }
.watch-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; flex-wrap: wrap; }
.actions { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.actions form { display: inline; }

.empty { padding: 22px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }

/* таблица находок */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.alerts { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.alerts th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.875rem; padding: 13px 16px; background: var(--field); border-bottom: 1px solid var(--line); }
.alerts td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.alerts tr:last-child td { border-bottom: 0; }
.alerts th.r, .alerts td.r { text-align: right; }

/* формы */
input, textarea, select {
  width: 100%; min-width: 0; min-height: 44px; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; min-height: auto; flex: none; accent-color: var(--accent); margin: 0 8px 0 0; transform: scale(1.15); }
.form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 500; }
.form label.check { flex-direction: row; align-items: center; font-weight: 400; }
.form small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.form fieldset { min-inline-size: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.form legend { padding: 0 6px; font-weight: 650; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .grow { flex: 1 1 260px; }
.w-s { width: 150px; }
.w-m { width: 240px; max-width: 100%; }
.indent { padding-left: 26px; }
.end { align-self: flex-end; padding-bottom: 10px; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }

.btn {
  display: inline-flex; justify-content: center; align-items: center; min-height: 42px;
  font: 650 0.875rem/1.35 Inter, system-ui, sans-serif; cursor: pointer; padding: 9px 15px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: center;
}
.btn:hover { background: var(--surface-hover); border-color: var(--muted); }
.btn-primary:hover { background: #7aefae; border-color: #7aefae; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-danger { color: var(--danger); }
.danger { margin: 0 0 28px; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

@media (max-width: 560px) {
  .w-s { width: calc(50% - 6px); }
  .indent { padding-left: 0; }
  .status form, .status .btn { width: 100%; }
}

/* куки */
.spaced { margin-bottom: 32px; }
.state { margin: 0; }
.howto { background: var(--bg); border-radius: 8px; padding: 10px 14px; }
.howto summary { cursor: pointer; font-weight: 550; }
.howto ol { margin: 10px 0 4px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
textarea[name=cookies], input[name=user_agent] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.note { margin: 0; }
.status-warn { border-color: #e0a100; background: var(--warn-soft); }

/* диагностика */
.diag { margin-bottom: 16px; }
.diag p { margin: 0 0 6px; }
.diag-verdict { font-size: 18px; font-weight: 650; }
.diag-ok { border-color: var(--accent); }
.diag-bad { border-color: var(--danger); }
td.break { word-break: break-all; }
a.btn { text-decoration: none; }
.err-line { color: var(--danger); font-size: 13px; }

/* цепочка переходов */
.bundle h3 { font-size: 15px; margin: 18px 0 8px; }
.code { font: 600 12px ui-monospace, Menlo, monospace; padding: 2px 7px; border-radius: 6px; }
.c-ok { background: var(--accent-soft); color: var(--accent); }
.c-redir { background: var(--bg); color: var(--drop); border: 1px solid var(--drop); }
.c-bad { background: var(--warn-soft); color: var(--danger); }
.final-row td { background: var(--bg); }
.shot { display: block; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
.spaced-s { margin-bottom: 8px; }
.run { margin-bottom: 10px; padding: 12px 16px; }
.run summary { cursor: pointer; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }

/* проверка Авито */
.flash-wait { background: var(--accent-soft); border-color: var(--accent); }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* аккаунты */
.code-box { background: var(--bg); border-radius: 8px; padding: 12px 14px; }
.code-box p { margin: 4px 0; }
.code-big { font: 700 20px ui-monospace, Menlo, monospace; letter-spacing: .08em; padding: 2px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.chip-on { background: var(--ink); color: var(--surface); }
a.chip { text-decoration: none; }
.picks { display: grid; gap: 6px; }
.form fieldset[hidden], .picks[hidden] { display: none; }
/* выгрузка в Excel */
.section-head { gap: 12px; flex-wrap: wrap; }
.export { display: flex; gap: 6px; align-items: center; }
.export select { width: auto; padding: 7px 10px; }
.export { flex-wrap: wrap; }
.section-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 20px; }
.section-nav a { color: var(--muted); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: .875rem; }
.section-nav a:hover { color: var(--accent); border-color: var(--accent); }
.section-nav ~ h2 { margin-top: 30px; }

.code-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  overflow-x: auto; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }

/* Вход и регистрация */
.auth-page .top { background: transparent; }
.auth-page .top-inner, .auth-page main.wrap { max-width: 1192px; }
.auth-page main.wrap { padding-block: clamp(28px, 6.5vw, 94px); }
.auth-layout {
  display: grid; grid-template-columns: 1.08fr 1fr; min-height: 520px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
}
.auth-intro, .auth-panel { display: grid; align-items: center; min-width: 0; }
.auth-intro {
  margin: 0; padding: clamp(28px, 4.5vw, 58px);
  background:
    radial-gradient(ellipse at 12% 80%, #1b4732, transparent 65%),
    repeating-linear-gradient(90deg, transparent 0 47px, #95cdb610 47px 48px),
    repeating-linear-gradient(0deg, transparent 0 47px, #95cdb610 47px 48px),
    #14291f;
}
.auth-intro-title { font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 720; line-height: 1.08; letter-spacing: -.045em; margin: 0; max-width: 17ch; }
.auth-intro-description { color: #bfd1c5; margin: 20px 0 0; max-width: 34ch; }
.auth-benefits { display: flex; flex-wrap: wrap; gap: 16px 28px; margin: 28px 0 0; padding-top: 18px; border-top: 1px solid #85baab38; }
.auth-benefits dt { font-weight: 700; font-size: 1.0625rem; }
.auth-benefits dd { margin: 2px 0 0; color: #bbd0c2; font-size: .875rem; }
.auth-panel { padding: clamp(22px, 4vw, 52px); }
.auth-panel-content { width: 100%; max-width: 380px; margin-inline: auto; }
.auth-panel h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); margin: 0 0 16px; }
.auth-description { color: var(--muted); margin: -6px 0 18px; }
.auth-panel .flash { font-size: .875rem; margin: 0 0 16px; }
.auth-panel .flash-wait { background: var(--warn-soft); border-color: #6b5135; color: #f4dbb5; }
.auth-form { gap: 13px; margin: 0; }
.auth-form label { font-weight: 600; }
.auth-form input { min-height: 46px; }
.auth-form .btn, .auth-fluent { width: 100%; min-height: 44px; }
.auth-forgot { align-self: flex-end; font-size: .875rem; }
.auth-fluent { margin-top: 10px; }
.auth-links { color: var(--muted); font-size: .875rem; margin: 19px 0 0; }
.auth-links a, .auth-forgot { color: var(--accent); }

@media (max-width: 760px) {
  .auth-page main.wrap { max-width: 540px; }
  .auth-layout { grid-template-columns: 1fr; min-height: 0; }
  .auth-intro { padding: 22px; }
  .auth-intro-title { max-width: none; font-size: clamp(1.65rem, 5vw, 2.25rem); }
  .auth-intro-description { margin-top: 8px; font-size: .875rem; }
  .auth-benefits { margin-top: 14px; padding-top: 10px; gap: 8px 22px; }
  .auth-benefits dt, .auth-benefits dd { font-size: .8125rem; }
  .auth-panel { padding: 22px; }
  .auth-intro { order: 1; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  .dot-busy { animation: none; }
}
