/* Банк референсов «Интерес». Палитра и шрифты — из бренда агентства
   (agency/04 Брендбук/Стили сайта — токены.css): Холст, Чернила, Ночь, один Синий. */

@font-face { font-family: "Onest"; src: url(/fonts/onest-cyrillic-400-normal.woff2) format("woff2"); font-weight: 400; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-display: swap; }
@font-face { font-family: "Onest"; src: url(/fonts/onest-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212; }
@font-face { font-family: "Onest"; src: url(/fonts/onest-cyrillic-500-normal.woff2) format("woff2"); font-weight: 500; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-display: swap; }
@font-face { font-family: "Onest"; src: url(/fonts/onest-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212; }
@font-face { font-family: "Onest"; src: url(/fonts/onest-cyrillic-700-normal.woff2) format("woff2"); font-weight: 700; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-display: swap; }
@font-face { font-family: "Onest"; src: url(/fonts/onest-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-cyrillic-400-normal.woff2) format("woff2"); font-weight: 400; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-cyrillic-500-normal.woff2) format("woff2"); font-weight: 500; unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212; }

:root {
  --canvas: #F0F1F9; --ink: #0B0D14; --night: #05060A; --accent: #1F3BD6; --white: #FFFFFF;
  --frost: #EDEFF5; --mute: #62687A; --mute-dark: #7E8494;

  --bg: var(--canvas); --fg: var(--ink); --muted: var(--mute);
  --surface: var(--white); --line: rgba(11, 13, 20, .12); --soft: rgba(11, 13, 20, .06);
  --chip: rgba(11, 13, 20, .05); --chip-on: var(--ink); --chip-on-fg: var(--canvas);
  --shade: rgba(5, 6, 10, .55);

  --sans: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --flow: cubic-bezier(.22, .8, .2, 1);
  --r: 14px; --r-s: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--night); --fg: var(--frost); --muted: var(--mute-dark);
    --surface: rgba(237, 239, 245, .045); --line: rgba(237, 239, 245, .14); --soft: rgba(237, 239, 245, .07);
    --chip: rgba(237, 239, 245, .07); --chip-on: var(--frost); --chip-on-fg: var(--night);
    --shade: rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ кнопки */
.btn { border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; font-size: 13px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; transition: transform .25s var(--flow), background .25s var(--flow), opacity .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: #2540B8; }
.btn-ghost { background: var(--chip); color: var(--fg); }
.btn-ghost:hover { background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.btn[disabled] { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.x:hover { color: var(--fg); background: var(--chip); }

/* ------------------------------------------------------------ поля */
.field { display: grid; gap: 6px; }
.field > span, .flabel, .klabel { font: 500 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea, .field select, .search input, .inline-select {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 11px 13px; outline: none; transition: border-color .2s;
}
.field input:focus, .field textarea:focus, .search input:focus, .inline-select:focus { border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

/* ------------------------------------------------------------ вход */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; background: var(--night); color: var(--frost); overflow: hidden; display: flex; align-items: flex-end; padding: 40px; }
/* картинка 1451 px: не растягиваем больше половины её ширины на экран, иначе на Retina она «сыпется» */
.login-drop { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); width: min(90%, 725px); height: auto; }
.login-art::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(to top, rgba(5, 6, 10, .88), transparent); }
.login-mark { position: relative; z-index: 1; }
.login-mark .mono { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute-dark); }
.login-mark p { font-size: clamp(28px, 3.4vw, 46px); line-height: 1.05; margin: 10px 0 0; font-weight: 500; max-width: 14ch; text-wrap: balance; }
.login-form { align-self: center; justify-self: center; width: min(380px, 100%); padding: 40px 24px; display: grid; gap: 18px; }
.login-form h1 { margin: 0 0 6px; font-size: 32px; font-weight: 500; }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; grid-template-rows: 38vh auto; }
  .login-art { padding: 24px; }
}

/* ------------------------------------------------------------ шапка */
.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 16px; align-items: center; padding: 14px 24px; background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--fg); font-weight: 500; white-space: nowrap; }
.brand-dot { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #6f84ff 0%, var(--accent) 45%, #0b1a6e 100%); box-shadow: 0 0 18px rgba(31, 59, 214, .45); }
.search { flex: 1; max-width: 520px; margin-left: auto; }
.search input { border-radius: 999px; padding: 10px 16px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; display: grid; box-shadow: 0 18px 50px rgba(5, 6, 10, .18); }
.menu button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--chip); }
@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 12px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
}

/* ------------------------------------------------------------ фильтры */
.filters { padding: 18px 24px 6px; display: grid; gap: 10px; }
.frow { display: flex; gap: 14px; align-items: center; min-width: 0; }
.flabel { width: 92px; flex: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
.chip { flex: none; border: 0; background: var(--chip); border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .2s var(--flow), color .2s; }
.chip:hover { background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-fg); }
.chip .n { font-family: var(--mono); font-size: 11px; opacity: .6; margin-left: 6px; }
.count { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 760px) {
  .filters { padding: 14px 16px 4px; }
  .frow { flex-direction: column; align-items: flex-start; gap: 6px; }
  .flabel { width: auto; }
  .chips { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 4px; }
  .count { margin-left: 0; }
}

