/* iSklad — шапка телефона (компания, колокольчик, профиль, вкладки), листы снизу и сводка продаж на Главной.
   На компьютере шапка телефона скрыта: там боковое меню. */

/* ---------- шапка и вкладки телефона ---------- */
.mtop, .mtabs { display:none; }
@media (max-width:820px) {
  .shell { flex-direction:column; }
  .shell > .sidebar { display:none !important; }
  .desk-only { display:none !important; }
  .mtop { display:flex; align-items:center; gap:6px; padding:calc(8px + env(safe-area-inset-top, 0px)) 12px 6px 16px; background:var(--ink);
    background-image:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0)); }
  .mtabs { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0, 1fr); gap:2px; position:sticky; top:0; z-index:40;
    padding:2px 6px 7px; background:var(--ink); border-bottom:1px solid var(--ink-line); box-shadow:0 8px 18px -14px rgba(10,14,28,.6); }
  .content { padding:16px 14px 44px; }
  .founder-banner { padding:11px 13px; gap:10px; font-size:13.5px; line-height:1.4; margin-bottom:12px; }
}
.mtop-brand { display:flex; align-items:center; gap:10px; min-width:0; flex:1; color:#fff !important; text-decoration:none !important; }
.mtop-brand .brand-mark { width:10px; height:17px; box-shadow:4px 4px 0 -1px rgba(242,168,29,.32); }
.mtop-company { font-size:17px; font-weight:650; letter-spacing:-.01em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mtop-btn { position:relative; width:40px; height:40px; display:grid; place-items:center; border:0; border-radius:50%; background:transparent;
  color:#c8d1e6; cursor:pointer; flex:none; -webkit-tap-highlight-color:transparent; }
.mtop-btn:active { background:var(--ink-2); }
.mtop-btn svg { width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.mtop-badge { position:absolute; top:4px; right:3px; min-width:17px; height:17px; padding:0 4px; border-radius:9px; background:var(--amber); color:#10172a;
  font-size:10.5px; font-weight:750; line-height:17px; text-align:center; box-shadow:0 0 0 2px var(--ink); }
.mtop-me { width:34px; height:34px; flex:none; border-radius:50%; border:1.5px solid rgba(255,255,255,.14); background:var(--ink-line); color:#fff;
  font:650 15px/1 var(--ui); display:grid; place-items:center; cursor:pointer; margin-left:2px; -webkit-tap-highlight-color:transparent; }
.mtop-me.big { width:48px; height:48px; font-size:20px; cursor:default; border:0; background:var(--action); }
.mtab { display:flex; flex-direction:column; align-items:center; gap:3px; min-width:0; padding:6px 2px 5px; border:0; border-radius:11px; background:transparent;
  color:var(--ink-fg) !important; font:500 10.5px/1.15 var(--ui); text-decoration:none !important; cursor:pointer; -webkit-tap-highlight-color:transparent; }
.mtab span { max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mtab svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.mtab.active { color:#fff !important; background:var(--ink-2); font-weight:600; }
.mtab.active svg { stroke:var(--amber); }
.mtab:active { background:var(--ink-2); }

/* ---------- листы снизу: «Ещё», «Требует внимания», профиль ---------- */
dialog.msheet { position:fixed; inset:auto 0 0 0; margin:0 auto; width:100%; max-width:560px; max-height:86vh; overflow:auto; border:0;
  border-radius:22px 22px 0 0; padding:8px 16px calc(20px + env(safe-area-inset-bottom, 0px)); background:var(--card); color:var(--fg);
  box-shadow:0 -12px 40px rgba(10,14,28,.28); overscroll-behavior:contain; }
/* backwards, а не both: после появления лист снова можно сдвигать пальцем (иначе анимация держит transform) */
dialog.msheet[open] { animation:sheet-up .24s var(--ease) backwards; }
dialog.msheet.settling { transition:transform .22s var(--ease); }
dialog.msheet:focus { outline:none; }
dialog.msheet.dragging { user-select:none; -webkit-user-select:none; }
/* пока лист открыт, страница под ним не прокручивается и не «пружинит» */
html.sheet-open, html.sheet-open body { overflow:hidden; overscroll-behavior:none; }
dialog.msheet::backdrop { background:rgba(10,14,28,.46); opacity:var(--bd, 1); transition:opacity .22s var(--ease); }
:root[data-theme="dark"]:not([data-tone="navy"]) dialog.msheet::backdrop { background:rgba(0,0,0,.6); }
dialog.msheet.dragging::backdrop { transition:none; }
dialog.msheet.closing::backdrop { opacity:0; }
@keyframes sheet-up { from { transform:translateY(40px); opacity:.4; } to { transform:none; opacity:1; } }
.msheet-grip { position:relative; width:40px; height:5px; border-radius:3px; background:var(--line); margin:2px auto 10px; }
.msheet-grip::after { content:""; position:absolute; inset:-14px -60px; }  /* за полоску удобно взяться пальцем */
:root[data-theme="dark"]:not([data-tone="navy"]) .msheet-grip { background:#5a5a5e; }
dialog.msheet h3 { font-size:18px; font-weight:650; margin:4px 2px 14px; }
.msheet-grid { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px; }
.msheet-tile { display:flex; flex-direction:column; align-items:center; gap:8px; padding:16px 6px 14px; border:1px solid var(--line); border-radius:16px;
  background:var(--card-2); color:var(--fg) !important; text-decoration:none !important; font-size:13.5px; font-weight:600; text-align:center; }
.msheet-tile svg { width:25px; height:25px; fill:none; stroke:var(--action); stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.msheet-tile.active { border-color:var(--action); background:var(--action-soft); }
.malert { display:flex; align-items:center; gap:12px; padding:12px; margin-bottom:8px; border-radius:14px; background:var(--card-2);
  border:1px solid var(--line-2); color:var(--fg) !important; text-decoration:none !important; }
.malert-ico { width:28px; height:28px; flex:none; border-radius:50%; display:grid; place-items:center; font-weight:750; font-size:14px;
  background:var(--action-soft); color:var(--action); }
.malert.warn .malert-ico { background:#fdf1d8; color:#9a6400; }
:root[data-theme="dark"] .malert.warn .malert-ico { background:#3a2a0c; color:var(--amber); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .malert.warn .malert-ico { background:#3a2a0c; color:var(--amber); } }
.malert-text { flex:1; min-width:0; }
.malert-text b { display:block; font-size:14.5px; font-weight:600; line-height:1.3; }
.malert-text small { display:block; color:var(--muted); font-size:12.5px; line-height:1.35; margin-top:2px; }
.malert-go { font-size:22px; line-height:1; color:var(--muted); padding-left:2px; }
.msheet-empty { color:var(--muted); padding:8px 2px 14px; margin:0; }
.mme-head { display:flex; align-items:center; gap:12px; padding:4px 2px 14px; }
.mme-head b { display:block; font-size:17px; font-weight:650; }
.mme-head small { display:block; color:var(--muted); font-size:13px; }
.mme-label { font-size:12px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin:16px 2px 6px; }
dialog.msheet form { margin:0; }
.mme-row { display:flex; align-items:center; gap:12px; width:100%; padding:13px 4px; border:0; border-top:1px solid var(--line-2); background:none;
  color:var(--fg) !important; font:500 15px var(--ui); text-align:left; text-decoration:none !important; cursor:pointer; }
.mme-row svg { width:21px; height:21px; flex:none; fill:none; stroke:var(--muted); stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.mme-row .chev { margin-left:auto; color:var(--muted); font-size:18px; }
.mme-row .badge { margin-left:auto; }
.mme-row.danger { color:var(--err) !important; margin-top:12px; }
.mme-row.danger svg { stroke:var(--err); }
.mme-co { width:28px; height:28px; flex:none; border-radius:8px; display:grid; place-items:center; background:var(--action-soft); color:var(--action);
  font-weight:700; font-size:13px; }
.mme-theme { display:flex; width:100%; }
.mme-theme button { flex:1; padding:9px 4px; font-size:13.5px; white-space:nowrap; }

/* ---------- сводка продаж ---------- */
.sd { margin:0 0 24px; --ax:46px; }
.sd-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.sd-title { margin:0; font-size:19px; }
.sd-seg { display:inline-flex; gap:2px; padding:3px; border-radius:12px; background:var(--card-2); border:1px solid var(--line); }
.sd-seg button { border:0; background:transparent; padding:7px 16px; border-radius:9px; font:600 14px var(--ui); color:var(--muted); cursor:pointer;
  -webkit-tap-highlight-color:transparent; }
.sd-seg button[aria-selected="true"] { background:var(--card); color:var(--fg); box-shadow:0 1px 3px rgba(16,23,42,.16); }
.sd-panel { display:none; }
.sd[data-p="day"] .sd-panel[data-p="day"], .sd[data-p="week"] .sd-panel[data-p="week"], .sd[data-p="month"] .sd-panel[data-p="month"] {
  display:flex; flex-direction:column; flex:1; animation:rise .22s var(--ease) both; }
.sd.loading { opacity:.55; transition:opacity .15s; pointer-events:none; }
.sd-tiles { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; }
.sd-tile { display:flex; flex-direction:column; align-items:flex-start; gap:3px; min-width:0; padding:14px 15px 12px; text-align:left; cursor:pointer;
  background:var(--card); border:1px solid var(--line); border-radius:14px; color:var(--fg); font:inherit; box-shadow:var(--shadow);
  transition:border-color .15s, box-shadow .15s; -webkit-tap-highlight-color:transparent; }
.sd-tile-title { font-size:12.5px; font-weight:500; color:var(--muted); }
.sd-tile-value { font-size:25px; font-weight:650; letter-spacing:-.015em; line-height:1.2; font-variant-numeric:proportional-nums;
  max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sd-tile-delta { font-size:12px; line-height:1.35; color:var(--muted); display:flex; flex-wrap:wrap; column-gap:6px; }
.sd-tile-delta .up { color:var(--ok); font-weight:650; } .sd-tile-delta .down { color:var(--err); font-weight:650; }
.sd-card { display:flex; flex-direction:column; margin-top:12px; padding:14px 16px 12px; background:var(--card); border:1px solid var(--line);
  border-radius:14px; box-shadow:var(--shadow); }
.sd-chart-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.sd-chart-title { min-width:0; }
.sd-chart-title b { display:block; font-size:14.5px; font-weight:650; }
.sd-legend { display:flex; align-items:center; flex-wrap:wrap; gap:5px; margin-top:3px; font-size:11.5px; color:var(--muted); }
.sd-legend i { display:inline-block; flex:none; }
.sd-legend .lg-cur { width:8px; height:10px; border-radius:2px 2px 0 0; background:var(--action); }
.sd-legend .lg-prev { width:3px; height:10px; border-radius:2px 2px 0 0; background:var(--sd-ghost); margin-left:7px; }
.sd-range { font-size:12.5px; color:var(--muted); white-space:nowrap; }
/* канал продаж: все, накладные или одна точка */
.sd-ch { position:relative; flex:none; }
.sd-ch-btn { display:flex; align-items:center; gap:4px; max-width:46vw; padding:6px 8px 6px 11px; border-radius:10px; border:1px solid var(--line);
  background:var(--card-2); color:var(--fg); font:600 13px var(--ui); cursor:pointer; -webkit-tap-highlight-color:transparent; }
.sd-ch-btn span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sd-ch-btn svg { width:16px; height:16px; flex:none; fill:none; stroke:var(--muted); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.sd-ch-menu { position:absolute; right:0; top:calc(100% + 6px); z-index:20; min-width:190px; max-width:80vw; padding:6px; border-radius:14px;
  background:var(--card); border:1px solid var(--line); box-shadow:0 18px 40px -12px rgba(10,14,28,.35); }
.sd-ch-menu button { display:flex; align-items:center; gap:8px; width:100%; padding:10px 10px; border:0; border-radius:9px; background:none;
  color:var(--fg); font:500 14px var(--ui); text-align:left; cursor:pointer; }
.sd-ch-menu button::before { content:""; width:16px; flex:none; text-align:center; color:var(--action); font-weight:700; }
.sd-ch-menu button[aria-selected="true"] { font-weight:650; }
.sd-ch-menu button[aria-selected="true"]::before { content:"✓"; }
.sd-ch-menu button:active, .sd-ch-menu button:hover { background:var(--card-2); }
/* график: слева шкала с круглыми значениями, пунктирные линии; серый тонкий столбик — прошлый период, синий — текущий */
.sd { --sd-ghost:rgba(97,108,132,.30); }
:root[data-theme="dark"] .sd { --sd-ghost:rgba(150,162,190,.30); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sd { --sd-ghost:rgba(150,162,190,.30); } }
/* чёрная тема: серые без синевы, переключатель периода — как в iPhone */
:root[data-theme="dark"]:not([data-tone="navy"]) .sd { --sd-ghost:rgba(152,152,159,.36); }
:root[data-theme="dark"]:not([data-tone="navy"]) .sd-seg { background:var(--card); }
:root[data-theme="dark"]:not([data-tone="navy"]) .sd-seg button[aria-selected="true"] { background:#636366; color:#fff; box-shadow:0 1px 3px rgba(0,0,0,.4); }
.sd-plot { position:relative; height:250px; margin-top:16px; }
.sd-y { position:absolute; left:0; top:0; bottom:0; width:var(--ax); }
.sd-y span { position:absolute; right:8px; transform:translateY(50%); font-size:10.5px; line-height:1; color:var(--muted); white-space:nowrap;
  font-variant-numeric:tabular-nums; }
.sd-gl { position:absolute; left:var(--ax); right:0; top:0; bottom:0; pointer-events:none; }
.sd-gl i { position:absolute; left:0; right:0; height:0; border-top:1px dashed var(--line); }
.sd-gl i.z { border-top:1px solid var(--line); }
.sd-empty { position:absolute; left:var(--ax); right:0; top:0; bottom:0; display:grid; place-items:center; color:var(--muted); font-size:13.5px;
  pointer-events:none; }
.sd-cols { position:absolute; left:var(--ax); right:0; top:0; bottom:0; display:grid; grid-template-columns:repeat(var(--n), minmax(0, 1fr)); }
.sd-col { position:relative; height:100%; cursor:pointer; --bw:min(54%, 22px); --gw:max(2px, calc(var(--bw) * .3));
  -webkit-tap-highlight-color:transparent; }
.sd-ghost, .sd-bar { position:absolute; bottom:0; height:0; transition:height .35s var(--ease), bottom .35s var(--ease), background .15s; }
.sd-ghost { width:var(--gw); left:calc(50% - (var(--gw) + 2px + var(--bw)) / 2); border-radius:2px 2px 0 0; background:var(--sd-ghost); }
.sd-bar { width:var(--bw); left:calc(50% - (var(--gw) + 2px + var(--bw)) / 2 + var(--gw) + 2px); border-radius:4px 4px 0 0; background:var(--action); }
.sd-col.on .sd-bar { background:var(--action-h); }
.sd-col.on .sd-ghost { background:var(--muted); opacity:.55; }
@media (hover:hover) { .sd-col:hover .sd-bar { background:var(--action-h); } .sd-col:hover .sd-ghost { background:var(--muted); opacity:.55; } }
.sd-tip { position:absolute; z-index:3; padding:6px 9px; border-radius:9px; background:#10172a; color:#fff; font-size:12px; line-height:1.35;
  white-space:nowrap; pointer-events:none; transform:translate(-50%, calc(-100% - 8px)); box-shadow:0 8px 20px -8px rgba(10,14,28,.5); }
.sd-tip b { font-weight:650; } .sd-tip span { opacity:.75; }
:root[data-theme="dark"] .sd-tip { background:#e8ecf6; color:#10172a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sd-tip { background:#e8ecf6; color:#10172a; } }
:root[data-theme="dark"]:not([data-tone="navy"]) .sd-tip { background:#f2f2f7; color:#000; }
.sd-x { display:grid; grid-template-columns:repeat(var(--n), minmax(0, 1fr)); margin:8px 0 0 var(--ax); font-size:11px; color:var(--muted);
  font-variant-numeric:tabular-nums; }
.sd-x span { text-align:center; white-space:nowrap; overflow:visible; }
.sd-x span.now { color:var(--fg); font-weight:700; }
/* какой показатель на графике: выбранная плитка подсвечена, остальное прячется */
.sd:not([data-m="revenue"]) [data-mv="revenue"], .sd:not([data-m="count"]) [data-mv="count"], .sd:not([data-m="items"]) [data-mv="items"],
.sd:not([data-m="profit"]) [data-mv="profit"], .sd:not([data-m="avg"]) [data-mv="avg"] { display:none; }
.sd[data-m="revenue"] .sd-tile[data-sd-m="revenue"], .sd[data-m="count"] .sd-tile[data-sd-m="count"], .sd[data-m="items"] .sd-tile[data-sd-m="items"],
.sd[data-m="profit"] .sd-tile[data-sd-m="profit"], .sd[data-m="avg"] .sd-tile[data-sd-m="avg"] { border-color:var(--action); box-shadow:inset 0 0 0 1px var(--action), var(--shadow); }
.sd[data-m="revenue"] .sd-bar { height:var(--h-revenue, 0%); bottom:var(--b-revenue, 0%); } .sd[data-m="revenue"] .sd-ghost { height:var(--gh-revenue, 0%); bottom:var(--gb-revenue, 0%); }
.sd[data-m="count"] .sd-bar { height:var(--h-count, 0%); bottom:var(--b-count, 0%); } .sd[data-m="count"] .sd-ghost { height:var(--gh-count, 0%); bottom:var(--gb-count, 0%); }
.sd[data-m="items"] .sd-bar { height:var(--h-items, 0%); bottom:var(--b-items, 0%); } .sd[data-m="items"] .sd-ghost { height:var(--gh-items, 0%); bottom:var(--gb-items, 0%); }
.sd[data-m="profit"] .sd-bar { height:var(--h-profit, 0%); bottom:var(--b-profit, 0%); } .sd[data-m="profit"] .sd-ghost { height:var(--gh-profit, 0%); bottom:var(--gb-profit, 0%); }
.sd[data-m="avg"] .sd-bar { height:var(--h-avg, 0%); bottom:var(--b-avg, 0%); } .sd[data-m="avg"] .sd-ghost { height:var(--gh-avg, 0%); bottom:var(--gb-avg, 0%); }
.sd[data-m="revenue"] .sd-bar.neg-revenue, .sd[data-m="count"] .sd-bar.neg-count, .sd[data-m="items"] .sd-bar.neg-items,
.sd[data-m="profit"] .sd-bar.neg-profit, .sd[data-m="avg"] .sd-bar.neg-avg { background:var(--err); border-radius:0 0 4px 4px; }

@media (max-width:820px) {
  /* телефон: сводка занимает экран целиком — график растягивается до низа, без пустого места */
  .sd { display:flex; flex-direction:column; margin-bottom:0; --ax:40px;
    min-height:calc(100vh - 176px); min-height:calc(100svh - 176px); }
  .sd-head { margin-bottom:12px; }
  .sd-title { display:none; }
  .sd-seg { display:flex; width:100%; }
  .sd-seg button { flex:1; padding:8px 6px; }
  .sd-tiles { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
  .sd-tile { padding:12px 13px 11px; border-radius:16px; }
  .sd-tile-value { font-size:21px; }
  .sd-card { flex:1; padding:13px 12px 10px; border-radius:16px; }
  .sd-plot { flex:1; height:auto; min-height:190px; }
  .sd-x { font-size:10.5px; }
  .sd-col { --bw:min(56%, 18px); }
}
/* ---------- отклик на нажатие ----------
   Кнопка на миг чуть уменьшается и темнеет (в тёмных темах — светлеет): видно, что касание прошло.
   Класс is-pressed ставит shell.js и держит его не меньше 0,14 с — иначе быстрый тап на телефоне не успевает отрисоваться. */
.sd-tile, .sd-seg button, .sd-ch-btn, .sd-ch-menu button, .mtab, .mtop-btn, .mtop-me, .msheet-tile, .malert, .mme-row, [data-theme-seg] button {
  transition:transform .14s var(--ease), filter .14s, background-color .15s, border-color .15s, box-shadow .15s, color .15s; }
:root { --press:.92; }
:root[data-theme="dark"] { --press:1.45; }
.is-pressed { transform:scale(.965); filter:brightness(var(--press)); }
.malert.is-pressed, .msheet-tile.is-pressed { transform:scale(.975); }
.sd-seg button.is-pressed, [data-theme-seg] button.is-pressed { transform:scale(.94); }
.sd-seg button.is-pressed:not([aria-selected="true"]), [data-theme-seg] button.is-pressed:not(.on) { background:color-mix(in srgb, var(--fg) 9%, transparent); filter:none; }
.mtab.is-pressed, .mtop-btn.is-pressed { transform:scale(.92); filter:none; background:var(--ink-2); }
.mtop-me.is-pressed { transform:scale(.9); filter:brightness(1.3); }
.mme-row.is-pressed, .sd-ch-menu button.is-pressed { transform:none; filter:none; background:var(--card-2); }
.mme-row { border-radius:10px; }
@media (prefers-reduced-motion: reduce) { .sd-bar, .sd-ghost { transition:none; } dialog.msheet[open] { animation:none; } .is-pressed { transform:none !important; } }
