/* Buba App. Цвета берём из темы Telegram (--tg-theme-*), SDK ставит их
   inline на <html>; значения ниже — запасные для просмотра в браузере. */
:root {
  --tg-theme-bg-color: #ffffff;
  --tg-theme-secondary-bg-color: #f0f0f4;
  --tg-theme-section-bg-color: #ffffff;
  --tg-theme-text-color: #111114;
  --tg-theme-hint-color: #8b8b93;
  --tg-theme-subtitle-text-color: #7d7d85;
  --tg-theme-link-color: #2678e4;
  --tg-theme-button-color: #2678e4;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-section-separator-color: #e3e3e8;

  --c-open: #e0880b;
  --c-work: #2f7cf6;
  --c-done: #23a04a;
  --c-hot: #e5484d;
  --r-guest: #e0880b;
  --r-admin: #2f7cf6;
  --r-master: #b44fd4;
  --r-manager: #149c8d;
  --r-chat: #64748b;
  --r-system: #8b8b93;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) {
    --tg-theme-bg-color: #1c1c1e;
    --tg-theme-secondary-bg-color: #101012;
    --tg-theme-section-bg-color: #1c1c1e;
    --tg-theme-text-color: #f2f2f5;
    --tg-theme-hint-color: #8e8e96;
    --tg-theme-subtitle-text-color: #9a9aa2;
    --tg-theme-link-color: #5ea2ff;
    --tg-theme-button-color: #3a8bf5;
    --tg-theme-section-separator-color: #2c2c30;
  }
}
:root[data-scheme="dark"] {
  --c-open: #f2a33a;
  --c-work: #5b9bff;
  --c-done: #3cc46a;
  --c-hot: #ff6b6f;
  --r-guest: #f2a33a;
  --r-admin: #5b9bff;
  --r-master: #d07ae8;
  --r-manager: #33c2b1;
  --r-chat: #94a3b8;
}

:root {
  --bg: var(--tg-theme-secondary-bg-color);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color));
  --text: var(--tg-theme-text-color);
  --hint: var(--tg-theme-hint-color);
  --sub: var(--tg-theme-subtitle-text-color, var(--tg-theme-hint-color));
  --link: var(--tg-theme-link-color);
  --accent: var(--tg-theme-button-color);
  --accent-text: var(--tg-theme-button-text-color);
  --sep: var(--tg-theme-section-separator-color, rgba(128, 128, 140, .2));
  --radius: 14px;
  --pad: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
.hidden { display: none !important; }

/* --- шапка списка ------------------------------------------------------- */
.top {
  padding: 14px var(--pad) 6px;
  display: flex; align-items: flex-start; gap: 12px;
}
.top h1 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.top .sub { margin-top: 3px; color: var(--sub); font-size: 14px; }
.top .sub b { color: var(--c-hot); font-weight: 600; }
.top .grow { flex: 1; min-width: 0; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); color: var(--link);
  flex: none; margin-top: 2px;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search {
  margin: 8px var(--pad) 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 11px; padding: 0 12px; height: 38px;
}
.search svg { width: 16px; height: 16px; color: var(--hint); flex: none; }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 15px; height: 100%;
}
.search input::placeholder { color: var(--hint); }

.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 12px var(--pad) 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 13px; border-radius: 16px;
  background: var(--card); color: var(--text);
  font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.chip .n { color: var(--hint); font-weight: 500; }
.chip.on { background: var(--accent); color: var(--accent-text); }
.chip.on .n { color: inherit; opacity: .75; }

