/* ============================================================
   Weekly AI Digest — design system v3
   Editorial Luxury × Asymmetrical Bento. Mobile-first.
   ============================================================ */

:root {
  --bg:             #fbfbf9;
  --surface:        #ffffff;
  --surface-soft:   #f5f4f1;
  --surface-dim:    #ecebe6;

  --ink:            #0e0e0c;
  --ink-2:          #46453f;
  --ink-3:          #807e76;
  --ink-4:          #b2b0a7;

  --accent:         #d76b3c;
  --accent-deep:    #b1542a;
  --accent-soft:    #f7e9e0;
  --accent-glow:    rgba(215,107,60,.08);

  --success:        #4f7a4a;
  --success-soft:   #e6efe3;
  --warn:           #b78a2b;
  --warn-soft:      #f4ecd6;
  --danger:         #a4392e;
  --danger-soft:    #f1ddd9;

  --hairline:       rgba(14,14,12,.06);
  --hairline-strong:rgba(14,14,12,.12);
  --inner-hl:       rgba(255,255,255,.7);

  --r-sm: 8px;  --r-md: 14px;  --r-lg: 20px;  --r-xl: 28px;  --r-2xl: 36px;  --r-pill: 999px;

  --shadow-card:
    0 1px 0 rgba(255,255,255,.65) inset,
    0 1px 2px rgba(14,14,12,.04),
    0 8px 24px -8px rgba(14,14,12,.06);
  --shadow-float:
    0 1px 0 rgba(255,255,255,.7) inset,
    0 12px 32px -12px rgba(14,14,12,.16),
    0 2px 6px -2px rgba(14,14,12,.06);

  --ease-out-quint: cubic-bezier(.22, 1, .36, 1);
  --ease-spring:    cubic-bezier(.32, .72, 0, 1);

  /* safe-area для iOS Safari */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  padding-bottom: calc(96px + var(--safe-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
code { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; font-size: .92em; }
::selection { background: var(--accent); color: #fff; }

/* film grain */
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: .04; mix-blend-mode: multiply;
}

/* ===== SHELL ===== */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 56px);
}

/* ============================================================
   COMMAND BAR (sticky glass)
   ============================================================ */
.commandbar-wrap {
  position: sticky;
  top: calc(16px + var(--safe-top));
  z-index: 40;
  padding-top: calc(16px + var(--safe-top));
}
.commandbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 8px 8px 22px;
  background: rgba(251,251,249,.78);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-card);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: -.02em; font-size: 15px;
}
.brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 0 3px var(--accent-glow);
  flex-shrink: 0;
}
.brand-sub {
  color: var(--ink-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: .02em;
  padding-left: 14px; margin-left: 4px;
  border-left: 1px solid var(--hairline-strong);
}
.brand-sub b { color: var(--ink-2); font-weight: 500; }
.commandbar-spacer { flex: 1; min-width: 0; }

.statuspill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 16px; border-radius: var(--r-pill);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; letter-spacing: .02em; font-weight: 500;
  white-space: nowrap;
  background: var(--surface-soft); color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.statuspill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.statuspill--completed { background: var(--success-soft); color: var(--success); border-color: rgba(79,122,74,.18); }
.statuspill--completed .dot { background: var(--success); }
.statuspill--running { background: var(--accent-soft); color: var(--accent-deep); border-color: rgba(215,107,60,.22); }
.statuspill--running .dot { background: var(--accent); animation: pulse 1.6s var(--ease-out-quint) infinite; }
.statuspill--paused { background: var(--warn-soft); color: var(--warn); border-color: rgba(183,138,43,.2); }
.statuspill--paused .dot { background: var(--warn); }
.statuspill--failed { background: var(--danger-soft); color: var(--danger); border-color: rgba(164,57,46,.2); }
.statuspill--failed .dot { background: var(--danger); }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: .45; } }

