/* modals.css — Stripe checkout overlay, books tab, reassign modal, edit-sheet fixes, order trackers + themes.
   Split from style.css (load order matters: see the stylesheet <link> order in index.html). */
/* ── Stripe Embedded Checkout overlay ── */
.stripe-checkout-overlay{
  display:none;
  position:fixed;
  top:0;left:0;right:0;bottom:0;
  background:rgba(0,0,0,.55);
  z-index:10000;
  justify-content:center;
  align-items:flex-start;
  overflow-y:auto;
  padding:24px 16px;
}
.stripe-checkout-overlay.on{display:flex}
.stripe-checkout-wrapper{
  position:relative;
  width:100%;
  max-width:500px;
  background:var(--white);
  border-radius: var(--radius-md);
  padding:0 16px 24px;
  box-shadow:0 8px 32px rgba(0,0,0,.3);
  margin:auto;
}
.stripe-checkout-header{
  display:flex;
  align-items:center;
  gap:8px;
  padding:12px 16px;
  margin:0 -16px 12px;
  border-bottom:1px solid #eee;
  position:sticky;
  top:0;
  background:var(--white);
  border-radius:12px 12px 0 0;
  z-index:2;
}
.stripe-checkout-logo{
  height:28px;width:28px;flex-shrink:0;
}
.stripe-checkout-biz{
  font-weight:700;font-size:18px;color:#5a2d82;
  flex:1 1 auto;min-width:0;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.stripe-checkout-close{
  flex:0 0 auto;
  background:none;border:none;
  font-size:22px;line-height:1;
  cursor:pointer;color:var(--grey-600);
  width:32px;height:32px;
  display:flex;align-items:center;justify-content:center;
  border-radius:50%;
}
.stripe-checkout-close:hover{color:var(--grey-900);background:var(--grey-100)}
#stripe-checkout-container{min-height:200px}
.stripe-pay-btn{
  display:block;width:100%;
  margin-top:16px;padding:12px;
  background:#635bff;color:var(--white);
  border:none;border-radius:6px;
  font-size:16px;font-weight:600;
  cursor:pointer;
}
.stripe-pay-btn:disabled{opacity:.55;cursor:default}
.stripe-pay-btn:hover:not(:disabled){background:#4b45c6}
.stripe-pay-msg{
  margin-top:8px;
  color:#df1b41;font-size:14px;
  min-height:20px;
}
.sheet-error {
    color: #a00;
    margin: 8px 12px;
    display: none;
}
.sheet-error:not(:empty) {
    display: block;
}

/* ── Books tab ──────────────────────────────────────────────────────────── */
.books-section{margin-bottom:12px;padding:16px}
.books-section-title{font-weight:700;font-size:15px;color:#5a2d82;margin-bottom:10px;padding-bottom:8px;border-bottom:2px solid #e8e0f0}
.books-note{font-size:12px;color:var(--grey-500);font-style:italic;margin-bottom:8px}
.books-row{display:flex;justify-content:space-between;align-items:baseline;padding:4px 0;gap:8px}
.books-label{flex:1 1 auto;color:#444;font-size:14px}
.books-value{flex:0 0 auto;font-family:monospace;font-size:14px;text-align:right;min-width:80px}
.books-row-total .books-label,.books-row-total .books-value{font-weight:700;font-size:15px}
.books-row-total{padding-top:6px}
.books-row-in .books-label{color:#2a7a2a}
.books-row-out .books-label{color:#b00}
.books-row-memo{padding:0 0 2px 16px;opacity:0.75;font-size:13px}
.books-divider{border:none;border-top:1px solid var(--grey-200);margin:6px 0}
.books-recon-ok .books-value{color:#2a7a2a}
.books-recon-fail .books-value{color:#b00}
/* Journal */
.books-journal{width:100%;margin-top:4px}
.books-j-row{display:grid;grid-template-columns:2fr 1fr 1fr;gap:4px;padding:3px 0;border-bottom:1px solid var(--grey-100);align-items:baseline}
.books-j-header{border-bottom:2px solid var(--grey-200);padding-bottom:5px;margin-bottom:2px}
.books-j-header .books-j-desc,.books-j-header .books-j-dr,.books-j-header .books-j-cr{font-weight:700;font-size:13px;color:#5a2d82}
.books-j-desc{font-size:13px;color:var(--grey-800)}
.books-j-dr,.books-j-cr{font-family:monospace;font-size:13px;text-align:right;white-space:nowrap}
.books-j-dr{color:#1a4fa0}
.books-j-cr{color:#8a1a8a}
.books-j-spacer{height:6px}


.modal-title {
    margin-bottom: 12px;
}

.retry-wrap {
    margin-top: 8px;
}

.inline-row {
    display: flex;
    gap: var(--gap-sm);
    align-items: center;
    flex-wrap: wrap;
}

.mt-8 {
    margin-top: 8px;
}

.image-preview {
    max-width: 360px;
    max-height: 360px;
    overflow: hidden;
    border: 1px solid var(--grey-200);
    padding: 6px;
    background: var(--white);
}

.image-preview-img {
    max-width: 100%;
    display: block;
}

#item-edit-sheet #ied-image-preview {
    display: none;
    width: min(280px, 100%);
    aspect-ratio: 1;
    max-width: 100%;
    max-height: none;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #f6f7f8;
}

#item-edit-sheet #ied-image-preview.has-image {
    display: block;
}

#item-edit-sheet #ied-image-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-overlay {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-overlay[hidden] {
    display: none !important;
}

/* Shared modal panel (the white card). Each modal below overrides only its own width. */
.account-modal-inner,
.directory-create-business-modal .modal-inner,
.money-adjust-modal .modal-inner,
.reassign-table-modal .modal-inner,
.reassign-table-modal-inner,
.or-confirm-modal .modal-inner,
.or-prompt-modal .modal-inner,
.or-cash-modal .modal-inner,
.or-card-confirm-modal .modal-inner,
.or-split-modal .modal-inner,
.books-export-modal-inner,
.email-receipt-modal-inner {
    background: var(--white);
    padding: 24px;
    border-radius: 18px;
    width: min(420px, calc(100% - 32px));
    box-sizing: border-box;
    box-shadow: 0 18px 40px rgba(0,0,0,0.2);
}

.directory-create-business-modal .modal-inner {
    width: min(560px, calc(100% - 32px));
    padding: 20px;
    text-align: left;
}

.directory-create-business-modal h3 {
    margin: 0 0 8px;
}

.directory-create-business-modal p {
    margin: 0 0 16px;
    color: #55606b;
}

.directory-create-business-form {
    display: grid;
    gap: 12px;
}

.directory-create-business-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.directory-create-business-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.money-adjust-modal .ues-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.money-adjust-modal .ues-header h3 {
    margin: 0;
    line-height: 1.25;
}

button.money-adjust-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--grey-700);
    padding: 0;
    width: auto;
    min-width: 0;
    flex-shrink: 0;
}

.money-adjust-form {
    display: grid;
    gap: 14px;
}

.money-adjust-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    font-size: var(--font-size-base);
}

.money-adjust-form input {
    padding: 10px 16px;
    border: 1px solid var(--grey-400);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    background: var(--white);
    outline: none;
}

.money-adjust-form input:focus {
    border-color: var(--grey-500);
}

.money-adjust-divider {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 6px 0 2px;
}

.money-adjust-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 0;
}

button.money-adjust-cancel-btn {
    background: none;
    border: none;
    color: var(--grey-800);
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    cursor: pointer;
    padding: 8px 4px;
    width: auto;
    min-width: 0;
}

button.money-adjust-save-btn {
    background: var(--button-primary-admin, #790e6e);
    color: var(--white);
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 28px;
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    width: auto;
    min-width: 0;
}

.money-adjust-op-toggle {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--header-action-fill, var(--grey-750));
    border-radius: var(--radius-pill);
    overflow: hidden;
}

button.money-op-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: var(--white);
    color: var(--header-action-fill, var(--grey-750));
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    cursor: pointer;
    font-weight: 600;
    width: auto;
    border-radius: 0;
}

button.money-op-btn.active {
    background: var(--header-action-fill, var(--grey-750));
    color: var(--white);
}

/* ── Reassign table modal ─────────────────────────────────────────────────── */
.reassign-table-modal .modal-inner,
.reassign-table-modal-inner {
    width: min(380px, calc(100% - 32px));
}

.reassign-table-modal .ues-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.reassign-table-modal .ues-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.reassign-table-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--grey-600);
    padding: 0 0 0 8px;
    width: auto;
    min-width: 0;
}

.reassign-table-from-row {
    font-size: var(--font-size-base);
    margin-bottom: 14px;
    color: #444;
}

.reassign-table-to-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: var(--font-size-base);
    margin-bottom: 12px;
}