/* --- карточка в списке ---------------------------------------------------- */
.list { padding: 8px var(--pad) 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.card {
  position: relative; display: block; width: 100%; text-align: left;
  background: var(--card); border-radius: var(--radius);
  padding: 12px 14px 12px 16px; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--status-c, var(--hint));
}
.card:active { opacity: .7; }
.card .row1 { display: flex; align-items: center; gap: 8px; }
.card .num { font-weight: 700; font-size: 16px; }
.card .age { margin-left: auto; font-size: 13px; color: var(--hint); white-space: nowrap; }
.card .age.hot { color: var(--c-hot); font-weight: 600; }
.card .body { display: flex; gap: 12px; margin-top: 6px; }
.card .txt { flex: 1; min-width: 0; }
.card .who { font-weight: 600; font-size: 15px; }
.card .who .arrow { color: var(--hint); font-weight: 400; margin: 0 2px; }
.card .what { color: var(--sub); font-size: 14px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .thumb {
  width: 58px; height: 58px; border-radius: 10px; flex: none; object-fit: cover;
  background: var(--bg);
}
.flags { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13px; color: var(--sub); }
.flags .warn { color: var(--c-open); }
.flags .bad { color: var(--c-hot); }
.card .last {
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--sep);
  font-size: 13.5px; color: var(--sub);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .last b { font-weight: 600; color: var(--text); }
.card .last .when { color: var(--hint); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: var(--status-c); background: color-mix(in srgb, var(--status-c) 14%, transparent);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-open { --status-c: var(--c-open); }
.st-in_progress { --status-c: var(--c-work); }
.st-resolved { --status-c: var(--c-done); }

.empty { text-align: center; color: var(--hint); padding: 48px 24px; font-size: 15px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* --- экран претензии ---------------------------------------------------- */
.navbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  padding: 8px 8px; background: var(--bg);
}
.navbar .back { display: inline-flex; align-items: center; gap: 2px; color: var(--link); font-size: 16px; padding: 6px 8px; }
.navbar .back svg { width: 20px; height: 20px; }
.in-tg .navbar { display: none; }

.gallery { position: relative; background: #000; }
.gallery .strip {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  aspect-ratio: 4 / 3.4; max-height: 62vh;
}
.gallery .strip::-webkit-scrollbar { display: none; }
.gallery .slide { flex: 0 0 100%; scroll-snap-align: center; position: relative; }
.gallery .slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery .cap {
  position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px);
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12.5px;
  padding: 4px 9px; border-radius: 9px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.gallery .count {
  position: absolute; right: 12px; top: 12px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 9px;
}
.gallery .dots { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.gallery .dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.45); }
.gallery .dots i.on { background: #fff; }
.no-photo { padding: 18px var(--pad) 0; color: var(--hint); font-size: 14px; }

.section { background: var(--card); border-radius: var(--radius); margin: 12px var(--pad) 0; }
.head { padding: 14px 16px 12px; }
.head .title { display: flex; align-items: center; gap: 10px; }
.head h2 { margin: 0; font-size: 21px; font-weight: 700; }
.head .meta { color: var(--sub); font-size: 13.5px; margin-top: 4px; }
.head .meta .hot { color: var(--c-hot); font-weight: 600; }
.facts { border-top: 1px solid var(--sep); }
.fact { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--sep); }
.fact:last-child { border-bottom: 0; }
.fact .k { width: 74px; flex: none; color: var(--hint); font-size: 14px; }
.fact .v { flex: 1; min-width: 0; font-size: 15px; }
.fact .v small { display: block; color: var(--sub); font-size: 13px; margin-top: 1px; }
.fact .v .ok { color: var(--c-done); }
.fact .v .warn { color: var(--c-open); }
.fact .v .bad { color: var(--c-hot); }

.tabs {
  position: sticky; top: 0; z-index: 4;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 14px var(--pad) 8px; background: var(--bg);
}
.in-browser .tabs { top: 52px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; height: 30px; padding: 0 12px; border-radius: 15px;
  font-size: 13.5px; font-weight: 500; color: var(--sub); background: var(--card);
}
.tab .n { opacity: .7; margin-left: 3px; }
.tab.on { color: var(--accent-text); background: var(--accent); }

.timeline { padding: 4px var(--pad) 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.ava {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 16px;
  background: color-mix(in srgb, var(--role-c) 18%, var(--card));
  border: 1.5px solid color-mix(in srgb, var(--role-c) 45%, transparent);
}
.bubble { flex: 1; min-width: 0; background: var(--card); border-radius: 4px var(--radius) var(--radius) var(--radius); padding: 9px 12px 10px; }
.bubble .by { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; }
.bubble .by .role { font-weight: 600; color: var(--role-c); }
.bubble .by .name { color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble .by .when { margin-left: auto; color: var(--hint); font-size: 12.5px; white-space: nowrap; }
.bubble .text { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.bubble .pics { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bubble .pics img { width: 64px; height: 64px; border-radius: 9px; object-fit: cover; background: var(--bg); }
.k-guest { --role-c: var(--r-guest); }
.k-admin { --role-c: var(--r-admin); }
.k-master { --role-c: var(--r-master); }
.k-manager { --role-c: var(--r-manager); }
.k-chat { --role-c: var(--r-chat); }
.sys { text-align: center; color: var(--hint); font-size: 12.5px; padding: 2px 24px; }
.sys span { display: inline-block; background: color-mix(in srgb, var(--hint) 12%, transparent); border-radius: 10px; padding: 3px 10px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px var(--pad) 0; }
.actions .btn {
  height: 44px; border-radius: 12px; background: var(--card); color: var(--link);
  font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.actions .btn:only-child { grid-column: 1 / -1; }
.note { color: var(--hint); font-size: 12.5px; text-align: center; padding: 12px 28px 32px; }

/* --- просмотр фото на весь экран --------------------------------------- */
.viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.viewer .vbar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: linear-gradient(rgba(0,0,0,.6), transparent); color: #fff;
}
.viewer .vbar .info { flex: 1; min-width: 0; font-size: 13.5px; }
.viewer .vbar .info b { display: block; font-size: 15px; }
.viewer .vbar .x { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; color: #fff; }
.viewer .vbar .x svg { width: 18px; height: 18px; }
.viewer .vstrip { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer .vstrip::-webkit-scrollbar { display: none; }
.viewer .vstrip.zoomed { overflow-x: hidden; }
.viewer .vslide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; overflow: hidden; touch-action: pan-x pan-y; }
.viewer .vslide.zoom { overflow: auto; }
.viewer .vslide .fit { width: 100%; height: 100%; display: grid; place-items: center; }
.viewer .vslide img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.viewer .vslide.zoom .fit { width: max-content; height: max-content; display: block; }
.viewer .vslide.zoom img { max-width: none; max-height: none; }
.viewer .hint { position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.55); font-size: 12px; pointer-events: none; }

/* --- состояния ----------------------------------------------------------- */
.state { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 32px; color: var(--sub); }
.state .big { font-size: 44px; margin-bottom: 10px; }
.state h3 { margin: 0 0 6px; color: var(--text); font-size: 18px; }
.state p { margin: 0 0 16px; font-size: 14.5px; }
.state .btn { height: 42px; padding: 0 20px; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-weight: 600; }
.skeleton { height: 120px; border-radius: var(--radius); background: var(--card); opacity: .6; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.devbar { margin: 0 var(--pad); padding: 6px 10px; border-radius: 10px; font-size: 12px; color: var(--c-open); background: color-mix(in srgb, var(--c-open) 12%, transparent); }

/* --- главная ------------------------------------------------------------- */
.group-title { padding: 18px var(--pad) 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--sub); }
.group-title .n { color: var(--c-hot); }
.inbox { margin: 0 var(--pad); background: var(--card); border-radius: var(--radius); overflow: hidden; }
.inbox-empty { padding: 16px; color: var(--hint); font-size: 14.5px; }
.inbox-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--sep); }
.inbox-item:last-child { border-bottom: 0; }
.inbox-item:active { opacity: .7; }
.ii-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex: none;
  background: color-mix(in srgb, var(--c-open) 16%, transparent); }
.inbox-item.urgent .ii-icon { background: color-mix(in srgb, var(--c-hot) 16%, transparent); }
.ii-txt { flex: 1; min-width: 0; }
.ii-txt b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ii-txt small { display: block; color: var(--sub); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ii-when { color: var(--hint); font-size: 12.5px; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 var(--pad) 28px; }
.tile { position: relative; background: var(--card); border-radius: var(--radius); padding: 14px; text-align: left; min-height: 104px;
  display: flex; flex-direction: column; gap: 2px; }
.tile:active { opacity: .7; }
.tile.soon { opacity: .45; }
.t-icon { font-size: 26px; margin-bottom: 6px; }
.t-title { font-weight: 600; font-size: 15.5px; }
.t-sub { color: var(--sub); font-size: 13px; }
.t-badge { position: absolute; right: 12px; top: 12px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--accent); color: var(--accent-text); font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
.t-badge.hot { background: var(--c-hot); color: #fff; }

/* --- навигация ------------------------------------------------------------ */
.nav-title { font-weight: 600; font-size: 16px; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.state .btn { height: 42px; padding: 0 20px; border-radius: 12px; font-weight: 600; }
.link { color: var(--link); display: inline-flex; align-items: center; gap: 2px; text-align: left; }
.link svg { width: 14px; height: 14px; }
.link.small { font-size: 13px; }

/* --- статусы и «ждём ответ» -------------------------------------------- */
.seg { display: flex; gap: 4px; margin-top: 12px; padding: 3px; border-radius: 11px; background: var(--bg); }
.seg-btn { flex: 1; height: 34px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--sub); }
.seg-btn:disabled { opacity: .35; cursor: default; }
.seg-btn.on { background: var(--card); color: var(--status-c); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.callout { margin: 12px var(--pad) 0; padding: 12px 14px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--r-master) 14%, var(--card)); display: grid; gap: 4px; }
.callout b { font-size: 15.5px; }
.callout span { color: var(--sub); font-size: 14px; }
.callout .btn { margin-top: 6px; height: 40px; border-radius: 11px; font-weight: 600; }
.bubble .via { font-size: 11px; opacity: .6; }

/* --- поле «написать» ------------------------------------------------------ */
.composer { margin: 16px var(--pad) 0; background: var(--card); border-radius: var(--radius); padding: 10px; }
.as { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.as-btn { height: 28px; padding: 0 11px; border-radius: 14px; font-size: 13px; font-weight: 500; background: var(--bg); color: var(--sub); }
.as-btn.on { background: var(--accent); color: var(--accent-text); }
.files { display: flex; gap: 6px; flex-wrap: wrap; }
.files:not(:empty) { margin-bottom: 8px; }
.fthumb { position: relative; width: 58px; height: 58px; }
.fthumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; }
.fthumb button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--text); color: var(--card); font-size: 15px; line-height: 22px; }
.cbox { display: flex; align-items: flex-end; gap: 8px; }
.cbox textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; border-radius: 12px; padding: 9px 12px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px; line-height: 1.35; max-height: 160px; }
.cbox textarea::placeholder { color: var(--hint); }
.clip { width: 38px; height: 38px; display: grid; place-items: center; color: var(--hint); cursor: pointer; flex: none; }
.clip svg { width: 22px; height: 22px; }
.sendbtn { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.sendbtn svg { width: 18px; height: 18px; margin-left: 2px; }
.sendbtn.busy { opacity: .5; }

/* --- нижний лист ------------------------------------------------------------ */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: 18px 18px 0 0;
  padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 14px); transform: translateY(100%); transition: transform .2s ease-out;
  max-height: 85vh; overflow: auto; }
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: var(--sep); margin: 2px auto 10px; }
.sheet-title { font-weight: 700; font-size: 17px; padding: 0 4px 10px; }
.sheet-items { display: grid; gap: 6px; }
.sheet-item { width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; background: var(--bg); font-size: 15px; }
.sheet-item.ghost { background: none; color: var(--link); margin-top: 4px; }
.sheet-custom { display: grid; gap: 8px; margin-top: 8px; }
.sheet-custom textarea { border: 0; outline: 0; border-radius: 12px; padding: 10px 12px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.sheet-custom .btn { height: 44px; border-radius: 12px; font-weight: 600; }

/* --- всплывашка --------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translate(-50%, 20px);
  background: rgba(30,30,34,.92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #c2373b; }

/* --- общие для форм ------------------------------------------------------- */
.btn { height: 42px; padding: 0 16px; border-radius: 12px; background: var(--card); color: var(--link); font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:disabled { opacity: .45; }
.btn.big { height: 48px; width: 100%; font-size: 15.5px; }
.btn.ok { background: color-mix(in srgb, var(--c-done) 16%, var(--card)); color: var(--c-done); }
.btn.bad, .btn.danger { background: color-mix(in srgb, var(--c-hot) 14%, var(--card)); color: var(--c-hot); }
.actions .btn.primary { color: var(--accent-text); }
.section.form { padding: 12px 14px; display: grid; gap: 12px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; color: var(--sub); }
.field input, .field textarea, .line input {
  width: 100%; min-width: 0; border: 0; outline: 0; border-radius: 11px; padding: 10px 12px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px; }
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.switch input { width: 20px; height: 20px; accent-color: var(--c-hot); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 8px; color: var(--sub); background: color-mix(in srgb, var(--hint) 16%, transparent); vertical-align: 1px; }
.hot { color: var(--c-hot); font-weight: 600; }
.sheet-hint { color: var(--sub); font-size: 14px; padding: 0 4px 12px; }
.sheet-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-row .btn.primary { color: var(--accent-text); }
.sheet-item.check { display: flex; align-items: center; gap: 10px; }
.sheet-item.check .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--hint); flex: none; }
.sheet-item.check.on { background: color-mix(in srgb, var(--c-hot) 12%, var(--bg)); }
.sheet-item.check.on .box { background: var(--c-hot); border-color: var(--c-hot); box-shadow: inset 0 0 0 3px var(--card); }
.sheet-ok { width: 100%; height: 46px; margin-top: 12px; color: var(--accent-text); }