.btn-rerun {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 22px;
  border: none; outline: none;
  border-radius: var(--r-pill);
  background: var(--ink); color: #fff;
  font-weight: 600; font-size: 14px; letter-spacing: -.005em;
  transition: transform .5s var(--ease-spring), box-shadow .5s var(--ease-spring), opacity .3s;
  min-height: 44px; /* touch target */
}
.btn-rerun .btn-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .5s var(--ease-spring), background .3s ease;
  flex-shrink: 0;
}
.btn-rerun .btn-icon svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 1.6; fill: none; }
.btn-rerun:hover:not([disabled]) { transform: translateY(-1px); box-shadow: 0 12px 28px -10px rgba(14,14,12,.32); }
.btn-rerun:hover:not([disabled]) .btn-icon { background: rgba(255,255,255,.2); transform: translate(2px,-2px) scale(1.05); }
.btn-rerun:active:not([disabled]) { transform: scale(.985); }
.btn-rerun[disabled] { opacity: .55; cursor: not-allowed; }

/* Back-link (на странице архива вместо «Пересобрать») */
.back-link {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 18px 8px 8px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  font-weight: 600; font-size: 14px; letter-spacing: -.005em;
  transition: background .35s var(--ease-out-quint), color .35s, border-color .35s, transform .4s var(--ease-spring);
  min-height: 44px;
  text-decoration: none;
}
.back-link .back-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-soft);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .3s, transform .5s var(--ease-spring);
  flex-shrink: 0;
}
.back-link .back-icon svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.7; fill: none; }
.back-link:hover { background: var(--ink); color: #fff; border-color: var(--ink); transform: translateY(-1px); }
.back-link:hover .back-icon { background: rgba(255,255,255,.12); transform: translate(-2px, 2px); }
.back-link:active { transform: scale(.985); }

/* ============================================================
   TITLE BLOCK
   ============================================================ */
.titleblock {
  padding: 96px 0 56px;
  display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: end;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: .18em;
  color: var(--ink-3); font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow .bullet { width: 4px; height: 4px; background: var(--accent); border-radius: 50%; display: inline-block; }

h1.display {
  margin: 14px 0 0;
  font-size: clamp(34px, 5.2vw, 52px);
  font-weight: 700; letter-spacing: -.025em; line-height: 1.04;
  color: var(--ink);
}
h1.display em { font-style: normal; color: var(--accent-deep); }
.lead {
  max-width: 640px; color: var(--ink-2);
  font-size: 17px; line-height: 1.55; margin-top: 18px;
}
.next-cron {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; color: var(--ink-3);
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 14px 18px; line-height: 1.5; text-align: right;
}
.next-cron b { display: block; color: var(--ink); font-weight: 500; font-size: 13px; margin-top: 2px; }

/* ============================================================
   PROJECT TABS
   ============================================================ */
.tabbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 24px 0 0;
  border-top: 1px solid var(--hairline);
}
.tab {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 18px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  border: 1px solid transparent;
  transition: background .3s var(--ease-out-quint), color .3s, border-color .3s, transform .3s var(--ease-spring);
  cursor: pointer; background: transparent;
  min-height: 44px; /* touch */
  text-decoration: none;
}
.tab:hover { background: rgba(14,14,12,.04); color: var(--ink); }
.tab.is-active {
  background: var(--accent-soft); color: var(--accent-deep);
  border-color: rgba(215,107,60,.18);
}
.tab .tab-icon { font-size: 14px; line-height: 1; }
.tab .tab-count {
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
  color: var(--ink-4); padding-left: 6px;
  border-left: 1px solid var(--hairline-strong); margin-left: 2px;
}
.tab.is-active .tab-count { color: var(--accent-deep); border-color: rgba(215,107,60,.3); }

.archive-cta {
  margin-left: auto;
  border: 1px solid var(--hairline-strong);
}
.archive-cta svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.7; fill: none; transition: transform .4s var(--ease-spring); }
.archive-cta:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.archive-cta:hover svg { transform: translate(2px,-2px); }

/* ===== SUB TABS ===== */
.subtabs {
  display: flex; gap: 28px;
  padding: 28px 0 0;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 48px;
}
.subtabs-spacer { height: 48px; }
.subtab {
  position: relative;
  padding: 0 0 18px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-3);
  cursor: pointer; background: none; border: none;
  letter-spacing: -.005em;
  transition: color .3s var(--ease-out-quint);
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex; align-items: center; gap: 8px;
}
.subtab .subtab-dot { font-size: 13px; }
.subtab.is-active { color: var(--ink); }
.subtab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--ink);
  transform: scaleX(0); transform-origin: left;
  transition: transform .55s var(--ease-spring);
}
.subtab.is-active::after { transform: scaleX(1); }
.subtab:hover { color: var(--ink-2); }

