/* AI Studio — тёмная тема, mobile-first.
   Товары фотографируют телефоном и заливают с него же, поэтому базовый макет
   рассчитан на узкий экран, а не наоборот. */

:root {
  --bg: #0d1117;
  --bg2: #151b23;
  --line: rgba(255,255,255,.10);
  --line2: rgba(255,255,255,.18);
  --fg: #e8edf4;
  --muted: rgba(232,237,244,.55);
  --accent: #7cc4ff;
  --accent2: #4f9de8;
  --warn: #ffcc66;
  --bad: #ff7b72;
  --good: #7ee787;
  --r: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding-bottom: 60px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 13px; }
.center { text-align: center; }
.spacer { flex: 1; }
h1 { font-size: 22px; margin: 8px 0 2px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em;
     color: var(--muted); margin: 22px 0 10px; font-weight: 700; }

/* ── вход ──────────────────────────────────────────────────────── */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.loginBox { width: min(340px, 100%); text-align: center; display: flex; flex-direction: column; gap: 12px; }
.loginBox .logo { font-size: 52px; }
.loginBox h1 { margin: 0; }
.loginBox p { margin: 0 0 8px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }

/* ── шапка ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(13,17,23,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 16px; }
.pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.07); border: 1px solid var(--line); white-space: nowrap;
}
.icon {
  background: none; border: 0; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 4px 6px; border-radius: 8px;
}
.icon:hover { color: var(--fg); background: rgba(255,255,255,.07); }

/* ── вкладки ───────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; padding: 10px 10px 0; overflow-x: auto;
  scrollbar-width: none; border-bottom: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; background: none; border: 0; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 13px;
  border-radius: 10px 10px 0 0; cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.on { color: var(--fg); border-bottom-color: var(--accent); background: rgba(255,255,255,.05); }

main { padding: 16px 14px 40px; max-width: 900px; margin: 0 auto; }
.tabpane { display: none; }
.tabpane.on { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.lead { margin: 0 0 18px; color: var(--muted); max-width: 62ch; }

/* ── элементы управления ───────────────────────────────────────── */
input, button, textarea, select { font: inherit; }
textarea, input[type=password], input[type=text] {
  width: 100%; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 11px 13px; color: var(--fg); resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--accent2); outline-offset: -1px; }

.btn {
  border: 0; border-radius: 999px; padding: 11px 22px; font-weight: 700; cursor: pointer;
  color: #06121f; background: linear-gradient(180deg, #9ad2ff, var(--accent2));
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn.big { padding: 14px 28px; font-size: 16px; }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line2); }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn.danger { background: linear-gradient(180deg, #ff9d95, #e5534b); color: #2a0b08; }

.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.lbl { font-size: 13px; color: var(--muted); min-width: 84px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; cursor: pointer; font-weight: 600;
}
.chip.on { background: rgba(124,196,255,.16); border-color: var(--accent2); color: var(--fg); }
.chip:disabled { opacity: .3; cursor: not-allowed; }
.chip small { display: block; font-weight: 400; opacity: .7; font-size: 11px; }
.seg { margin-bottom: 14px; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent2); flex: 0 0 auto; }

/* ── загрузка фото ─────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--line2); border-radius: var(--r); padding: 26px 16px;
  text-align: center; cursor: pointer; position: relative; background: var(--bg2);
  transition: border-color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent2); }
.dropzone.has .dzInner { display: none; }
.dzIcon { font-size: 34px; margin-bottom: 6px; }
.preview { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; margin: 0 auto; }
.privacy { margin-top: 8px; }

/* ── пресеты ───────────────────────────────────────────────────── */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.presetCard {
  text-align: left; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px; cursor: pointer; color: var(--fg);
}
.presetCard.on { border-color: var(--accent2); background: rgba(124,196,255,.10); }
.presetCard b { display: block; margin-bottom: 3px; font-size: 14px; }
.presetCard span { font-size: 12px; color: var(--muted); line-height: 1.35; }

/* ── действие и прогресс ───────────────────────────────────────── */
.actionBar { display: flex; align-items: center; gap: 14px; margin: 22px 0 10px; flex-wrap: wrap; }
.estimate { font-size: 14px; color: var(--muted); }
.estimate b { color: var(--fg); }

.job { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 14px 0; }
.bar { height: 6px; background: rgba(255,255,255,.1); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
           border-radius: 999px; transition: width .3s; }
.job.err { border-color: var(--bad); }
.job.err .jobNote { color: var(--bad); }

/* ── результат ─────────────────────────────────────────────────── */
.result { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r);
          padding: 16px; margin-top: 18px; }
