@font-face { font-family: Lato; font-weight: 400; font-display: swap; src: url(../assets/fonts/lato-regular.woff2) format('woff2'); }
@font-face { font-family: Lato; font-weight: 800; font-display: swap; src: url(../assets/fonts/lato-extrabold.woff2) format('woff2'); }
@font-face { font-family: Lato; font-weight: 900; font-display: swap; src: url(../assets/fonts/lato-black.woff2) format('woff2'); }
@font-face { font-family: 'Bebas Neue'; font-weight: 700; font-display: swap; src: url(../assets/fonts/bebas-bold.woff2) format('woff2'); }

:root {
  --teal: #0e5b5c;
  --teal-hover: #0a4a4b;
  --mint: #cae8de;
  --mint-soft: #eaf5f1;
  --orange: #ffb460;
  --red: #dd4526;
  --ink: #16302f;
  --muted: #5b716f;
  --line: #d3e2de;
  --bg: #f4f8f7;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(14, 91, 92, .08), 0 6px 24px rgba(14, 91, 92, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 400 15px/1.45 Lato, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h2 { font: 700 30px/1 'Bebas Neue', Lato, sans-serif; letter-spacing: .01em; color: var(--teal); margin: 0 0 6px; }
button, input, select, textarea { font: inherit; color: inherit; }

/* шапка */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  padding: 10px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; border-radius: 8px; }
.brand:hover .brand-title { color: var(--teal-hover); }
.brand:hover .brand-sub { color: var(--teal); }
.brand-logo { height: 38px; }
.brand-title { font: 700 22px/1 'Bebas Neue', sans-serif; color: var(--teal); }
.brand-sub { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs button {
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  padding: 10px 14px; border-radius: 8px; font-weight: 800; color: var(--muted);
}
.tabs button:hover { color: var(--teal); background: var(--mint-soft); }
.tabs button[aria-selected="true"] { color: var(--teal); background: var(--mint); }
.user { font-size: 13px; color: var(--muted); white-space: nowrap; }
.user button { border: 0; background: none; color: var(--teal); cursor: pointer; text-decoration: underline; padding: 0 0 0 8px; }

/* раскладка */
main { padding: 24px; }
.pane { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 24px; align-items: start; }
.pane[hidden] { display: none; }
.side {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 84px; max-height: calc(100vh - 108px); overflow: auto;
}
.lead { margin: 0; color: var(--muted); }
.hint { margin: 0; color: var(--muted); font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 800; font-size: 13px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea, .item textarea, .item input, .batch textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff;
}
.field textarea, .batch textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 1px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 800; font-size: 13px; padding: 0; margin-bottom: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; flex-direction: column; padding: 7px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; font-weight: 800; font-size: 13px;
}
.chip small { font-weight: 400; color: var(--muted); font-size: 11px; }
.chip input:checked + span { border-color: var(--teal); background: var(--mint-soft); color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.chip input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 1px; }

.checks { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.checks input { accent-color: var(--teal); margin-right: 6px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  padding: 22px 12px; border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--mint-soft); cursor: pointer; transition: border-color .15s, background .15s;
}
.drop strong { color: var(--teal); }
.drop span { color: var(--muted); font-size: 13px; }
.drop:hover, .drop.over { border-color: var(--teal); background: var(--mint); }

.items { display: flex; flex-direction: column; gap: 12px; }
.item { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.item img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.item-fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.item-tools { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.item-tools button { border: 0; background: none; padding: 0; color: var(--teal); cursor: pointer; text-decoration: underline; font-size: 12px; }
.item-tools button.danger { color: var(--red); }
.item-tools label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.item-tools input[type="range"] { width: 80px; accent-color: var(--teal); }

.batch summary { cursor: pointer; font-weight: 800; color: var(--teal); }
.batch[open] summary { margin-bottom: 8px; }
.batch .hint { margin-bottom: 8px; }

/* превью */
.stage { min-width: 0; }
.stage-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.stage-info { color: var(--muted); font-size: 14px; }
.stage-hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.previews.single { grid-template-columns: minmax(0, 640px); }
.previews.single.is-wide { grid-template-columns: minmax(0, 900px); }
.preview { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.preview canvas { display: block; width: 100%; height: auto; border-radius: 4px; }
.preview.focusable canvas { cursor: crosshair; }
.preview-cap { display: flex; justify-content: space-between; gap: 8px; padding: 8px 4px 2px; font-size: 13px; color: var(--muted); }
.preview-cap button { border: 0; background: none; color: var(--teal); cursor: pointer; font-weight: 800; padding: 0; }
.empty-stage {
  display: grid; place-items: center; min-height: 360px; padding: 24px; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}

.export { display: flex; align-items: center; gap: 8px; }
.export select { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: #fff; }
.btn {
  border: 0; border-radius: 8px; padding: 10px 18px; font-weight: 800; cursor: pointer;
  background: var(--mint); color: var(--teal);
}
.btn:hover { background: #b8dfd2; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-hover); }
.btn:disabled { opacity: .5; cursor: default; }

/* архив */
.pane-archive { display: block; }
.archive-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; }
.archive-filter { min-width: 220px; }
.archive { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.arch { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.arch-img { aspect-ratio: 1; background: var(--mint-soft); display: grid; place-items: center; }
.arch-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.arch-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.arch-name { font-weight: 800; overflow-wrap: anywhere; }
.arch-meta { color: var(--muted); }
.arch-actions { display: flex; gap: 12px; margin-top: 6px; }
.arch-actions a, .arch-actions button { color: var(--teal); font-weight: 800; text-decoration: none; border: 0; background: none; padding: 0; cursor: pointer; font-size: 13px; }
.arch-actions button { color: var(--red); }
.expiring { color: var(--red); }

/* вход */
dialog#login { border: 0; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(420px, calc(100vw - 32px)); }
dialog#login::backdrop { background: rgba(8, 60, 61, .55); }
#login-form { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-logo { height: 54px; align-self: flex-start; }
.error { color: var(--red); margin: 0; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 860px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .tabs { order: 3; flex-basis: 100%; }
  main { padding: 16px; }
  .pane { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
}

.item-tag { font-size: 12px; font-weight: 800; color: var(--teal); }
.ba { display: flex; flex-direction: column; gap: 10px; }
.ba[hidden] { display: none; }
.hint pre { margin: 6px 0; padding: 8px 10px; background: var(--mint-soft); border-radius: 6px; font: 13px/1.4 ui-monospace, monospace; color: var(--ink); white-space: pre-wrap; }
.hint p { margin: 0; }