.reassign-table-to-row select {
    padding: 10px 16px;
    border: 1px solid var(--grey-400);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    background: var(--white);
    outline: none;
    appearance: auto;
}

.reassign-table-to-row select:focus {
    border-color: var(--grey-500);
}

.reassign-table-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

button.reassign-cancel-btn {
    background: none;
    border: none;
    color: var(--grey-800);
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    cursor: pointer;
    padding: 8px 4px;
    width: auto;
    min-width: 0;
}

button.reassign-confirm-btn {
    background: var(--button-primary-admin, var(--brand-purple));
    color: var(--white);
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 28px;
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    width: auto;
    min-width: 0;
}

button.reassign-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─────────────────────────────────────────────────────────────────────────── */

@media (min-width: 641px) {
    #manager-money-adjust-icon {
        margin-right: auto;
    }
}

.qr-modal .modal-inner,
.qr-modal .qr-modal-inner {
    background: var(--white);
    padding: 18px;
    border-radius: var(--radius-lg);
    max-width: 420px;
    width: calc(100% - 32px);
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.qr-target-toggle {
    width: 100%;
    margin: 0 0 14px;
}

.item-desc-modal .idm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.45);
}

.item-desc-modal .idm-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    padding: 18px;
    border-radius: var(--radius-sm);
    background: var(--white);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.item-desc-modal .idm-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--button-primary-customer);
    color: var(--white);
    font-size: var(--font-size-base);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.item-desc-modal .idm-title-wrap {
    margin-bottom: 8px;
}

