/* Small additions on top of Bulma. */

/* Also defined by Bulma; repeated so filtering/tabs keep working if Bulma fails to load. */
.is-hidden { display: none !important; }

.week-tabs a { flex-direction: column; text-align: center; line-height: 1.35; padding-top: .6em; padding-bottom: .6em; }
.week-tabs .tag { margin-top: .3em; }

.product-table .group-row th,
.table .group-row th {
  background: hsl(0, 0%, 96%);
  color: hsl(0, 0%, 29%);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: .6em;
}
.product-table td { vertical-align: middle; }
.product-table .qty-input { width: 5.5em; text-align: right; }
.product-table tr.in-bag td:first-child { font-weight: 600; }
.product-table tr.in-bag { background: hsl(153, 53%, 96%); }

.bag-box { position: sticky; top: 1rem; }
.bag-list { list-style: none; margin: 0; max-height: 45vh; overflow-y: auto; }
/* Next to the product list (tablet/desktop): the bag box never gets taller than the screen –
   it scrolls inside itself, and the confirmation + order button stay pinned to its bottom. */
@media screen and (min-width: 769px) {
  .bag-box { box-sizing: border-box; max-height: calc(100vh - 2rem); overflow-y: auto;
             overscroll-behavior: contain; }  /* app.js narrows max-height to the visible space */
  .bag-box .bag-list { max-height: 30vh; }
  .bag-box .submit-bar { position: sticky; bottom: -1.25rem; z-index: 2; margin: 0 -1.25rem -1.25rem;
                         padding: .75rem 1.25rem 1.25rem; background: var(--bulma-scheme-main, #fff);
                         box-shadow: 0 -6px 10px -8px rgba(0, 0, 0, .25); }
  .bag-jump { display: none !important; }
}
/* Phones: a bar at the bottom of the screen jumps to the order button */
.bag-jump { position: fixed; left: .75rem; right: .75rem; bottom: .75rem; z-index: 30;
            display: flex; justify-content: space-between; align-items: center; gap: .75rem;
            padding: .7rem 1rem; border-radius: 8px; background: var(--bulma-primary, #00d1b2);
            color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); font-size: .9rem; }
.bag-jump:hover, .bag-jump:focus { color: #fff; }
.bag-jump.is-hidden, .bag-jump.is-out { display: none; }
.bag-jump-action { font-weight: 600; white-space: nowrap; }
@media screen and (max-width: 768px) {
  body:has(.bag-jump:not(.is-hidden)) .section { padding-bottom: 5rem; }  /* room for the bar */
}
.bag-list li { display: flex; justify-content: space-between; gap: 1em; padding: .3em 0; border-bottom: 1px solid hsl(0, 0%, 93%); font-size: .9rem; }
.bag-list li > .bag-value { white-space: nowrap; font-weight: 600; }
.bag-list .bag-meta { display: block; font-size: .75rem; color: hsl(0, 0%, 48%); }
.bag-total { display: flex; justify-content: space-between; padding: .5em 0 .25em; border-top: 2px solid hsl(0, 0%, 86%); margin-bottom: .25em; }

.stat-box { height: 100%; }

.print-only { display: none; }

@media print {
  .no-print, .navbar, .notification .delete { display: none !important; }
  .print-only { display: block !important; }
  .section { padding: 0; }
  .box { box-shadow: none; border: 1px solid #ccc; }
  .location-order { break-after: page; }
  .tab-panel.is-hidden { display: none !important; }
  a[href]::after { content: none; }
}

.confirm-box { background: hsl(48, 100%, 96%); border-radius: 6px; padding: .6em .75em; font-size: .85rem; }
.confirm-box .checkbox { line-height: 1.4; }
.confirm-box input { margin-right: .4em; }

/* ---------------------------------------------------------------- charts (statistics)
   Validated categorical palette (fixed order: food, cleaning, electronics) with
   separate steps for dark mode. Text never uses series colours. */
.viz {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --viz-grid: hsl(0, 0%, 90%);
  --viz-axis: hsl(0, 0%, 40%);
  --viz-surface: var(--bulma-scheme-main, #fff);
}
@media (prefers-color-scheme: dark) {
  .viz {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --viz-grid: hsl(0, 0%, 25%);
    --viz-axis: hsl(0, 0%, 70%);
  }
}
.viz-legend { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: .85rem; }
.viz-legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.viz-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.hbar-chart { display: grid; gap: 6px; }
.hbar-row { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; align-items: center; gap: .75rem;
            padding: 2px 4px; border-radius: 4px; outline: none; }
.hbar-row:hover, .hbar-row:focus-visible { background: var(--bulma-scheme-main-bis, hsl(0, 0%, 97%)); }
.hbar-label { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.hbar-bar { display: block; height: 14px; min-width: 2px; border-radius: 0 4px 4px 0; flex: none; }
.hbar-value { font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--viz-axis); }

@media (max-width: 600px) {
  .hbar-row { grid-template-columns: 1fr; gap: .1rem; }
}
.column-chart svg { width: 100%; height: auto; display: block; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-baseline { stroke: var(--viz-axis); stroke-width: 1; }
.viz-axis { fill: var(--viz-axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-hit { fill: transparent; cursor: default; outline: none; }
.viz-hit:hover, .viz-hit:focus-visible { fill: hsla(0, 0%, 50%, .08); }

.viz-tooltip { position: fixed; z-index: 50; pointer-events: none; white-space: pre-line; font-size: .8rem;
               line-height: 1.45; padding: .45rem .6rem; border-radius: 6px; max-width: 18rem;
               background: var(--bulma-scheme-invert, #222); color: var(--bulma-scheme-main, #fff);
               box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }

.window-banner p + p { margin-top: .25rem; }
.ntfy-events { padding-left: .25rem; }

@media print {
  .viz-tooltip { display: none !important; }
}

/* ---------------------------------------------------------------- delivered orders */
.delivery-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.location-order.is-delivered { opacity: .55; background: var(--bulma-scheme-main-bis, hsl(0, 0%, 97%)); }
.location-order.is-delivered:hover { opacity: .85; }
.location-order.is-delivered table { text-decoration: line-through; text-decoration-color: hsla(0, 0%, 50%, .5); }
tr.is-delivered-row td { opacity: .5; }
tr.is-delivered-row:hover td { opacity: .85; }
.delivery-bar .level-right { gap: .5rem; flex-wrap: wrap; }
@media print {
  .location-order.is-delivered { opacity: 1; }
}

/* ---------------------------------------------------------------- inventory */
.stock-input { width: 6.5em; text-align: right; display: inline-block; }
.stock-input.is-changed { border-color: var(--bulma-warning, #ffb70f); background: hsl(48, 100%, 96%); }

/* ---------------------------------------------------------------- per person: diverging bars
   blue = less than the reference, red = more, grey = about the reference (dataviz diverging pair) */
.viz { --div-neg: #2a78d6; --div-pos: #e34948; --div-neutral: #b4b2ac; }
@media (prefers-color-scheme: dark) {
  .viz { --div-neg: #3987e5; --div-pos: #e66767; --div-neutral: #6b6a66; }
}
.dv-chart { display: grid; gap: 4px; }
.dv-row { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; align-items: center; gap: .75rem;
          padding: 2px 4px; border-radius: 4px; color: inherit; }
.dv-row:hover, .dv-row:focus-visible, .dv-row.is-selected { background: var(--bulma-scheme-main-bis, hsl(0, 0%, 96%)); color: inherit; }
.dv-label { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-track { position: relative; height: 18px; }
.dv-track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--viz-axis); }
.dv-bar { position: absolute; top: 3px; height: 12px; min-width: 2px; }
.dv-bar[style*="left: 50%"] { border-radius: 0 4px 4px 0; }
.dv-bar[style*="right: 50%"] { border-radius: 4px 0 0 4px; }
.dv-pos { background: var(--div-pos); }
.dv-neg { background: var(--div-neg); }
.dv-neutral { background: var(--div-neutral); }
.dv-value { position: absolute; top: 0; font-size: .75rem; line-height: 18px; color: var(--viz-axis);
            font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.is-selected-row td { background: var(--bulma-scheme-main-bis, hsl(0, 0%, 96%)); }
@media (max-width: 600px) { .dv-row { grid-template-columns: 1fr; } }

/* product pictures and details */
.product-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; display: block; background: hsl(0, 0%, 96%); }
.product-thumb-cell { width: 60px; }
.product-cell { display: flex; align-items: center; gap: .75em; }
.product-thumb-button { padding: 0; border: 0; background: none; cursor: zoom-in; flex: none; }
.product-price { white-space: nowrap; }
.product-modal-card { max-width: 720px; width: calc(100% - 2rem); }
.product-modal-image { margin: 0 0 .75em; text-align: center; background: hsl(0, 0%, 97%); border-radius: 6px; }
.product-modal-image img { max-height: 55vh; max-width: 100%; display: inline-block; }
.product-modal-thumbs { display: flex; flex-wrap: wrap; gap: .5em; margin-bottom: .75em; }
.product-modal-thumbs button { padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; cursor: pointer; }
.product-modal-thumbs button.is-active { border-color: hsl(217, 71%, 53%); }
.product-modal-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; display: block; }
.product-modal-description { white-space: pre-line; }
.admin-image .image img { object-fit: cover; }
.admin-image.is-main { box-shadow: 0 0 0 2px hsl(217, 71%, 53%); }

/* electronics: each location's order */
.location-order { border: 1px solid hsl(0, 0%, 90%); border-radius: 6px; padding: .5em .75em; }
.location-order > summary { cursor: pointer; }

/* Transgourmet: carton input when booking in, schedule table */
.receipt-line { display: flex; align-items: center; justify-content: flex-end; gap: .5em; }
.receipt-unit { width: 5.5rem; flex: none; text-align: left; font-size: .75rem;
                color: hsl(0, 0%, 48%); white-space: nowrap; }
.schedule-table input[type="time"] { max-width: 8rem; }
.pack-hint { white-space: normal; height: auto; }

/* attendance: small bar next to the percentage */
.att-bar { display: inline-block; width: 4rem; height: .5rem; border-radius: 2px;
           background: hsl(0, 0%, 90%); vertical-align: middle; margin-right: .35rem; overflow: hidden; }
.att-bar > span { display: block; height: 100%; background: var(--series-1, #2a78d6); border-radius: 2px; }
.present-box .help.is-warning { color: hsl(35, 100%, 30%); }

/* maintenance mode */
.maintenance-banner { background: #b42318; color: #fff; padding: .6rem 1rem; text-align: center; }
.maintenance-banner a { color: #fff; text-decoration: underline; font-weight: 600; }
.maintenance-icon { font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.maintenance-box.is-active { border: 2px solid #b42318; }

/* "Hat es gereicht?" */
.feedback-box { border-left: 4px solid var(--series-1, #2a78d6); }
.feedback-choice input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.feedback-choice label:has(input:checked) { background: var(--series-1, #2a78d6); color: #fff; border-color: transparent; }
.feedback-choice label:has(input:focus-visible) { outline: 2px solid var(--series-1, #2a78d6); outline-offset: 2px; }
.fb-stack { display: flex; width: 10rem; height: .75rem; border-radius: 3px; overflow: hidden; gap: 2px; }
.fb-stack > span { display: block; height: 100%; }
.fb-wenig { background: var(--div-neg, #2a78d6); }
.fb-passt { background: var(--div-neutral, #a8a29e); }
.fb-viel { background: var(--div-pos, #e34948); }

/* standard order: readiness indicator (always together with a text label) */
.readiness { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%;
             vertical-align: middle; margin-right: .3rem; }
.readiness-green { background: #1baf7a; }
.readiness-yellow { background: #eda100; }
.readiness-red { background: #e34948; }
.std-hint { margin-top: .15rem; }
.mode-steps .box { height: 100%; }

/* people + note at the top of the bag: the part that matters most in the standard modes */
.order-details { background: hsl(204, 86%, 96%); border: 1px solid hsl(204, 70%, 85%);
  border-radius: 6px; padding: .75rem; }
.order-details .label { margin-bottom: .35rem; }
.order-details .recalc-button { background: hsl(217, 71%, 45%); color: #fff; border-color: transparent;
  font-weight: 600; box-shadow: 0 1px 3px rgba(10, 10, 10, .25); }
.order-details .recalc-button:hover { background: hsl(217, 71%, 38%); color: #fff; }
