/* Панель магазина TECH-TM. Три темы: светлая (по умолчанию), тёмная, цветная. */
@font-face { font-family: "Exo 2"; font-weight: 400 900; font-display: swap; src: url(/fonts/exo2-cyr.woff2) format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Exo 2"; font-weight: 400 900; font-display: swap; src: url(/fonts/exo2-latext.woff2) format("woff2"); unicode-range: U+0100-02AF, U+1E00-1EFF, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Exo 2"; font-weight: 400 900; font-display: swap; src: url(/fonts/exo2-lat.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root, [data-theme="light"] {
  --bg: #F4F5F9; --panel: #FFFFFF; --panel-2: #F7F8FB; --line: #E5E8EF; --text: #1C2130; --muted: #6B7385;
  --accent: #EF7F1A; --accent-ink: #FFFFFF; --accent-soft: #FFF1E3; --accent-text: #C25F06;
  --side: #FFFFFF; --side-text: #3A4152; --side-muted: #8A91A1; --side-on: #FFF1E3; --side-on-text: #C25F06; --side-line: #ECEEF3;
  --new: #EF7F1A; --new-bg: #FFF1E3; --work: #2F6FEB; --work-bg: #E8F0FE; --done: #1E9E5A; --done-bg: #E5F6EC; --off: #7A8191; --off-bg: #EEF0F4;
  --warn: #D9480F; --ok-bg: #E5F6EC; --ok: #146C3E; --err-bg: #FDECEC; --err: #B42318;
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 6px 20px rgba(20, 24, 40, .06);
  --page-bg: var(--bg); color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0F1217; --panel: #171B22; --panel-2: #1C212A; --line: #262C36; --text: #E8EBF1; --muted: #8E97A8;
  --accent: #F5973A; --accent-ink: #1A1207; --accent-soft: rgba(245, 151, 58, .14); --accent-text: #F7AD62;
  --side: #12151B; --side-text: #C9CFDA; --side-muted: #7D8697; --side-on: rgba(245, 151, 58, .14); --side-on-text: #F7AD62; --side-line: #20252E;
  --new: #F5973A; --new-bg: rgba(245, 151, 58, .15); --work: #6EA2FF; --work-bg: rgba(110, 162, 255, .14); --done: #4CC987; --done-bg: rgba(76, 201, 135, .14); --off: #8E97A8; --off-bg: rgba(142, 151, 168, .14);
  --warn: #FF8A5B; --ok-bg: rgba(76, 201, 135, .14); --ok: #7FDDA9; --err-bg: rgba(255, 99, 99, .14); --err: #FF9C9C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --page-bg: var(--bg); color-scheme: dark;
}
[data-theme="color"] {
  --bg: #F3F1FF; --panel: #FFFFFF; --panel-2: #F8F6FF; --line: #E6E1FA; --text: #1E1B3A; --muted: #6E6A8F;
  --accent: #FF6B2C; --accent-ink: #FFFFFF; --accent-soft: #FFEDE4; --accent-text: #D9480F;
  --side: linear-gradient(170deg, #4F46E5 0%, #7C3AED 55%, #C026D3 100%); --side-text: #F1EEFF; --side-muted: #CFC7FF; --side-on: rgba(255, 255, 255, .2); --side-on-text: #FFFFFF; --side-line: rgba(255, 255, 255, .18);
  --new: #FF6B2C; --new-bg: #FFEDE4; --work: #4F46E5; --work-bg: #ECEBFF; --done: #0EA371; --done-bg: #E2F8EF; --off: #7C7897; --off-bg: #EFEDF7;
  --warn: #E8590C; --ok-bg: #E2F8EF; --ok: #0B7A55; --err-bg: #FFE8EC; --err: #C2185B;
  --shadow: 0 1px 2px rgba(60, 40, 140, .06), 0 8px 24px rgba(79, 70, 229, .10);
  --page-bg: radial-gradient(1200px 600px at 100% -10%, #FFE6F4 0%, transparent 60%), radial-gradient(900px 500px at 30% 110%, #E3F6FF 0%, transparent 60%), #F3F1FF;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--page-bg); background-attachment: fixed; color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3, .brand b, .auth-brand b, .stat b { font-family: "Exo 2", system-ui, sans-serif; }
h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.3px; }
h2 { margin: 0; font-size: 18px; font-weight: 700; }
a { color: inherit; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 15px; height: 15px; }
[hidden] { display: none !important; }

/* Кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid transparent; font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer; text-decoration: none; transition: filter .15s, background .15s; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--panel); border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.big { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn .ic { width: 18px; height: 18px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--side-muted); cursor: pointer; }
.icon-btn:hover { background: var(--side-on); color: var(--side-on-text); }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form { display: grid; gap: 16px; }
.form fieldset { display: grid; gap: 16px; border: 0; padding: 0; margin: 0; min-width: 0; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.form label.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); font-weight: 500; }
.form label.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.w-price { max-width: 220px; }
.note { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.note.ok { background: var(--ok-bg); color: var(--ok); } .note.err { background: var(--err-bg); color: var(--err); }

/* Каркас: меню слева, на телефоне — снизу */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 20px 14px; background: var(--side); color: var(--side-text); border-right: 1px solid var(--side-line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; text-decoration: none; }
.brand b { display: block; font-size: 18px; letter-spacing: .3px; } .brand small { display: block; font-size: 12px; color: var(--side-muted); }
.nav { display: grid; gap: 4px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; text-decoration: none; font-weight: 600; color: var(--side-text); transition: background .15s; }
.nav a:hover { background: var(--side-on); }
.nav a.on { background: var(--side-on); color: var(--side-on-text); }
.badge { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; display: grid; place-items: center; font: 700 12px/1 system-ui, sans-serif; font-style: normal; background: var(--accent); color: var(--accent-ink); }
.side-foot { margin-top: auto; display: grid; gap: 14px; }
.themes { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--side-on); width: max-content; }
.themes button { display: grid; place-items: center; width: 36px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: var(--side-muted); cursor: pointer; }
.themes button .ic { width: 18px; height: 18px; }
.themes button.on { background: var(--panel); color: var(--accent); box-shadow: var(--shadow); }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0 8px; border-top: 1px solid var(--side-line); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.me-t { flex: 1; min-width: 0; } .me-t b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .me-t small { color: var(--side-muted); font-size: 12px; }
.main { padding: 32px 40px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 22px; }
.page-head .muted { margin: 0; }
.link { color: var(--accent-text); text-decoration: none; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.empty { color: var(--muted); padding: 10px 0; } .empty.big { padding: 40px 20px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: 16px; }
.toast { position: fixed; right: 20px; bottom: 20px; padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow); z-index: 20; }

/* Сводка */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { display: grid; gap: 2px; padding: 18px 20px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 32px; font-weight: 800; line-height: 1.15; } .stat b i { font-style: normal; font-size: 15px; color: var(--muted); font-weight: 600; }
.stat small { color: var(--muted); font-size: 12.5px; }
.stat.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stat.accent span, .stat.accent small { color: inherit; opacity: .85; }
a.stat:hover { filter: brightness(1.03); }
[data-theme="color"] .stat:nth-child(2) { background: linear-gradient(135deg, #EEF0FF, #FFFFFF); }
[data-theme="color"] .stat:nth-child(3) { background: linear-gradient(135deg, #E6F8FF, #FFFFFF); }
[data-theme="color"] .stat:nth-child(4) { background: linear-gradient(135deg, #E8FBF2, #FFFFFF); }
[data-theme="color"] .stat.accent { background: linear-gradient(135deg, #FF6B2C, #FF3D7F); border: 0; }
.cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.mini-order { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); text-decoration: none; }
.mini-order:first-of-type { border-top: 0; }
.mini-order:hover .mo-main b { color: var(--accent-text); }
.mo-main { flex: 1; min-width: 0; display: grid; } .mo-main small { font-size: 12.5px; }
.mo-sum { font-weight: 700; white-space: nowrap; }
.checks, .top { list-style: none; margin: 0; padding: 0; }
.checks li, .top li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks a { color: var(--accent-text); text-decoration: none; } .checks b.warn { color: var(--warn); }
.sub { margin: 20px 0 4px; font-size: 14px; color: var(--muted); font-weight: 700; }
.top { counter-reset: t; } .top li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Статусы */
.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill.new { background: var(--new-bg); color: var(--new); } .pill.work { background: var(--work-bg); color: var(--work); }
.pill.done { background: var(--done-bg); color: var(--done); } .pill.off { background: var(--off-bg); color: var(--off); }

/* Заявки */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 2px; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tabs a em { font-style: normal; font-size: 12px; padding: 2px 7px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.tabs a.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.tabs a.on em { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.orders { display: grid; gap: 14px; }
.order { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--off); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); scroll-margin-top: 20px; }
.order.st-new { border-left-color: var(--new); } .order.st-confirmed { border-left-color: var(--work); } .order.st-done { border-left-color: var(--done); }
.order:target { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.order-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.order-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.order-total { margin-left: auto; font-size: 20px; font-weight: 800; } .order-total small { font-size: 13px; color: var(--muted); font-weight: 600; }
.order-who { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 8px; }
.who-name { font-size: 17px; font-weight: 700; }
.phone { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); text-decoration: none; font-weight: 700; }
.phone .ic { width: 16px; height: 16px; }
.order-items { list-style: none; margin: 0; padding: 0; border-top: 1px dashed var(--line); }
.order-items li { display: grid; grid-template-columns: minmax(0, 1fr) auto 90px; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.order-items li span:last-child { text-align: right; font-weight: 600; }
.order-comment { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); font-size: 14px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.order-actions form { margin: 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; }

/* Товары */
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 220px 220px auto; gap: 10px; margin-bottom: 16px; }
.search { position: relative; } .search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 40px; }
.plist { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 120px 80px 56px; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; }
.prow:hover { background: var(--panel-2); }
.prow.off .prow-main { opacity: .55; }
.prow-main { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.prow-main img, .noimg { width: 48px; height: 48px; flex: none; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.noimg { display: grid; place-items: center; color: var(--muted); background: var(--panel-2); }
.noimg.big { width: 100%; height: 220px; } .noimg.big .ic { width: 40px; height: 40px; }
.prow-t { min-width: 0; display: grid; } .prow-t b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-t small { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-main:hover b { color: var(--accent-text); }
.prow-price { text-align: right; font-weight: 700; white-space: nowrap; } .prow-price small { color: var(--muted); font-weight: 600; font-size: 12px; }
.prow-qty { text-align: right; font-size: 14px; white-space: nowrap; }
.warn-t { color: var(--warn); font-style: normal; font-weight: 600; }
.site-toggle { margin: 0; justify-self: end; }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--done); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.back:hover { color: var(--accent-text); }
.h-prod { font-size: 24px; }
.prod { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.prod-img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.facts { margin: 14px 0 0; display: grid; gap: 0; }
.facts div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; text-align: right; }
.form-foot { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }

/* Вход */
.auth { display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card .form { margin: 18px 0 14px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand b { display: block; font-size: 19px; } .auth-brand small { color: var(--muted); font-size: 12.5px; }
.code-input { font: 700 26px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 10px; text-align: center; }
.auth-themes { display: flex; margin: 22px auto 0; background: var(--panel-2); }
.auth-themes button { color: var(--muted); }

/* Планшет и телефон */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } .cols { grid-template-columns: 1fr; } .toolbar { grid-template-columns: minmax(0, 1fr) 1fr; } .toolbar .search { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .app { display: block; padding-bottom: 76px; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--side-line); }
  .brand { padding: 0; } .brand small { display: none; }
  .side-foot { margin: 0; display: flex; align-items: center; gap: 8px; }
  .me { border: 0; padding: 0; } .me-t, .avatar { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(0,0,0,.06); }
  .nav a { flex-direction: column; gap: 3px; padding: 7px 4px; font-size: 12px; color: var(--muted); border-radius: 10px; }
  .nav a:hover { background: transparent; }
  .nav a.on { background: var(--accent-soft); color: var(--accent-text); }
  .nav .badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 20px; height: 20px; font-size: 11px; }
  [data-theme="color"] .nav { background: #fff; }
  .main { padding: 20px 16px 30px; }
  h1 { font-size: 24px; }
  .prod { grid-template-columns: 1fr; }
  .prod-side { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: start; }
  .prod-side .facts { margin: 0; } .noimg.big { height: 120px; }
  .prow { grid-template-columns: minmax(0, 1fr) auto 50px; padding: 10px 12px; }
  .prow-qty { display: none; }
  .toast { left: 16px; right: 16px; bottom: 86px; text-align: center; }
}
@media (max-width: 520px) {
  .stats { gap: 10px; } .stat { padding: 14px; } .stat b { font-size: 26px; }
  .toolbar { grid-template-columns: 1fr 1fr; } .toolbar .btn { grid-column: 1 / -1; }
  .order { padding: 14px 14px; } .order-total { font-size: 18px; }
  .order-items li { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; } .order-items li span:first-child { grid-column: 1 / -1; } .order-items li span:last-child { text-align: right; }
  .order-actions .btn { min-height: 46px; } .order-actions form { flex: 1; } .order-actions .btn { width: 100%; }
  .prow-main img, .prow-main .noimg { width: 42px; height: 42px; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