.item-desc-modal .idm-title {
    font-size: var(--font-size-base);
}

.item-desc-modal .idm-text {
    color: var(--grey-900);
    line-height: 1.4;
    white-space: pre-wrap;
}

.item-desc-modal .idm-allergens {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.08);
    color: #b3261e;
    font-size: 0.92em;
    line-height: 1.4;
}
.item-desc-modal .idm-allergens strong { color: #b3261e; }

.modal-btn-wrap {
    display: flex;
    gap: var(--gap-sm);
    justify-content: center;
}

.qr-modal button.filter-button.secondary,
.qr-modal .qr-close {
    width: auto;
    min-width: 76px;
    background: var(--white);
    color: var(--button-primary-admin);
    border: 1px solid var(--button-primary-admin);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.qr-modal button.filter-button.secondary:hover,
.qr-modal .qr-close:hover,
.qr-modal button.filter-button.secondary:focus,
.qr-modal .qr-close:focus {
    background: var(--white);
}

.qr-image {
    max-width: 300px;
    width: 80%;
    height: auto;
    display: block;
    margin: 0 auto 12px;
}

.qr-input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.qr-download {
    margin-left: 8px;
}

.qr-wrap {
    margin-top: 8px;
}

/* Let JS set tick horizontal position using --left */
.gantt-axis-tick {
    left: var(--left);
}

/* Utility: prefer class-controlled visibility rather than frequent inline style writes */
.hidden {
    display: none !important;
}

/* Small set of helper classes that the JS helper may add when a specific display
type is required (inline-block / block / flex). These are intentionally
named with a js-display- prefix to avoid colliding with existing class names. */

.js-display-inline-block {
    display: inline-block !important;
}

.js-display-block {
    display: block !important;
}

.js-display-flex {
    display: flex !important;
}

/* Fixed-value utility classes — replace hardcoded element.style writes in JS. */
.refund-select-hint {
    margin-bottom: 8px;
}

.biz-photo-crop-img {
    max-height: 320px;
}

/* Popups: allow JS to supply placement via --left/--top (fallback uses left/top). */
.gantt-action-popup {
    left: var(--left, auto);
    top: var(--top, auto);
}

/* Product image min-height is set via --min-h by JS when needed. */
.productimage {
    min-height: var(--min-h, auto);
}

/* ===== Bottom sheets (user/table edit sheets + generic .sheet) =====
JS only toggles the "ues-open" class (see ensureSheet in modals.js); the
closed/open pair below is the single source of truth for sheet positioning.
The variation picker (#variation-select-sheet.sheet.ues-open in sheets.css)
deliberately out-specifies the open rule to render centred instead. */

/* Diagnostics: deliveries-range .slots-overview panel shown by script.js */
#deliveries-range-summary {
    box-sizing: border-box;
    margin: 8px 12px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg,#fffef8,#fff9e6);
    border: 1px solid rgba(255,210,77,0.9);
    font-family: monospace, system-ui, -apple-system, Segoe UI, Roboto, Arial;
    font-size: var(--font-size-sm);
    color: var(--grey-900);
    max-height: 220px;
    overflow: auto;
}

.deliveries-range-row {
    padding: 4px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.06);
}

.user-edit-sheet,
.table-edit-sheet,
.sheet {
    /* start hidden off-screen */
    display: none;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: -140%;
    width: calc(100% - 32px);
    max-width: 760px;
    box-sizing: border-box;
    padding: var(--gap-md);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transition: bottom 280ms ease, opacity 200ms ease, transform 200ms ease;
    opacity: 0;
    z-index: 9999;
}

/* Open state: out-specifies the closed base above (0,2,0 vs 0,1,0). */
.user-edit-sheet.ues-open,
.table-edit-sheet.ues-open,
.sheet.ues-open {
    display: block;
    bottom: 8px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    opacity: 1;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Prevent background page scrolling while a bottom-sheet is open.
   !important is required: JS elsewhere writes body.style.overflow inline
   (a documented dynamic-style case), and only !important beats an inline style. */
body:has(.sheet.ues-open) {
    overflow: hidden !important;
}

/* Table group edit: checkbox list for assigning tables */
.vtge-tables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 8px 0;
}
.vtge-table-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    min-width: 120px;
    font-size: var(--font-size-body, 14px);
}
.vtge-table-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.vtge-table-checkbox .dummycheckbox {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 2px solid var(--ink, var(--grey-800));
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms, border-color 150ms;
}
.vtge-table-checkbox input[type="checkbox"]:checked + .dummycheckbox {
    background: var(--accent, var(--brand-purple-bright));
    border-color: var(--accent, var(--brand-purple-bright));
}
.vtge-table-checkbox input[type="checkbox"]:checked + .dummycheckbox::after {
    content: '';
    display: block;
    width: 6px;
    height: 10px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* Small responsive tweak so sheet uses full width on very small screens */
@media (max-width:420px) {
    .user-edit-sheet, .table-edit-sheet, .sheet {
        left: 8px;
        right: 8px;
        transform: none;
        width: calc(100% - 16px);
    }

    /* Same specificity as the open rule above; later in the file, so it wins here. */
    .user-edit-sheet.ues-open, .table-edit-sheet.ues-open, .sheet.ues-open {
        left: 8px;
        right: 8px;
        transform: none;
    }

}

/* Deliveries tracker styles */
.deliveries-list,
#orders,
#tableorders-list {
    display:flex;
    flex-direction:column;
    gap:12px;
}

#orders,
#tableorders-list {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.delivery-card {
    padding:var(--pad-card);
}

.delivery-card-hdr {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:8px;
    min-height:56px;
}

.delivery-eta {
    display:flex;
    align-items:center;
    gap: var(--gap-sm);
    white-space:nowrap;
    margin-left:12px;
}

/* Mobile fix: long edit sheets must scroll when content exceeds viewport height. */
@media (max-width: 768px) {
    .user-edit-sheet.ues-open,
    .table-edit-sheet.ues-open,
    .sheet.ues-open {
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

.delivery-ref {
    display:flex;
    align-items:center;
}

.delivery-ref {
    font-weight:600;
}

.delivery-tracker {
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 10px 0 6px;
    overflow-x: auto;
}

/* ---- step node ---- */
.delivery-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    min-width: 72px;
}

.step-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #dde1e7;
    margin-bottom: 7px;
    flex-shrink: 0;
    position: relative;
    transition: background 0.3s, box-shadow 0.3s;
}

/* Completed past steps — filled + checkmark */
.delivery-step.active:not(.current) .step-dot {
    background: #4A90D9;
}
.delivery-step.active:not(.current) .step-dot::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}

/* Current step — pulsing ring */
.delivery-step.current .step-dot {
    background: #2563EB;
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.2);
    animation: pulse-blue 1.8s ease-in-out infinite;
}
@keyframes pulse-blue {
    0%, 100% { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.22); }
    50%       { box-shadow: 0 0 0 11px rgba(37, 99, 235, 0.0); }
}

/* ---- connector line ---- */
.step-connector {
    flex: 1 1 0;
    height: 3px;
    background: #dde1e7;
    align-self: flex-start;
    margin-top: 10px;   /* (22px dot − 3px line) / 2 = 9.5 → 10 */
    min-width: 12px;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}
.step-connector.active {
    background: #4A90D9;
}
/* shimmer sweep on completed connectors */
.step-connector.active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,0.65) 50%,
        transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 2.4s ease-in-out infinite;
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ---- labels ---- */
.step-label {
    font-size: 0.72rem;
    text-align: center;
    color: #b0b5be;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s, font-weight 0.2s;
}
.delivery-step.active:not(.current) .step-label {
    color: var(--grey-700);
    font-weight: 600;
}
.delivery-step.current .step-label {
    color: #2563EB;
    font-weight: 700;
}

