/* Панель Менеджера в браузері. Палітри — ті самі, що в Mgr_*.style / DashPainter (TDashPalette.Read). */
:root {
  --page: #F4F6FA; --card: #FFFFFF; --border: #E4E7EC; --text: #1F2D3D; --muted: #6B778B;
  --track: #EDEFF2; --gridc: #E9EBEF; --good: #15803D; --bad: #B91C1C; --warn: #B45309; --prev: #A3ADBD;
  --accent: #2F7AE5; --soft: #DCE8FB;
  --s0: #2A78D6; --s1: #EB6834; --s2: #1BAF7A; --s3: #EDA100;
  --top: #FFFFFF; --top-stroke: #DDE3EA; --top-text: #1F2D3D; --top-muted: #6B7A90;
  --chip: #F4F6FA; --chip-stroke: #DDE3EA; --chip-text: #1F2D3D; --chip-hover: #E8F0FC;
  --side: #1E2633; --side-text: #C9D3E0; --side-muted: #7C8BA1; --active: #2F7AE5; --active-text: #FFFFFF;
  /* the sidebar menu of ManagerFMX (NEWSTYLE\ManagerFMX, variant graphite) */
  --sb-bg: linear-gradient(180deg, #1e2633 0%, #161c26 100%); --sb-fg: #dfe5ee; --sb-muted: #8693a6; --sb-line: #2a3343;
  --sb-hover: #252e3d; --sb-active: #2b3a52; --sb-active-fg: #ffffff; --sb-bar: #4f9cf9; --sb-sub-line: #334055; --sb-search: #121822;
  --sbw: 268px; --sbw-rail: 68px;
}
body[data-theme="1"] {
  --page: #1B222D; --card: #242D3A; --border: #313C4C; --text: #E9EEF4; --muted: #8B98AA;
  --track: #384150; --gridc: #3B4453; --good: #62E3A4; --bad: #FF8A8A; --warn: #F3C969; --prev: #5B6878;
  --accent: #52E0E6; --soft: #22384A;
  --s0: #3987E5; --s1: #D95926; --s2: #199E70; --s3: #C98500;
  --top: #1B222D; --top-stroke: #242D3A; --top-text: #E9EEF4; --top-muted: #8B98AA;
  --chip: #242D3A; --chip-stroke: #313C4C; --chip-text: #E9EEF4; --chip-hover: #2C3746;
  --side: #161C26; --side-text: #C9D3E0; --side-muted: #6B7A90; --active: #22384A; --active-text: #52E0E6;
  --sb-bg: #121821; --sb-fg: #e9eef4; --sb-muted: #8b98aa; --sb-line: #242d3a; --sb-hover: #1b222d;
  --sb-active: #22384a; --sb-active-fg: #ffffff; --sb-bar: #52e0e6; --sb-sub-line: #2b3646; --sb-search: #090c11;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body { background: var(--page); color: var(--text); font: 13px/1.35 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
button, select { font: inherit; color: inherit; }
/* ---------- the layout of ManagerFMX: the sidebar menu on the left, the top bar and the section on the right ---------- */
.app { display: grid; grid-template-columns: var(--sbw) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
.app.rail { grid-template-columns: var(--sbw-rail) minmax(0, 1fr); }
.sb { position: sticky; top: 0; height: 100vh; background: var(--sb-bg); color: var(--sb-fg); display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--sb-line); z-index: 8; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; height: 60px; flex: none; }
.logo { width: 34px; height: 34px; border-radius: 9px; flex: none; display: block; }   /* logo.png = the Logo image of ManagerFMX Main.fmx */
.sb-brand b { font-size: 16px; letter-spacing: .01em; white-space: nowrap; display: block; }
.sb-brand small { display: block; color: var(--sb-muted); font-size: 11.5px; white-space: nowrap; }
.sb-search { margin: 2px 12px 8px; display: flex; align-items: center; gap: 8px; background: var(--sb-search); border-radius: 9px; padding: 7px 10px; flex: none; }
.sb-search-ic { width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.sb-search-ic svg { width: 18px; height: 18px; }
.sb-search input { border: 0; outline: 0; background: transparent; color: var(--sb-fg); font: inherit; width: 100%; min-width: 0; }
.sb-search input::placeholder { color: var(--sb-muted); }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; scrollbar-width: thin; }
.sb-sec { margin-top: 12px; }
.sb-sec > .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--sb-muted); padding: 4px 10px 6px; white-space: nowrap; }
.sb-it { position: relative; display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent; text-align: left;
  padding: 7px 10px; border-radius: 9px; cursor: pointer; color: var(--sb-fg); white-space: nowrap; font: inherit; font-size: 13.5px; }