/* ===== SECTION GOAL ===== */
.section-goal {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 22px 26px; margin-bottom: 32px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 0 var(--inner-hl) inset;
}
.section-goal-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--ink-3); padding-top: 3px;
}
.section-goal-text { color: var(--ink-2); font-size: 14.5px; line-height: 1.6; max-width: 720px; white-space: pre-wrap; }

/* Кнопка «Скачать раздел в .md» */
.section-export {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 18px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  font-size: 13px; font-weight: 500; color: var(--ink);
  white-space: nowrap;
  align-self: center;
  transition: background .35s var(--ease-out-quint), color .35s, border-color .35s, transform .4s var(--ease-spring);
  min-height: 40px;
}
.section-export .section-export-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; opacity: .65;
  padding-left: 4px; border-left: 1px solid var(--hairline-strong); padding-left: 8px;
}
.section-export .section-export-icon {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-soft);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .3s, transform .4s var(--ease-spring);
  flex-shrink: 0;
}
.section-export-icon svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.section-export:hover { background: var(--ink); color: #fff; border-color: var(--ink); transform: translateY(-1px); }
.section-export:hover .section-export-icon { background: rgba(255,255,255,.12); transform: translateY(2px); }
.section-export:hover .section-export-meta { border-color: rgba(255,255,255,.2); }

/* ============================================================
   FEED (single column, Substack-style)
   ============================================================ */
.bento {
  display: flex; flex-direction: column; gap: 18px;
  max-width: 760px;            /* читаемая ширина строки */
  margin-left: auto;
  margin-right: auto;
}
/* legacy col-* классы оставлены no-op для обратной совместимости шаблонов */
.col-4, .col-6, .col-8, .col-12 { width: 100%; }

.card {
  padding: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  transition: transform .6s var(--ease-out-quint), box-shadow .6s var(--ease-out-quint), border-color .3s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-float); border-color: var(--hairline-strong); }
.card-inner {
  background: var(--surface);
  border-radius: calc(var(--r-xl) - 8px);
  padding: 28px 30px;
  box-shadow: 0 1px 0 var(--inner-hl) inset, var(--shadow-card);
  height: 100%;
  display: flex; flex-direction: column; gap: 14px;
}
.card-eyebrow {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-3); font-weight: 500;
}
.card-eyebrow-left { display: inline-flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-eyebrow .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); flex-shrink: 0; }

