/* ============================================================
   Pagey — общие стили
   Современная минималистичная эстетика, мятно-зелёный акцент
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Палитра */
  --ink: #0f1411;
  --ink-2: #2a322d;
  --ink-3: #5d6660;
  --ink-4: #8b938d;
  --line: #e4e7e3;
  --line-2: #eef1ed;
  --bg: #f5f7f3;
  --bg-2: #fbfcfa;
  --paper: #ffffff;

  /* Акценты */
  --green: oklch(0.72 0.13 155);
  --green-strong: oklch(0.58 0.14 156);
  --green-soft: oklch(0.94 0.05 155);
  --green-tint: oklch(0.97 0.025 155);

  --violet: oklch(0.62 0.16 295);
  --violet-soft: oklch(0.95 0.04 295);

  --amber: oklch(0.78 0.13 70);
  --amber-soft: oklch(0.96 0.05 80);

  --red: oklch(0.62 0.18 22);
  --red-soft: oklch(0.95 0.04 22);

  /* Прочее */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --shadow-1: 0 1px 0 rgba(15,20,17,0.04), 0 1px 2px rgba(15,20,17,0.04);
  --shadow-2: 0 1px 0 rgba(15,20,17,0.04), 0 8px 24px -8px rgba(15,20,17,0.08);
  --shadow-3: 0 1px 0 rgba(15,20,17,0.04), 0 16px 48px -16px rgba(15,20,17,0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum";
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, oklch(0.85 0.04 155 / 0.4) 1px, transparent 0);
  background-size: 28px 28px;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.022em;
  margin: 0;
  color: var(--ink);
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-feature-settings: "tnum"; }
.tnum { font-variant-numeric: tabular-nums; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ===== Header ===== */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-header__inner {
  max-width: 1440px; margin: 0 auto;
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600; letter-spacing: -0.025em; font-size: 18px;
  color: var(--ink);
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--ink);
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  color: white;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 5px;
  border-radius: 3px;
  background:
    linear-gradient(135deg, var(--green) 0%, var(--green) 50%, transparent 50%),
    var(--bg);
}
.brand small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--ink-3);
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-left: 4px;
  border-left: 1px solid var(--line);
  padding-left: 10px;
}
.app-header__nav { display: flex; align-items: center; gap: 8px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { background: var(--line-2); }
.btn--ghost { color: var(--ink-3); }
.btn--ghost:hover { color: var(--ink); background: var(--line-2); }
.btn--outline { border-color: var(--line); background: var(--paper); }
.btn--outline:hover { border-color: var(--ink-4); background: var(--paper); }
.btn--ink { background: var(--ink); color: white; }
.btn--ink:hover { background: var(--ink-2); }
.btn--primary {
  background: var(--green-strong); color: white;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.06);
}
.btn--primary:hover { background: oklch(0.52 0.14 156); }
.btn--sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn--lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn .ico { width: 16px; height: 16px; }

/* ===== Avatar / profile menu ===== */
.profile {
  position: relative;
}
.profile__btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px; padding: 4px 14px 4px 4px;
  font-size: 13px; font-weight: 500; color: var(--ink);
}
.profile__btn:hover { border-color: var(--ink-4); }
.profile__avatar {
  width: 26px; height: 26px; border-radius: 999px;
  background: linear-gradient(135deg, var(--green) 0%, oklch(0.55 0.14 200) 100%);
  color: white; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.profile__menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 6px; width: 220px;
  box-shadow: var(--shadow-3);
  display: none; z-index: 60;
}
.profile.open .profile__menu { display: block; }
.profile__menu a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 9px;
  font-size: 13px; color: var(--ink);
}
.profile__menu a:hover { background: var(--line-2); }
.profile__menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.profile__menu .kbd {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-4);
}

/* ===== Containers ===== */
.page {
  max-width: 1440px; margin: 0 auto;
  padding: 32px 28px 80px;
}
.page--narrow { max-width: 980px; }

/* ===== Pipeline ===== */
.pipeline {
  display: inline-flex; align-items: center; gap: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 4px;
}
.pipeline__step {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-3);
  position: relative;
}
.pipeline__step .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--ink-4);
}
.pipeline__step.is-done { color: var(--ink-2); }
.pipeline__step.is-done .num {
  width: 16px; height: 16px; border-radius: 999px;
  background: var(--green); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.pipeline__step.is-active {
  background: var(--ink); color: white;
}
.pipeline__step.is-active .num { color: rgba(255,255,255,0.6); }
.pipeline__sep {
  width: 16px; height: 1px; background: var(--line); margin: 0 2px;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-transform: lowercase;
  border: 1px solid transparent;
}
.badge::before {
  content: ""; width: 5px; height: 5px; border-radius: 999px; background: currentColor;
  opacity: 0.85;
}
.badge--brief { background: #f1f3ef; color: var(--ink-3); border-color: var(--line); }
.badge--create { background: var(--violet-soft); color: var(--violet); }
.badge--edit { background: var(--ink); color: white; }
.badge--edit::before { background: var(--green); opacity: 1; }
.badge--live { background: var(--green-soft); color: var(--green-strong); }
.badge--archive { background: #ecedea; color: var(--ink-4); }
.badge--no-dot::before { display: none; }

/* ===== Cards ===== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card--bare { box-shadow: none; }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label {
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px;
}
.field__hint { font-size: 12px; color: var(--ink-4); }
.input, .textarea, .select {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--green-strong);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235d6660' stroke-width='2' stroke-linecap='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}

.radio-row, .check-row { display: inline-flex; gap: 6px; }
.radio, .check {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px; color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.radio input, .check input { display: none; }
.radio:hover, .check:hover { border-color: var(--ink-4); }
.radio.is-active, .check.is-active {
  background: var(--ink); color: white; border-color: var(--ink);
}
.check__box {
  width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid var(--ink-4);
  display: inline-flex; align-items: center; justify-content: center;
}
.check.is-active .check__box {
  background: var(--green-strong); border-color: var(--green-strong);
}
.check.is-active .check__box::after {
  content: ""; width: 8px; height: 5px;
  border: 1.5px solid white; border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(0, -1px);
}

/* ===== Section header ===== */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 22px; gap: 24px;
}
.section-title h1 {
  font-size: 36px; line-height: 1.05;
}
.section-title h2 { font-size: 22px; }
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-4);
}

/* ===== Generic utilities ===== */
.row { display: flex; align-items: center; gap: 12px; }
.row--wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-4); }
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }
.divider-label {
  display: flex; align-items: center; gap: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-4);
  margin: 28px 0 14px;
}
.divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ===== Icon helpers ===== */
.ico {
  width: 18px; height: 18px;
  display: inline-block; vertical-align: middle;
  flex-shrink: 0;
}

/* ===== Toast / hint ===== */
.kbd {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--ink-3);
  padding: 2px 6px;
  border: 1px solid var(--line); border-radius: 5px;
  background: var(--bg-2);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }
