/* Палитра и шрифты — как в «AI мастерской фито роликов» (Travnik. Radar)
   и на nektarica.ru: кремовый фон, шалфейные акценты, заголовки Bebas Neue. */

:root {
  --bg: #FBFAF3;
  --card: #FFFFFF;
  --ink: #2E362B;
  --muted: #54604A;
  --line: rgba(32, 38, 27, .13);
  --accent: #758D64;
  --accent-deep: #4F6540;
  --accent-soft: #E5EBDD;
  --olive: #8C842F;
  --clay: #A9784B;
  --cream: #F5F3E9;
  --mist: #EAEADC;
  --danger: #9B3B2C;
  --danger-soft: #F6E3E0;
  --radius: 12px;
  --shadow: 0 12px 36px -22px rgba(37, 48, 26, .4);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

h1, h2, h3, h4 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1.15;
  margin: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent-deep); }
a:hover { color: var(--ink); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 22px 20px 80px; }

/* ── Шапка и вкладки ─────────────────────────────────────────── */
header.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 0; }
header.top .wrap { padding-top: 0; padding-bottom: 0; display: flex; align-items: center; gap: 16px; }
.home { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.logo { width: 48px; height: 48px; border-radius: 50%; }
header.top h1 { font-size: 26px; }
header.top .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.nav { margin-left: auto; display: flex; gap: 8px; }
.nav a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none;
         color: var(--muted); font-size: 14px; }
.nav a:hover { border-color: var(--accent); color: var(--accent-deep); }