.chip-repeat {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent-deep);
  padding: 4px 10px; border-radius: var(--r-pill);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em; font-weight: 500;
  border: 1px solid rgba(215,107,60,.2);
  flex-shrink: 0;
}
.chip-repeat::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.card h2 {
  margin: 6px 0 0;
  font-size: 21px; line-height: 1.28; font-weight: 650; letter-spacing: -.012em;
  color: var(--ink);
  /* line clamp защита от runaway titles */
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card-summary {
  color: var(--ink-2); font-size: 14.5px; line-height: 1.55; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card-bullets { margin: 8px 0 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.card-bullets li {
  position: relative; padding-left: 18px;
  color: var(--ink-2); font-size: 14px; line-height: 1.5;
}
.card-bullets li::before {
  content: ""; position: absolute; left: 2px; top: 9px;
  width: 5px; height: 5px; background: var(--accent);
  border-radius: 1px; transform: rotate(45deg);
}
.card-action {
  position: relative;
  margin-top: auto;                       /* прижимаемся ко дну карточки */
  padding: 14px 18px 14px 20px;
  background: var(--accent-soft);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid rgba(215,107,60,.16);
  /* Левый accent-bar: толстый, продлевает «энергию» наружу */
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--ink);
  transition: transform .35s var(--ease-out-quint), box-shadow .35s;
}
.card-action::before {
  /* угол-маркер сверху: terracotta точка для дополнительного «привлечения» */
  content: "";
  position: absolute;
  top: -4px; right: 14px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.card-action-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .16em;
  color: var(--accent-deep);
}
.card-action-icon {
  font-size: 12px; line-height: 1; font-weight: 700;
  /* strelka → */
  transform: translateY(-1px);
  transition: transform .35s var(--ease-spring);
}
.card-action-text {
  font-size: 14px; line-height: 1.5;
  color: var(--ink);
  font-weight: 500;
}
.card:hover .card-action { box-shadow: inset 4px 0 0 var(--accent), 0 8px 18px -10px rgba(215,107,60,.3); }
.card:hover .card-action-icon { transform: translate(3px, -1px); }
.card-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-top: 12px; margin-top: 2px;
}
.card-source {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
  color: var(--ink-3);
  max-width: 78%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .3s;
}
.card-source:hover { color: var(--accent-deep); }
.card-source svg { width: 11px; height: 11px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.6; fill: none; }
.card-source-host { overflow: hidden; text-overflow: ellipsis; }
.card-tags { display: flex; gap: 5px; flex-shrink: 0; }
.tag-mini {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; letter-spacing: .05em; text-transform: lowercase;
  color: var(--ink-3); background: var(--surface-soft);
  padding: 3px 8px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
}

/* scroll entry */
.card { opacity: 0; transform: translateY(20px) scale(.985); filter: blur(6px); }
.card.is-in {
  opacity: 1; transform: none; filter: blur(0);
  transition: opacity .8s var(--ease-out-quint), transform .8s var(--ease-out-quint), filter .8s var(--ease-out-quint);
}

/* ============================================================
   ARCHIVE PAGE — Editorial Split
   ============================================================ */
.split {
  display: grid; grid-template-columns: 5fr 7fr; gap: 64px;
  padding: 96px 0 56px; align-items: start;
}
.split-left { position: sticky; top: calc(88px + var(--safe-top)); }
h1.massive {
  margin: 18px 0 0;
  font-size: clamp(42px, 6.5vw, 80px);
  font-weight: 700; letter-spacing: -.028em; line-height: .96;
  color: var(--ink);
}
h1.massive em { font-style: normal; color: var(--accent-deep); }
.split-lead { max-width: 420px; color: var(--ink-2); font-size: 16px; line-height: 1.55; margin-top: 22px; }
.summary-strip { margin-top: 36px; display: flex; flex-direction: column; gap: 0; max-width: 340px; }
.summary-strip-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--hairline);
  font-size: 13px; color: var(--ink-2);
}
.summary-strip-row:last-child { border-bottom: 1px solid var(--hairline); }
.summary-strip-row b { font-family: 'JetBrains Mono', monospace; color: var(--ink); font-weight: 500; font-size: 13px; }

.archive-list {
  display: flex; flex-direction: column;
  gap: 14px;
}
.archive-row {
  /* Double-bezel-light: simple card, не grid */
  display: flex; flex-direction: column; gap: 16px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  position: relative;
  transition:
    transform .55s var(--ease-out-quint),
    box-shadow .55s var(--ease-out-quint),
    border-color .3s;
}
.archive-row::before {
  /* левая акцент-полоска (тонкая) — терракотовая «нить» */
  content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity .4s var(--ease-out-quint);
}
.archive-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
  border-color: var(--hairline-strong);
}
.archive-row:hover::before { opacity: 1; }

.archive-date {
  font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1;
}
.archive-date small {
  display: block; margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 500; color: var(--ink-3);
  letter-spacing: .05em; text-transform: uppercase;
}
.archive-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--ink-2); font-size: 14px; }
.pill-stat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--surface-soft);
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--ink-2);
  border: 1px solid var(--hairline);
  white-space: nowrap;
}
.pill-stat .stat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.pill-stat.success .stat-dot { background: var(--success); }
.pill-stat.warn .stat-dot { background: var(--warn); }
.pill-stat.failed .stat-dot { background: var(--danger); }
.pill-stat b { color: var(--ink); font-weight: 500; }

.archive-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }

