/*
 * Aplikacia Vazenie – doplnok k bruto/css/bruto-ui.css (tokeny, tlacidla, formulare, tabulky).
 * Len prvky, ktore kit nema: kompaktna hlavicka, stlpce formulara, suhrn, vyhladavanie, prepinac.
 * Nove farby sa nepridavaju – vsetko z tokenov --bruto-*.
 */

[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app-body { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bruto-wash); }
.app-main { flex: 1; padding-block: 32px 56px; }

/* Hlavicka: kompaktnejsia ako na webe, aplikacia potrebuje miesto na formular */
.app-header .bruto-header-inner { min-height: 76px; gap: 24px; }
.app-header .bruto-logo img { width: 76px; height: 50px; }
.app-name { font-weight: 800; font-size: 18px; letter-spacing: -.3px; padding-left: 20px; border-left: 1px solid var(--bruto-line); }
.app-header .bruto-navigation ul { gap: 22px; }
.app-user { display: flex; flex-direction: column; line-height: 1.3; font-size: 14px; color: var(--bruto-muted); text-align: right; }
.app-user strong { color: var(--bruto-ink); font-weight: 750; }
.app-user a { color: var(--bruto-blue); font-weight: 700; padding: 0 !important; font-size: 13px !important; }
.app-logout { margin: 0; }
.app-logout .bruto-btn { min-height: 42px; padding: 8px 16px; font-size: 14px; }

