/* Evalto — оболочка. Плитки модулей устроены как полочные ценники: цветная полоса и отверстие под крючок. */
:root {
  --wine: #7A1F3D;
  --wine-ink: #5E142D;
  --ink: #1D1A24;
  --ink-2: #5B6470;
  --line: #DCDFE5;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --field: #FFFFFF;
  --focus: #2F5D9E;
  --danger: #B3261E;
  --ok: #2E7D4F;
  --tag-promo: #F2C230;
  --tag-shelf: #2E8B57;
  --tag-tag: #D2463A;
  --tag-chart: #2F5D9E;
  --tag-box: #B08A3E;
  --tag-grid: #6B6F78;
  --radius: 6px;
  --shadow: 0 1px 0 rgba(29, 26, 36, .06), 0 6px 18px -10px rgba(29, 26, 36, .25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wine: #C25577;
    --wine-ink: #E07C9B;
    --ink: #EEEAF2;
    --ink-2: #A7A3B0;
    --line: #34303D;
    --bg: #15131A;
    --card: #1F1C26;
    --field: #26222E;
    --focus: #8DB2EA;
    --danger: #F2867E;
    --ok: #7CC79A;
    --shadow: 0 1px 0 rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--wine); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.wordmark {
  font-family: "Unbounded", "Golos Text", sans-serif;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--wine);
}
.boot { min-height: 100vh; display: grid; place-items: center; font-size: 28px; opacity: .5; }

/* ---------- Вход ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}
.auth-box { width: 100%; max-width: 380px; }
.auth-head { margin-bottom: 28px; }
.auth-head .wordmark { font-size: 34px; display: block; line-height: 1.1; }
.auth-head .tenant { color: var(--ink-2); margin-top: 6px; font-size: 15px; }
.auth h1 { font-size: 22px; line-height: 1.25; margin: 0 0 18px; font-weight: 600; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  min-height: 48px;
}
.field input:focus, .field select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.check { display: flex; gap: 10px; align-items: center; margin: 4px 0 16px; }
.check input { width: 20px; height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--wine); color: #fff;
  font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--wine-ink); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.block { width: 100%; }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.quiet:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--wine); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.auth .linkbtn { margin-top: 16px; }

.msg { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: 15px; }
.msg.err { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.msg.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }

/* ---------- Верхняя полоса ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; min-width: 0; }
.top .brand .wordmark { font-size: 20px; }
.top .brand .tenant { color: var(--ink-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .tools { display: flex; align-items: center; gap: 6px; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lang button { border: 0; background: transparent; padding: 6px 9px; font-size: 13px; cursor: pointer; color: var(--ink-2); min-height: 34px; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.iconbtn { border: 1px solid var(--line); background: transparent; border-radius: var(--radius); min-height: 36px; padding: 0 10px; cursor: pointer; font-size: 14px; color: var(--ink); }

/* ---------- Главная ---------- */
main { max-width: 980px; margin: 0 auto; padding: 24px 16px calc(40px + env(safe-area-inset-bottom)); }
.hello h1 { font-size: clamp(24px, 4.5vw, 34px); line-height: 1.15; margin: 4px 0 6px; font-weight: 600; letter-spacing: -.01em; }
.hello p { margin: 0; color: var(--ink-2); }
.hello { margin-bottom: 24px; }

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  padding: 0; margin: 0; list-style: none;
}

/* плитка-ценник */
.tag {
  --c: var(--tag-grid);
  position: relative;
  display: flex; flex-direction: column;
  width: 100%; min-height: 148px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 0;
  cursor: pointer;
  color: inherit; text-decoration: none;
  overflow: hidden;
}
.tag::after { /* отверстие под крючок */
  content: "";
  position: absolute; top: 8px; right: 12px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
}
.tag .band {
  display: flex; align-items: center; gap: 8px;
  background: var(--c);
  color: #1D1A24;
  padding: 0 12px; height: 32px;
  font-size: 13px; font-weight: 600; line-height: 1;
}
.tag .band svg { width: 18px; height: 18px; flex: none; }
.tag .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tag .title { font-size: 20px; font-weight: 600; line-height: 1.2; }
.tag .descr { color: var(--ink-2); font-size: 15px; line-height: 1.4; }
.tag .note { margin-top: auto; padding-top: 8px; font-size: 13px; color: var(--ink-2); }
.tag:hover { border-color: color-mix(in srgb, var(--c) 70%, var(--line)); }
.tag:active { transform: translateY(1px); }
.tag.soon { cursor: default; }
.tag.soon .band { background: color-mix(in srgb, var(--c) 35%, var(--card)); }
.tag.soon .title { color: var(--ink-2); }
.tag[data-icon="promo"] { --c: var(--tag-promo); }
.tag[data-icon="shelf"] { --c: var(--tag-shelf); }
.tag[data-icon="tag"] { --c: var(--tag-tag); }
.tag[data-icon="tag"] .band, .tag[data-icon="chart"] .band, .tag[data-icon="shelf"] .band { color: #fff; }
.tag.soon[data-icon] .band { color: var(--ink); }
.tag[data-icon="chart"] { --c: var(--tag-chart); }
.tag[data-icon="box"] { --c: var(--tag-box); }

.empty { padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); }

.foot { margin-top: 32px; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; color: var(--ink-2); font-size: 14px; }
.foot .lang { display: none; }

/* ---------- Админка ---------- */
.admin h2 { font-size: 20px; margin: 28px 0 12px; font-weight: 600; }
.admin .back { margin-bottom: 8px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.users { list-style: none; margin: 0; padding: 0; }
.users li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.users li:last-child { border-bottom: 0; }
.users .who { min-width: 0; }
.users .who b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; }
.users .who small { color: var(--ink-2); font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; }
.users .off b { color: var(--ink-2); text-decoration: line-through; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.mods { display: grid; gap: 12px; }
.mod { display: grid; grid-template-columns: 1fr 2fr 140px auto; gap: 10px; align-items: end; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.mod:last-child { border-bottom: 0; padding-bottom: 0; }
.mod .name { font-weight: 600; padding-bottom: 12px; }
.mod .field { margin: 0; }
.hint { color: var(--ink-2); font-size: 14px; margin: 0 0 12px; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .mod { grid-template-columns: 1fr; }
  .mod .name { padding-bottom: 0; }
  .shelf { grid-template-columns: 1fr; gap: 12px; }
  .tag { min-height: 0; }
  .top .brand .tenant { display: none; }
  .top .lang { display: none; }
  .foot .lang { display: inline-flex; }
}

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 12px 16px; border-radius: var(--radius); font-size: 15px; max-width: calc(100% - 32px);
  z-index: 20;
}

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