:root {
    --red: #e21b23;
    --red-dark: #c9151d;
    --blue: #242424;
    --blue-soft: #2f6fed;
    --green: #197c35;
    --green-dark: #125725;
    --yellow: #ffe600;
    --warm: #ffffff;
    --line: #e6e0d2;
    --text: #242424;
    --muted: #6b665d;
    --panel: #ffffff;
    --shadow: 0 2px 10px rgba(36, 36, 36, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--warm);
    font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
}

.inline-print-surface {
    display: none;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button,
.primary-link,
.secondary-link {
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease,
        color 160ms ease;
}

button:not(:disabled):hover,
.primary-link:hover,
.secondary-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(36, 36, 36, 0.14);
}

button:not(:disabled):active,
.primary-link:active,
.secondary-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(36, 36, 36, 0.12);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 2px;
}

button:disabled {
    cursor: wait;
    opacity: 0.62;
    transform: none;
    box-shadow: none;
}

.topbar {
    min-height: 72px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--yellow);
    color: var(--text);
    box-shadow: var(--shadow);
}

.topbar-left {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.brand {
    color: var(--red);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-weight: 800;
}

.brand img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--yellow);
}

.brand-title {
    color: var(--red);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.topbar-history-link {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--red);
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.topbar-history-link:hover,
.topbar-history-link.active {
    background: var(--red-dark);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.privacy-toplink {
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.privacy-toplink:hover {
    color: var(--red);
}

.ghost-button,
.secondary-button,
.primary-button,
.danger-button,
.icon-button,
.primary-link,
.secondary-link {
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    min-height: 42px;
    padding: 10px 16px;
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ghost-button {
    color: #fff;
    background: var(--red);
}

.ghost-button:hover,
.danger-button:hover {
    background: #ad1118;
}

.primary-button,
.primary-link {
    color: #fff;
    background: var(--red);
}

.primary-button:hover,
.primary-link:hover {
    background: var(--red-dark);
}

.primary-button.success {
    background: var(--green);
}

.primary-button.success:hover {
    background: var(--green-dark);
}

.secondary-button,
.secondary-link {
    color: var(--blue);
    background: #e9f0f4;
}

.secondary-button:hover,
.secondary-link:hover,
.icon-button:hover {
    background: #dbe8ee;
}

.print-link {
    color: var(--red);
    background: var(--yellow);
}

.print-link:hover {
    color: #fff;
    background: var(--red);
}

.danger-button {
    color: #fff;
    background: var(--red-dark);
}

.compact {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 14px;
}

.messages {
    max-width: 1120px;
    margin: 12px auto 0;
    padding: 0 16px;
}

.message {
    padding: 10px 12px;
    border-radius: 6px;
    background: #e8f7f2;
    color: #075f49;
    font-weight: 800;
    box-shadow: var(--shadow);
}

.message.error {
    background: #ffe9ec;
    color: var(--red-dark);
}

.message.success {
    background: #e8f7f2;
    color: #075f49;
}

.login-page {
    background: #fff;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 420px);
    padding: 24px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(36, 36, 36, 0.12);
}

.login-logo {
    width: 180px;
    height: 180px;
    object-fit: cover;
    display: block;
    margin: 0 auto 22px;
    border-radius: 8px;
    background: var(--yellow);
}

.login-schedule-status {
    margin: 0 0 16px;
    padding: 10px 12px;
    border-left: 4px solid var(--green);
    border-radius: 6px;
    background: #e8f7f2;
    color: #075f49;
    display: grid;
    gap: 3px;
    line-height: 1.25;
}

.login-schedule-status.closed {
    border-left-color: var(--red);
    background: #ffe9ec;
    color: var(--red-dark);
}

.login-schedule-status strong {
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
}

.login-schedule-status span {
    font-size: 13px;
    font-weight: 700;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    font-weight: 800;
    color: var(--blue);
}

.login-form input,
.filters input,
.filters select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

button.password-toggle:hover,
button.password-toggle:active {
    background: #eef5f8;
    color: var(--blue);
    transform: translateY(-50%);
    box-shadow: none;
}

button.password-toggle,
button.password-toggle:active {
    transform: translateY(-50%);
}

.password-toggle:focus-visible {
    outline-offset: 0;
}

.password-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-icon-eye-off {
    display: none;
}

.password-toggle.is-visible .password-icon-eye {
    display: none;
}

.password-toggle.is-visible .password-icon-eye-off {
    display: block;
}

.login-legal {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}

.login-legal a {
    color: var(--red);
    font-weight: 900;
}

.privacy-page {
    background: #fff;
}

.privacy-shell {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 34px 18px 52px;
}

.privacy-document {
    display: grid;
    gap: 18px;
}

.privacy-back {
    width: fit-content;
}

.privacy-document h1 {
    margin: 0;
    color: var(--blue);
    font-size: 38px;
    line-height: 1;
}

.privacy-updated {
    margin: -8px 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.privacy-document section {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.privacy-document h2 {
    margin: 0 0 8px;
    color: var(--red);
    font-size: 20px;
}

.privacy-document p {
    margin: 0 0 10px;
    max-width: 76ch;
    color: var(--text);
    line-height: 1.55;
}

.privacy-document a {
    color: var(--red);
    font-weight: 900;
}

.demo-credentials {
    margin-top: 18px;
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.order-shell {
    min-height: calc(100vh - 72px);
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(190px, 240px) minmax(260px, 1fr) minmax(320px, 380px);
    grid-template-rows: minmax(360px, 1fr) auto;
    grid-template-areas:
        "products focus summary"
        "calculator calculator summary";
    gap: 16px;
}

.admin-order-switcher {
    width: min(100%, 540px);
    margin: 12px auto 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.admin-order-switcher form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: end;
}

.admin-order-switcher label {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-order-switcher select {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: var(--text);
}

.login-session-conflict {
    display: grid;
    gap: 0.65rem;
    padding: 1rem;
    margin: 0.9rem 0;
    border: 1px solid #e2a13a;
    border-radius: 14px;
    background: #fff8e8;
    color: #563b12;
}

.login-session-conflict strong {
    font-size: 1.05rem;
}

.login-session-conflict span,
.login-session-conflict small,
.login-session-conflict p {
    overflow-wrap: anywhere;
}

.login-session-conflict p {
    margin: 0;
}

.takeover-form .danger-button {
    width: 100%;
}

.diagnostic-shell {
    display: grid;
    gap: 1.25rem;
}

.diagnostic-header {
    align-items: start;
}

.diagnostic-header p {
    max-width: 760px;
    color: var(--muted);
}

.diagnostic-section {
    display: grid;
    gap: 1rem;
}

.diagnostic-agent,
.diagnostic-detail {
    min-width: 220px;
    max-width: 420px;
    overflow-wrap: anywhere;
}

.diagnostic-id {
    max-width: 180px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.76rem;
    overflow-wrap: anywhere;
}

.diagnostic-time {
    display: block;
    margin-top: 0.3rem;
    color: var(--muted);
}

.order-segments {
    width: 118px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
}

.order-segment {
    display: block;
    height: 9px;
    border-radius: 999px;
    background: #dfe5e8;
    box-shadow: inset 0 0 0 1px rgba(20, 49, 67, 0.1);
    transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.order-segment.filled {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 5px rgba(20, 49, 67, 0.16);
}

.order-segment.segment-1.filled {
    background: #20ad69;
}

.order-segment.segment-2.filled {
    background: #86c83e;
}

.order-segment.segment-3.filled {
    background: #f2d33b;
}

.order-segment.segment-4.filled {
    background: #f19a32;
}

.order-segment.segment-5.filled {
    background: #e64b43;
}

.daily-order-progress {
    padding: 10px;
    border: 1px solid #d8e2e7;
    border-radius: 8px;
    background: #f8fbfc;
    display: grid;
    gap: 7px;
}

.daily-order-progress-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.daily-order-progress-label strong {
    color: var(--blue);
    font-size: 14px;
}

.daily-order-progress .order-segments {
    width: 100%;
}

.daily-order-progress small {
    color: #a32924;
    font-size: 11px;
    font-weight: 900;
}

.daily-order-progress.limit-reached {
    border-color: #efb7b3;
    background: #fff5f4;
}

.history-page {
    background: var(--yellow);
}

.history-shell {
    width: min(100%, 640px);
    margin: 0 auto;
    padding: 14px;
    display: grid;
    gap: 12px;
}

.history-header {
    min-height: 64px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.history-header h1 {
    margin: 2px 0 0;
    color: var(--blue);
    font-size: 28px;
    line-height: 1;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.history-card summary {
    min-height: 72px;
    padding: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    list-style: none;
}

.macro-history-summary {
    grid-template-columns: minmax(0, 1fr) auto 118px !important;
}

.macro-history-leading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-disclosure {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-right: 2px solid var(--blue);
    border-bottom: 2px solid var(--blue);
    transform: rotate(-45deg);
    transition: transform 180ms ease;
}

.macro-history-card > details[open] > .macro-history-summary .history-disclosure {
    transform: rotate(45deg) translate(-2px, -2px);
}

.macro-progress {
    display: grid;
    justify-items: end;
    gap: 4px;
}

.macro-progress small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.macro-history-detail {
    padding-top: 2px;
}

.macro-aggregate,
.component-orders {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.macro-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.macro-section-heading > div {
    display: grid;
    gap: 3px;
}

.component-orders {
    display: grid;
    gap: 8px;
}

.component-orders h2 {
    margin: 0;
    color: var(--blue);
    font-size: 16px;
}

.component-order {
    overflow: hidden;
    border: 1px solid #dce4e8;
    border-radius: 7px;
    background: #fff;
}

.component-order > summary {
    min-height: 58px;
    padding: 10px;
}

.component-order-body {
    padding: 0 10px 10px;
    display: grid;
    gap: 8px;
}

.history-card summary::-webkit-details-marker {
    display: none;
}

.history-card summary strong,
.history-item strong {
    color: var(--blue);
}

.history-card summary small {
    margin-top: 4px;
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.history-card summary b {
    color: var(--red);
    font-size: 18px;
}

.history-detail {
    padding: 0 12px 12px;
    display: grid;
    gap: 10px;
}

.history-items {
    display: grid;
    gap: 8px;
}

.history-item {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfd;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.history-item span {
    color: var(--muted);
    font-weight: 900;
    white-space: nowrap;
}

.history-total-note {
    margin: 0;
    padding: 10px;
    border-radius: 6px;
    color: #604500;
    background: #fff0b7;
    font-weight: 900;
}

.history-actions {
    display: flex;
    justify-content: flex-end;
}

.history-empty {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #fff;
    font-weight: 800;
    text-align: center;
}

.history-empty p {
    margin: 0;
}

.product-panel,
.focus-panel,
.summary-panel,
.calculator-panel,
.table-wrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.mobile-panel-tab {
    display: none;
}

.product-panel {
    grid-area: products;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-heading,
.summary-header,
.admin-header,
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-heading span,
.summary-header h2,
.admin-header h1,
.modal h2 {
    margin: 0;
    color: var(--blue);
}

.panel-heading small,
.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.product-list {
    display: grid;
    gap: 10px;
}

.product-button {
    min-height: 62px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f7f9fb;
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    font-weight: 900;
    font-size: 15px;
    line-height: 1.15;
    cursor: pointer;
    overflow-wrap: anywhere;
    text-align: center;
}

.product-button:hover {
    background: #edf4f8;
}

.product-button.active {
    color: var(--text);
    background: var(--yellow);
    border-color: #d6c000;
    box-shadow: inset 0 -3px 0 #d6c000;
}

.focus-panel {
    grid-area: focus;
    padding: 24px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 24px;
    text-align: center;
}

.focus-panel img {
    width: min(60%, 320px);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    background: var(--yellow);
}

.focus-panel h1 {
    margin: 8px 0;
    color: var(--blue);
    font-size: 32px;
}

.summary-panel {
    grid-area: summary;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.item-count {
    min-width: 34px;
    min-height: 34px;
    border-radius: 999px;
    color: #fff;
    background: var(--red);
    display: grid;
    place-items: center;
    font-weight: 900;
}

.notice {
    padding: 10px 12px;
    border-radius: 6px;
    background: #e8f7f2;
    color: #075f49;
    font-weight: 800;
}

.notice.error {
    background: #ffe9ec;
    color: var(--red-dark);
}

.empty-state {
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.items-list {
    flex: 1 1 auto;
    overflow: auto;
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 0;
}

.order-item,
.detail-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.order-item:hover {
    border-color: var(--green);
    background: #f7fff8;
}

.order-item.active {
    border-color: #d6c000;
    background: #fff9b8;
    box-shadow: inset 4px 0 0 var(--yellow);
}

.order-item strong,
.detail-item strong {
    color: var(--blue);
}

.item-meta {
    color: var(--muted);
    font-size: 14px;
}

.summary-footer {
    display: grid;
    gap: 6px;
    align-content: end;
    grid-auto-rows: max-content;
}

.summary-footer .primary-button,
.summary-footer .secondary-button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 14px;
}

.total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    font-size: 16px;
}

.total-row strong {
    color: var(--blue);
    font-size: 22px;
}

.calculator-panel {
    grid-area: calculator;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
}

.calculator-display {
    border-radius: 8px;
    padding: 12px 16px;
    background: #e9f0f4;
    color: var(--blue);
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto minmax(42px, 0.35fr);
    align-items: center;
    gap: 12px;
    min-height: 76px;
    transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.calculator-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: #fff;
    color: var(--blue);
    display: grid;
    place-items: center;
    align-self: center;
    justify-self: center;
    line-height: 0;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(36, 36, 36, 0.1);
}

.calculator-toggle:hover {
    background: #fff8a8;
    box-shadow: inset 0 0 0 1px #d6c000, 0 5px 12px rgba(36, 36, 36, 0.12);
}

.calculator-toggle svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.6;
    transition: transform 180ms ease;
}

.calculator-panel.keyboard-collapsed .calculator-toggle svg {
    transform: rotate(180deg);
}

.calculator-display span {
    color: var(--blue);
    font-weight: 800;
}

.display-product {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}

.display-unit {
    justify-self: end;
    font-size: 14px;
    letter-spacing: 0;
}

.calculator-display.confirmed {
    background: var(--green);
    color: #fff;
    box-shadow: inset 0 0 0 2px var(--green-dark);
}

.calculator-display.confirmed span {
    color: #fff;
}

.calculator-display.confirmed .calculator-toggle {
    color: var(--green-dark);
}

.calculator-display strong {
    font-size: 36px;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    justify-self: center;
}

.calculator-controls {
    min-height: 0;
    display: grid;
    gap: 8px;
}

.calculator-controls[hidden] {
    display: none;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, minmax(60px, 1fr));
    gap: 8px;
}

.keypad button,
.arrow-button {
    min-height: 56px;
    border: 0;
    border-radius: 6px;
    color: var(--blue);
    background: #e9f0f4;
    font-size: 22px;
    font-weight: 900;
    cursor: pointer;
}

.keypad button:hover {
    background: #dbe8ee;
}

.calculator-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(88px, 1fr));
    gap: 8px;
}

.calculator-actions .arrow-button {
    min-height: 54px;
    font-size: 30px;
}

.arrow-button.add {
    color: #fff;
    background: var(--green);
}

.arrow-button.add:hover {
    background: var(--green-dark);
}

.arrow-button.remove {
    color: #fff;
    background: var(--red-dark);
}

.arrow-button.remove:hover {
    background: #ad1118;
}

.admin-shell {
    padding: 24px;
    display: grid;
    gap: 18px;
}

.admin-header {
    align-items: end;
}

.admin-header h1 {
    font-size: 32px;
}

.admin-config-link {
    margin-top: 10px;
}

.admin-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 10px;
}

.stat-card {
    min-width: 130px;
    padding: 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stat-card strong {
    color: var(--blue);
    font-size: 24px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) minmax(150px, 1fr) minmax(170px, 1fr) 150px 150px auto auto;
    gap: 10px;
    align-items: center;
}

.table-wrap {
    overflow: auto;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-status,
.pagination-disabled {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 900;
}

.pagination-status {
    color: var(--blue);
    background: #fff;
    border: 1px solid var(--line);
}

.pagination-disabled {
    color: var(--muted);
    background: #f2f2f2;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1120px;
    background: #fff;
}

.orders-table th,
.orders-table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.orders-table th {
    color: var(--blue);
    background: #eef5f8;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.in-progress-orders {
    display: grid;
    gap: 10px;
}

.admin-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.admin-section-heading h2 {
    margin: 3px 0 0;
    color: var(--blue);
}

.admin-section-heading small {
    color: var(--muted);
    font-weight: 700;
}

.in-progress-table {
    min-width: 820px;
}

.in-progress-items {
    display: grid;
    gap: 3px;
    font-size: 13px;
}

.macro-order-row > td {
    background: #fff;
}

.macro-toggle {
    max-width: 100%;
    border: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--blue);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.macro-toggle > i {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 180ms ease;
}

.macro-toggle[aria-expanded="true"] > i {
    transform: rotate(45deg) translate(-2px, -2px);
}

.macro-toggle > span {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.macro-toggle strong {
    font-size: 15px;
}

.macro-toggle small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.macro-progress-cell {
    min-width: 145px;
}

.macro-details-row[hidden] {
    display: none;
}

.macro-details-row > td {
    padding: 0;
    background: #f3f7f9;
}

.macro-details-shell {
    padding: 14px;
    display: grid;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.macro-component-list {
    display: grid;
    gap: 10px;
}

.macro-component-row {
    min-width: 0;
    padding: 12px;
    border: 1px solid #d6e2e7;
    border-radius: 8px;
    background: #fff;
    display: grid;
    grid-template-columns: minmax(150px, 1.15fr) minmax(130px, 1fr) minmax(70px, 0.48fr) minmax(80px, 0.55fr) minmax(92px, 0.68fr) minmax(220px, 1.35fr) minmax(90px, 0.65fr);
    gap: 10px 12px;
    align-items: center;
    box-shadow: 0 1px 4px rgba(36, 36, 36, 0.04);
}

.macro-component-cell {
    min-width: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.macro-component-cell::before,
.macro-component-actions::before {
    display: block;
    margin-bottom: 3px;
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.macro-component-order {
    display: flex;
    align-items: center;
    gap: 8px;
}

.macro-component-order > i {
    width: 16px;
    height: 28px;
    flex: 0 0 16px;
    border-left: 3px solid var(--yellow);
    border-bottom: 3px solid var(--yellow);
    border-radius: 0 0 0 7px;
}

.macro-component-order > span {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.macro-component-order strong {
    color: var(--blue);
    font-size: 15px;
}

.macro-component-order small,
.macro-component-progress span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.macro-component-actions {
    align-items: flex-start;
}

.macro-component-items {
    grid-column: 1 / -1;
    margin-left: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 6px;
}

.macro-component-items > div {
    padding: 7px 8px;
    border-radius: 6px;
    background: #f6f8f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
}

.macro-component-items span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.macro-component-items strong {
    color: var(--blue);
    white-space: nowrap;
}

.status-pill {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 13px;
    color: var(--blue);
    background: #e9f0f4;
}

.status-pill.confirmado {
    color: #075f49;
    background: #ddf5ee;
}

.status-pill.enviado {
    color: #604500;
    background: #fff0b7;
}

.status-pill.recibido {
    color: #fff;
    background: var(--blue-soft);
}

.table-empty {
    text-align: center;
    color: var(--muted);
}

.data-shell {
    max-width: 1500px;
    margin: 0 auto;
}

.data-filters {
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.5fr) auto;
}

.data-grid {
    display: grid;
    grid-template-columns: minmax(340px, 1.2fr) repeat(2, minmax(280px, 1fr));
    gap: 14px;
}

.data-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    display: grid;
    align-content: start;
    gap: 14px;
}

.data-card-heading h2 {
    margin: 4px 0 0;
    color: var(--blue);
    font-size: 22px;
}

.prediction-list,
.bar-list {
    display: grid;
    gap: 10px;
}

.prediction-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    align-items: center;
}

.prediction-row strong {
    color: var(--blue);
}

.prediction-row span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.prediction-row b {
    color: var(--red);
    font-size: 18px;
}

.prediction-row i,
.bar-row i {
    display: block;
    width: var(--bar);
    min-width: 3px;
    height: 7px;
    border-radius: 999px;
    background: var(--yellow);
    box-shadow: inset 0 0 0 1px #d6c000;
}

.prediction-row i {
    grid-column: 1 / -1;
}

.bar-row {
    display: grid;
    grid-template-columns: 86px minmax(80px, 1fr) 82px;
    gap: 10px;
    align-items: center;
}

.bar-row span {
    min-width: 0;
    overflow: hidden;
    color: var(--blue);
    font-size: 13px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-row div {
    min-height: 10px;
    border-radius: 999px;
    background: #f1f3f5;
}

.bar-row strong {
    text-align: right;
    color: var(--blue);
    font-size: 13px;
}

.data-table {
    min-width: 860px;
}

.settings-shell {
    max-width: 1600px;
    margin: 0 auto;
}

.settings-header {
    align-items: center;
}

.settings-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.settings-nav a {
    min-height: 38px;
    padding: 8px 14px;
    border-bottom: 3px solid transparent;
    color: var(--blue);
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.settings-nav a:hover {
    color: var(--red);
    border-bottom-color: var(--yellow);
    background: #fffef0;
}

.settings-section {
    scroll-margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.settings-section-heading {
    min-height: 70px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: #fffef0;
}

.settings-section-heading h2 {
    margin: 2px 0 0;
    color: var(--blue);
    font-size: 22px;
}

.settings-form {
    display: grid;
}

.settings-table-wrap {
    width: 100%;
    overflow: auto;
}

.settings-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    background: #fff;
}

.settings-table th,
.settings-table td {
    padding: 10px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.settings-table th:last-child,
.settings-table td:last-child {
    border-right: 0;
}

.settings-table thead th,
.settings-table tbody th {
    color: var(--blue);
    background: #eef5f8;
    font-size: 13px;
    font-weight: 900;
}

.settings-table input:not([type="checkbox"]),
.settings-table select,
.create-form input,
.create-form select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: var(--text);
}

.settings-table input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--green);
    cursor: pointer;
}

.settings-table .short-input,
.create-form .short-input {
    min-width: 82px;
}

.toggle-cell {
    width: 76px;
    text-align: center;
}

.config-settings-table {
    min-width: 0;
    max-width: 720px;
}

.config-settings-table th {
    width: 260px;
}

.dias-recordatorio {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.dias-recordatorio label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}

.config-card-grid {
    padding: 16px;
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
    gap: 14px;
}

.config-card {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
    display: grid;
    gap: 14px;
}

.config-card legend {
    padding: 0 8px;
    color: var(--red);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.config-card label {
    display: grid;
    gap: 6px;
    color: var(--blue);
    font-weight: 800;
}

.config-card label > span {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.config-card input:not([type="checkbox"]) {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: var(--text);
}

.time-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 12px;
}

.switch-row {
    width: fit-content;
    display: inline-flex !important;
    grid-auto-flow: column;
    grid-auto-columns: auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #fffef0;
}

.switch-row input,
.inline-toggle input {
    width: 20px;
    height: 20px;
    accent-color: var(--green);
}

.settings-hint {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.product-settings-table {
    min-width: 1280px;
    table-layout: fixed;
}

.product-settings-table th:nth-child(1) {
    width: 18%;
}

.product-settings-table th:nth-child(2) {
    width: 14%;
}

.product-settings-table th:nth-child(3) {
    width: 18%;
}

.product-settings-table th:nth-child(4) {
    width: 8%;
}

.product-settings-table th:nth-child(5) {
    width: 10%;
}

.product-settings-table th:nth-child(6),
.product-settings-table th:nth-child(7),
.product-settings-table th:nth-child(8) {
    width: 8%;
}

.price-settings-table {
    min-width: 1280px;
}

.price-settings-table th,
.price-settings-table td {
    min-width: 145px;
}

.price-settings-table tbody th {
    position: sticky;
    left: 0;
    z-index: 2;
}

.price-cell {
    display: grid;
    gap: 6px;
}

.price-cell > input {
    min-height: 36px !important;
    font-size: 13px;
}

.currency-input {
    display: grid;
    grid-template-columns: auto minmax(88px, 1fr);
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-weight: 800;
}

.settings-actions {
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
    background: #fbfcfd;
}

.create-form {
    padding: 14px 16px;
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr)) repeat(4, minmax(90px, 0.55fr)) auto;
    gap: 10px;
    align-items: center;
    border-top: 1px solid var(--line);
    background: #fbfcfd;
}

.inline-toggle {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--blue);
    font-weight: 800;
    background: #fff;
}

.user-create-form {
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
}

.admin-account-form {
    grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
    border-top: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    padding: 18px;
    background: rgba(23, 32, 51, 0.42);
    display: grid;
    place-items: center;
    z-index: 20;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-backdrop.error .modal {
    border-top: 6px solid var(--red);
}

.modal-backdrop.error .modal h2 {
    color: var(--red-dark);
}

.modal {
    width: min(100%, 420px);
    padding: 20px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 44px rgba(23, 32, 51, 0.28);
}

.modal.wide {
    width: min(100%, 680px);
}

.ticket-preview-modal {
    width: min(100%, 540px);
    max-height: calc(100dvh - 36px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.ticket-preview-header {
    align-items: center;
}

.ticket-preview-scroll {
    min-height: 0;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef5f8;
    overflow: auto;
}

.ticket-preview-frame {
    width: var(--ticket-preview-width, 72mm);
    min-height: var(--ticket-preview-height, 73mm);
    margin: 0 auto;
    background: #fff;
    color: #000;
    box-shadow: 0 6px 22px rgba(23, 32, 51, 0.16);
}

.ticket-preview-frame .inline-print-sheet {
    width: 100%;
    margin: 0;
    background: #fff;
}

.ticket-preview-frame .inline-ticket-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
}

.ticket-preview-frame .inline-ticket-table,
.ticket-preview-frame .inline-ticket-table * {
    box-sizing: border-box;
    color: #000;
    font-family: Calibri, Arial, sans-serif;
}

.ticket-preview-frame .inline-ticket-title {
    padding: 0;
    border: 0;
    font-size: 16pt;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.ticket-preview-frame .inline-ticket-date-row td {
    padding: 0;
    border: 0;
}

.ticket-preview-frame .inline-ticket-date-cell {
    border: 1px solid #000;
    font-size: 11pt;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
}

.ticket-preview-frame .inline-ticket-item-row td {
    padding: 0;
    border: 1px solid #000;
    line-height: 1;
    vertical-align: middle;
}

.ticket-preview-frame .inline-ticket-product {
    padding-left: 1mm;
    font-size: 10pt;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}

.ticket-preview-frame .inline-ticket-quantity {
    padding: 0 0.5mm;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

.ticket-preview-frame .inline-ticket-quantity-value {
    width: 100%;
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.45mm;
}

.ticket-preview-frame .inline-ticket-quantity-number {
    font-size: 13pt;
    font-weight: 900;
    line-height: 1;
}

.ticket-preview-frame .inline-ticket-quantity-unit {
    font-size: 6pt;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.modal p {
    color: var(--muted);
}

/* El texto de #confirmModal llega con saltos de linea desde el JS. */
#confirmText {
    white-space: pre-line;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.modal-actions button {
    flex: 1;
    min-height: 48px; /* area tactil comoda en movil */
}

.icon-button {
    width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 999px;
    background: #e9f0f4;
    color: var(--blue);
    font-size: 24px;
}

.detail-list {
    margin: 16px 0;
    display: grid;
    gap: 10px;
    max-height: 55vh;
    overflow: auto;
}
