/* Мягкий «пастельный» стиль: сиреневый фон, белые карточки с крупным скруглением, тёмно-синий текст,
   фиолетовые и розовые градиенты, цветные значки-подложки, нижняя панель из иконок.
   Светлая и тёмная темы — по настройке телефона. */
:root {
  --bg: #eceef7;
  --card: #ffffff;
  --card-2: #f5f6fb;
  --ink: #2b3156;              /* тёмно-синий текст */
  --muted: #8f96b4;
  --line: #eceef6;
  --fill: #f2f3f9;             /* поля, серые кнопки, фон миниатюр */
  --fill-2: #e6e8f3;
  --bar: rgba(255, 255, 255, .86);
  --violet: #7a6ff0;   --violet-2: #9b92ff;
  --pink: #f4577e;     --pink-2: #ff8aa6;
  --green: #22c49a;    --green-2: #5be0b9;
  --accent: var(--violet);
  --accent-ink: #ffffff;
  --accent-soft: rgba(122, 111, 240, .12);
  --ok: #1f9e7a;      --ok-solid: #22c49a; --ok-soft: rgba(34, 196, 154, .14);
  --warn: #d17a12;    --warn-soft: rgba(255, 168, 64, .16);
  --danger: #e23d64;  --danger-solid: #f4577e; --danger-soft: rgba(244, 87, 126, .13);
  --info: #6258e0;    --info-soft: rgba(122, 111, 240, .11);
  --gray-soft: #eef0f7;
  --radius: 24px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 14px 34px rgba(88, 98, 160, .08);
  --shadow-soft: 0 6px 16px rgba(88, 98, 160, .06);
  /* только системные шрифты с кириллицей: иначе цифры и русские буквы рисуются разными шрифтами */
  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12152a; --card: #1c2038; --card-2: #232846; --ink: #eef0fb; --muted: #8d93b8; --line: #2a3050;
    --fill: #262b4a; --fill-2: #30365a; --bar: rgba(28, 32, 56, .88);
    --violet: #8c82ff; --violet-2: #aaa3ff; --pink: #ff6b8f; --pink-2: #ff97b1; --green: #3ad7ab;
    --accent-soft: rgba(140, 130, 255, .18);
    --ok: #4fe0b5; --ok-solid: #3ad7ab; --ok-soft: rgba(58, 215, 171, .16);
    --warn: #ffb35c; --warn-soft: rgba(255, 179, 92, .16);
    --danger: #ff7a9a; --danger-solid: #ff6b8f; --danger-soft: rgba(255, 107, 143, .16);
    --info: #b3adff; --info-soft: rgba(140, 130, 255, .16);
    --gray-soft: #262b4a;
    --shadow: 0 14px 34px rgba(0, 0, 0, .25); --shadow-soft: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 var(--font); -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.08rem; font-weight: 800; }
a { color: var(--accent); text-decoration: none; }
small, .muted { color: var(--muted); }
small { font-size: .82em; }
b { font-weight: 800; }
p { margin: .6em 0; }
.center { text-align: center; }
[hidden] { display: none !important; }
button, a, input, select, textarea, summary, label { touch-action: manipulation; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* ---- шапка ---- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 24px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); min-height: 64px;
  background: var(--bar); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 1.15rem; white-space: nowrap; display: flex; align-items: center; }
.brand span { color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lang-sel {
  width: auto; margin: 0; min-height: 40px; padding: 4px 32px 4px 14px; font-size: .88rem; font-weight: 700;
  border-radius: 14px; background-color: var(--card); box-shadow: inset 0 0 0 1.5px var(--line);
}
.user-btn {
  display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 2px; cursor: pointer;
  color: var(--ink); font: inherit; text-align: right; min-width: 0; border-radius: 16px;
}
.user-name { min-width: 0; }
.user-name b, .user-name small { display: block; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.user-name b { font-size: .92rem; }
/* аватар — скруглённый квадрат с градиентом, как на макете */
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--violet-2), var(--violet)); color: #fff; font-weight: 800; font-size: 1.05rem; text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(122, 111, 240, .32);
}