/* Primary action — открыть выпуск как основные карточки */
.open-button {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 18px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background .35s var(--ease-out-quint), transform .4s var(--ease-spring), box-shadow .35s;
  min-height: 44px;
}
.open-button .open-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.14);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .3s, transform .4s var(--ease-spring);
  flex-shrink: 0;
}
.open-button .open-icon svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.open-button:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -8px rgba(215,107,60,.4);
}
.open-button:hover .open-icon { background: rgba(255,255,255,.22); transform: translate(2px,-2px); }
.open-button:active { transform: scale(.985); }
.dl-button {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 18px;
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  border: 1px solid var(--hairline-strong);
  width: 100%; justify-content: space-between;
  font-size: 13px; font-weight: 500; color: var(--ink);
  transition: background .35s var(--ease-out-quint), color .35s, border-color .35s, transform .4s var(--ease-spring);
  min-height: 44px;
}
.dl-button .dl-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-soft);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .3s, transform .4s var(--ease-spring);
  flex-shrink: 0;
}
.dl-button .dl-icon svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.dl-button .dl-size { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: inherit; opacity: .7; }
.dl-button:hover { background: var(--ink); color: #fff; border-color: var(--ink); transform: translateY(-1px); }
.dl-button:hover .dl-icon { background: rgba(255,255,255,.12); transform: translateY(2px); }
.dl-button--none {
  background: transparent; color: var(--ink-4);
  border-style: dashed; cursor: default; pointer-events: none;
}
.dl-button--none:hover { background: transparent; color: var(--ink-4); border-color: var(--hairline-strong); transform: none; }

.archive-row { opacity: 0; transform: translateY(16px); }
.archive-row.is-in {
  opacity: 1; transform: none;
  transition: opacity .7s var(--ease-out-quint), transform .7s var(--ease-out-quint);
}

.footer-note {
  margin-top: 80px;
  padding: 28px 32px;
  border-radius: var(--r-lg);
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  color: var(--ink-2); font-size: 14px; line-height: 1.55;
  display: flex; gap: 16px; align-items: flex-start;
}
.footer-note-icon {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep);
  display: inline-flex; align-items: center; justify-content: center;
}
.footer-note code {
  font-size: 12.5px; color: var(--ink);
  background: var(--surface); padding: 2px 6px; border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
}

/* ============================================================
   SELECT MODE (галочки на карточках + floating bar)
   ============================================================ */
.select-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 12px;
  border-radius: var(--r-pill);
  background: transparent;
  border: 1px solid var(--hairline-strong);
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  transition: background .3s var(--ease-out-quint), color .3s, border-color .3s;
  min-height: 40px;
  position: relative;
}
.select-toggle-icon {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
.select-toggle-icon svg { width: 16px; height: 16px; }
.select-toggle:hover { background: rgba(14,14,12,.04); color: var(--ink); }
body.select-mode .select-toggle {
  background: var(--accent-soft); color: var(--accent-deep);
  border-color: rgba(215,107,60,.28);
}
.select-toggle-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: var(--r-pill);
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px; font-weight: 600;
  background: var(--accent); color: #fff;
}
.select-toggle-count[hidden] { display: none; }

/* Чекбокс на карточке — виден только в select-mode */
.card-select {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 3;
  width: 28px; height: 28px;
  cursor: pointer;
  display: none;
}
body.select-mode .card-select { display: inline-flex; align-items: center; justify-content: center; }
.card-select-input {
  position: absolute; inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.card-select-mark {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--hairline-strong);
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
  transition: background .25s var(--ease-out-quint), color .25s, border-color .25s, transform .25s var(--ease-spring);
  box-shadow: 0 2px 6px rgba(14,14,12,.08);
}
.card-select-mark svg { width: 14px; height: 14px; }
.card-select:hover .card-select-mark { border-color: var(--accent); }
.card-select-input:checked + .card-select-mark {
  background: var(--accent); color: #fff; border-color: var(--accent);
  transform: scale(1.06);
}
.card.is-selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-card) !important;
}
.card.is-selected .card-inner { box-shadow: 0 1px 0 var(--inner-hl) inset, var(--shadow-card); }

/* Карточка переносится position:relative чтобы чекбокс позиционировался */
.card { position: relative; }

