/* Демо повторяет окно программы (app/ui/style.py): графит, бумажный белый, оранжевый акцент,
   таблицы с тёмной шапкой. На компьютере страница занимает весь экран, как окно;
   на телефоне разделы идут сверху вниз, а строки таблиц становятся карточками. */
:root {
  --bg: #17181a; --bar: #0f1011; --panel: #202225; --field: #2a2c30; --line: #3a3d42; --line2: #4a4e54;
  --text: #ebe8e1; --muted: #9b978e; --accent: #e8892b; --accent-hover: #f39a3d; --on-accent: #17181a;
  --danger: #d0574a; --ok: #7fae5b; --sel: #3a3024;
  --head: "Bahnschrift SemiBold Condensed", "Bahnschrift Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body: "Bahnschrift", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.3 var(--body); padding-bottom: env(safe-area-inset-bottom, 0px); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--head); font-weight: 400; margin: 0; letter-spacing: 1px; }
h1 { font-size: 26px; }
h2 { font-size: 19px; padding-left: 10px; border-left: 4px solid var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

.notice { display: flex; flex-wrap: wrap; gap: 2px 16px; align-items: center; justify-content: space-between; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 13px;
  padding: 3px max(14px, env(safe-area-inset-right, 0px)) 3px max(14px, env(safe-area-inset-left, 0px)); }
.notice a { color: inherit; white-space: nowrap; }
.top { display: flex; flex-wrap: wrap; gap: 4px 26px; align-items: center; background: var(--bar); border-bottom: 3px solid var(--accent);
  padding: 7px max(14px, env(safe-area-inset-right, 0px)) 0 max(14px, env(safe-area-inset-left, 0px)); }
.org { display: flex; gap: 12px; align-items: center; padding-bottom: 7px; text-decoration: none; color: var(--text); }
.org img { height: 50px; width: 50px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
.org b { display: block; font-family: var(--head); font-weight: 400; font-size: 27px; letter-spacing: 2px; line-height: 1; }
.org small { display: block; color: var(--muted); font-size: 10.5px; letter-spacing: 3px; margin-top: 3px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1 1 320px; min-width: 0; scrollbar-width: none; align-self: flex-end; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 18px 12px; white-space: nowrap; color: var(--muted); font-family: var(--head); font-size: 19px; letter-spacing: 2px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.top .settings { margin-bottom: 7px; }

main { padding-block: 12px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
.brandline { text-align: right; color: var(--muted); font-size: 11px; letter-spacing: 1.5px; padding: 3px 14px; background: var(--bar); }

.btn { background: var(--panel); border: 1px solid var(--line2); border-radius: 3px; padding: 7px 13px; font-family: var(--head); font-size: 15.5px; letter-spacing: 1px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.main { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.main:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .45; cursor: default; }
.seg { display: inline-flex; }
.seg button { background: none; border: 1px solid var(--line); margin-left: -1px; padding: 6px 9px; color: var(--muted); font-family: var(--head); font-size: 14.5px; letter-spacing: .8px; border-bottom-width: 1px; }
.seg button.on { color: var(--text); border-bottom: 3px solid var(--accent); padding-bottom: 4px; }
.x { background: none; border: 0; color: var(--muted); font-size: 17px; padding: 2px 8px; }
.x:hover { color: var(--danger); }

input, select, textarea { background: var(--field); border: 1px solid var(--line); border-radius: 3px; padding: 6px 8px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 0; }
input:disabled, textarea:disabled, select:disabled { color: var(--muted); }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
textarea { resize: vertical; min-height: 52px; display: block; }
label.f { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 12px; letter-spacing: .5px; min-width: 0; text-transform: uppercase; }
label.f > * { color: var(--text); font-size: 14.5px; letter-spacing: 0; text-transform: none; }
.check { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); white-space: nowrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px; }
.card-head { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 200px; min-width: 0; }

/* таблицы как в программе */
.tw { overflow: auto; border: 1px solid var(--line); min-width: 0; }
table { border-collapse: collapse; width: 100%; }
th { position: sticky; top: 0; z-index: 1; background: var(--field); color: var(--muted); font-family: var(--head); font-weight: 400; font-size: 13px; letter-spacing: .8px; text-align: center; padding: 7px 8px; border-bottom: 2px solid var(--line2); border-right: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 9px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: middle; }
td.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.c { text-align: center; }
td.b { font-weight: 700; }
td.free { font-weight: 700; color: var(--ok); }
td.low { font-weight: 700; color: var(--danger); }
tr.go { cursor: pointer; }
tr.go:hover td { background: #26282c; }
tr.on td { background: var(--sel); }
tr.total td { font-weight: 700; }
td.ell { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt td { padding: 2px 4px; }
.lt td.c, .lt td.r { padding: 2px 8px; }
.lt input, .lt select { background: transparent; border-color: transparent; padding: 5px 6px; }
.lt input:hover, .lt select:hover { border-color: var(--line); }
.lt input:focus { background: var(--field); border-color: var(--accent); }
.lt input.n { text-align: right; font-variant-numeric: tabular-nums; }
.lt .empty { color: var(--muted); text-align: center; padding: 11px; }
.lt .pname { padding-left: 8px; }

/* наряды */
.orders { display: grid; grid-template-columns: 284px minmax(0, 1fr); gap: 14px; }
.side { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.side > .btn { padding: 11px; font-size: 16px; }
.seg2 { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.seg2 button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 6px; color: var(--muted); font-family: var(--head); letter-spacing: 1px; }
.seg2 button.on { color: var(--text); border-bottom-color: var(--accent); }
.olist { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; }
.oitem { display: block; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line2); border-radius: 3px; padding: 6px 10px; }
.oitem:hover { border-color: var(--line2); }
.oitem.on { background: var(--sel); border-color: var(--accent); border-left-color: var(--accent); }
.oitem b { display: block; font-family: var(--head); font-weight: 400; font-size: 20px; letter-spacing: .5px; }
.orow { display: flex; justify-content: space-between; gap: 8px; }
.owork { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.ohead { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.badge { border: 1px solid var(--accent); color: var(--accent); border-radius: 3px; padding: 5px 11px; font-family: var(--head); letter-spacing: 1px; }
.badge.done { border-color: var(--ok); color: var(--ok); }
.oscroll { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; padding-right: 4px; }
.g12 { display: grid; gap: 6px 14px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s6 { grid-column: span 6; } .s9 { grid-column: span 9; } .s12 { grid-column: span 12; }
.fill-hint { color: var(--ok) !important; }
.addrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ac { position: relative; flex: 1 1 240px; min-width: 0; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: var(--field); border: 1px solid var(--accent); max-height: 280px; overflow-y: auto; }
.ac-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; background: none; border: 0; padding: 7px 9px; }
.ac-item.on, .ac-item:hover { background: var(--line); }
.ac-item span:last-child { color: var(--muted); white-space: nowrap; }
.related { margin-top: 8px; border: 1px dashed var(--accent); border-radius: 3px; padding: 8px 12px; }
.related b { font-family: var(--head); font-weight: 400; font-size: 16px; letter-spacing: .5px; }
.related label { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.related .addrow { margin-top: 5px; }
.totals { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; justify-content: space-between; background: var(--bar); border-top: 3px solid var(--line); padding: 10px 14px; }
.totals dl { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; align-items: flex-end; }
.totals dt { color: var(--muted); font-size: 12px; letter-spacing: .5px; text-transform: uppercase; }
.totals dd { margin: 3px 0 0; font-weight: 700; font-size: 16px; }
.disc { display: flex; gap: 4px; }
.disc input { width: 84px; font-weight: 400; } .disc select { width: 58px; font-weight: 400; }
.pay { border: 2px solid var(--accent); border-radius: 4px; padding: 5px 16px; min-width: 190px; text-align: right; }
.pay small { display: block; text-align: left; color: var(--muted); letter-spacing: 1.5px; font-size: 12px; }
.pay strong { font-family: var(--head); font-weight: 400; font-size: 34px; color: var(--accent); }
.acts { display: grid; grid-template-columns: repeat(6, auto); gap: 6px; }
.acts .a2 { grid-column: span 2; } .acts .a3 { grid-column: span 3; } .acts .a4 { grid-column: span 4; }
.menu { position: relative; }
.menu-list { position: absolute; z-index: 30; right: 0; top: 100%; width: 330px; max-width: 80vw; background: var(--field); border: 1px solid var(--line2); }
.menu-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; }
.menu-list button:hover { background: var(--line); }
.tryit { display: flex; gap: 6px 14px; align-items: baseline; justify-content: space-between; border-left: 4px solid var(--accent); background: var(--panel); padding: 5px 10px; font-size: 13.5px; flex: none; }
.tryit code { font-family: inherit; color: var(--accent); font-weight: 700; }

/* плитки */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; flex: none; }
.tile { display: block; text-align: left; width: 100%; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--line2); border-radius: 4px; padding: 7px 15px; min-width: 0; }
button.tile:hover { border-color: var(--accent); }
.tile span { display: block; color: var(--muted); font-size: 12.5px; letter-spacing: .5px; text-transform: uppercase; }
.tile strong { display: block; font-family: var(--head); font-weight: 400; font-size: 29px; line-height: 1.15; }
.tile small { display: block; color: var(--muted); font-size: 12px; }
.tile.hot strong { color: var(--accent); }

/* склад, клиенты, отчёты */
.split { display: grid; gap: 12px; min-height: 0; }
.stock-split { grid-template-columns: minmax(0, 1fr) 360px; }
.client-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.icard { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: hidden; }
.ifacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px 10px; }
.ifacts span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.ifacts b { font-family: var(--head); font-weight: 400; font-size: 19px; }
.ifacts b.ok { color: var(--ok); }
.btns3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.btns3 { grid-template-columns: minmax(0, .85fr) minmax(0, .85fr) minmax(0, 1.3fr); }
.btns3 .btn { padding-inline: 4px; font-size: 14px; letter-spacing: .3px; overflow: hidden; }
.lab { color: var(--muted); font-size: 12px; letter-spacing: .5px; text-transform: uppercase; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }
.mv b { font-weight: 400; color: var(--accent); display: block; line-height: 1.1; }

/* календарь */
.booking { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; min-height: 0; }
.cal-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 4px; min-height: 0; background: var(--panel); }
.cal { display: grid; min-width: 880px; }
.cal-h { padding: 8px 2px; text-align: center; font-family: var(--head); font-size: 16px; letter-spacing: .5px; border-left: 1px solid var(--line2); border-bottom: 1px solid var(--line); }
.cal-h.today { color: var(--accent); box-shadow: inset 0 -3px var(--accent); }
.cal-h.off { color: var(--danger); }
.cal-p { padding: 4px 1px; text-align: center; color: var(--muted); font-size: 11px; border-left: 1px solid var(--line); border-bottom: 2px solid var(--line2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-t { color: var(--muted); font-size: 12px; text-align: right; padding: 1px 6px; border-top: 1px solid var(--line); }
.cal-c { position: relative; display: block; border: 0; border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: none; height: 46px; padding: 0; }
.cal-c.dayb { border-left-color: var(--line2); }
.cal-c:hover { background: var(--field); }
.cal-c.today { background: rgba(232, 137, 43, .07); }
.now { position: absolute; z-index: 3; left: 0; right: 0; height: 2px; background: var(--danger); pointer-events: none; }
.appt { position: absolute; z-index: 2; left: 2px; right: 2px; top: 1px; overflow: hidden; text-align: left; line-height: 1.12; background: #3a2f22; border: 1px solid var(--line2); border-left: 3px solid var(--accent); border-radius: 3px; padding: 2px 4px; font-size: 12px; }
.appt.arrived { background: #27331f; border-left-color: var(--ok); }
.appt.no_show { background: #3b2422; border-left-color: var(--danger); }
.appt.on { border-color: var(--accent); }
.appt small { display: block; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.appt b { display: block; font-family: var(--head); font-weight: 400; font-size: 14.5px; white-space: nowrap; }
.today-list { display: flex; flex-direction: column; border: 1px solid var(--line); min-height: 60px; }
.today-list button { background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; padding: 9px 12px; }
.today-list button:hover { background: var(--field); }

/* окна */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .65); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 24px max(14px, env(safe-area-inset-right, 0px)) 24px max(14px, env(safe-area-inset-left, 0px)); }
.dlg { background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; padding: 14px 18px; width: 100%; max-width: 680px; display: flex; flex-direction: column; gap: 9px; }
.dlg.wide { max-width: 900px; }
.dlg .tw { max-height: 52vh; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(92vw, 520px); background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 4px; }
.tree-g { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; font-family: var(--head); font-size: 15.5px; letter-spacing: .6px; }
.tree-g i { color: var(--accent); font-style: normal; display: inline-block; width: 20px; }
.tree-w { display: grid; grid-template-columns: minmax(0, 1fr) 60px 84px; gap: 6px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 5px 8px 5px 28px; }
.tree-w:hover { background: var(--field); }
.tree-w.on { background: var(--sel); }
.tree-w span:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.dtabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.dtabs button { flex: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: 7px 13px; color: var(--muted); font-family: var(--head); letter-spacing: 1px; }
.dtabs button.on { color: var(--text); border-bottom-color: var(--accent); }

/* бланк: как лист бумаги, поэтому светлый */
.paper { background: #fff; color: #202225; padding: 22px; font-size: 13px; overflow-x: auto; }
.paper h3 { color: #202225; font-size: 22px; }
.paper .p-top { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; border-bottom: 3px solid #e8892b; padding-bottom: 8px; margin-bottom: 10px; }
.paper .p-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 18px; margin-bottom: 10px; }
.paper .p-info span { color: #6b6d72; }
.paper table { margin-bottom: 10px; }
.paper th { background: #eee; color: #444; position: static; font-family: inherit; font-size: 12px; letter-spacing: 0; border: 1px solid #bbb; }
.paper td { border: 1px solid #bbb; padding: 4px 6px; }
.paper .p-total { text-align: right; font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.paper .p-sign { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; margin-top: 22px; }

/* компьютер: одно окно на весь экран, прокручиваются только таблицы и наряд */
@media (min-width: 1100px) {
  html, body { height: 100%; }
  body { display: flex; flex-direction: column; overflow: hidden; }
  main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
  .orders, .booking, .split { flex: 1; min-height: 0; }
  .orders > *, .booking > *, .split > * { min-height: 0; }
  .cal-wrap { flex: 1; min-height: 0; }
  .col { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; }
  .owork .oscroll { flex: 1; }
  .side .olist { flex: 1; }
  .tw.grow-y { flex: 1; min-height: 0; }
}
@media (max-width: 1099px) {
  .orders, .booking, .stock-split, .client-split { grid-template-columns: minmax(0, 1fr); }
  .olist { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .oitem { flex: 0 0 210px; }
  .brandline { display: none; }
  .tw { max-height: 70vh; }
  .col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  main { display: flex; flex-direction: column; gap: 10px; }
}
@media (max-width: 760px) {
  .org img { height: 36px; width: 36px; }
  .org b { font-size: 21px; }
  .top .settings { display: none; }
  .g12 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g12 > * { grid-column: span 2; }
  .g12 > .s3 { grid-column: span 1; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pay { flex: 1 1 100%; }
  .acts { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .acts .a2, .acts .a3 { grid-column: auto; }
  .acts .a4 { grid-column: span 2; }
  .tw:has(.lt) { max-height: none; overflow: visible; border: 0; }
  .lt thead { display: none; }
  .lt, .lt tbody { display: block; }
  .lt tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 30px; gap: 4px; border: 1px solid var(--line); padding: 6px; margin-bottom: 6px; }
  .lt td { border: 0; padding: 0; min-width: 0; }
  .lt td.c0 { display: none; }
  .lt td.wide { grid-column: 1 / -2; grid-row: 1; }
  .lt td.delc { grid-column: -2; grid-row: 1; }
  .lt td.full { grid-column: 1 / -1; }
  .lt td.sum { grid-column: span 2; align-self: center; }
  .lt input, .lt select { background: var(--field); border-color: var(--line); }
  .dlg { padding: 12px; }
  .btns3 .btn { padding-inline: 4px; font-size: 14px; }
}
@media print {
  body { display: block; overflow: visible; height: auto; }
  body * { visibility: hidden; }
  .paper, .paper * { visibility: visible; }
  .modal { position: absolute; background: none; padding: 0; overflow: visible; }
  .dlg { border: 0; padding: 0; max-width: none; background: #fff; }
  .paper { position: absolute; left: 0; top: 0; width: 100%; padding: 0; }
}