/* ---- навигация: на компьютере — вкладки-«пилюли» сверху, на телефоне — панель иконок снизу ---- */
.tabs {
  display: flex; gap: 4px; padding: 6px 24px 12px; overflow-x: auto; scrollbar-width: none;
  background: var(--bar); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 19;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .more-btn {
  flex: none; padding: 9px 16px; border-radius: 14px; color: var(--muted); font: inherit; font-size: .93rem; font-weight: 700;
  white-space: nowrap; background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, color .15s;
}
.tabs a:hover, .more-btn:hover { background: var(--fill); color: var(--ink); }
.tabs a.on, .more-btn.on { background: var(--ink); color: var(--card); }
.tabs svg { display: block; width: 18px; height: 18px; flex: none; }
.tabs .lbl-s { display: none; }
.more-btn { display: none; }
main { max-width: 1140px; margin: 0 auto; padding: 22px 24px 60px; }

/* ---- карточки ---- */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h3:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); gap: 18px; margin-bottom: 18px; }
.cols > .card { margin-bottom: 0; }
/* показатели: белые плитки, как блок «184 Total / 88 Send» */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: 20px; padding: 16px 18px; box-shadow: var(--shadow-soft); border: 1.5px solid var(--line); }
.kpi small { display: block; margin-bottom: 6px; font-size: .8rem; font-weight: 700; }
.kpi b { font-size: 1.55rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi.warn { background: var(--warn-soft); border-color: transparent; }
.kpi.warn b { color: var(--warn); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 10px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 4px 16px; }
.page-head h2 { margin: 0; }
.page-head > small, .page-head small { padding-bottom: 4px; font-weight: 600; }
.page-head div > small { display: block; margin-top: 4px; }

/* ---- плитки быстрых действий (как Send / Receive на макете) ---- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; max-width: 520px; }
.tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 22px 16px 16px; border-radius: 26px; color: #fff; min-height: 168px; justify-content: space-between;
  box-shadow: 0 16px 30px -10px var(--tile-shadow); transition: transform .15s;
}
.tile:active { transform: scale(.97); }
.tile::before, .tile::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .14); pointer-events: none; }
.tile::before { width: 140px; height: 140px; right: -50px; top: -40px; }
.tile::after { width: 90px; height: 90px; left: -30px; bottom: -36px; }
.tile.pink { background: linear-gradient(150deg, var(--pink-2), var(--pink)); --tile-shadow: rgba(244, 87, 126, .55); }
.tile.violet { background: linear-gradient(150deg, var(--violet-2), var(--violet)); --tile-shadow: rgba(122, 111, 240, .55); }
.tile-ic {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: #fff;
  box-shadow: 0 0 0 12px rgba(255, 255, 255, .22); color: var(--pink); position: relative; z-index: 1;
}
.tile.violet .tile-ic { color: var(--violet); }
.tile-ic svg { width: 28px; height: 28px; }
.tile-btn {
  width: 100%; background: #fff; color: var(--ink); border-radius: 14px; padding: 10px; text-align: center;
  font-weight: 700; font-size: .95rem; position: relative; z-index: 1;
}

/* ---- значки-подложки и заголовки с ними ---- */
.ichip { flex: none; width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; color: #fff; }
.ichip svg { width: 19px; height: 19px; }
.ichip.pink { background: linear-gradient(145deg, var(--pink-2), var(--pink)); }
.ichip.violet { background: linear-gradient(145deg, var(--violet-2), var(--violet)); }
.ichip.green { background: linear-gradient(145deg, var(--green-2), var(--green)); }
.h-chip { display: flex; align-items: center; gap: 12px; }
.h-chip .ichip { width: 34px; height: 34px; border-radius: 11px; }

/* ---- график продаж ---- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 18px 0 0; margin-top: 8px;
  background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); background-size: 100% calc(100% - 24px); background-repeat: no-repeat; }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; }
.chart .col i { display: block; width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px; background: color-mix(in srgb, var(--violet) 22%, transparent); transition: height .4s; }
.chart .col.hi i { background: linear-gradient(180deg, var(--violet-2), var(--violet)); box-shadow: 0 10px 20px -8px rgba(122, 111, 240, .7); }
.chart .col span { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.chart .col.hi span { color: var(--ink); font-weight: 800; }

/* ---- лента событий (как «Latest activities») ---- */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 18px; border: 1.5px solid var(--line); margin-bottom: 10px; }
.activity li > div { flex: 1; min-width: 0; }
.activity b { font-size: .95rem; }
.activity .ichip { background: var(--card-2); color: var(--violet); width: 42px; height: 42px; }
.activity .ichip.pink { color: var(--pink); background: var(--danger-soft); }
.activity .ichip.green { color: var(--ok); background: var(--ok-soft); }
.activity .ichip.violet { color: var(--violet); background: var(--accent-soft); }
.act-q { font-weight: 800; white-space: nowrap; }
.see-all { display: inline-block; font-weight: 800; margin-top: 2px; }

/* ---- таблицы ---- */
.tbl-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1.5px solid var(--line); vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 800; white-space: nowrap; }
td.r, th.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--fill) 60%, transparent); }
tr.low td:first-child { box-shadow: inset 3px 0 0 var(--danger-solid); }
.num-neg { color: var(--danger); } .num-pos { color: var(--ok); }
.empty { padding: 22px 10px 26px; text-align: center; color: var(--muted); font-weight: 600; }
.empty img { display: block; margin: 0 auto 10px; width: 120px; height: auto; }