/* --- места ------------------------------------------------------------------ */
.pl-card { background: var(--card); border-radius: var(--radius); padding: 12px 14px; position: relative; overflow: hidden; }
.pl-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--pl-c, var(--hint)); }
.pl-card.st-review { --pl-c: var(--c-work); }
.pl-card.st-no_place { --pl-c: var(--c-hot); }
.pl-card.st-photo { --pl-c: var(--c-open); }
.pl-card.st-clean { --pl-c: var(--c-done); }
.pl-card.st-dirty { --pl-c: var(--c-hot); }
.pl-card.st-overdue { --pl-c: var(--hint); }
.pl-card.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.pl-head { display: flex; align-items: center; gap: 12px; }
.pl-place { width: 48px; height: 48px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 17px;
  background: color-mix(in srgb, var(--pl-c, var(--hint)) 14%, var(--bg)); color: var(--text); }
.pl-place.none { color: var(--c-hot); }
.pl-who { flex: 1; min-width: 0; }
.pl-who b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-who small { color: var(--sub); font-size: 13px; }
.pl-st { margin-top: 8px; font-size: 13.5px; color: var(--sub); }
.pl-card.st-review .pl-st { color: var(--c-work); font-weight: 600; }
.pl-card.st-no_place .pl-st, .pl-card.st-dirty .pl-st { color: var(--c-hot); font-weight: 600; }
.pl-pics { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; scrollbar-width: none; }
.pl-pics::-webkit-scrollbar { display: none; }
.pl-pics img { width: 76px; height: 76px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg); }
.pl-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pl-left { margin-top: 8px; font-size: 13px; color: var(--sub); }
.pl-left.hot { color: var(--c-hot); font-weight: 600; }
.section.tbl { overflow: hidden; }
.mk-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--sep); font-size: 15px; }
.mk-row:last-child { border-bottom: 0; }
.mk-name { flex: 1; min-width: 0; }
.mk-d, .mk-p { width: 52px; text-align: right; color: var(--sub); font-variant-numeric: tabular-nums; }
.mk-d.hot { color: var(--c-hot); font-weight: 700; }