/* ========== Pickup — green theme ========== */
.delivery-tracker--pickup .delivery-step.active:not(.current) .step-dot { background: #22A37A; }
.delivery-tracker--pickup .delivery-step.current .step-dot {
    background: #16A34A;
    box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.22);
    animation: pulse-green 1.8s ease-in-out infinite;
}
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.22); }
    50%       { box-shadow: 0 0 0 11px rgba(22, 163, 74, 0.0); }
}
.delivery-tracker--pickup .step-connector.active { background: #22A37A; }
.delivery-tracker--pickup .delivery-step.active:not(.current) .step-label { color: #16A34A; }
.delivery-tracker--pickup .delivery-step.current .step-label { color: #16A34A; }

/* ========== Table — admin brand colour theme ========== */
.delivery-tracker--table .delivery-step.active:not(.current) .step-dot { background: var(--button-primary-admin); }
.delivery-tracker--table .delivery-step.current .step-dot {
    background: var(--button-primary-admin);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--button-primary-admin) 22%, transparent);
    animation: pulse-table 1.8s ease-in-out infinite;
}
@keyframes pulse-table {
    0%, 100% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--button-primary-admin) 22%, transparent); }
    50%       { box-shadow: 0 0 0 11px color-mix(in srgb, var(--button-primary-admin) 0%, transparent); }
}
.delivery-tracker--table .step-connector.active { background: var(--button-primary-admin); }
.delivery-tracker--table .delivery-step.active:not(.current) .step-label { color: var(--button-primary-admin); }
.delivery-tracker--table .delivery-step.current .step-label { color: var(--button-primary-admin); }

.delivery-details {
    margin-top: 4px;
    font-size: var(--font-size-sm);
    text-align: left;
}

.delivery-items {
    text-align: left;
}

.delivery-items p {
    margin: 8px 0 0;
}

.delivery-eta-footer {
    margin-top: 6px;
    text-align: left;
}

#screen-deliveries .delivery-details {
    margin-bottom: 6px;
}

#screen-deliveries .delivery-eta-footer .status-badge {
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
    display: inline-flex;
    justify-content: flex-start;
}

#screen-deliveries .delivery-eta-footer .status-badge.delivered-range {
    font-weight: 700;
}

/* Stations delivery footer */
.station-delivery-footer {
    margin-top: 0;
}

.station-delivery-footer--delivery {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-left: 4px;
    margin-right: 4px;
}

.station-delivery-footer .station-delivery-address {
    font-weight: 600;
    margin-bottom: 8px;
}

.station-delivery-footer .delivery-details {
    margin-bottom: 6px;
}

.station-delivery-footer .delivery-eta-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.station-delivery-footer .delivery-eta-footer .status-badge {
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
}

.station-delivery-footer .delivery-eta-footer .status-badge.eta-range {
    background: transparent;
    color: var(--black);
    padding: 0;
    font-size: var(--font-size-base);
    font-weight: 700;
    box-shadow: none;
}

.station-delivery-footer .override-delivery.icon-btn {
    background: transparent;
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-sm);
    padding: 5px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--grey-700);
}

.station-delivery-footer .override-delivery.icon-btn:hover {
    background: #f5f5f5;
    border-color: var(--grey-450);
}

/* Scoped overrides to beat any inherited centering */
#screen-deliveries .delivery-card,
#screen-deliveries .delivery-card * {
    text-align: left;
}
#screen-deliveries .step-label {
    text-align: center;
}
#screen-deliveries .delivery-details {
    margin-bottom: 10px;
}

@media (max-width:600px) {
    .delivery-card {
        padding: 10px;
    }

    .delivery-card-hdr .delivery-eta {
        margin-left: 8px;
    }
}

/* Vertical-centering fixes for the deliveries header (right-hand timestamp / badges) */
.delivery-card-hdr .delivery-eta {
    display: flex;
    align-items: center;
    /* center contents vertically via flexbox */
    gap: var(--gap-sm);
    margin-left: 12px;
    .eta-label {
        white-space: nowrap;
        margin-left: 6px;
        font-weight: 600;
    }

    .eta-debug {
        font-family: monospace;
        font-size: var(--font-size-xs);
        color: var(--grey-600);
        margin-top: 6px;
    }

    align-self: center;
    /* ensure the group sits in the middle of the header */
    height: auto;
    /* let the header's min-height define the box;
    don't force height */
}

.delivery-card-hdr .delivery-eta * {
    display: inline-flex;
    align-items: center;
}

.delivery-card-hdr .delivery-eta .status-badge,
.delivery-card-hdr .delivery-eta .badge,
.delivery-card-hdr .delivery-eta .pill {
    margin-left: 8px;
    vertical-align: middle;
}

.delivery-card-hdr .delivery-eta span {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    /* avoid baseline shifts */
}