/* ── Карточки ───────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.card > h3 { background: var(--accent-soft); padding: 10px 18px; font-size: 21px; display: flex;
             align-items: center; gap: 10px; flex-wrap: wrap; }
.card > h3 .btn { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
                  letter-spacing: 0; text-transform: none; }
.card-body { padding: 16px 18px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hint { background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
        font-size: 14px; color: var(--muted); }
.hint.warn { background: #FBF3E4; border-color: #E5D3A8; color: #7A5A12; }
.hint.err { background: var(--danger-soft); border-color: #D8C3BE; color: var(--danger); }

.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; line-height: 1.6;
       background: var(--mist); color: var(--muted); white-space: nowrap; }
.tag.rub { background: var(--accent); color: #fff; }
.tag.rt { background: #E9E2D2; color: #6B5326; }
.tag.zv { background: #E1E8EE; color: #3A5468; }
.tag.ok { background: var(--accent-soft); color: var(--accent-deep); }
.tag.pub { background: var(--accent-deep); color: #fff; }
.tag.chosen { background: var(--olive); color: #fff; }
.tag.personal { background: #F0E2D6; color: #7A4A28; }

/* ── Кнопки и поля ──────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px;
       border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-size: 15px;
       cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent-deep); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--ink); }
.btn.flat { border-color: var(--line); background: var(--card); color: var(--muted); }
.btn.flat:hover { border-color: var(--accent); color: var(--ink); background: var(--card); }
.btn.danger { background: transparent; border-color: #D8C3BE; color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 4px 12px; font-size: 14px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn.busy::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent;
                   border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

input[type=text], input[type=url], input[type=password], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea.post { min-height: 420px; font-size: 15.5px; line-height: 1.6; resize: vertical; }
label.f { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.row > .btn, .row > .shrink { flex: 0 0 auto; }

/* ── День ───────────────────────────────────────────────────── */
.daybar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.daybar h2 { font-size: 34px; }
.daybar .grow { flex: 1; }
.daygrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.side .card > h3 { font-size: 18px; }
.side ul { margin: 0; padding-left: 18px; font-size: 14px; }
.side li { margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.draft-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 12px 18px 0; }
.draft-head .grow { flex: 1; }
.draft .card-body { padding-top: 10px; }
.draft.is-chosen { border-color: var(--olive); box-shadow: 0 0 0 2px rgba(140, 132, 47, .25), var(--shadow); }
.draft.is-published { border-color: var(--accent-deep); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.counter { font-size: 13px; color: var(--muted); margin-left: auto; }
.counter.over { color: var(--danger); font-weight: 600; }
details.more { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details.more ul { margin: 6px 0; padding-left: 18px; font-size: 14px; }
.claims li { color: #7A5A12; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.photo { position: relative; width: 120px; }
.photo img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.photo .x { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.9); border: 0; border-radius: 50%;
            width: 24px; height: 24px; cursor: pointer; color: var(--danger); }
.photo a.dl { font-size: 12px; }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--muted);
        cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

/* ── Таблица плана ──────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 14px; }
.filters > * { flex: 0 1 auto; }
.filters input[type=search] { min-width: 240px; }
table.plan { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.plan th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 8px 10px;
                border-bottom: 2px solid var(--line); background: var(--cream); }
table.plan td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plan tr.month td { background: var(--accent-soft); font-family: "Bebas Neue", Impact, sans-serif;
                         font-size: 19px; letter-spacing: .03em; padding: 6px 10px; }
table.plan td.date { white-space: nowrap; color: var(--muted); }
table.plan td .title { font-weight: 500; }
table.plan td .sum { color: var(--muted); font-size: 13px; }
table.plan select, table.plan input { padding: 4px 8px; font-size: 13.5px; border-radius: 8px; }
table.plan .plants { min-width: 190px; }
table.plan .views { text-align: right; color: var(--muted); white-space: nowrap; }
.saved { outline: 2px solid var(--accent) !important; transition: outline .6s; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; }
.pager span { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Статистика ─────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.stat b { display: block; font-family: "Bebas Neue", Impact, sans-serif; font-size: 32px; font-weight: 400; }
.stat span { color: var(--muted); font-size: 13.5px; }
.hbar { display: grid; grid-template-columns: 170px 1fr 56px; gap: 10px; align-items: center; font-size: 14px;
        margin-bottom: 6px; }
.hbar .bar { background: var(--mist); border-radius: 6px; height: 12px; overflow: hidden; }
.hbar .bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.hbar .bar i.personal { background: var(--clay); }
.hbar .n { text-align: right; color: var(--muted); }
.diff { font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.diff del { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.diff ins { background: var(--accent-soft); color: var(--accent-deep); text-decoration: none; }
.pre { white-space: pre-wrap; font-size: 14.5px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.log { font-size: 13px; font-family: ui-monospace, Menlo, monospace; max-height: 340px; overflow: auto; }
.log div { padding: 2px 0; border-bottom: 1px solid var(--line); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.thumbs label { display: block; font-size: 12px; color: var(--muted); }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
         padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 50; box-shadow: var(--shadow); }
.toast.err { background: var(--danger); }

.login { max-width: 420px; margin: 60px auto; }

@media (max-width: 900px) {
  .daygrid, .cols2 { grid-template-columns: 1fr; }
  .side { order: 2; }
  header.top h1 { font-size: 21px; }
  .hbar { grid-template-columns: 120px 1fr 44px; }
  table.plan .hide-sm { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding-left: 14px; padding-right: 14px; }
  header.top .sub, .nav { display: none; }
  textarea.post { min-height: 340px; }
  table.plan { font-size: 13.5px; }
}

/* ── Подсказки ─────────────────────────────────────────────── */
.who { align-self: center; color: var(--muted); font-size: 14px; padding: 0 6px; }
details.guide { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius);
                margin-bottom: 18px; font-size: 15px; }
details.guide > summary { cursor: pointer; padding: 10px 16px; font-weight: 600; color: var(--accent-deep); list-style: none;
                          display: flex; align-items: center; gap: 10px; }