/* ---- товар с фото / иллюстрацией ---- */
.prod { display: flex; align-items: center; gap: 14px; min-width: 0; }
.prod-txt { min-width: 0; }
.thumb {
  flex: none; width: 52px; height: 52px; border-radius: 16px; overflow: hidden; padding: 0; border: 0;
  background: var(--fill); display: grid; place-items: center; cursor: zoom-in; color: var(--muted); box-shadow: var(--shadow-soft);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.art, .thumb.none { cursor: default; }
.thumb.none svg { width: 22px; height: 22px; opacity: .55; }

/* ---- бейджи ---- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 10px; font-size: .74rem; font-weight: 800; white-space: nowrap; vertical-align: middle; }
.badge.gray { background: var(--gray-soft); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* ---- формы ---- */
label { display: block; font-weight: 700; font-size: .82rem; color: var(--muted); margin-bottom: 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 7px; padding: 12px 16px; min-height: 50px;
  border: 1.5px solid transparent; border-radius: 16px; background: var(--fill); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600;
  -webkit-appearance: none; appearance: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); font-weight: 500; }
input:focus, select:focus, textarea:focus { outline: none; background: var(--card); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f96b4' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
}
textarea { min-height: 92px; resize: vertical; }
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }

/* переключатель */
input[type=checkbox] {
  flex: none; width: 52px; height: 32px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 999px; position: relative; cursor: pointer;
  background: var(--fill-2); transition: background .2s;
}
input[type=checkbox]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(43, 49, 86, .2); transition: transform .2s;
}
input[type=checkbox]:checked { background: var(--accent); }
input[type=checkbox]:checked::after { transform: translateX(20px); }
input[type=checkbox]:focus { box-shadow: none; }
label.check { display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: .98rem; color: var(--ink); font-weight: 700; }
label.check input { order: 2; }

/* круглая отметка — для списка сборки */
.checklist input[type=checkbox] {
  width: 30px; height: 30px; border-radius: 10px; background: var(--card); box-shadow: inset 0 0 0 2px var(--fill-2);
}
.checklist input[type=checkbox]::after {
  top: 0; left: 0; width: 30px; height: 30px; box-shadow: none; transform: scale(0); background: transparent; border-radius: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 12.5 10.5 17 18 8'/%3E%3C/svg%3E");
  background-size: 18px; background-position: center; background-repeat: no-repeat;
}
.checklist input[type=checkbox]:checked { background: linear-gradient(145deg, var(--violet-2), var(--violet)); box-shadow: 0 6px 14px -4px rgba(122, 111, 240, .6); }
.checklist input[type=checkbox]:checked::after { transform: scale(1); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0 16px; }
.form-grid.facts { gap: 12px; }
.form-grid.facts > div { background: var(--card-2); border-radius: 18px; padding: 12px 14px; }
.form-grid.facts b { font-size: 1.02rem; }
.inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline > label { margin-bottom: 0; flex: 1 1 150px; }
.inline > label.grow { flex: 3 1 260px; }
.inline > label.sm { flex: 0 1 110px; }
.inline > .btn { flex: none; }
td input { margin: 0; min-height: 42px; padding: 8px 12px; width: 104px; text-align: right; border-radius: 12px; }