.app-footer { border-top: 1px solid var(--bruto-line); background: #fff; color: var(--bruto-muted); font-size: 14px; }
.app-footer .bruto-shell { min-height: 56px; display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; justify-content: space-between; }
.app-footer a { color: var(--bruto-blue); font-weight: 700; }

/* Nadpis stranky */
.app-page-head { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.app-title { font-size: clamp(28px, 3vw, 38px); font-weight: 800; letter-spacing: -1px; line-height: 1.15; margin-top: 8px; }
.app-title span { color: var(--bruto-blue); }

/* Karty formulara */
.app-card { background: #fff; border: 1px solid var(--bruto-line); border-radius: var(--bruto-radius-card); padding: 24px 26px 26px; }
.app-card-title { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 780; letter-spacing: -.3px; margin-bottom: 18px; }
.app-steps { counter-reset: step; }
.app-step::before { counter-increment: step; content: counter(step); }
.app-step { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e7ebf3; color: var(--bruto-blue); font-size: 14px; font-weight: 800; flex-shrink: 0; }
.app-subtitle { font-size: 15px; font-weight: 780; color: var(--bruto-muted); text-transform: uppercase; letter-spacing: 1px; margin: 0 0 12px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px 18px; }
.app-grid .is-wide { grid-column: 1 / -1; }
.app-weighing-part + .app-weighing-part { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--bruto-line); }
.app-hint { color: var(--bruto-muted); font-size: 14px; margin-top: 14px; }

/* Rozlozenie: formular + suhrn s ulozenim */
.app-columns { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.app-steps { display: grid; gap: 20px; min-width: 0; }
.app-summary { position: sticky; top: 100px; }
.app-summary .bruto-panel { padding: 24px; box-shadow: var(--bruto-shadow); }
.app-summary h2 { font-size: 22px; margin-top: 8px; line-height: 1.25; }
.app-summary .bruto-btn { width: 100%; margin-top: 18px; }
.app-summary .bruto-btn.is-outline { margin-top: 10px; }
.app-summary .bruto-alert { margin-top: 16px; font-size: 15px; line-height: 1.5; }
.app-totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 0; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--bruto-line); font-size: 15px; }
.app-totals dt { color: var(--bruto-muted); }
.app-totals dd { margin: 0; padding-left: 12px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.app-totals .is-netto { display: flex; align-items: center; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--bruto-line); color: var(--bruto-ink); }
.app-totals dt.is-netto { font-weight: 750; }
.app-totals dd.is-netto { justify-content: flex-end; font-size: 20px; font-weight: 800; }
.app-summary .bruto-note { margin: 16px 0 0; line-height: 1.55; }
.app-shortcut { color: var(--bruto-muted); font-size: 13px; text-align: center; margin-top: 8px !important; }
kbd { font: inherit; font-weight: 700; padding: 1px 6px; border: 1px solid var(--bruto-field); border-bottom-width: 2px; border-radius: 4px; background: #fff; }

.app-msg-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; }
.app-msg-actions .bruto-btn { width: auto !important; margin: 0 !important; min-height: 40px; padding: 8px 16px; font-size: 14px; }
.app-msg-actions a { color: var(--bruto-blue); font-weight: 750; }

/* Live hmotnost z vahy */
.app-scale { margin: -4px 0 18px; padding: 14px 16px; border-radius: var(--bruto-radius); background: var(--bruto-navy); color: #fff; }
.app-scale-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13px; font-weight: 750; letter-spacing: .6px; text-transform: uppercase; color: #c9d1e6; }
.app-scale-status { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 700; }
.app-scale-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #c9d1e6; }
.app-scale-value { margin-top: 4px !important; font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; text-align: right; font-variant-numeric: tabular-nums; }
.app-scale-value small { font-size: 16px; font-weight: 700; color: #c9d1e6; letter-spacing: 0; }
.app-scale[data-state="stable"] .app-scale-status::before { background: #fff; box-shadow: 0 0 0 3px #ffffff40; }
.app-scale[data-state="unstable"] .app-scale-status::before { background: var(--bruto-red); }
.app-scale[data-state="unstable"] .app-scale-value { color: #c9d1e6; }
.app-scale:is([data-state="connecting"], [data-state="nodata"], [data-state="offline"], [data-state="server"]) .app-scale-value { color: #8a96b8; }
.app-scale:is([data-state="nodata"], [data-state="offline"], [data-state="server"]) .app-scale-status::before { background: var(--bruto-red); }

.app-weight-row { display: flex; gap: 10px; align-items: stretch; }
.app-weight-row .app-unit { flex: 1; min-width: 0; }
.app-capture { min-height: 50px !important; padding: 10px 18px !important; flex-shrink: 0; }
.app-capture:disabled { opacity: .45; cursor: not-allowed; }
.app-weight-source { color: var(--bruto-blue); font-weight: 700; }
.app-weight input[readonly],
.app-admin-form input[readonly] { background: var(--bruto-wash); cursor: default; }
.app-weight input.is-captured { border-color: var(--bruto-blue); }

/* Rezim (nove vazenie / dovazenie) */
.app-mode { margin-top: 16px; padding: 14px 16px; border-radius: var(--bruto-radius); border-left: 4px solid var(--bruto-field); background: var(--bruto-wash); font-size: 15px; line-height: 1.55; }
.app-mode.is-second { border-left-color: var(--bruto-blue); background: #e7ebf3; }
.app-mode strong { font-weight: 800; }

/* Vyhladavanie v ciselniku */
.lookup ul { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 6px 0; list-style: none; max-height: 300px; overflow: auto; background: #fff; border: 1px solid var(--bruto-field); border-radius: var(--bruto-radius); box-shadow: var(--bruto-shadow); }
.lookup li { padding: 10px 16px; cursor: pointer; font-size: 15px; line-height: 1.4; }
.lookup li[aria-selected="true"], .lookup li:hover { background: #e7ebf3; color: var(--bruto-blue); }
.lookup li.info { color: var(--bruto-muted); cursor: default; background: none; }
.bruto-form .lookup.selected input[type=text] { border-color: var(--bruto-blue); padding-right: 44px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23303c92' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") no-repeat right 14px center / 18px; }
.app-vehicle input[type=text] { font-size: 22px !important; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; min-height: 58px; }

/* Hmotnost: hlavny udaj formulara */
.app-unit { position: relative; }
.app-unit input { padding-right: 52px !important; }
.app-unit::after { content: attr(data-unit); position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--bruto-muted); font-weight: 700; pointer-events: none; }
.app-weight input { font-size: 22px !important; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.bruto-form input:disabled { background: var(--bruto-wash); color: var(--bruto-muted); cursor: not-allowed; }

/* Prepinac druhu pohybu (radio ako segmenty) */
.bruto-form .app-segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.app-segmented label { position: relative; }
.app-segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.app-segmented span { display: inline-flex; align-items: center; min-height: 46px; padding: 10px 18px; border: 1px solid var(--bruto-field); border-radius: var(--bruto-radius); font-size: 15px; font-weight: 700; background: #fff; transition: background .15s, border-color .15s, color .15s; }
.app-segmented label:hover span { border-color: var(--bruto-blue); }
.app-segmented input:checked + span { background: var(--bruto-blue); border-color: var(--bruto-blue); color: #fff; }
.app-segmented input:focus-visible + span { outline: 3px solid var(--bruto-focus); outline-offset: 2px; }

/* Objednavky */
.app-options { display: grid; gap: 8px; }
.app-options label { display: flex; gap: 12px; align-items: center; min-height: 50px; padding: 10px 14px; border: 1px solid var(--bruto-field); border-radius: var(--bruto-radius); cursor: pointer; font-size: 15px; font-weight: 600; }
.app-options label:hover { border-color: var(--bruto-blue); }
.app-options label:has(input:checked) { border-color: var(--bruto-blue); background: #e7ebf3; color: var(--bruto-blue); }
.app-options input { width: 20px; height: 20px; margin: 0; accent-color: var(--bruto-blue); flex-shrink: 0; }
.app-muted { color: var(--bruto-muted); font-size: 15px; }

/* Doplnujuce polia (rozbalovacie, ako FAQ na bruto.sk) */
.app-card.app-extras { padding: 0; }
.app-extras summary { position: relative; list-style: none; cursor: pointer; padding: 22px 64px 22px 26px; }
.app-extras summary::-webkit-details-marker { display: none; }
.app-extras summary::after { content: '+'; position: absolute; right: 24px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--bruto-field); border-radius: 50%; color: var(--bruto-blue); font-weight: 700; }
.app-extras[open] summary::after { content: '–'; }
.app-extras summary .app-card-title { margin: 0; }
.app-extras-body { padding: 0 26px 26px; display: grid; gap: 20px; }
.app-extras-body .bruto-check { color: var(--bruto-ink); font-weight: 700; }

/* Zoznam */
.app-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.app-daypick { display: flex; gap: 10px; min-width: 0; }
.app-toolbar input[type=date] { min-height: 46px; padding: 8px 12px; font: inherit; font-size: 15px; color: var(--bruto-ink); border: 1px solid var(--bruto-field); border-radius: var(--bruto-radius); background: #fff; }
.app-toolbar .bruto-btn { min-height: 46px; padding: 8px 16px; font-size: 15px; }
.app-filter { display: inline-flex; min-width: 0; border: 1px solid var(--bruto-field); border-radius: var(--bruto-radius); overflow: hidden; }
.app-filter a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; font-size: 14px; font-weight: 700; color: var(--bruto-ink); background: #fff; }
.app-filter a[aria-current="true"] { background: var(--bruto-blue); color: #fff; }
.app-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.app-stat { background: #fff; border: 1px solid var(--bruto-line); border-radius: var(--bruto-radius-card); padding: 16px 20px; color: var(--bruto-muted); font-size: 14px; }
.app-stat strong { display: block; color: var(--bruto-ink); font-size: 26px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.app-stat.is-accent { border-top: 3px solid var(--bruto-red); }
.app-list .bruto-table { position: relative; background: #fff; }
.app-list .bruto-table table { min-width: 940px; }
.app-list .bruto-table th, .app-list .bruto-table td { padding-inline: 12px; }
.app-list .bruto-table td { min-width: 0; white-space: nowrap; }
.app-list .bruto-table td.is-wrap { white-space: normal; min-width: 140px; }
.app-list tr.storno td:not(.status):not(.actions) { color: var(--bruto-muted); text-decoration: line-through; }
.app-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.app-pager-info { margin: 0; color: var(--bruto-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.app-pager nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.app-pager ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.app-pager a, .app-pager-step, .app-pager-gap { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: var(--bruto-radius); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.app-pager a { border: 1px solid var(--bruto-field); background: #fff; color: var(--bruto-ink); text-decoration: none; }
.app-pager a:hover { border-color: var(--bruto-blue); color: var(--bruto-blue); }
.app-pager a[aria-current="page"] { background: var(--bruto-blue); border-color: var(--bruto-blue); color: #fff; }
.app-pager-step[aria-disabled="true"] { border: 1px solid var(--bruto-line); color: var(--bruto-field); }
.app-pager-gap { min-width: 24px; padding: 0; color: var(--bruto-muted); }
.app-empty { background: #fff; border: 1px dashed var(--bruto-field); border-radius: var(--bruto-radius-card); padding: 40px 24px; text-align: center; color: var(--bruto-muted); }
.app-badge { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 750; white-space: nowrap; }
.app-badge.finished { background: #e7ebf3; color: var(--bruto-blue); }
.app-badge.waiting { background: #fff; color: var(--bruto-ink); border: 1px solid var(--bruto-field); }
.app-badge.waiting::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--bruto-red); }
.app-badge.storno { background: var(--bruto-wash); color: var(--bruto-muted); }
.row-actions { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.row-actions a, .row-actions button { font: inherit; font-size: 14px; font-weight: 750; color: var(--bruto-blue); background: none; border: 0; padding: 6px 0; cursor: pointer; }
.row-actions a:hover, .row-actions button:hover { text-decoration: underline; text-decoration-color: var(--bruto-red); text-underline-offset: 4px; }
.row-actions .is-muted { color: var(--bruto-muted); font-size: 14px; }

/* Sprava pracovisk */
.app-gap { margin-bottom: 20px; }
.app-gap-top { margin-top: 18px; }
.app-admin-form { gap: 20px; max-width: 900px; }
.app-admin-form .bruto-form-row, .app-admin-form .app-grid { align-items: start; }
.app-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 20px; margin-top: 14px; }
.app-users .bruto-check { color: var(--bruto-ink); font-weight: 650; }
.app-scale-test { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin-top: 20px; }
.app-scale-test .bruto-btn { min-height: 46px; padding: 10px 18px; font-size: 15px; }
.app-admin-actions { margin-top: 0; }
.app-admin-actions .bruto-btn[type=submit] { width: auto; }
.bruto-eyebrow a { color: inherit; }

/* Prihlasenie, pracovisko, spravy */
.app-narrow { max-width: 460px; margin: 24px auto 0; }
.app-narrow .bruto-panel h1 { font-size: 28px; font-weight: 800; letter-spacing: -.6px; margin: 8px 0 22px; }
.app-narrow .bruto-alert { margin-bottom: 18px; }
.app-stations { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.app-stations form { margin: 0; }
.app-stations button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 58px; padding: 12px 18px; font: inherit; font-size: 17px; font-weight: 750; color: var(--bruto-ink); background: #fff; border: 1px solid var(--bruto-field); border-radius: var(--bruto-radius); cursor: pointer; text-align: left; }
.app-stations button:hover { border-color: var(--bruto-blue); color: var(--bruto-blue); }
.app-stations small { color: var(--bruto-muted); font-size: 14px; font-weight: 700; }

@media (max-width: 1200px) {
  .app-list .is-optional { display: none; }
}
@media (max-width: 1100px) {
  .app-columns { grid-template-columns: minmax(0, 1fr); }
  /* suhrn s tlacidlom ostava na spodku obrazovky */
  .app-summary { position: sticky; top: auto; bottom: 0; z-index: 30; margin-inline: -1px; }
  .app-summary .bruto-panel { border-radius: var(--bruto-radius-card) var(--bruto-radius-card) 0 0; padding: 16px 20px 18px; }
  .app-summary .app-summary-detail { display: none; }
  .app-summary h2 { font-size: 17px; margin-top: 0; }
  .app-summary .app-totals { margin-top: 6px; padding-top: 0; border-top: 0; }
  .app-summary .app-totals .is-netto { margin-top: 0; }
  .app-summary .bruto-btn { margin-top: 12px; }
  .app-summary .app-scale { margin: 0 0 10px; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .app-summary .app-scale-value { margin: 0 !important; font-size: 26px; }
}
@media (max-width: 900px) {
  .app-header .bruto-header-inner { min-height: 68px; }
  .app-header .bruto-menu-toggle { margin-left: auto; }
  .app-name { padding-left: 14px; }
  .app-header .bruto-navigation ul { display: grid; gap: 4px; }
  .app-user { text-align: left; padding-block: 10px; }
  .app-logout .bruto-btn { width: 100%; }
}
@media (max-width: 650px) {
  .app-header .bruto-header-inner { gap: 12px; }
  .app-name { font-size: 16px; padding-left: 12px; }
  .app-main { padding-block: 20px 0; }
  .app-card { padding: 18px 16px 20px; }
  .app-extras summary { padding: 18px 56px 18px 16px; }
  .app-extras summary::after { right: 14px; }
  .app-extras-body { padding: 0 16px 20px; }
  .app-segmented label { flex: 1 1 40%; }
  .app-segmented span { width: 100%; justify-content: center; }
  .app-summary { margin-inline: -20px; }
  .app-summary .bruto-panel { border-inline: 0; }
  .app-toolbar { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .app-daypick { grid-column: 1 / -1; grid-row: 1; }
  .app-daypick input[type=date] { flex: 1; min-width: 0; }
  .app-filter { grid-column: 1 / -1; }
  .app-filter a { flex: 1; justify-content: center; }
  .app-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .app-stat.is-accent { grid-column: 1 / -1; }
  .app-stat { padding: 10px 12px; font-size: 12px; line-height: 1.35; }
  .app-stat strong { font-size: 18px; }
  .app-pager { justify-content: center; }
  .app-pager nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .app-pager ol { grid-column: 1 / -1; grid-row: 1; justify-content: center; }
  .app-pager-step { width: 100%; }
  .app-toolbar form { flex: 1; }
}