/* Floating selection bar */
.selection-bar {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: transform .55s var(--ease-spring), opacity .35s var(--ease-out-quint);
}
.selection-bar[hidden] { display: none !important; }
.selection-bar.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.selection-bar-inner {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 8px 8px 20px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-pill);
  box-shadow: 0 24px 48px -16px rgba(14,14,12,.4);
}
.selection-bar-count {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 500; padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,.16);
}
.selection-bar-count b { font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.selection-bar-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(215,107,60,.28);
}
.selection-bar-clear,
.selection-bar-copy,
.selection-bar-download {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.1);
  font-size: 13px; font-weight: 500;
  transition: background .3s var(--ease-out-quint), transform .25s var(--ease-spring);
  min-height: 36px;
}
.selection-bar-clear:hover,
.selection-bar-copy:hover,
.selection-bar-download:hover { background: rgba(255,255,255,.16); }
.selection-bar-clear:active,
.selection-bar-copy:active,
.selection-bar-download:active { transform: scale(.96); }
.selection-bar-download {
  background: var(--accent); border-color: var(--accent);
}
.selection-bar-download:hover { background: var(--accent-deep); }
.selection-bar-copy svg,
.selection-bar-download svg { width: 13px; height: 13px; }

/* Mobile: bar full-width внизу */
@media (max-width: 600px) {
  .selection-bar { left: 8px; right: 8px; transform: translateY(40px); }
  .selection-bar.is-visible { transform: translateY(0); }
  .selection-bar-inner { width: 100%; justify-content: space-between; padding-left: 14px; gap: 4px; flex-wrap: wrap; }
  .selection-bar-clear, .selection-bar-copy, .selection-bar-download { padding: 8px 10px; font-size: 12.5px; }
}

/* ============================================================
   ARCHIVE-VIEW BANNER (когда открыт через ?digest=YYYY-MM-DD)
   ============================================================ */
.archive-view-banner {
  display: inline-flex; align-items: center; gap: 14px;
  margin-top: 32px;
  padding: 10px 8px 10px 18px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  box-shadow: 0 1px 0 var(--inner-hl) inset;
}
.archive-view-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent-deep); font-weight: 600;
  padding-right: 12px; border-right: 1px solid var(--hairline-strong);
}
.archive-view-date {
  font-weight: 600; color: var(--ink); font-size: 14px;
}
.archive-view-back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 14px;
  border-radius: var(--r-pill);
  background: var(--ink); color: #fff;
  font-size: 12.5px; font-weight: 500;
  transition: background .3s, transform .4s var(--ease-spring);
}
.archive-view-back svg { width: 12px; height: 12px; }
.archive-view-back:hover { background: var(--accent-deep); }

/* === Archive row → клик по дате открывает выпуск === */
.archive-row-open {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: color .3s var(--ease-out-quint);
}
.archive-row:hover .archive-row-open .archive-date { color: var(--accent-deep); }
.archive-row .archive-date small {
  transition: color .3s;
}
.archive-row:hover .archive-row-open .archive-date small { color: var(--accent-deep); }

/* ============================================================
   ACTIVITY DRAWER (правая боковая панель)
   ============================================================ */
.activity-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 12px;
  border-radius: var(--r-pill);
  background: transparent;
  border: 1px solid var(--hairline-strong);
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  transition: background .3s var(--ease-out-quint), color .3s, border-color .3s;
  min-height: 40px;
}
.activity-toggle .activity-icon {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
}
.activity-toggle .activity-icon svg { width: 16px; height: 16px; }
.activity-toggle:hover { background: rgba(14,14,12,.04); color: var(--ink); border-color: var(--hairline-strong); }
.activity-toggle.has-running .activity-icon::after {
  /* Зелёная точка при running */
  content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); transform: translate(8px,-8px);
  animation: pulse 1.6s var(--ease-out-quint) infinite;
}
.activity-toggle .activity-icon { position: relative; }

/* Узкая постоянная sticky-панель справа без backdrop, можно свернуть */
.activity-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 320px;
  z-index: 35;
  background: var(--bg);
  border-left: 1px solid var(--hairline);
  box-shadow: -16px 0 32px -16px rgba(14,14,12,.1);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .5s var(--ease-spring);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.activity-drawer[hidden] { display: none !important; }
.activity-drawer.is-open { transform: translateX(0); }