.sb-it:hover { background: var(--sb-hover); }
.sb-it .ic { width: 24px; height: 24px; flex: none; display: grid; place-items: center; }
.sb-it .ic svg { width: 24px; height: 24px; }
.sb-it .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-it .chev { width: 16px; height: 16px; flex: none; opacity: .65; transition: transform .15s; }
.sb-it[aria-expanded="true"] .chev { transform: rotate(90deg); }
.sb-it .cnt { font-size: 11px; color: var(--sb-muted); background: var(--sb-hover); border-radius: 10px; padding: 0 7px; }
.sb-it.on { background: var(--sb-active); color: var(--sb-active-fg); font-weight: 600; }
.sb-it.on::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sb-bar); }
.sb-sub { margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid var(--sb-sub-line); }
.sb-sub[hidden] { display: none; }
/* the free reports in the menu: long names wrap, a report with a dialog page is muted (it cannot run in the browser) */
.sb-nav .sb-it.wrap .tx { white-space: normal; line-height: 1.25; }
.sb-nav .sb-it.dlg .tx { color: var(--sb-muted); opacity: .8; }
.sb-sub .sb-it { padding: 5px 10px; font-size: 13px; color: var(--sb-muted); }
.sb-sub .sb-it:hover { color: var(--sb-fg); }
.sb-sub .sb-it.on { color: var(--sb-active-fg); background: var(--sb-active); }
.sb-sub .sb-it.on::before { left: -13px; }
.sb-foot { border-top: 1px solid var(--sb-line); padding: 8px 10px 10px; display: grid; gap: 2px; flex: none; }
.sb-foot .sb-it[hidden] { display: none; }
.app.rail .sb-brand-text, .app.rail .sb-search, .app.rail .sb-sec > .lbl, .app.rail .sb-it .tx, .app.rail .sb-it .chev, .app.rail .sb-it .cnt, .app.rail .sb-sub { display: none; }
.app.rail .sb-it { justify-content: center; padding: 9px 0; }
.app.rail .sb-brand { justify-content: center; padding-inline: 0; }
.app.rail .sb-sec { margin-top: 6px; border-top: 1px solid var(--sb-line); padding-top: 6px; }
.app.rail .sb-sec:first-child { border-top: 0; }
.sb-mask { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: 60px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 20px 0 12px; background: var(--top); color: var(--top-text);
  border-bottom: 1px solid var(--top-stroke); position: sticky; top: 0; z-index: 5; }