/* ---- кнопки ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; min-height: 50px;
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink);
  font: inherit; font-size: .98rem; font-weight: 800; cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .1s, filter .15s, background .15s, box-shadow .15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--fill); }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(150deg, var(--violet-2), var(--violet)); border-color: transparent; color: #fff;
  box-shadow: 0 12px 24px -10px rgba(122, 111, 240, .75);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.danger:hover { filter: brightness(.97); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--fill); }
.btn.sm { min-height: 38px; padding: 7px 14px; font-size: .86rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* фильтры — как переключатель Send / Receive */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 9px 16px; min-height: 38px; border-radius: 12px; border: 0; background: var(--fill); color: var(--ink);
  font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .15s;
}
.chip:hover { background: var(--fill-2); }
.chip.on { background: var(--ink); color: var(--card); }

.err { background: var(--danger-soft); color: var(--danger); border-radius: 16px; padding: 12px 16px; margin: 10px 0; font-weight: 700; font-size: .95rem; }
.hint { background: var(--info-soft); color: var(--info); border-radius: 16px; padding: 12px 16px; margin: 10px 0; font-size: .92rem; font-weight: 600; }

/* ---- задачи кладовщика ---- */
.tasks { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.task { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.task h3 { margin: 0; font-size: 1.12rem; }
.checklist { list-style: none; margin: 2px 0 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1.5px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; align-items: center; gap: 14px; margin: 0; font-weight: 700; flex: 1; font-size: .98rem; color: var(--ink); min-width: 0; }
.checklist label small { font-weight: 600; }
.checklist .thumb { width: 58px; height: 58px; border-radius: 16px; }
.checklist .qty { font-size: 1.15rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.task .actions { margin-top: auto; }
.task .actions .btn { width: 100%; min-height: 54px; font-size: 1.02rem; border-radius: 18px; }

/* ---- вход ---- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.card.login-card { width: 100%; max-width: 420px; margin: 0; padding: 0; overflow: hidden; border-radius: 32px; display: grid; }
/* картинка входа: на телефоне — полоса сверху, на компьютере — левая половина карточки */
.login-art { background: #eef0f9; }
.login-art img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 70%; }
.login form { margin: 0; padding: 22px 26px 26px; }
@media (min-width: 860px) {
  .card.login-card { max-width: 920px; grid-template-columns: 1.05fr 1fr; }
  .login-art img { height: 100%; aspect-ratio: auto; object-position: center; }
  .login form { padding: 44px 40px; align-self: center; }
}
.login h1 { font-size: 1.9rem; margin: 0; }
.login h1 span { color: var(--accent); }
.login .btn.primary { min-height: 56px; font-size: 1.04rem; margin-top: 6px; border-radius: 18px; }
.demo { margin-top: 18px; font-size: .9rem; }
.demo summary { cursor: pointer; color: var(--accent); padding: 6px 0; font-weight: 800; }
.demo .chips { margin-top: 10px; }

/* ---- окна ---- */
dialog {
  border: 0; border-radius: 30px; padding: 0; width: min(540px, calc(100vw - 24px)); background: var(--card); color: var(--ink);
  box-shadow: 0 30px 70px rgba(43, 49, 86, .25);
}
dialog[open] { animation: pop .22s cubic-bezier(.2, .9, .3, 1.1); }
dialog::backdrop { background: rgba(43, 49, 86, .3); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
.modal { padding: 26px 22px 22px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal h3 { font-size: 1.2rem; text-align: center; margin-bottom: 18px; }
.modal-actions { margin-top: 8px; }
.modal-actions .btn { flex: 1 1 0; }
.sheet-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sheet-link {
  display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 58px; border-radius: 18px; border: 1.5px solid var(--line);
  color: var(--ink); font-weight: 800;
}
.sheet-link svg { width: 22px; height: 22px; flex: none; color: var(--accent); }

/* ---- фото: управление и просмотр ---- */
.pm { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.pm .empty { grid-column: 1 / -1; background: var(--fill); border-radius: 20px; }
.pm-item { position: relative; margin: 0; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: var(--fill); }
.pm-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-cover, .pm-btn {
  position: absolute; left: 6px; bottom: 6px; padding: 4px 9px; border-radius: 10px; font: inherit; font-size: .7rem; font-weight: 800; border: 0;
  background: rgba(43, 49, 86, .6); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pm-cover { background: var(--violet); }
.pm-btn { cursor: pointer; }
.pm-del {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 10px; border: 0; cursor: pointer;
  background: rgba(43, 49, 86, .6); color: #fff; font-size: .8rem; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.upload { margin-bottom: 4px; }
.photo-dlg { width: min(720px, calc(100vw - 24px)); }
.viewer { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; border-radius: 20px; margin-bottom: 10px; scrollbar-width: none; }
.viewer::-webkit-scrollbar { display: none; }
.viewer img { flex: 0 0 100%; width: 100%; max-height: 70vh; max-height: 70dvh; object-fit: contain; scroll-snap-align: center; border-radius: 20px; background: var(--fill); }

/* ---- уведомления ---- */
#toasts {
  position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 100;
  display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none;
}
.toast {
  padding: 14px 16px; border-radius: 20px; font-weight: 700; font-size: .95rem; background: var(--card); color: var(--ink);
  box-shadow: 0 16px 40px rgba(43, 49, 86, .18); animation: drop .3s cubic-bezier(.2, .9, .3, 1.1); display: flex; align-items: center; gap: 12px;
}
.toast::before {
  content: ""; flex: none; width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(145deg, var(--green-2), var(--green)) center / 100% no-repeat;
  -webkit-mask: none;
}
.toast.err::before { background: linear-gradient(145deg, var(--pink-2), var(--pink)); }
.toast.err { color: var(--danger); }
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }

details.inline-details summary { cursor: pointer; color: var(--accent); font-weight: 800; padding: 4px 0; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.pill-list li { background: var(--fill); border-radius: 10px; padding: 5px 11px; font-size: .88rem; font-weight: 600; }
.bar { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; min-width: 70px; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet-2), var(--violet)); border-radius: 4px; }
.scroll-x { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.sticky-bar { margin-top: 16px; }

/* оплата */
.price-in { width: 112px; text-align: right; }
.pay-line { margin: 2px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task select.pay-method { width: 100%; }

/* индикатор мгновенных обновлений */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; background: var(--muted); opacity: .45; transition: background .3s, opacity .3s; }
.live-dot.on { background: var(--ok-solid); opacity: 1; box-shadow: 0 0 0 3px var(--ok-soft); }

/* ================= ТЕЛЕФОН ================= */
@media (max-width: 720px) {
  body { font-size: 15.5px; }
  h2 { font-size: 1.6rem; }
  .top { padding: 8px 18px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); min-height: 60px; }
  .user-name { display: none; }
  .avatar { width: 42px; height: 42px; }
  main { padding: 8px 18px calc(var(--nav-h) + var(--safe-b) + 100px); }
  .card { padding: 18px; border-radius: 26px; }
  .page-head { margin: 6px 2px 14px; }
  .tiles { gap: 14px; }
  .tile { min-height: 158px; border-radius: 24px; }
  .tile-ic { width: 64px; height: 64px; }

  /* нижняя панель: только иконки, у активной — подпись и тёмная «капля» снизу */
  .tabs {
    position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); top: auto; z-index: 30; gap: 0;
    justify-content: space-around; overflow: visible; padding: 8px 6px; border-radius: 26px;
    background: var(--bar); box-shadow: 0 16px 40px rgba(43, 49, 86, .16);
  }
  .tabs a, .more-btn {
    flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; padding: 6px 2px; min-height: 50px;
    border-radius: 16px; font-size: 10.5px; line-height: 1.1; font-weight: 800; text-align: center; white-space: normal; color: #a4aac6;
    position: relative;
  }
  .tabs a:hover, .more-btn:hover { background: none; color: #a4aac6; }
  .tabs a.on, .more-btn.on { background: none; color: var(--ink); }
  .tabs a.on::after, .more-btn.on::after {
    content: ""; position: absolute; bottom: -8px; left: 50%; width: 26px; height: 5px; margin-left: -13px; border-radius: 5px 5px 0 0; background: var(--ink);
  }
  .tabs svg { display: block; width: 24px; height: 24px; flex: none; stroke-width: 2; }
  .tabs .lbl-l { display: none; }
  .tabs .lbl-s { display: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabs a.on .lbl-s, .more-btn.on span { display: block; }
  .tabs a.extra { display: none; }
  .more-btn { display: flex; }
  .more-btn span { display: none; }

  /* формы */
  .inline { flex-direction: column; align-items: stretch; gap: 12px; }
  .inline > label, .inline > label.grow, .inline > label.sm { flex: 1 1 auto; width: 100%; }
  .inline > .btn { width: 100%; }
  .inline > label.check { width: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.facts { grid-template-columns: 1fr 1fr; gap: 10px; }
  .row.actions-row .btn { flex: 1 1 100%; }
  .row.end { justify-content: stretch; }
  .row.end .btn { flex: 1 1 0; }

  /* таблицы превращаются в список карточек */
  .tbl-wrap { overflow: visible; margin: 0; padding: 0; }
  table:not(.keep), table:not(.keep) tbody { display: block; }
  table:not(.keep) thead { display: none; }
  table:not(.keep) tr { display: block; padding: 4px 0 12px; border-bottom: 1.5px solid var(--line); }
  table:not(.keep) tbody tr:last-child { border-bottom: 0; padding-bottom: 2px; }
  table:not(.keep) tbody tr:hover { background: none; }
  table:not(.keep) tr.low td:first-child { box-shadow: none; }
  table:not(.keep) tr.low .thumb { box-shadow: 0 0 0 2.5px var(--danger-solid); }
  table:not(.keep) td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px; border: 0; padding: 3px 0; text-align: right; font-size: .94rem;
  }
  table:not(.keep) td::before { content: attr(data-label); color: var(--muted); font-size: .84rem; font-weight: 700; text-align: left; flex: none; max-width: 46%; }
  table:not(.keep) td:first-child { display: block; text-align: left; font-size: 1rem; font-weight: 700; padding: 10px 0 8px; }
  table:not(.keep) td:first-child::before, table:not(.keep) td[data-label=""]::before { display: none; }
  table:not(.keep) td[data-label=""] { justify-content: flex-start; padding-top: 8px; }
  table:not(.keep) td[data-label=""] .btn { flex: 1 1 0; }
  table:not(.keep) td[data-label=""] .row.nowrap { width: 100%; }
  table:not(.keep) td .bar { margin-top: 4px; }
  table:not(.keep) td details { text-align: right; }
  table.keep th { white-space: normal; font-size: .68rem; }
  table.keep th, table.keep td { padding: 9px 5px; }
  table.keep td input { width: 78px; padding: 6px 8px; }
  table.keep td:first-child { max-width: 50vw; }
  table.keep .thumb { width: 42px; height: 42px; border-radius: 13px; }

  /* окна — шторки снизу с «ручкой» */
  dialog { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 30px 30px 0 0; box-shadow: 0 -16px 50px rgba(43, 49, 86, .2); }
  dialog[open] { animation: slide-up .3s cubic-bezier(.2, .9, .3, 1); }
  .photo-dlg { width: 100%; }
  .modal { padding: 30px 18px calc(20px + var(--safe-b)); max-height: 90vh; max-height: 90dvh; position: relative; }
  .modal::before { content: ""; position: absolute; top: 10px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--fill-2); }
  .modal .btn { min-height: 52px; }

  /* кнопки действий прилипают над нижней панелью */
  .sticky-bar {
    position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 22px); z-index: 10;
    background: var(--bar); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
    padding: 10px; margin: 16px -4px 0; border-radius: 22px; box-shadow: 0 12px 30px rgba(43, 49, 86, .16);
  }
  .sticky-bar .btn { flex: 1 1 0; min-height: 50px; }
  .card > .sticky-bar { margin-left: 0; margin-right: 0; }

  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; border-radius: 20px; }
  .kpi b { font-size: 1.25rem; }
  .chart { height: 160px; gap: 8px; }
  .sheet-links { grid-template-columns: 1fr; }
  .task .actions .btn { min-height: 56px; }
}

@media (max-width: 360px) {
  .brand { font-size: 1rem; }
  .lang-sel { padding-left: 10px; font-size: .82rem; }
  h2 { font-size: 1.4rem; }
  .tile { min-height: 140px; padding: 16px 12px 12px; }
}

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