.activity-drawer-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.activity-drawer-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--ink-3); font-weight: 500;
}
.activity-drawer-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .3s, color .3s, transform .35s var(--ease-spring);
  flex-shrink: 0;
}
.activity-drawer-close:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.activity-drawer-close:active { transform: scale(.92); }
.activity-drawer-close svg { width: 13px; height: 13px; }

.activity-drawer-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 8px 10px 14px 16px;
  scrollbar-width: thin;
}

/* === Codex limits — компактные шкалы в шапке drawer === */
.codex-limits {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--hairline);
}
.codex-limits-row {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
}
.codex-limits-label {
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); font-weight: 500;
}
.codex-limits-bar {
  position: relative; height: 6px; border-radius: 3px;
  background: var(--surface-dim); overflow: hidden;
}
.codex-limits-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--success);
  transition: width .6s var(--ease-out-quint), background .3s;
}
.codex-limits-fill.warn   { background: var(--warn); }
.codex-limits-fill.danger { background: var(--danger); }
.codex-limits-meta {
  color: var(--ink-2); font-size: 11px; white-space: nowrap;
}
.codex-limits-meta b { color: var(--ink); font-weight: 500; }

/* === Codex чип в commandbar === */
.codex-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  min-height: 32px;
  transition: background .3s, color .3s, border-color .3s;
}
.codex-chip-label {
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3);
}
.codex-chip-pct {
  color: var(--ink); font-weight: 600;
}
.codex-chip.warn { background: var(--warn-soft); border-color: rgba(183,138,43,.22); }
.codex-chip.warn .codex-chip-pct { color: var(--warn); }
.codex-chip.danger { background: var(--danger-soft); border-color: rgba(164,57,46,.22); }
.codex-chip.danger .codex-chip-pct { color: var(--danger); }
.codex-chip:hover { transform: translateY(-1px); }
@media (max-width: 600px) {
  .codex-chip .codex-chip-label { display: none; }
}
.activity-drawer-body::-webkit-scrollbar { width: 6px; }
.activity-drawer-body::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 3px; }

.activity-line {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 8px;
  padding: 8px 4px 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12.5px; line-height: 1.4;
}
.activity-line:last-child { border-bottom: none; }
.activity-line .activity-ts {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--ink-4);
  letter-spacing: .02em; padding-top: 2px;
}
.activity-line .activity-msg {
  color: var(--ink); position: relative; padding-left: 14px;
  word-break: break-word;
}
.activity-line .activity-msg::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4);
}
.activity-line.level-info  .activity-msg::before { background: var(--ink-3); }
.activity-line.level-warn  .activity-msg::before { background: var(--warn); }
.activity-line.level-error .activity-msg::before { background: var(--danger); }
.activity-line.level-alert .activity-msg::before { background: var(--accent); }
.activity-line .activity-msg .activity-details {
  display: block; margin-top: 3px; color: var(--ink-3);
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
}

.activity-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

.activity-drawer-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-soft);
}
.activity-foot-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--ink-3); letter-spacing: .02em;
}
.activity-foot-refresh {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .5s var(--ease-spring), background .3s;
}
.activity-foot-refresh:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.activity-foot-refresh:active { transform: rotate(180deg) scale(.94); }
.activity-foot-refresh.is-spinning svg { animation: rotate 1s linear infinite; }
.activity-foot-refresh svg { width: 14px; height: 14px; }
@keyframes rotate { from {transform:rotate(0);} to {transform:rotate(360deg);} }

@media (max-width: 880px) {
  .activity-toggle .activity-label { display: none; }
  .activity-toggle { padding: 8px 10px; }
  .activity-drawer { width: min(360px, 90vw); }
}
@media (max-width: 400px) {
  .activity-drawer { width: 100vw; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--ink-3);
  background: var(--surface-soft);
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-lg);
}
.empty-state-icon { font-size: 32px; line-height: 1; margin-bottom: 12px; opacity: .6; }
.empty-state h3 { margin: 0 0 6px; color: var(--ink-2); font-size: 18px; font-weight: 600; }
.empty-state p { margin: 0; max-width: 420px; margin-left: auto; margin-right: auto; }