.ibtn { width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: inherit; flex: none; }
.ibtn:hover { background: var(--chip); }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs b { color: var(--top-text); font-weight: 600; }
.crumbs i { font-style: normal; opacity: .5; }
.user { display: flex; align-items: center; gap: 9px; padding-left: 6px; }
.user[hidden] { display: none; }
.ava { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #f97316, #ec4899); flex: none; }
.user b { display: block; line-height: 1.2; white-space: nowrap; }
.user small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.rep-title { font-weight: 700; font-size: 15px; margin: 2px 0 8px; }
/* the period presets popup next to the second date */
.rep-filters .grp { position: relative; }
.per-btn { padding: 6px 9px; font-size: 12px; line-height: 1; }
.per-menu { position: absolute; top: 100%; right: 0; margin-top: 4px; z-index: 9; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px; display: grid; min-width: 150px; }
.per-menu[hidden] { display: none; }
.per-menu button { border: 0; background: transparent; color: var(--text); text-align: left; padding: 7px 12px; border-radius: 7px; cursor: pointer; font: inherit; white-space: nowrap; }
.per-menu button:hover { background: var(--chip-hover); }
.fr-frame { display: block; width: 100%; height: 60vh; border: 0; background: #fff; }
@media (max-width: 640px) { .fr-print { display: none; } }   /* the print button is for the desktop */
.fr-sel { max-width: 420px; }
.rep-fold { display: block; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 10px;
  padding: 8px 12px; margin-bottom: 8px; cursor: pointer; font: inherit; font-size: 13px; }
.rep-fold[hidden] { display: none; }
/* the current record (the cursor of the Manager's grids): click / arrows; a double click or Enter opens the row where there is a card */
.rep-wrap:focus, .doc-lines:focus { outline: none; }
table.rt tr.leaf { cursor: default; }
table.rt tr.leaf:hover td { background: var(--chip-hover); }
table.rt tr.leaf.cur td, table.rt tr.leaf.cur:hover td { background: var(--soft) !important; }
table.rt tr.leaf.cur td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.rep-wrap:focus table.rt tr.leaf.cur td { background: color-mix(in srgb, var(--soft) 75%, var(--accent) 25%) !important; }
table.rt tr.clickable { cursor: pointer; }
/* the document card (view mode) */
.doc-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; }
.doc-card { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 14px; width: min(1100px, 100%); max-height: 92vh;
  display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 15px; }
.doc-head .btn { padding: 4px 9px; }
.doc-body { padding: 12px 16px 16px; overflow: auto; overscroll-behavior: contain; min-height: 0; flex: 1 1 auto; }   /* min-height: 0 — else the flex child grows past the card and nothing scrolls */
.doc-lines { overscroll-behavior: contain; }
.doc-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 12px; }
.doc-kv .k { color: var(--muted); font-size: 11.5px; display: block; }
.doc-kv .v { display: block; font-weight: 600; overflow-wrap: anywhere; }
.doc-lines { border: 1px solid var(--border); border-radius: 10px; }
.doc-body .err { color: var(--bad); }
@media (max-width: 640px) { .doc-modal { padding: 0; } .doc-card { max-height: 100vh; border-radius: 0; } }
.rep-filters input[type=number] { font: inherit; color: var(--text); background: var(--chip); border: 1px solid var(--chip-stroke); border-radius: 8px; padding: 5px 8px; width: 90px; }
main { padding: 14px 20px 24px; min-width: 0; }
@media (max-width: 900px) {
  .app, .app.rail { grid-template-columns: minmax(0, 1fr); }
  .sb { position: fixed; left: 0; top: 0; width: var(--sbw); transform: translateX(-100%); transition: transform .18s ease; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .app.open .sb { transform: none; }
  .app.open .sb-mask { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 7; }
  .app.rail .sb-brand-text, .app.rail .sb-search, .app.rail .sb-sec > .lbl, .app.rail .sb-it .tx, .app.rail .sb-it .chev, .app.rail .sb-it .cnt { display: initial; }
  .app.rail .sb-sub:not([hidden]) { display: block; }
  .app.rail .sb-it { justify-content: flex-start; padding: 7px 10px; }
  .user b, .user small { display: none; }
  .top { padding: 0 10px 0 6px; gap: 8px; }
  .crumbs span.sec, .crumbs i.sec { display: none; }   /* the phone shows the item and the page, not the section */
  /* the menu button is merged with the page name: a tap on the name opens the menu */
  #railBtn { display: none; }
  .crumbs { cursor: pointer; gap: 10px; font-size: 15px; }
  .crumbs::before { content: ""; width: 20px; height: 14px; flex: none; background: linear-gradient(currentColor 0 2px, transparent 2px 6px, currentColor 6px 8px, transparent 8px 12px, currentColor 12px 14px); opacity: .8; }
}
@media (max-width: 640px) {
  /* fewer things on the phone (user, 18.10.2026): no date presets, no status lines, no theme select, no user badge */
  .rep-filters .seg { display: none; }
  .rep-title { display: none; }   /* the page name is already next to the menu button */
  .group-box .drag { display: none; }   /* no drag and drop of the headers on the phone */
  .ex-time { display: none !important; }   /* the time window of the extended report / kitchen OLAP */
  .rep-filters[hidden] { display: none; }
  .rep-status > div:not(.err), .status > #periodText { display: none; }
  #theme, #userBox { display: none; }
  .rep-filters { padding: 8px 10px; gap: 6px 8px; }
  .rep-filters input[type=date] { padding: 5px 4px; width: 112px; font-size: 12.5px; }   /* two dates + the period button in one row */
  .per-lbl { display: none; }
  .rep-filters .grp { gap: 4px 6px; }
  .per-btn { padding: 5px 7px; }
  .top { height: 52px; }
  .sb { top: 0; }
}
/* --- reports --- */
.rep-filters { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.rep-filters .grp { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.rep-filters .lbl { color: var(--muted); font-size: 12px; margin-right: 2px; }
.rep-filters label.ck { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; font-size: 12.5px; }
.rep-filters input[type=date], .rep-filters input[type=time], .rep-filters input[type=number], .rep-filters input[type=text] {
  font: inherit; color: var(--text); background: var(--chip); border: 1px solid var(--chip-stroke); border-radius: 8px; padding: 6px 8px; }
.rep-filters input[type=number] { width: 70px; }
.rep-filters .sep { width: 100%; height: 0; }
.rep-filters details { width: 100%; }
.rep-filters summary { cursor: pointer; color: var(--accent); font-size: 12.5px; margin: 2px 0; }
.rep-filters .more { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 8px; }
.rep-status { display: flex; justify-content: space-between; gap: 12px; margin: 8px 2px; flex-wrap: wrap; font-weight: 600; }
.rep-status[hidden] { display: none; }
.rep-status .err { color: var(--bad); }
/* the rows / time of the OLAP after the «Сформувати» button (the status line is used only for errors) */
.rep-info { white-space: nowrap; font-weight: 600; }
.rep-info.err { color: var(--bad); }
.rep-result { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; position: relative; }
/* the wait spinner while a report runs */
.rep-result.busy { min-height: 180px; }
.rep-result.busy::before { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--card) 60%, transparent); z-index: 7; }
.rep-result.busy::after { content: ""; position: absolute; left: 50%; top: 80px; width: 36px; height: 36px; margin-left: -18px; border-radius: 50%;
  border: 4px solid var(--track); border-top-color: var(--accent); animation: spin .8s linear infinite; z-index: 8; }
@keyframes spin { to { transform: rotate(360deg); } }
.rep-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--gridc); }
.rep-tools input[type=text] { font: inherit; color: var(--text); background: var(--chip); border: 1px solid var(--chip-stroke); border-radius: 8px; padding: 6px 10px; min-width: 200px; }
.rep-tools .btn { padding: 6px 10px; font-size: 12.5px; }
.rep-wrap { overflow: auto; max-height: calc(100vh - 230px); }
table.rt { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
table.rt th { position: sticky; top: 0; background: var(--card); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .02em;
  text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; z-index: 1; }
table.rt th.l, table.rt td.l { text-align: left; }
table.rt th.sorted { color: var(--text); }
table.rt th .cap { cursor: pointer; }
table.rt th .hf, table.rt th .hg { margin-left: 5px; color: var(--muted); cursor: pointer; font-size: 11px; opacity: .55; }
table.rt th:hover .hf, table.rt th:hover .hg, table.rt th .hf.on { opacity: 1; }
table.rt th .hf.on { color: var(--accent); }
table.rt tr.grp-row td { background: color-mix(in srgb, var(--track) 60%, var(--card)); cursor: pointer; white-space: nowrap; }
table.rt tr.grp-row.lv1 td { background: color-mix(in srgb, var(--track) 35%, var(--card)); }
table.rt tr.grp-row.lv2 td { background: color-mix(in srgb, var(--track) 20%, var(--card)); }
table.rt tr.grp-row .gsum { margin-left: 18px; font-weight: 600; }
.group-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--gridc); min-height: 36px; background: var(--page); }
.group-box .lbl { font-size: 10.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; margin-right: 4px; }
.group-box.drop-hover { outline: 2px dashed var(--accent); outline-offset: -3px; }
.ui-draggable-dragging { background: var(--card); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 8px; font-size: 12px; list-style: none; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
table.rt td { padding: 5px 8px; border-bottom: 1px solid var(--gridc); text-align: right; white-space: nowrap; }
table.rt td.l { white-space: normal; min-width: 160px; }
table.rt tr:nth-child(even) td { background: color-mix(in srgb, var(--track) 35%, transparent); }
table.rt tr.hdr td { font-weight: 700; background: var(--track); }
table.rt tr.minus td { color: var(--bad); }
table.rt tr.sub td { color: var(--muted); }
table.rt tfoot td { position: sticky; bottom: 0; background: var(--card); font-weight: 700; border-top: 2px solid var(--border); border-bottom: 0; }
.rep-totals { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 10px 14px; border-top: 1px solid var(--gridc); }
.rep-totals .t { display: flex; flex-direction: column; }
.rep-totals .t span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.rep-totals .t b { font-size: 15px; }
.cols-pop { position: relative; }
.cols-pop .menu { position: absolute; top: 34px; left: 0; z-index: 6; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; display: none; grid-template-columns: repeat(3, auto); gap: 4px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 60vh; overflow: auto; }
.cols-pop.open .menu { display: grid; }
.cols-pop .menu label { white-space: nowrap; font-size: 12.5px; display: flex; gap: 5px; align-items: center; }
/* pivot */
.pv-cfg { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--gridc); }
.pv-cfg select { font: inherit; color: var(--text); background: var(--chip); border: 1px solid var(--chip-stroke); border-radius: 8px; padding: 5px 8px; }
table.rt th.grp { text-align: center; border-left: 1px solid var(--gridc); }
table.rt td.l1 { font-weight: 700; }
table.rt td.l2 { padding-left: 24px; }
table.rt td.l3 { padding-left: 42px; }
table.rt tr.sum td { font-weight: 700; background: var(--track); }
table.rt td.bl { border-left: 1px solid var(--gridc); }
.more-btn { display: block; width: 100%; padding: 10px; background: transparent; border: 0; color: var(--accent); cursor: pointer; }
@media (max-width: 640px) {
  .rep-wrap { max-height: none; }
}
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dash-cond { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dash-cond[hidden] { display: none; }
.dash-row { display: flex; gap: 10px; align-items: center; margin-left: auto; font-weight: 600; }
#statusTextM { display: none; }   /* the phone shows the status next to the button, the desktop under the toolbar */
@media (max-width: 640px) { .dash-row { width: 100%; justify-content: space-between; margin-left: 0; font-size: 12px; } #statusTextM { display: block; } #statusText { display: none; } .status { margin: 4px 2px; } }
.spacer { flex: 1; }
.seg { display: flex; background: var(--chip); border: 1px solid var(--chip-stroke); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg button:hover { background: var(--chip-hover); }
.seg button.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chip-select, .btn { background: var(--chip); border: 1px solid var(--chip-stroke); color: var(--chip-text); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; }
.chip-select:hover, .btn:hover { background: var(--chip-hover); }
.btn.primary { background: var(--active); color: var(--active-text); border-color: transparent; font-weight: 600; }
.status { display: flex; justify-content: space-between; gap: 12px; margin: 8px 2px 6px; flex-wrap: wrap; font-weight: 600; }
.status .err { color: var(--bad); }
.muted { color: var(--muted); }
.progress { height: 3px; border-radius: 2px; background: transparent; overflow: hidden; margin-bottom: 8px; }
.progress.on { background: var(--track); }
.progress.on div { height: 100%; width: 30%; background: var(--accent); border-radius: 2px; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 86px; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 0; overflow: hidden;
  display: flex; flex-direction: column; min-width: 0; }
.card .head { height: 36px; padding: 10px 8px 0 14px; display: flex; align-items: center; gap: 8px; flex: none; }
.card .title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 10px; color: var(--muted); background: var(--track); border-radius: 5px; padding: 2px 6px; flex: none; }
.card .body { padding: 4px 14px 12px; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.kpi .big { font-size: 24px; font-weight: 700; line-height: 34px; white-space: nowrap; }
.kpi .big.bad { color: var(--bad); }
.row { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.delta { font-weight: 700; font-size: 12px; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); } .delta.none { color: var(--muted); }
.small { font-size: 12px; } .tiny { font-size: 11.5px; }
.spark { flex: 1; min-height: 20px; margin-top: auto; }
canvas { display: block; width: 100%; height: 100%; }
.chart { flex: 1; min-height: 0; margin-top: 8px; position: relative; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); min-height: 20px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: 6px; }
.dot.dash { height: 0; width: 12px; border-top: 2px dashed var(--prev); border-radius: 0; }
.top-row { display: grid; grid-template-columns: 18px 1fr auto; grid-template-rows: auto auto; column-gap: 6px; padding: 5px 0 3px; }
.top-row .n { color: var(--muted); font-size: 11px; grid-row: 1; }
.top-row .name { font-size: 12.5px; grid-row: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-row .val { font-size: 12.5px; grid-row: 1; text-align: right; white-space: nowrap; }
.top-row .sub { grid-column: 2 / 4; grid-row: 2; text-align: right; font-size: 10.5px; color: var(--muted); }
.top-row .bar { grid-column: 2 / 4; grid-row: 3; height: 4px; background: var(--track); border-radius: 2px; margin-top: 3px; }
.top-row .bar i { display: block; height: 4px; border-radius: 2px; background: var(--s0); }
.top-row.other .name, .top-row.other .n { color: var(--muted); }
.stack { height: 16px; border-radius: 4px; overflow: hidden; display: flex; gap: 2px; margin: 6px 0 10px; }
.stack i { display: block; height: 100%; }
.struct-row { display: grid; grid-template-columns: 18px 1fr 54px 120px; align-items: center; height: 24px; font-size: 12.5px; }
.struct-row .pct { text-align: right; color: var(--muted); font-size: 12px; }
.struct-row .val { text-align: right; }
.struct-row.total { font-weight: 700; }
.alert-row { display: flex; align-items: center; gap: 10px; height: 32px; font-size: 12.5px; }
.pill { width: 24px; height: 24px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; flex: none; }
.alert-row .txt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-row .val { font-weight: 700; min-width: 60px; text-align: right; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th { font-size: 10.5px; color: var(--muted); text-align: right; font-weight: 700; padding: 4px 8px; border-bottom: 1px solid var(--gridc); white-space: nowrap; }
table.tbl td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--gridc); white-space: nowrap; }
table.tbl th.l, table.tbl td.l { text-align: left; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.b { font-weight: 700; }
table.tbl .open { color: var(--s0); } table.tbl .closed { color: var(--good); }
.tbl-wrap { overflow: auto; flex: 1; min-height: 0; }
.empty { color: var(--muted); font-size: 12px; padding-top: 6px; }
.user { color: var(--top-muted); font-size: 12px; white-space: nowrap; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; }
.login { position: fixed; inset: 0; background: var(--page); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.login[hidden] { display: none; }
.login-card { width: 100%; max-width: 340px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px;
  display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.login-card .logo.big { width: 48px; height: 48px; border-radius: 12px; margin: 0 auto 4px; }
.login-title { font-size: 17px; font-weight: 700; }
.login-card input { font: inherit; font-size: 18px; letter-spacing: 2px; text-align: center; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--chip-stroke); background: var(--chip); color: var(--text); outline: none; }
.login-card input:focus { border-color: var(--accent); }
.login-card .btn.primary { padding: 10px; }
.login-err { color: var(--bad); font-size: 12px; min-height: 18px; }
.reg-dev { display: flex; flex-direction: column; gap: 6px; }
.reg-dev input { width: 100%; box-sizing: border-box; font-size: 12.5px; letter-spacing: 0; font-family: Consolas, 'Courier New', monospace; padding: 8px 6px; }
.reg-dev .btn { align-self: center; padding: 4px 14px; font-size: 12px; }
.login-card #regCode { font-size: 12.5px; letter-spacing: 0; font-family: Consolas, 'Courier New', monospace; padding: 8px 6px; }
.tip { position: fixed; pointer-events: none; background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.15); display: none; z-index: 10; white-space: nowrap; }
.tip b { display: block; margin-bottom: 2px; }
@media (max-width: 1100px) {
  .card.span-8, .card.span-12 { grid-column: span 12 !important; }
  .card.span-3, .card.span-4 { grid-column: span 6 !important; }
}
@media (max-width: 640px) {
  main { padding: 10px 10px 20px; }
  .top select { max-width: 40vw; }
  .seg { overflow-x: auto; max-width: 100%; }
  .toolbar > * { max-width: 100%; }
  .status { font-size: 12px; }
  .grid { gap: 10px; }
  .card { grid-column: span 12 !important; }
  .card.kpi { grid-column: span 6 !important; }
  .kpi .big { font-size: 20px; }
  .seg button { padding: 6px 9px; }
}