details.guide > summary:hover { color: var(--ink); }
.chev { margin-left: auto; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
        transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
details.guide[open] .chev { transform: rotate(-135deg) translate(-2px, -2px); }
details.guide > summary::-webkit-details-marker { display: none; }
details.guide[open] > summary { border-bottom: 1px solid var(--line); }
details.guide .g { padding: 4px 18px 12px; }
details.guide ol, details.guide ul { padding-left: 22px; margin: 8px 0; }
details.guide li { margin-bottom: 6px; }
.tip { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }
.help h3 { font-size: 24px; margin: 26px 0 8px; }
.help p, .help li { font-size: 16px; }
.help li { margin-bottom: 6px; }

/* ── Иконки: один набор, одна толщина линии ───────────────── */
.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
     stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.i.ok { color: var(--accent-deep); }
.tag .i { width: 1em; height: 1em; margin-right: 4px; vertical-align: -.15em; }
.hint .i { margin-right: 4px; }
.hint.warn .i { color: #9A6B12; }
.btn .i { width: 1.1em; height: 1.1em; }
.drop { display: inline-flex; align-items: center; gap: 8px; }

/* ── Шапка в стиле nektarica.ru: стеклянная «капсула» меню ─────── */
header.top { background: rgba(255, 254, 245, .86); -webkit-backdrop-filter: blur(14px) saturate(1.2);
             backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid rgba(117, 141, 100, .22);
             position: sticky; top: 0; z-index: 10; padding: 12px 0; }
header.top .bar { gap: 22px; }
header.top h1 { font-size: 26px; white-space: nowrap; }
.main-nav { display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 40px; margin: 0 auto;
            background: rgba(255, 255, 255, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
            border: 1px solid rgba(117, 141, 100, .28); box-shadow: 0 10px 28px -20px rgba(37, 48, 26, .5);
            font-size: 13.5px; line-height: 20px; font-weight: 600; letter-spacing: -.1px; }
.main-nav a { white-space: nowrap; text-decoration: none; padding: 8px 14px; border-radius: 30px; color: #1c2418;
              transition: background .2s, color .2s; }
.main-nav a:hover { background: var(--accent); color: #fff; }
.main-nav a.on { background: rgba(117, 141, 100, .18); }
.main-nav a.on:hover { background: var(--accent); }
.user { display: flex; align-items: center; gap: 6px; margin-left: 0; }
.who { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; padding-right: 6px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%;
           border: 1px solid rgba(117, 141, 100, .28); color: var(--accent-deep); background: rgba(255, 255, 255, .62);
           transition: background .2s, color .2s; }
.iconbtn:hover, .iconbtn.on { background: var(--accent); color: #fff; }
.iconbtn .i { width: 19px; height: 19px; }
@media (max-width: 900px) {
  header.top .bar { flex-wrap: wrap; gap: 10px 14px; }
  .user { margin-left: auto; }
  .main-nav { order: 3; width: 100%; margin: 0; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .who { display: none; }
}

/* ── Контент-план: фильтры ─────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; margin-bottom: 16px; }
.filters .fld { flex: 0 0 auto; min-width: 150px; }
.filters .fld.grow { flex: 1 1 320px; }
.filters select, .filters input[type=search] { height: 42px; }
.searchbox { display: flex; gap: 8px; }
.searchbox input { flex: 1; min-width: 0; }
.searchbox .btn { height: 42px; padding: 0 22px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 0 16px; border: 1px solid var(--line);
          border-radius: 999px; background: var(--card); cursor: pointer; font-size: 14px; color: var(--muted); margin-left: auto; }
.toggle:hover { border-color: var(--accent); }
.toggle input { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--mist);
                position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
                       background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(14px); }
.toggle:has(input:checked) { color: var(--ink); border-color: var(--accent); }
@media (max-width: 700px) { .toggle { margin-left: 0; } .filters .fld { flex: 1 1 140px; } }

/* ── Контент-план: ссылки ТГ / MAX ─────────────────────────── */
.links { display: flex; align-items: center; gap: 8px; }
.tglink { flex: none; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep);
          text-decoration: none; font-size: 13px; font-weight: 600; }
.tglink:hover { background: var(--accent); color: #fff; }
table.plan .links input { height: 32px; min-width: 150px; }
table.plan td.hide-sm { min-width: 260px; }

/* ── Выбор файла ───────────────────────────────────────────── */
.importrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.importrow .or { color: var(--muted); font-size: 14px; }
.filepick { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border: 1px dashed var(--accent);
            border-radius: 999px; color: var(--accent-deep); background: var(--cream); cursor: pointer; font-size: 15px;
            max-width: 280px; }
.filepick:hover { background: var(--accent-soft); }
.filepick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.plan td select { min-width: 140px; }
table.plan td.hide-sm { min-width: 0; }
table.plan .links input { min-width: 130px; width: 100%; }

/* ── Справка по клику «?» ──────────────────────────────────── */
.q { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; margin-left: 6px;
     border-radius: 50%; border: 1.5px solid rgba(117, 141, 100, .6); background: transparent; color: var(--accent-deep);
     font: 600 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; letter-spacing: 0;
     cursor: pointer; vertical-align: middle; flex: none; text-transform: none; }
.q:hover, .q:focus-visible { background: var(--accent); border-color: var(--accent); color: #fff; outline: none; }
.qpop { position: absolute; z-index: 60; max-width: 340px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff;
        font: 400 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; letter-spacing: 0; text-transform: none;
        box-shadow: 0 14px 34px -14px rgba(37, 48, 26, .6); white-space: pre-line; }
.stat .q { margin-left: 4px; }

/* ── Выбор даты ────────────────────────────────────────────── */
.datebtn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px;
           border: 1px solid rgba(117, 141, 100, .4); background: var(--card); color: var(--ink); font: inherit; font-size: 15px;
           cursor: pointer; }
.datebtn:hover { border-color: var(--accent); background: var(--accent-soft); }
.datebtn .i { color: var(--accent-deep); }
.cal { position: absolute; z-index: 70; width: 300px; padding: 14px; border-radius: 16px; background: var(--card);
       border: 1px solid rgba(117, 141, 100, .28); box-shadow: 0 18px 44px -18px rgba(37, 48, 26, .5); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head b { font-family: "Bebas Neue", Impact, sans-serif; font-weight: 400; font-size: 21px; letter-spacing: .03em; }
.cal-nav { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--accent-deep);
           cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.cal-nav:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.cal-w { font-size: 12px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-d { height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font: inherit; font-size: 14.5px;
         cursor: pointer; padding: 0; }
.cal-d:hover { background: var(--accent-soft); }
.cal-d.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-d.sel { background: var(--accent); color: #fff; box-shadow: none; }
.cal-foot { margin-top: 10px; text-align: center; }
.cal-today { border: 0; background: transparent; color: var(--accent-deep); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.cal-today:hover { text-decoration: underline; }
.draft-head .counter { margin-left: 0; }
.draft-head .q { margin-left: 4px; }

/* ── Плашки статистики: «?» в правом верхнем углу ─────────── */
.stat { position: relative; }
.stat > .q { position: absolute; top: 12px; right: 12px; margin: 0; }
.stat b { padding-right: 28px; }

/* ── Длинные слова не должны раздвигать карточки ───────────── */
.daygrid > *, .cols2 > *, .card, .card-body { min-width: 0; }
.card { overflow: clip; }
textarea, input { max-width: 100%; }
textarea { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; overflow-x: hidden; }
.card-body, .hint, .pre, .diff, details.guide .g { overflow-wrap: anywhere; }

/* ═══ Аналитика и общая полировка в духе Apple ═══════════════════ */
:root { --radius: 18px; --shadow: 0 1px 2px rgba(37,48,26,.04), 0 12px 32px -18px rgba(37,48,26,.28);
        --ease: cubic-bezier(.22, 1, .36, 1); }
body { -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "kern" 1; }
.card { border-color: rgba(32,38,27,.08); }
.card > h3 { background: transparent; border-bottom: 1px solid rgba(32,38,27,.07); padding: 14px 20px; font-size: 21px; }
.card > h3 .btn { background: var(--card); }
.btn { transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease); }
.btn:active { transform: scale(.97); }
:focus-visible { outline: 3px solid rgba(117,141,100,.45); outline-offset: 2px; border-radius: 10px; }
.main-nav a:focus-visible, .iconbtn:focus-visible { outline-offset: 0; }
.stat, .kpi { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }

/* сегментированный переключатель периода (как в iOS) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(32,38,27,.06); }
.seg a { padding: 7px 14px; border-radius: 9px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500;
         transition: background .2s var(--ease), color .2s; white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(37,48,26,.18), 0 0 0 .5px rgba(37,48,26,.08); }
@media (max-width: 640px) { .seg { width: 100%; overflow-x: auto; } .seg a { flex: 1; text-align: center; padding: 7px 10px; } }

/* крупные показатели */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; background: var(--card); border: 1px solid rgba(32,38,27,.08);
       border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; min-width: 0; }
.kpi.flat { box-shadow: none; background: var(--cream); }
.kpi.link:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(37,48,26,.04), 0 18px 36px -18px rgba(37,48,26,.38); color: inherit; }
.kpi-label { font-size: 13px; color: var(--muted); letter-spacing: .01em; }
.kpi-num { font-family: "Bebas Neue", Impact, sans-serif; font-weight: 400; font-size: 44px; line-height: 1.05; letter-spacing: .01em; }
.kpi-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 8px; border-radius: 999px;
        font-size: 13px; font-weight: 600; }
.chip.up { background: #E3EFD9; color: #3E6B2A; }
.chip.down { background: #F6E3E0; color: var(--danger); }

.insights { background: linear-gradient(180deg, #FFFFFF, #F8F9F2); }
.insights h4 { font-size: 20px; margin-bottom: 8px; }
.insights ul { list-style: none; margin: 0; padding: 0; }
.insights li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid rgba(32,38,27,.06); }
.insights li:last-child { border-bottom: 0; }
.insights li .i { color: var(--olive); margin-top: 3px; }

/* график по месяцам */
svg.trend { width: 100%; height: auto; display: block; overflow: visible; }
svg.trend .grid { stroke: rgba(32,38,27,.08); stroke-width: 1; }
svg.trend .axis { fill: var(--muted); font-size: 11px; }
svg.trend .line { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
                  stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 1.1s var(--ease) .1s forwards; }
svg.trend .pt { fill: #fff; stroke: var(--accent-deep); stroke-width: 2; transition: r .15s; }
svg.trend .dot:hover .pt { r: 6; fill: var(--accent); }
@keyframes draw { to { stroke-dashoffset: 0; } }
table.mini { border-collapse: collapse; font-size: 14px; margin-top: 8px; }
table.mini th, table.mini td { padding: 5px 18px 5px 0; text-align: left; border-bottom: 1px solid var(--line); }

/* расходящиеся полоски: вправо — лучше обычного, влево — слабее */
.dbar { display: grid; grid-template-columns: minmax(96px, 150px) 1fr 54px; grid-template-areas: "l t v" ". n n";
        column-gap: 12px; row-gap: 0; align-items: center; margin-bottom: 12px; }
.dbar-label { grid-area: l; font-size: 14.5px; overflow-wrap: anywhere; }
.dbar.best .dbar-label { font-weight: 600; }
.dbar-track { grid-area: t; position: relative; height: 12px; border-radius: 99px; background: rgba(32,38,27,.06); }
.dbar-track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1.5px; background: rgba(32,38,27,.28); border-radius: 2px; }
.dbar-track i { position: absolute; top: 0; bottom: 0; width: var(--w); border-radius: 99px; transform-origin: left; animation: grow .8s var(--ease) both; }
.dbar-track i.pos { left: 50%; background: linear-gradient(90deg, #8AA079, #6F8A5C); transform-origin: left center; }
.dbar-track i.neg { right: 50%; background: linear-gradient(270deg, #D2A27A, #B98557); transform-origin: right center; }
.dbar-val { grid-area: v; text-align: right; font-weight: 600; font-size: 14.5px; color: var(--accent-deep); }
.dbar-val.neg { color: #8A5A32; }
.dbar-note { grid-area: n; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .i { width: 40px; height: 40px; color: var(--accent); margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  svg.trend .line { stroke-dashoffset: 0; }
}

/* «Что бросается в глаза» — плашка в стиле «Лучший пост», занимает свободное место в сетке */
.insights-kpi { grid-column: span 3; gap: 8px; }
.insights-kpi .kpi-label { display: flex; align-items: center; gap: 6px; color: var(--olive); font-weight: 600; }
.insights-kpi ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.insights-kpi li { position: relative; padding-left: 16px; font-size: 14.5px; line-height: 1.45; }
.insights-kpi li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
@media (max-width: 1000px) { .insights-kpi { grid-column: 1 / -1; } }
.card > h3 .seg { background: rgba(32,38,27,.07); }
.card > h3 .seg a { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; letter-spacing: 0; padding: 6px 16px; }
.kpis4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .kpis4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpis4 { grid-template-columns: 1fr; } }

/* Длинные плашки (обороты, источники) переносятся внутри рамки, а не вылезают за неё */
.chips .tag, .tag.wrap { white-space: normal; max-width: 100%; border-radius: 14px; padding: 4px 12px; line-height: 1.4; overflow-wrap: anywhere; }
.chips { min-width: 0; }

/* ═══ Мобильная версия: правки по замечаниям ═══════════════════ */
/* «?» всегда в правом углу заголовка карточки; если есть кнопка («Переобучить»), она слева от «?» */
.card > h3 { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.card > h3 .q { margin-left: auto; flex: none; order: 3; }
.card > h3:has(.btn) .btn { margin-left: auto; order: 2; flex: none; }
.card > h3:has(.btn) .q { margin-left: 4px; }
.card > h3:has(.seg) .q { margin-left: auto; }

/* день: стрелки и дата — всегда одна строка */
.daynav { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.daynav h2 { white-space: nowrap; }
.daybar h2 .short { display: none; }

/* чистка */
.cleanrow { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; margin-bottom: 8px; }
.cleanrow input[type=number] { width: 78px; flex: none; text-align: center; }
.cleanbtn { margin: 6px 0 18px; }
.btnq { display: inline-flex; align-items: center; gap: 2px; }

.tablewrap { overflow-x: auto; }
table.mini th, table.mini td { white-space: nowrap; }

@media (max-width: 600px) {
  .daybar { gap: 10px; }
  .daybar h2 .full { display: none; }
  .daybar h2 .short { display: inline; }
  .daybar h2 { font-size: 28px; }
  .daybar .grow { display: none; }
  .datebtn { margin-left: auto; }

  /* кнопки под постом: на всю ширину, по две в ряд — середина между ними по центру экрана */
  .draft .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .draft .actions .btn { width: 100%; justify-content: center; }
  .draft .actions .btn.ghost[hidden] { display: none; }

  .cleanbtn .btn, .btnq .btn { width: 100%; justify-content: center; }
  .cleanbtn { margin-bottom: 16px; }
  .storage-actions, .card-body .actions:has(.btnq) { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .btnq { display: flex; }
  .btnq .btn { flex: 1; }
}
@media (max-width: 600px) { table.mini { width: 100%; } table.mini th, table.mini td { padding-right: 12px; } table.mini th { font-size: 13px; } }

/* Контент-план: шапка и кнопки */
.planbar .planbtns { display: flex; gap: 10px; }
.reactions-note { margin: 0; }
.rrow { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 8px 0;
        border-bottom: 1px solid rgba(32,38,27,.07); }
.rrow:last-child { border-bottom: 0; }
.rrow > :first-child { min-width: 0; overflow-wrap: anywhere; }
.rrow .rval { flex: none; font-weight: 600; color: var(--accent-deep); white-space: nowrap; }
.cleanrow span, .cleanrow label { white-space: nowrap; }
@media (max-width: 700px) {
  .planbar { row-gap: 10px; }
  .planbar .grow { display: none; }
  .planbar .planbtns { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .planbar .planbtns .btn { width: 100%; justify-content: center; }
  .filters .toggle { width: 100%; justify-content: flex-start; }
}
@media (max-width: 600px) {
  .card-body > .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .card-body > .actions .btn { width: 100%; justify-content: center; padding-left: 8px; padding-right: 8px; }
}

/* ═══ Логотип, выпадающие списки, шапка дня ═══════════════════ */
.logo { width: 60px; height: 40px; border-radius: 0; object-fit: contain; }
header.top h1 { font-size: 26px; }

select { -webkit-appearance: none; appearance: none; }
.dd { position: relative; display: block; width: 100%; }
.dd-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.dd-btn { display: block; width: 100%; height: 42px; padding: 0 38px 0 16px; text-align: left; font: inherit; color: var(--ink);
          background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1.5 1.5l5.5 5.5 5.5-5.5' fill='none' stroke='%234F6540' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 15px center;
          border: 1px solid rgba(32,38,27,.14); border-radius: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
          box-shadow: 0 1px 2px rgba(37,48,26,.04); transition: border-color .2s, box-shadow .2s, background-color .2s; }
.dd-btn:hover { border-color: rgba(117,141,100,.6); }
.dd-btn.open, .dd-btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(117,141,100,.2); outline: none; }
.ddmenu { position: absolute; z-index: 80; max-height: 300px; overflow-y: auto; padding: 6px; border-radius: 14px; background: rgba(255,255,255,.98);
          border: 1px solid rgba(117,141,100,.28); box-shadow: 0 18px 44px -16px rgba(37,48,26,.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
          animation: ddin .14s ease-out; }
@keyframes ddin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dd-item { display: block; width: 100%; text-align: left; padding: 9px 14px 9px 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink);
           font: inherit; font-size: 15px; cursor: pointer; position: relative; white-space: nowrap; }
.dd-item:hover, .dd-item:focus-visible { background: var(--accent-soft); outline: none; }
.dd-item.sel { font-weight: 600; color: var(--accent-deep); }
.dd-item.sel::before { content: ""; position: absolute; left: 13px; top: 50%; width: 5px; height: 10px; margin-top: -7px;
                       border-right: 2px solid var(--accent-deep); border-bottom: 2px solid var(--accent-deep); transform: rotate(45deg); }
table.plan .dd-btn { height: 34px; font-size: 13.5px; border-radius: 10px; padding-left: 12px; min-width: 130px; }

.datebtn .dshort { display: none; }
.subact { margin: 0 0 14px; }
.subact .btn { background: var(--card); }

@media (max-width: 600px) {
  .logo { width: 52px; height: 35px; }
  .daybar-day { flex-wrap: nowrap; gap: 8px; }
  .daynav { gap: 6px; flex: 0 1 auto; }
  .daynav .btn.small { padding: 6px 9px; }
  .daybar h2 { font-size: 26px; }
  .daybar .todaylink { display: none; }
  .datebtn { margin-left: auto; padding: 0 12px; height: 36px; gap: 6px; font-size: 14px; flex: none; }
  .datebtn .dfull { display: none; }
  .datebtn .dshort { display: inline; }
}

/* ═══ Проверка перед публикацией ═══════════════════════════════ */
details.review { margin-top: 14px; border: 1px solid rgba(32,38,27,.09); border-radius: 16px; background: #FBFAF4; overflow: clip; }
details.review > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; flex-wrap: wrap; }
details.review > summary::-webkit-details-marker { display: none; }
details.review > summary:hover { background: rgba(117,141,100,.07); }
details.review > summary .i { color: var(--accent-deep); }
.rv-title { font-weight: 600; }
.rv-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.rv-badge { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: var(--mist); color: var(--muted); }
.rv-badge.warn { background: #F7ECCF; color: #7A5A12; }
details.review > summary .chev { margin-left: auto; }
details.review[open] > summary .chev { transform: rotate(-135deg) translate(-2px, -2px); }
.rv-body { padding: 4px 16px 16px; border-top: 1px solid rgba(32,38,27,.07); }
.rv-seg { margin: 12px 0 14px; }
.rv-lead { margin: 0 0 12px; font-size: 14px; color: var(--muted); }

.claim { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; margin-bottom: 8px; border-radius: 12px;
         background: #FBF3E1; border: 1px solid #EBDDB4; cursor: pointer; transition: background .2s, border-color .2s; }
.claim input { position: absolute; opacity: 0; pointer-events: none; }
.claim .tick { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 1.6px solid #C9AE6A; background: #fff; position: relative; transition: all .2s; }
.claim .tick::after { content: ""; position: absolute; left: 6px; top: 2.5px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .2s; }
.claim input:checked ~ .tick { background: var(--accent); border-color: var(--accent); }
.claim input:checked ~ .tick::after { transform: rotate(45deg) scale(1); }
.claim:has(input:checked) { background: #EEF3E9; border-color: #CBD9BE; }
.claim:has(input:checked) .claim-t { color: var(--muted); }
.claim input:focus-visible ~ .tick { box-shadow: 0 0 0 3px rgba(117,141,100,.3); }
.claim-t { font-size: 15px; line-height: 1.5; }

.fact { padding: 10px 14px; margin-bottom: 8px; background: #fff; border: 1px solid rgba(32,38,27,.08); border-left: 3px solid var(--accent);
        border-radius: 10px; display: flex; flex-direction: column; gap: 4px; }
.fact-t { font-size: 15px; line-height: 1.5; }
.fact-src { font-size: 12.5px; color: var(--accent-deep); font-weight: 500; overflow-wrap: anywhere; }

dl.about { margin: 0; display: grid; gap: 4px 0; }
dl.about dt { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 10px; }
dl.about dt:first-child { margin-top: 0; }
dl.about dd { margin: 0; font-size: 15px; line-height: 1.5; }
dl.about dd.chips { display: flex; flex-wrap: wrap; gap: 6px; }
dl.about dd.chips a.tag { text-decoration: none; background: #fff; border: 1px solid rgba(32,38,27,.1); color: var(--accent-deep); }
dl.about dd.chips a.tag:hover { background: var(--accent-soft); }
dl.about blockquote { margin: 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--olive); color: var(--muted); font-style: italic; }
@media (max-width: 600px) { .rv-body { padding: 4px 12px 14px; } .rv-seg { width: 100%; } .rv-seg a { flex: 1; } }

/* «Основа — ваши посты»: плашки идут подряд и переносятся на следующую строку, выровнены влево */
dl.about dd.chips { display: block; text-align: left; }
dl.about dd.chips a.tag { display: inline-block; margin: 0 6px 6px 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }

.fact-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.fact-links .fl { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft);
                  color: var(--accent-deep); text-decoration: none; }
.fact-links .fl:hover { background: var(--accent); color: #fff; }
.fact-links .fl.bad { background: #F6E3E0; color: var(--danger); }
.fl-ok { font-size: 12px; color: var(--accent-deep); }
.fl-bad { font-size: 12px; color: var(--danger); font-weight: 600; }

/* Публикация в Telegram */
.sendrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.btn.send { background: #2E8BC9; border-color: #2E8BC9; }
.btn.send:hover { background: #2577AD; border-color: #2577AD; }
@media (max-width: 600px) { .sendrow .btn { width: 100%; justify-content: center; } }