/* ===== FOCUS-VISIBLE ===== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
.tab:focus-visible,
.subtab:focus-visible,
.btn-rerun:focus-visible,
.dl-button:focus-visible,
.archive-cta:focus-visible {
  outline-offset: 2px;
}

/* ============================================================
   MOBILE (≤ 880)
   ============================================================ */
@media (max-width: 880px) {
  body { padding-bottom: calc(48px + var(--safe-bottom)); }
  .shell { padding: 0 16px; }

  /* commandbar — собирается в две строки, status + кнопка под брендом */
  .commandbar {
    flex-wrap: wrap;
    padding: 10px 10px 10px 16px;
    gap: 10px 12px;
    border-radius: 22px;
  }
  .brand-sub { display: none; }
  .commandbar-spacer { flex-basis: 100%; height: 0; }
  .statuspill { font-size: 11px; padding: 7px 12px; }
  .btn-rerun { padding: 6px 8px 6px 18px; font-size: 13.5px; }
  .btn-rerun .btn-icon { width: 30px; height: 30px; }

  .titleblock { grid-template-columns: 1fr; padding: 48px 0 28px; gap: 22px; }
  h1.display { font-size: clamp(28px, 8vw, 36px); }
  .lead { font-size: 15.5px; }
  .next-cron { text-align: left; }

  /* Project tabs — горизонтальный скролл */
  .tabbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 18px 0 6px;
    margin: 0 -16px;
    padding-left: 16px; padding-right: 16px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; scroll-snap-align: start; }
  .archive-cta { margin-left: 0; }

  /* Sub-tabs — тоже horizontal scroll */
  .subtabs {
    gap: 22px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 20px 0 0;
    margin: 0 -16px 32px;
    padding-left: 16px; padding-right: 16px;
    scrollbar-width: none;
  }
  .subtabs::-webkit-scrollbar { display: none; }
  .subtab { flex-shrink: 0; padding-bottom: 14px; }
  .subtabs-spacer { height: 24px; }

  .section-goal {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px 18px; margin-bottom: 24px;
    border-radius: 16px;
  }
  .section-goal-text { font-size: 14px; }
  .section-export {
    width: 100%; justify-content: space-between;
    margin-top: 4px;
  }

  /* BENTO collapses to single column */
  .bento { gap: 14px; }
  .col-4, .col-6, .col-8, .col-12 { grid-column: span 12; }
  .card { border-radius: 22px; padding: 5px; }
  .card-inner { padding: 22px 22px; border-radius: 18px; gap: 12px; }
  .card h2 { font-size: 19px; }
  .card-summary { font-size: 14px; }
  .card-bullets li { font-size: 13.5px; }
  .card-action { padding: 12px 14px 12px 16px; }
  .card-action-text { font-size: 13.5px; }
  /* Отключаем hover-эффекты на touch */
  .card:hover { transform: none; box-shadow: var(--shadow-card); border-color: var(--hairline); }
  .card:active { transform: scale(.99); }

  /* === ARCHIVE === */
  .split { grid-template-columns: 1fr; gap: 28px; padding: 36px 0 24px; }
  .split-left { position: static; }
  h1.massive { font-size: clamp(36px, 11vw, 56px); }
  .split-lead { font-size: 15px; }
  .summary-strip { max-width: 100%; }

  .archive-row { padding: 18px 18px; gap: 14px; }
  .archive-row:hover { transform: none; box-shadow: var(--shadow-card); }
  .archive-date { font-size: 22px; }
  .archive-date small { margin-top: 4px; font-size: 10.5px; }
  .archive-actions { flex-direction: column; align-items: stretch; }
  .open-button { width: 100%; justify-content: space-between; }
  .footer-note { margin-top: 48px; padding: 20px 22px; flex-direction: column; gap: 12px; }
}

/* very small phones */
@media (max-width: 400px) {
  .commandbar { padding: 8px 8px 8px 14px; gap: 8px; }
  .btn-rerun .btn-rerun-label { display: none; }
  .btn-rerun { padding: 6px 6px 6px 6px; }
  .btn-rerun .btn-icon { width: 32px; height: 32px; }
  h1.display { font-size: 26px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card, .archive-row { opacity: 1 !important; transform: none !important; filter: none !important; }
}