/* ------------------------------------------------------------ сетка */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 28px 20px; padding: 18px 24px 64px; }
@media (max-width: 760px) { .grid { padding: 14px 16px 48px; grid-template-columns: 1fr 1fr; gap: 20px 12px; } }
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }
.ref { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; cursor: pointer; text-align: left; background: none; border: 0; padding: 0; color: inherit; min-width: 0; width: 100%; align-content: start; }
.ref-meta, .ref-top { min-width: 0; }
.ref-img { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r); overflow: hidden; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.ref-img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .6s var(--flow); }
.ref:hover .ref-img img { transform: scale(1.025); }
.ref-meta { display: grid; gap: 6px; padding: 0 2px; }
.ref-top { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.ref-title { font-weight: 500; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-no { font: 11px var(--mono); color: var(--muted); flex: none; }
.ref-style { color: var(--muted); font-size: 13px; line-height: 1.35; }
.kws { display: flex; flex-wrap: wrap; gap: 5px; }
.kw { font: 11px/1.3 var(--mono); padding: 4px 7px; border-radius: 6px; background: var(--chip); color: var(--fg); }
.ref-fam { font: 500 10.5px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); display: flex; gap: 8px; }
@media (prefers-color-scheme: dark) { .ref-fam { color: #8b9cff; } }
.ref-fam .k { color: var(--muted); }
.state { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in oklab, var(--bg) 55%, transparent); backdrop-filter: blur(3px); font: 500 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.state.working::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(31, 59, 214, .18) 50%, transparent 70%); background-size: 220% 100%; animation: sweep 1.6s linear infinite; }
@keyframes sweep { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.state.error { color: var(--fg); padding: 16px; text-align: center; text-transform: none; font-family: var(--sans); font-size: 13px; }
.empty { text-align: center; padding: 80px 24px; color: var(--muted); }
.empty-title { font-size: 22px; color: var(--fg); margin: 0 0 8px; }

/* ------------------------------------------------------------ окна */
.dlg { border: 0; padding: 0; border-radius: 20px; background: var(--bg); color: var(--fg); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); box-shadow: 0 30px 90px rgba(5, 6, 10, .35); }
.dlg-wide { width: min(1180px, calc(100vw - 32px)); }
.dlg::backdrop { background: var(--shade); backdrop-filter: blur(4px); }
.dlg[open] { animation: rise .35s var(--flow); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.99); } }
.dlg-body { padding: 22px 24px 24px; display: grid; gap: 16px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-head h2 { margin: 0; font-size: 22px; font-weight: 500; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; }
.dlg p { margin: 0; }
.drop { display: grid; gap: 4px; place-items: center; text-align: center; padding: 26px 18px; border: 1.5px dashed var(--line); border-radius: var(--r); cursor: pointer; transition: border-color .2s, background .2s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop span { color: var(--muted); font-size: 13px; max-width: 34ch; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs:empty { display: none; }
.thumbs figure { margin: 0; position: relative; width: 84px; height: 64px; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumbs button { position: absolute; right: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--night); color: var(--frost); font-size: 13px; line-height: 1; cursor: pointer; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.copyline { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 6px 6px 6px 12px; }
.copyline code { flex: 1; font: 12px var(--mono); overflow-x: auto; white-space: nowrap; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.people li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.people .mono { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.team-form { display: grid; gap: 12px; }
.secret { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r-s); padding: 14px; display: grid; gap: 8px; font-size: 14px; }
.secret code { font: 13px var(--mono); user-select: all; }

/* ------------------------------------------------------------ полная карточка */
.card-full { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); max-height: calc(100dvh - 48px); }
.cf-media { background: var(--soft); overflow: auto; max-height: calc(100dvh - 48px); }
.cf-media img { width: 100%; height: auto; }
.cf-info { padding: 22px 24px 28px; overflow: auto; display: grid; gap: 18px; align-content: start; max-height: calc(100dvh - 48px); }
.cf-info h2 { margin: 0; font-size: 26px; font-weight: 500; line-height: 1.15; text-wrap: balance; }
.cf-row { display: grid; gap: 6px; }
.cf-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-select { padding: 8px 10px; font-size: 13px; }
.cf-style { font-size: 17px; line-height: 1.35; }
.cf-desc { color: var(--fg); line-height: 1.55; }
.pal { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { display: grid; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer; font: 10.5px var(--mono); color: var(--muted); }
.sw i { width: 46px; height: 32px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 14px; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; max-height: 260px; overflow: auto; }
.box-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cf-foot { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--line); }
.cf-foot .spacer { flex: 1; }
.meta-line { color: var(--muted); font-size: 13px; }
.meta-line a { color: var(--accent); word-break: break-all; }
.cf-close { position: sticky; top: 0; justify-self: end; }
.confirm { display: flex; gap: 8px; align-items: center; font-size: 13px; }
@media (max-width: 860px) {
  .card-full { grid-template-columns: 1fr; overflow: auto; }
  .cf-media, .cf-info { max-height: none; overflow: visible; }
  .cf-media { max-height: 60vh; overflow: auto; }
}

/* ------------------------------------------------------------ семейства */
.fam-list { display: grid; gap: 10px; }
.fam { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); }
.fam-head { display: flex; gap: 10px; align-items: center; }
.fam-head input { flex: 1; font-weight: 500; }
.fam textarea { min-height: 84px; font-size: 13.5px; }
.fam-n { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }

/* ------------------------------------------------------------ прочее */
.dropzone-full { position: fixed; inset: 12px; z-index: 50; border: 2px dashed var(--accent); border-radius: 24px; background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: blur(6px); display: grid; place-items: center; pointer-events: none; }
.dropzone-full p { font-size: 28px; font-weight: 500; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--night); color: var(--frost); padding: 12px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 12px 40px rgba(5, 6, 10, .3); max-width: calc(100vw - 32px); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