/* --- закупки ----------------------------------------------------------------- */
.cart-card { margin: 8px var(--pad) 0; width: calc(100% - 2 * var(--pad)); display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--card); border-radius: var(--radius); padding: 14px; }
.cart-card svg { width: 18px; height: 18px; color: var(--hint); }
.cc-icon { font-size: 28px; }
.cc-txt { flex: 1; min-width: 0; }
.cc-txt b { display: block; font-size: 16px; }
.cc-txt small { color: var(--sub); font-size: 13.5px; }
.ord-row { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: var(--card); border-radius: 12px; padding: 11px 12px; }
.ord-num { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 44px; }
.ord-mid { flex: 1; min-width: 0; }
.ord-mid b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ord-mid small { color: var(--sub); font-size: 13px; }
.pill.os-new { --status-c: var(--c-open); }
.pill.os-accepted, .pill.os-ordered { --status-c: var(--c-work); }
.pill.os-arrived, .pill.os-closed { --status-c: var(--c-done); }
.pill.os-deferred { --status-c: var(--hint); }
.pill.os-rejected { --status-c: var(--c-hot); }
.lines { padding: 8px var(--pad) 0; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.line { background: var(--card); border-radius: var(--radius); padding: 10px 12px 12px; display: grid; gap: 8px; transition: box-shadow .3s; }
.line.saving { opacity: .7; }
.line.saved { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-done) 60%, transparent); }
.line-top { display: flex; gap: 8px; align-items: flex-start; }
.line-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; }
.line-x { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--hint); flex: none; }
.line-x svg { width: 14px; height: 14px; }
.line-row { display: flex; gap: 8px; }
.line .unit { width: 84px; flex: none; }
.line .lnote { font-size: 14px; }
.stepper { display: flex; align-items: center; background: var(--bg); border-radius: 11px; overflow: hidden; flex: 1; min-width: 0; }
.stepper button { width: 42px; height: 40px; font-size: 20px; color: var(--link); flex: none; }
.stepper input { flex: 1; min-width: 0; text-align: center; background: transparent !important; padding: 8px 0 !important; font-weight: 600; font-size: 16px !important; border: 0; outline: 0; color: var(--text); font-family: inherit; }
.it-list { margin: 0 var(--pad); background: var(--card); border-radius: var(--radius); overflow: hidden; }
.it-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--sep); }
.it-row:last-child { border-bottom: 0; }
.it-row.ghost { margin: 10px var(--pad) 0; width: calc(100% - 2 * var(--pad)); background: var(--card); border-radius: var(--radius); border: 0; }
.it-row svg { width: 16px; height: 16px; color: var(--hint); flex: none; }
.it-row img, .it-ph { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg); display: grid; place-items: center; font-size: 20px; }
.it-txt { flex: 1; min-width: 0; }
.it-txt b { display: block; font-weight: 500; font-size: 15px; line-height: 1.3; }
.it-txt small { color: var(--sub); font-size: 13px; }
.it-price { color: var(--sub); font-size: 13.5px; white-space: nowrap; }
.it-photo { background: #000; }
.it-photo img { width: 100%; max-height: 46vh; object-fit: contain; }
.links { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 10px 16px 14px; font-size: 14.5px; }
.links a { color: var(--link); text-decoration: none; }
.o-comment { margin-top: 8px; font-size: 14.5px; }
.st-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.st-btns .btn { flex: 1 1 auto; }
.st-btns .btn.primary { color: var(--accent-text); }
.cart-pad { height: 72px; }
.cart-bar { position: fixed; left: var(--pad); right: var(--pad); bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); z-index: 20;
  height: 48px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); }