.report { font-size: 13px; color: var(--muted); margin: 10px 0; line-height: 1.6; white-space: pre-line; }
.report b { color: var(--good); }

/* Слайдер до/после.
   Исходник с телефона обычно 4:3, а карточка квадратная, поэтому «до» вписываем
   через object-fit на белом фоне: заодно видно, как изменилось само кадрирование.
   Шторка — clip-path в процентах, так что при смене размера окна ничего не едет
   и пересчитывать из JS нечего. */
.ba { position: relative; border-radius: 10px; overflow: hidden; user-select: none;
      touch-action: none; background: #fff; max-width: 520px; margin: 0 auto; }
.ba > img { display: block; width: 100%; }
.ba .after { position: absolute; inset: 0; clip-path: inset(0 50% 0 0); }
.ba .after img { width: 100%; height: 100%; object-fit: contain; background: #fff; display: block; }
.ba .handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
              background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.6); cursor: ew-resize; }
.ba .handle::after {
  content: "◀▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: #fff; color: #111; font-size: 11px; padding: 3px 6px; border-radius: 999px; white-space: nowrap;
}
.baLabels { display: flex; justify-content: space-between; font-size: 12px;
            color: var(--muted); max-width: 520px; margin: 6px auto 0; }

.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.fileBtn {
  background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--fg); text-decoration: none; cursor: pointer;
}
.fileBtn:hover { border-color: var(--accent2); }
.fileBtn small { display: block; color: var(--muted); font-size: 11px; }

/* ── галерея ───────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gcard { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r);
         overflow: hidden; cursor: pointer; position: relative; }
.gcard:hover { border-color: var(--accent2); }
.gcard img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #fff; }
.gcard .cap { padding: 7px 9px; font-size: 11px; color: var(--muted);
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard .badge { position: absolute; top: 6px; left: 6px; font-size: 14px;
                filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.gcard .warnDot { position: absolute; top: 6px; right: 6px; font-size: 13px; }

/* ── плашки ────────────────────────────────────────────────────── */
.banner { margin: 10px 14px 0; padding: 12px 14px; border-radius: var(--r); font-size: 14px;
          border: 1px solid; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.banner.warn { background: rgba(255,204,102,.10); border-color: rgba(255,204,102,.4); }
.banner.bad  { background: rgba(255,123,114,.10); border-color: rgba(255,123,114,.45); }
.banner.info { background: rgba(124,196,255,.09); border-color: rgba(124,196,255,.35); }
.banner .bactions { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; margin-top: 4px; }

/* ── полосы занятости ──────────────────────────────────────────── */
.meter { margin: 14px 0; }
.meter .mt { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.meter .mb { height: 9px; background: rgba(255,255,255,.09); border-radius: 999px; overflow: hidden; }
.meter .mb > i { display: block; height: 100%; background: var(--accent2); border-radius: 999px; }
.meter .mb > i.hot { background: var(--warn); }
.meter .mb > i.full { background: var(--bad); }

/* ── таблицы ───────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.tbl th, .tbl td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scrollx { overflow-x: auto; }

/* ── модалка ───────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(5,8,12,.86); z-index: 30;
         display: none; align-items: center; justify-content: center; padding: 14px; }
.modal.on { display: flex; }
.sheet { background: var(--bg2); border: 1px solid var(--line2); border-radius: 18px;
         padding: 18px; width: min(620px, 96vw); max-height: 92dvh; overflow: auto; }
.sheet img.big { width: 100%; border-radius: 12px; background: #fff; }

/* ── тост ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 80px);
  background: #23303f; border: 1px solid var(--line2); color: var(--fg);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 50;
  transition: transform .25s; max-width: 92vw; text-align: center;
}
.toast.on { transform: translate(-50%, 0); }
.toast.bad { background: #4a1f1c; border-color: var(--bad); }

@media (min-width: 700px) {
  .lbl { min-width: 96px; }
  main { padding: 22px 20px 60px; }
}
