/* Раздача материалов. Палитра и шрифт лендинга «Сайты с ИИ» (DESIGN_SYSTEM.md):
   белая основа, чернила #07231e, лайм только на действиях и живых статусах. */

@font-face { font-family: "PP Mori"; src: url("/static/fonts/PPMori-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "PP Mori"; src: url("/static/fonts/PPMori-Semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --ground: #ffffff;
  --ink: #07231e;
  --ink-70: #3d5650;
  --line: #dde2df;
  --line-strong: #c4c8c6;
  --card: #eef0ee;
  --card-hover: #e2e6e3;
  --card-line: #d5dbd8;
  --lime: #b7f629;
  --lime-hover: #a9e81d;
  --error: #b3261e;
  --radius: 12px;
  --font: "PP Mori", "Onest", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 32px); }
.wrap.wide { max-width: 1200px; }

/* ---------- шапка */
.top { border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-name { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand-course { color: var(--ink-70); font-size: 15px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.top-right form { margin: 0; }
.who { font-size: 15px; color: var(--ink-70); }

/* ---------- типографика */
main.wrap { padding-top: clamp(40px, 8vh, 72px); padding-bottom: 96px; }
h1 {
  font-weight: 600;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 8px 0 16px;
  text-wrap: balance;
}
h2 { font-weight: 600; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 16px; }
.meta { color: var(--ink-70); font-size: 15px; margin: 0; }
.lead { color: var(--ink-70); font-size: 18px; margin: 0 0 32px; max-width: 60ch; text-wrap: pretty; }
.muted { color: var(--ink-70); font-size: 15px; }
.sub { display: block; font-size: 13px; line-height: 1.4; color: var(--ink-70); }
.hint { color: var(--ink-70); font-size: 14px; margin: 10px 0 0; }
.mono { font-family: var(--mono); font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- иконки */
.ic { flex: none; display: block; }

/* ---------- карточка пака */
.card { background: var(--card); border-radius: var(--radius); padding: 4px 20px 16px; margin: 0 0 32px; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--card-line); }
.files .ic { color: var(--ink-70); }
.files .path { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.files .size { color: var(--ink-70); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-foot { margin: 12px 0 0; font-size: 14px; color: var(--ink-70); }

/* ---------- кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 22px; border: 0; border-radius: var(--radius);
  font: 600 16px/1 var(--font); color: var(--ink); text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background-color .15s ease, transform .1s ease;
}
.btn.primary { background: var(--lime); }
.btn.primary:hover { background: var(--lime-hover); }
.btn.secondary { background: var(--card); }
.btn.secondary:hover { background: var(--card-hover); }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border: 0; border-radius: 10px;
  background: var(--card); color: var(--ink); text-decoration: none;
  cursor: pointer; transition: background-color .15s ease, transform .1s ease;
}
.icon-btn:hover { background: var(--card-hover); }
.icon-btn.ghost { width: 32px; height: 32px; background: transparent; color: var(--ink-70); vertical-align: middle; }
.icon-btn.ghost:hover { background: var(--card); color: var(--ink); }
.icon-btn.done { color: var(--ink); background: var(--lime); }

.btn:active, .icon-btn:active { transform: scale(.97); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- поля */
input, textarea {
  font: 400 17px/1.4 var(--font); color: var(--ink);
  background: var(--ground); border: 1px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color .15s ease;
}
input { height: 52px; padding: 0 16px; }
textarea { width: 100%; padding: 12px 16px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7d8b87; }
input:hover, textarea:hover { border-color: var(--ink-70); }
input:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--error); }

.code-form label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1 1 auto; min-width: 0; }
#code { font-family: var(--mono); font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
#code::placeholder { letter-spacing: .06em; }
.error { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 15px; }
.error .ic { color: var(--error); }

/* ---------- действия и статусы */
.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--card); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.tag.accent { background: var(--lime); }
.tag.dark { background: var(--ink); color: #fff; }

/* ---------- мои материалы */
.mats { margin-top: 56px; }
.mat-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.mat { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--ink); text-decoration: none; border-radius: 6px; }
.mat-main .meta { font-size: 14px; }
.mat-title { font-weight: 600; }
.mat-main:hover .mat-title { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- состояния */
.state { padding-top: 16px; }
.state.compact { padding-top: 8px; }
.state-icon {
  width: 56px; height: 56px; border-radius: 16px; background: var(--card);
  display: grid; place-items: center; margin-bottom: 24px;
}
.empty { color: var(--ink-70); padding: 24px 0; }
.flash {
  display: flex; align-items: center; gap: 8px; margin: 0 0 24px; padding: 12px 16px;
  background: var(--card); border-radius: var(--radius); font-weight: 600;
}

/* ---------- админка */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 8px 14px; border-radius: 10px; white-space: nowrap;
  color: var(--ink-70); text-decoration: none; font-size: 15px; font-weight: 600;
  transition: background-color .15s ease, color .15s ease;
}
.tabs a:hover { background: var(--card); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: #fff; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.count { color: var(--ink-70); font-weight: 400; }
.search {
  display: flex; align-items: center; gap: 8px; width: min(360px, 100%); height: 44px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink-70);
}
.search:hover { border-color: var(--ink-70); }
.search:focus-within { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.search input { flex: 1; min-width: 0; height: 40px; padding: 0; border: 0; outline: none; font-size: 15px; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--ink-70);
  padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
.cell-main { display: block; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.code { font-family: var(--mono); font-size: 14px; letter-spacing: .02em; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.link-cell { display: flex; align-items: center; gap: 6px; }
.link-cell input { width: 320px; height: 36px; padding: 0 10px; background: var(--card); border-color: transparent; font-size: 13px; }
.sub-cell { color: var(--ink-70); }

.add { margin-top: 48px; max-width: 760px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.add-row input { flex: 1 1 220px; }
details { margin-top: 16px; }
summary { cursor: pointer; font-weight: 600; color: var(--ink-70); width: fit-content; border-radius: 6px; }
summary:hover { color: var(--ink); }
details form { display: grid; gap: 8px; justify-items: start; margin-top: 12px; }

.leak { display: grid; gap: 12px; max-width: 760px; justify-items: start; }
.drop {
  position: relative; width: 100%; display: grid; justify-items: center; gap: 6px;
  padding: 32px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  transition: border-color .15s ease, background-color .15s ease;
}
.drop:hover, .drop.over { border-color: var(--ink); background: var(--card); }
.drop:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-title { font-weight: 600; }

.verdict { max-width: 760px; margin: 40px 0 16px; padding: 20px 24px; border-radius: var(--radius); background: var(--card); }
.verdict.sure { background: var(--ink); color: #fff; }
.verdict.sure .meta, .verdict.sure .sub { color: #c4c8c6; }
.verdict h2 { margin: 8px 0 2px; font-size: 28px; letter-spacing: -0.02em; }
.verdict p:last-child { margin: 12px 0 0; }

/* ---------- мобильный */
@media (max-width: 560px) {
  .brand-course { display: none; }
  .field-row { flex-direction: column; }
  .actions .btn, .field-row .btn { width: 100%; }
  .link-cell input { width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .btn:active, .icon-btn:active { transform: none; }
}
@media (max-width: 560px) { .state .btn { width: 100%; } }