/* --- режим «глазами сотрудника» ---------------------------------------------- */
#previewbar { position: fixed; left: 10px; right: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); z-index: 30;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 14px;
  background: #5b3fd1; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 14px; }
#previewbar span { flex: 1; min-width: 0; }
#previewbar small { display: block; opacity: .75; font-size: 12px; }
#previewbar button { height: 34px; padding: 0 14px; border-radius: 10px; background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
body.previewing #app { padding-bottom: 76px; }
body.previewing .cart-bar { bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); }

/* --- закупки: средняя цена и режим закупки ----------------------------------- */
.buy-stats { padding: 12px 14px; display: grid; gap: 6px; }
.bs-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bs-main b { font-size: 22px; }
.bs-main span { color: var(--sub); font-size: 13.5px; }
.bs-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--sub); }
.bs-row b { color: var(--text); }
.bs-row.muted { color: var(--hint); }
.sub-line { display: block; color: var(--sub); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.line.buy.done { box-shadow: inset 4px 0 0 var(--c-done); }
.bought { font-size: 13.5px; color: var(--c-done); }
.buy-form { display: grid; gap: 8px; }
.buy-form .btn.primary { color: var(--accent-text); }
.field-row.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* --- фото до/после ------------------------------------------------------------ */
.ph-n { min-width: 44px; font-size: 13.5px; color: var(--sub); font-variant-numeric: tabular-nums; }
.btn.upl { cursor: pointer; }
.actions .btn.upl.primary { color: var(--accent-text); }

/* --- оценки работ ------------------------------------------------------------------ */
.score { font-weight: 700; font-size: 13.5px; padding: 2px 8px; border-radius: 9px; white-space: nowrap;
  background: color-mix(in srgb, var(--hint) 14%, transparent); color: var(--sub); }
.score.s5, .score.s4 { background: color-mix(in srgb, var(--c-done) 16%, transparent); color: var(--c-done); }
.score.s3 { background: color-mix(in srgb, var(--c-open) 16%, transparent); color: var(--c-open); }
.score.s2, .score.s1 { background: color-mix(in srgb, var(--c-hot) 16%, transparent); color: var(--c-hot); }
.stars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.star { height: 48px; border-radius: 12px; background: var(--bg); font-size: 18px; font-weight: 700; color: var(--sub); }
.star.on { background: var(--accent); color: var(--accent-text); }
.tagpick, .tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tagcloud { padding: 0 var(--pad) 10px; }
.tg { padding: 7px 11px; border-radius: 16px; background: var(--bg); font-size: 13.5px; color: var(--text); }
.tagcloud .tg { background: var(--card); }
.tg b { color: var(--c-hot); }
.tg.on { background: color-mix(in srgb, var(--c-hot) 16%, var(--bg)); color: var(--c-hot); font-weight: 600; }
.sheet-custom input { border: 0; outline: 0; border-radius: 12px; padding: 10px 12px; background: var(--bg); color: var(--text); font: inherit; width: 100%; }

/* счётчик оценок (13.10) */
.sc-sum{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:0 16px 12px}
.sc-sum>div{background:var(--card);border-radius:12px;padding:10px;text-align:center}
.sc-sum b{display:block;font-size:20px}
.sc-sum small{color:var(--hint);font-size:12px}
.sc-row{align-items:flex-start}
.sc-bar{display:block;height:6px;border-radius:3px;background:var(--sep);margin:6px 0 2px;overflow:hidden}
.sc-bar i{display:block;height:100%;background:var(--ok,#34c759);border-radius:3px}
.sc-right{display:flex;flex-direction:column;align-items:flex-end;gap:4px;white-space:nowrap}
.sc-right b{font-size:17px}
.sc-sum>div small{display:block}
.sc-line{display:flex;gap:6px;font-size:13px;color:var(--hint);margin-top:6px}
.sc-who{color:var(--text,inherit);min-width:58px}
.sc-bar{margin:3px 0 0}
.sc-bar.g i{background:#f5a623}
.sc-name{flex:1;min-width:0}
.sc-line{align-items:baseline}
.sc-txt{flex:1;min-width:0}
.sc-p{color:var(--text,inherit);font-size:15px}
