/* Panel styles: Golos Text, an ink side column with the shops as blocks, white panels with 1 px
   lines on a light page and one indigo accent. Lime marks results only: the "Активний" badge,
   done marks, the chosen shop and status dots. */

:root {
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ink: #1E1B4B; --indigo: #4338CA; --lime: #C6F432; --warn: #FFB020; --err: #FF5A5F;
  --bg: #F5F4FA; --panel: #FFFFFF; --field: #F6F5FB; --line: #E4E2EF; --line-2: #D3D0E4; --line-soft: #EFEEF6;
  --text: #1E1B4B; --text-2: #3A3668; --muted: #6F6C90; --faint: #9C99B6; --sel: #EEEDFB; --none: #B4B1CE;
  --err-text: #C2333A; --warn-text: #9A5B00; --danger: #D63B41;
  --r: 8px; --r-s: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { min-height: 100vh; font: 400 13px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; text-align: inherit; }
i, em { font-style: normal; }
svg { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.tn { font-variant-numeric: tabular-nums; }
.mk { width: 16px; height: 16px; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #C8C6DA; flex: none; }
.d-ok { background: #B4E81E; box-shadow: 0 0 0 1px rgba(30,27,75,.28); }
.d-warn { background: var(--warn); }
.d-err { background: var(--err); }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 13px; border-radius: var(--r-s); font-weight: 500; white-space: nowrap; flex: none; }
.btn.pri { background: var(--indigo); color: #fff; }
.btn.pri:hover { background: #3A30B5; }
.btn.line { background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.line:hover { background: var(--bg); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #C2333A; }
.btn.icon { width: 32px; padding: 0; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--muted); }
.btn.icon svg { width: 16px; height: 16px; }
.btn.icon:hover { background: var(--bg); color: var(--text); }
.btn.icon[aria-expanded="true"] { background: var(--sel); color: var(--text); }
.btn.wide { width: 100%; height: 40px; }

/* ---- frame: the ink side column on the left, the shop on the right ---- */
body.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); }

.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; min-height: 0; padding: 14px 12px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 12px; }
.logo { width: 28px; height: 28px; }
.brand b { font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.out { margin-left: auto; }
.out button { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-s); color: rgba(255,255,255,.5); }
.out button:hover { background: rgba(255,255,255,.08); color: #fff; }
.out svg { width: 16px; height: 16px; }
.cap { padding: 10px 6px 8px; font-size: 11.5px; font-weight: 500; color: rgba(255,255,255,.45); }
.shops { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.shop { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; flex: none; }
.shop:hover { background: rgba(255,255,255,.05); }
.shop.on { background: rgba(255,255,255,.1); }
.ava { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.09); color: rgba(255,255,255,.86); font-size: 11.5px; font-weight: 600; flex: none; }
.shop.on .ava { background: var(--lime); color: var(--ink); }
.shop span { flex: 1; min-width: 0; }
.shop b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop small { display: block; font-size: 11.5px; color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .dot, .mbar .dot { background: rgba(255,255,255,.3); box-shadow: none; }
.side .d-ok, .mbar .d-ok { background: var(--lime); }
.side .d-warn, .mbar .d-warn { background: var(--warn); }
.side .d-err, .mbar .d-err { background: var(--err); }
.add { display: grid; place-items: center; height: 36px; margin-top: 10px; border: 1px dashed rgba(255,255,255,.24); border-radius: var(--r); font-size: 12.5px; font-weight: 500; color: rgba(255,255,255,.75); flex: none; }
.add:hover { border-color: rgba(255,255,255,.4); color: #fff; }
.health { margin-top: auto; padding-top: 12px; }
.h { display: flex; align-items: center; gap: 10px; padding: 4px 6px; font-size: 12.5px; white-space: nowrap; }
.h em { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.side .h { color: rgba(255,255,255,.84); }
.side .h em { color: rgba(255,255,255,.44); }

/* ---- the shop: header, settings, parcels and the right column ---- */
.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 100vh; padding: 18px 24px 24px; }
.top { display: flex; align-items: center; gap: 12px; min-height: 34px; flex: none; white-space: nowrap; }
h1 { font-size: 21px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.top h1 { min-width: 0; padding-bottom: 1px; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 5px; background: var(--lime); font-size: 12px; font-weight: 500; flex: none; }
.pill i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.pill.off { background: #E7E6F0; color: var(--muted); }
.meta { font-size: 12.5px; color: var(--muted); flex: none; }
.ready { display: flex; align-items: center; gap: 8px; margin-left: auto; font-size: 12.5px; color: var(--muted); flex: none; }
.ready b { font-weight: 500; color: var(--text); }
.seg { display: flex; gap: 3px; }
.seg i { width: 14px; height: 4px; border-radius: 2px; background: var(--indigo); }
.seg i.no { background: var(--line-2); }
.actions { display: flex; align-items: center; gap: 8px; margin-left: 8px; flex: none; }
.actions form { display: flex; }
.more { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 184px; padding: 4px; border-radius: var(--r); background: #fff; box-shadow: 0 0 0 1px var(--line), 0 12px 32px -8px rgba(30,27,75,.22); }
.menu[hidden] { display: none; }
.menu button { display: flex; align-items: center; width: 100%; height: 32px; padding: 0 10px; border-radius: 5px; font-weight: 500; white-space: nowrap; }
.menu button:hover, .menu button:focus-visible { background: var(--sel); outline: 0; }
.menu .danger { color: var(--err-text); }

.settings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); flex: none; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.blk { min-width: 0; padding: 13px 16px 12px; }
.blk + .blk { border-left: 1px solid var(--line); }
h3 { font-size: 13px; font-weight: 600; }
.blk h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; white-space: nowrap; }
.act { margin-left: auto; }
.act, .act button { font-size: 12.5px; font-weight: 500; color: var(--indigo); }
.act:hover, .act button:hover { text-decoration: underline; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 3.5px 0; white-space: nowrap; }
.kv dt { flex: none; color: var(--muted); }
.kv dd { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.kv .none { color: var(--none); }
.kv .w { color: var(--warn-text); font-weight: 500; }
.hint { margin-top: 8px; font-size: 12px; line-height: 1.4; color: var(--muted); }
h3 + .hint { margin-top: 0; }

.man { position: relative; display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.av { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--sel); color: var(--indigo); font-size: 10px; font-weight: 600; flex: none; }
.man span { min-width: 0; }
.man b { display: block; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.man small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.man em { margin-left: auto; font-size: 12px; color: var(--muted); flex: none; }
.man .x { position: absolute; right: 0; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--err-text); opacity: 0; pointer-events: none; }
.man .x:hover { text-decoration: underline; }
.man:hover .x, .man:focus-within .x { opacity: 1; pointer-events: auto; }
.man:hover em, .man:focus-within em { visibility: hidden; }
@media (hover: none) {
  .man .x { position: static; transform: none; opacity: 1; pointer-events: auto; flex: none; }
  .man:focus-within em { visibility: visible; }
}

.inv-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; white-space: nowrap; }
.inv-h span { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.inv-h b { font-weight: 500; color: var(--text); }
.inv-h form { flex: none; }
.inv-h button { font-size: 12.5px; color: var(--err-text); }
.inv-h button:hover { text-decoration: underline; }
.link { display: flex; align-items: center; gap: 8px; height: 30px; margin: 7px 0 8px; padding: 0 4px 0 10px; border-radius: var(--r-s); background: var(--field); box-shadow: inset 0 0 0 1px var(--line); font: 500 12px var(--mono); color: var(--text-2); }
.link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link button { display: grid; place-items: center; width: 24px; height: 24px; margin-left: auto; border-radius: 4px; color: var(--muted); flex: none; }
.link button:hover { background: var(--line-soft); color: var(--text); }
.link svg { width: 14px; height: 14px; }
.past { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; font-size: 12px; color: var(--muted); white-space: nowrap; }
.past span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.past span:last-child { flex: none; }

.lower { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; flex: 1 0 auto; }
.rcol { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pane { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.rcol .events { flex: 1; }
.pane.none { flex: 1; }
.bar { display: flex; align-items: center; gap: 16px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); white-space: nowrap; flex: none; }
.bar .count { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--muted); }
.empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 4px; min-height: 260px; padding: 24px; text-align: center; color: var(--none); }
.empty svg { width: 34px; height: 34px; }
.empty h4 { margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--text); }
.empty p { max-width: 300px; color: var(--muted); }
.empty .btn { margin-top: 14px; }
.steps { padding: 8px 16px 10px; }
.step { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.step.todo { color: var(--muted); }
.rows { padding: 8px 0; }
.rows .hint { margin: 0; padding: 4px 16px; }
.ev { display: flex; gap: 11px; padding: 5.5px 14px 5.5px 16px; }
.ev time { flex: none; padding-top: 1px; font: 500 11.5px/1.5 var(--mono); color: var(--faint); }
.ev span { display: block; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ---- dialogs, fields, messages ---- */
.dlg { width: min(460px, calc(100vw - 28px)); max-height: calc(100vh - 28px); margin: auto; padding: 20px 22px 18px; overflow: auto; border: 0; border-radius: 12px; background: #fff; color: var(--text); box-shadow: 0 0 0 1px rgba(30,27,75,.06), 0 24px 60px -12px rgba(30,27,75,.35); }
.dlg::backdrop { background: rgba(30,27,75,.42); }
.dlg:focus-visible { outline: 0; }
h2 { margin-bottom: 14px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.sub { margin: -8px 0 14px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld { display: block; }
.fld.wide { grid-column: 1 / -1; }
.fld > span:first-child { display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 500; }
.fld input, .fld select, .fld .val { display: flex; align-items: center; width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: #fff; outline: 0; }
.fld input::placeholder { color: var(--faint); }
.fld input:focus, .fld select:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(67,56,202,.16); }
.fld.bad input { border-color: var(--err); box-shadow: 0 0 0 3px rgba(255,90,95,.14); }
.fld .val { border-color: var(--line); background: var(--field); }
.fld .link { height: 38px; margin: 0; padding-left: 11px; font-size: 12.5px; }
.fld .link button { width: 30px; height: 30px; }
.ferr { display: block; margin-top: 5px; font-size: 12px; line-height: 1.35; color: var(--err-text); }
.sel { position: relative; display: block; }
.sel select { padding-right: 34px; appearance: none; cursor: pointer; }
.sel svg { position: absolute; right: 11px; top: 12px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.segc { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 7px; background: var(--line-soft); }
.segc label, .segc span { position: relative; display: grid; place-items: center; height: 32px; border-radius: 5px; font-weight: 500; color: var(--muted); text-align: center; }
.segc label { cursor: pointer; }
.segc input { position: absolute; opacity: 0; pointer-events: none; }
.segc .on, .segc label:has(input:checked) { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(30,27,75,.14); }
.segc label:has(input:focus-visible) { outline: 2px solid var(--indigo); outline-offset: 1px; }
.fld + .fld, .segc + .fld, .grid2 + .segc { margin-top: 14px; }
.grid2 > .fld + .fld { margin-top: 0; }
.foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.sub + .foot { margin-top: 4px; }

.toasts { inset: auto auto 22px 50%; margin: 0; padding: 0; overflow: visible; border: 0; background: none; color: inherit; transform: translateX(-50%); }
.toasts:popover-open { display: grid; gap: 8px; justify-items: center; }
.toast { display: flex; align-items: center; gap: 9px; min-height: 40px; max-width: min(520px, calc(100vw - 28px)); padding: 9px 14px 9px 12px; border-radius: var(--r); background: var(--ink); color: #fff; font-weight: 500; line-height: 1.35; box-shadow: 0 10px 30px -8px rgba(30,27,75,.5); transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---- sign-in ---- */
body.login-page { display: grid; place-items: center; padding: 20px 14px; }
.auth { width: min(360px, 100%); padding: 26px 28px 28px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 24px 60px -36px rgba(30,27,75,.45); }
.auth .brand { padding: 0; }
.auth h1 { margin: 22px 0 4px; font-size: 20px; }
.auth .sub { margin: 0 0 18px; }
.auth .fld { margin: 0 0 12px; }
.auth-err { margin: -2px 0 12px; font-size: 12.5px; color: var(--err-text); }
.auth .btn { margin-top: 6px; }

/* ---- phone parts, hidden on wider screens ---- */
.mbar, .mhealth, .mout { display: none; }

/* ---- narrow screens: settings in two columns, the date line hidden ---- */
@media (max-width: 1279px) {
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blk:nth-child(odd) { border-left: 0; }
  .blk:nth-child(n+3) { border-top: 1px solid var(--line); }
  .meta { display: none; }
}

/* ---- phone: the shop picker on top, the blocks one under another ---- */
@media (max-width: 900px) {
  body.app { display: block; }
  .side { display: none; }
  .mbar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--ink); color: #fff; }
  .mbar .logo { width: 32px; height: 32px; }
  .pick, .sysb { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 11px; border-radius: var(--r); background: rgba(255,255,255,.1); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
  .pick { position: relative; flex: 1; min-width: 0; }
  .pick span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .pick svg { width: 14px; height: 14px; color: rgba(255,255,255,.6); }
  .pick select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }

  .main { gap: 12px; min-height: 0; padding: 16px 14px 28px; }
  .top { flex-wrap: wrap; gap: 10px; }
  .top h1 { max-width: 100%; }
  .meta { display: block; flex-basis: 100%; margin-top: -6px; }
  .ready { flex-basis: 100%; margin: 0; }
  .seg { flex: 1; }
  .seg i { flex: 1; }
  .actions { flex-basis: 100%; margin: 0; }
  .actions > .btn, .actions > form { flex: 1; order: -1; }
  .actions .btn { height: 40px; }
  .actions form .btn { flex: 1; }
  .actions .btn.icon { width: 40px; }
  .settings { grid-template-columns: minmax(0, 1fr); gap: 12px; border: 0; background: none; }
  .settings .blk { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
  .kv { padding: 5px 0; }
  .lower { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .rcol { gap: 12px; }
  .empty { min-height: 200px; }
  .pane.none { min-height: calc(100vh - 100px); }
  .mhealth { display: flex; }
  .mhealth .h { padding: 5px 16px; }
  .mout { display: flex; justify-content: center; margin-top: 4px; }
  .toasts { bottom: 14px; }
}
