/* Цветочная касса — Telegram Mini App */
:root {
  --bg: #faf6f7;
  --card: #ffffff;
  --ink: #2a1b24;
  --muted: #8b7a84;
  --line: rgba(42, 27, 36, 0.09);
  --accent: #e5406f;
  --accent-2: #a8438f;
  --accent-soft: rgba(229, 64, 111, 0.1);
  --good: #1f9d6e;
  --danger: #e0483f;
  --shadow: 0 1px 2px rgba(60, 30, 45, 0.05), 0 10px 24px -12px rgba(60, 30, 45, 0.22);
  --radius: 20px;
  --nav-h: calc(60px + env(safe-area-inset-bottom, 0px));
}

/* класс висит на <html>: иначе фон холста остаётся светлым и вылезает снизу */
:root.dark {
  --bg: #141017;
  --card: #1e1822;
  --ink: #f4ecf1;
  --muted: #9a8b95;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #ff5f88;
  --accent-2: #c264dd;
  --accent-soft: rgba(255, 95, 136, 0.14);
  --good: #3ec897;
  --danger: #ff6b60;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.7);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}

button, input, select { font: inherit; color: inherit; }
b, strong { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }

/* --- каркас --- */
#app { padding: 10px 14px calc(var(--nav-h) + 20px); max-width: 620px; margin: 0 auto; }
.view { animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.head { display: flex; align-items: center; gap: 10px; margin: 6px 2px 14px; }
.head h1 { margin: 0; font-size: 21px; letter-spacing: -0.3px; font-weight: 700; }
.head .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.head .spacer { flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); font-weight: 650; }

/* --- герой смены --- */
.hero {
  position: relative;
  overflow: hidden;
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 18px;
}
.hero::after {
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  right: -70px; top: -110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
}
.hero .pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  backdrop-filter: blur(6px);
}
.hero .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.hero .dot.live { animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }
.hero .big { font-size: 38px; font-weight: 700; letter-spacing: -1.2px; margin: 12px 0 2px; }
.hero .cap { opacity: 0.8; font-size: 12.5px; }
.hero .split { display: flex; gap: 10px; margin-top: 14px; position: relative; }
.hero .split div {
  flex: 1; background: rgba(255, 255, 255, 0.16);
  border-radius: 14px; padding: 9px 11px; backdrop-filter: blur(6px);
}
.hero .split span { display: block; font-size: 11.5px; opacity: 0.85; }
.hero .split b { font-size: 16px; }

/* --- кнопки --- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; border: none; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 650; font-size: 15.5px;
  cursor: pointer; transition: transform 0.12s, opacity 0.12s;
}
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.5; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: none; color: var(--danger); border: 1px solid var(--line); }
.btn.sm { padding: 10px 14px; font-size: 14px; border-radius: 13px; width: auto; }
.btns { display: flex; gap: 10px; margin-bottom: 12px; }

/* --- строки/списки --- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; margin-bottom: 8px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.12s;
  text-align: left; width: 100%;
}
.row:active { transform: scale(0.99); }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-weight: 600; }
.row .t span { color: var(--muted); font-size: 12.5px; }
.row .v { text-align: right; font-weight: 650; white-space: nowrap; }
.row .v span { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.row .chev { color: var(--muted); opacity: 0.55; }
.row .ic {
  width: 38px; height: 38px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--accent-soft);
}

.line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14.5px; }
.line + .line { border-top: 1px dashed var(--line); }
.line span { color: var(--muted); }
.line b { font-weight: 650; }
.line.total { font-size: 17px; padding-top: 11px; }
.line.total span { color: var(--ink); font-weight: 600; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; background: var(--accent-soft); color: var(--accent);
}
.badge.open { background: rgba(31, 157, 110, 0.14); color: var(--good); }
.badge.grey { background: var(--line); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 44px 20px; }
.empty .e { font-size: 40px; display: block; margin-bottom: 10px; opacity: 0.75; }

/* --- сегменты --- */
.seg {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 15px;
  overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1; white-space: nowrap; padding: 9px 12px; border: none; border-radius: 11px;
  background: none; color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.seg button.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

/* --- сетка товаров/аксессуаров --- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 13px; text-align: left; cursor: pointer; box-shadow: var(--shadow);
  transition: transform 0.12s;
}
.tile:active { transform: scale(0.97); }
.tile b { display: block; font-weight: 600; font-size: 14.5px; }
.tile span { color: var(--muted); font-size: 12.5px; }
.tile.add { border-style: dashed; box-shadow: none; background: none; color: var(--muted); text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 8px 13px; font-size: 13.5px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform 0.12s;
}
.chip:active { transform: scale(0.95); }
.chip b { color: var(--accent); margin-left: 5px; }

/* --- корзина --- */
.cart { position: sticky; bottom: calc(var(--nav-h) + 8px); z-index: 5; }
.cart .card { border-color: var(--accent-soft); }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.cart-line + .cart-line { border-top: 1px dashed var(--line); }
.cart-line .t { flex: 1; }
.cart-line .t b { display: block; font-size: 14.5px; }
.cart-line .t span { color: var(--muted); font-size: 12px; }
.x { border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }

/* --- нижняя навигация --- */
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
nav button {
  flex: 1; border: none; background: none; color: var(--muted); cursor: pointer;
  padding: 8px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 600;
}
nav button.on { color: var(--accent); }
nav svg { width: 22px; height: 22px; }

/* --- шторка --- */
.backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(20, 10, 16, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadein 0.2s ease; backdrop-filter: blur(2px);
}
@keyframes fadein { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto;
  background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: up 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes up { from { transform: translateY(100%); } }
.sheet .grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 6px auto 14px; }
.sheet h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.3px; }
.sheet p.hint { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; white-space: pre-line; }

label.f { display: block; margin-bottom: 12px; }
label.f span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
input {
  width: 100%; padding: 13px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); outline: none;
}
input:focus { border-color: var(--accent); }

pre.export {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; font-size: 11.5px; line-height: 1.5; max-height: 46vh;
  overflow: auto; white-space: pre; margin: 0 0 12px;
}

/* --- мелочи --- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 14px;
  font-size: 13.5px; max-width: 86%; text-align: center; transition: 0.25s;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.loader { display: grid; place-items: center; padding: 60px; }
.loader i {
  width: 26px; height: 26px; border-radius: 50%; display: block;
  border: 2.5px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.medal { font-size: 15px; margin-right: 2px; }
.muted { color: var(--muted); font-size: 12.5px; }
.center { text-align: center; }
