:root {
    color-scheme: light;
    --navy: #101d34;
    --navy-soft: #182a4a;
    --navy-border: #24365a;
    --bg: #f4f5f8;
    --surface: #ffffff;
    --surface-muted: #fafbfc;
    --border: #e7e9ee;
    --text: #1c1e29;
    --text-muted: #6b7280;
    --label: #4b5568;
    --primary: #f4801e;
    --primary-dark: #dd6a0d;
    --primary-tint: #fff1e2;
    --danger: #dc2626;
    --danger-tint: #fee2e2;
    --success: #16a34a;
    --success-tint: #dcfce7;
    --radius: 10px;
    --shadow-rgb: 16, 29, 52;
    --shadow: 0 1px 2px rgba(var(--shadow-rgb), .05), 0 4px 16px rgba(var(--shadow-rgb), .07);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1420;
    --surface: #1a2236;
    --surface-muted: #202a42;
    --border: #2c3654;
    --text: #e6e9f2;
    --text-muted: #9aa5c0;
    --label: #c3c9dc;
    --primary: #f4801e;
    --primary-dark: #ff9a4d;
    --primary-tint: #3a2a16;
    --danger: #f87171;
    --danger-tint: #3a1a1a;
    --success: #4ade80;
    --success-tint: #163524;
    --shadow-rgb: 0, 0, 0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .35);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1420;
        --surface: #1a2236;
        --surface-muted: #202a42;
        --border: #2c3654;
        --text: #e6e9f2;
        --text-muted: #9aa5c0;
        --label: #c3c9dc;
        --primary: #f4801e;
        --primary-dark: #ff9a4d;
        --primary-tint: #3a2a16;
        --danger: #f87171;
        --danger-tint: #3a1a1a;
        --success: #4ade80;
        --success-tint: #163524;
        --shadow-rgb: 0, 0, 0;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .35);
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* Topbar — navy fixo, independente do tema, igual ao ReconDashboard */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 12px 32px;
    background: var(--navy);
    border-bottom: 1px solid var(--navy-border);
    color: #fff;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    text-decoration: none;
}

.topbar-brand:hover {
    opacity: 0.85;
}

.topbar-brand img {
    height: 30px;
    flex-shrink: 0;
}

.topbar h1 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    color: #fff;
}

.topbar h1 .accent {
    color: var(--primary);
}

.topbar .controls {
    display: flex;
    gap: 10px;
    flex: 1;
    flex-wrap: wrap;
    min-width: 200px;
}

.topbar input[type="search"] {
    padding: 9px 12px;
    border: 1px solid var(--navy-border);
    border-radius: 9px;
    font-size: 13.5px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    min-width: 160px;
}

.topbar .combo input {
    padding: 9px 34px 9px 12px;
    border: 1px solid var(--navy-border);
    border-radius: 9px;
    font-size: 13.5px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    min-width: 160px;
}

.topbar input[type="search"]::placeholder,
.topbar .combo input::placeholder {
    color: var(--text-muted);
}

.topbar input[type="search"]:focus,
.topbar .combo input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(244, 128, 30, 0.4);
}

.topbar input[type="search"] {
    flex: 1;
    min-width: 220px;
}

.topbar .combo {
    min-width: 160px;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--navy-border);
    flex-shrink: 0;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-user-info {
    text-align: right;
    line-height: 1.25;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.topbar-user-role {
    font-size: 11.5px;
    color: #93a0b8;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-tint);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.topbar-icon-btn {
    position: relative;
    background: none;
    border: none;
    color: #93a0b8;
    padding: 7px;
    cursor: pointer;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topbar-icon-btn:hover {
    background: var(--navy-soft);
    color: #fff;
}

.icon-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--navy);
}

.icon-badge[hidden] {
    display: none;
}

.btn-topbar {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-topbar:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-muted);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(0.9);
}

.btn-block {
    width: 100%;
}

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

.icon-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    background: none;
    color: #93a0b8;
    cursor: pointer;
    flex-shrink: 0;
}

.icon-toggle:hover {
    background: var(--navy-soft);
    color: #fff;
}

.icon-toggle .icon-moon {
    display: none;
}

:root[data-theme="dark"] .icon-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .icon-toggle .icon-moon {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-toggle .icon-sun {
        display: none;
    }

    :root:not([data-theme="light"]) .icon-toggle .icon-moon {
        display: block;
    }
}

main {
    padding: 28px 32px 110px;
    max-width: 1900px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.page-title .accent {
    color: var(--primary);
}

.title-count {
    font-size: 13px;
    color: var(--text-muted);
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}


.input-inline {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    min-width: 270px;
}

.input-inline:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(244, 128, 30, 0.25);
}

.link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: underline;
    cursor: pointer;
    white-space: nowrap;
}

.link-btn:hover {
    color: var(--primary);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
}

.back-link[hidden] {
    display: none;
}

.back-link:hover {
    color: var(--text);
}

.meta-row {
    display: none;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(var(--shadow-rgb), .06), 0 10px 24px rgba(var(--shadow-rgb), .1);
}

.card.in-cart {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.card.is-archived {
    border-style: dashed;
}

.card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 9px;
    background: var(--surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-image-edit {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.card-image-edit:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.card-image-archive {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.card-image-archive:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.card-familia {
    align-self: flex-start;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-muted);
    border-radius: 6px;
    padding: 2px 8px;
}

.card-codigo {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.card-nome {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.35;
    min-height: 38px;
    margin-bottom: 4px;
}

.card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-footer .qty-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    overflow: hidden;
    margin-left: auto;
}

.qty-control button {
    width: 30px;
    height: 34px;
    border: none;
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    font-family: inherit;
}

.qty-control input {
    width: 42px;
    border: none;
    text-align: center;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    -moz-appearance: textfield;
}

.qty-control input::-webkit-outer-spin-button,
.qty-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* Botão flutuante de encomenda */
.order-fab {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    border: none;
    background: var(--navy);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(var(--shadow-rgb), 0.25);
    z-index: 50;
}

.order-fab:hover {
    background: var(--navy-soft);
}

.order-fab-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    line-height: 1.3;
}

/* Modal / overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.5);
    display: flex;
    justify-content: flex-end;
    z-index: 100;
}

.overlay[hidden] {
    display: none;
}

.overlay.center {
    justify-content: center;
    align-items: center;
}

.panel {
    background: var(--surface);
    width: 100%;
    max-width: 420px;
    height: 100%;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.overlay.center .panel {
    height: auto;
    max-height: 90vh;
    border-radius: var(--radius);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    border-radius: 8px;
    padding: 2px 6px;
}

.icon-btn:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.order-item-info .codigo {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.order-item-info .nome {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.order-item-qty {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-dark);
    white-space: nowrap;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Dentro de <form> (ex.: "Novo Produto") os campos não são filhos diretos do .panel com
   flex-gap — sem isto ficam colados uns aos outros. */
.field + .field {
    margin-top: 16px;
}

.field input[type="file"] {
    padding: 8px;
    font-size: 13px;
    cursor: pointer;
}

.field input[type="file"]::file-selector-button {
    padding: 7px 12px;
    margin-right: 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-muted);
    color: var(--text);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.field input[type="file"]::file-selector-button:hover {
    background: var(--border);
}

.field label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--label);
}

.field input,
.field select,
.field textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 13.5px;
    font-family: inherit;
    width: 100%;
    background: var(--surface);
    color: var(--text);
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.field small {
    color: var(--text-muted);
    font-size: 12px;
}

.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy);
    color: #fff;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 13px;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    box-shadow: 0 8px 20px rgba(var(--shadow-rgb), .25);
}

.toast.show {
    opacity: 1;
}

@media (max-width: 640px) {
    .topbar {
        padding: 10px 16px;
        gap: 12px;
    }

    .topbar-user-info {
        display: none;
    }

    main {
        padding: 20px 16px 110px;
    }

    /* Em ecrãs estreitos a grelha é de uma só coluna — um FAB centrado ficaria sempre
       em cima dos cartões ao fazer scroll; encostado ao canto não tapa o conteúdo. */
    .order-fab {
        left: auto;
        right: 16px;
        transform: none;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}

/* Autenticação */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    justify-content: center;
}

.auth-brand img {
    height: 30px;
}

.auth-brand .logo-dark-mode {
    display: none;
}

:root[data-theme="dark"] .auth-brand .logo-light-mode {
    display: none;
}

:root[data-theme="dark"] .auth-brand .logo-dark-mode {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .auth-brand .logo-light-mode {
        display: none;
    }

    :root:not([data-theme="light"]) .auth-brand .logo-dark-mode {
        display: block;
    }
}

.auth-brand .divider {
    width: 1px;
    height: 22px;
    background: var(--border);
}

.auth-brand .name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.auth-title .accent {
    color: var(--primary);
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: -6px 0 4px;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}

.remember-label input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.auth-back {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}

.auth-back:hover {
    color: var(--primary);
}

.code-input {
    text-align: center;
    letter-spacing: 10px;
    font-size: 22px;
    font-weight: 700;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
}

.flash-error {
    background: var(--danger-tint);
    color: var(--danger);
}

.flash-success {
    background: var(--primary-tint);
    color: var(--primary-dark);
}

/* Combobox de pesquisa (dropdown de lojas para admins) */
.combo {
    position: relative;
}

.combo input {
    padding: 10px 34px 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 13.5px;
    font-family: inherit;
    width: 100%;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.combo input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.combo-chevron {
    position: absolute;
    top: 50%;
    right: 11px;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: transform 0.15s ease;
}

.combo.open .combo-chevron {
    transform: translateY(-50%) rotate(180deg);
    color: var(--primary);
}

.combo-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(var(--shadow-rgb), .18), 0 2px 6px rgba(var(--shadow-rgb), .08);
    z-index: 20;
    padding: 6px;
}

.combo-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
}

.combo-option:hover,
.combo-option.focused {
    background: var(--surface-muted);
}

.combo-option.selected {
    color: var(--primary-dark);
    font-weight: 600;
}

.combo-option .check {
    visibility: hidden;
    color: var(--primary);
    flex-shrink: 0;
}

.combo-option.selected .check {
    visibility: visible;
}

.combo-empty {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-muted);
}

#locale-combo-list .combo-option {
    justify-content: flex-start;
}

.info-note {
    margin: -10px 0 18px;
    font-size: 12.5px;
    color: var(--text-muted);
}

/* Filtro em segmentos (ex.: Todos / Pendentes / Confirmados) */
.segmented {
    display: flex;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.segmented-btn {
    background: none;
    border: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.segmented-btn:hover {
    color: var(--text);
}

.segmented-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Tabela de dados (página Pedidos das Lojas) */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--surface-muted);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--surface-muted);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table.static tbody tr {
    cursor: default;
}

.pedidos-group-row td {
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 16px;
    cursor: default;
}

.pedido-row-pendente td:first-child {
    box-shadow: inset 3px 0 0 var(--primary);
}

/* Histórico — barra de filtros (produto + período) */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-field-push-right {
    margin-left: auto;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-field select,
.filter-field input[type="date"],
.filter-field input[type="search"] {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

.filter-field select:focus,
.filter-field input[type="date"]:focus,
.filter-field input[type="search"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(244, 128, 30, 0.25);
}

.filter-field .combo {
    width: 220px;
}

.filter-field .combo input {
    padding: 8px 30px 8px 10px;
    font-size: 13px;
}

.filter-bar .filter-clear {
    margin-bottom: 9px;
}

/* Histórico — tabela pivot Loja x Produto, com scroll nos dois eixos e cabeçalho/coluna fixos */
.table-wrap.scroll-both {
    overflow: auto;
    max-height: 72vh;
}

.table-wrap.scroll-both thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.pivot-loja-col {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 2;
}

.table-wrap.scroll-both thead th.pivot-loja-col {
    background: var(--surface-muted);
    z-index: 3;
}

.data-table td.pivot-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table td.pivot-zero {
    color: var(--text-muted);
    opacity: 0.45;
}

.data-table td.pivot-total,
.data-table th.pivot-total {
    font-weight: 700;
    border-left: 1px solid var(--border);
}

/* Pedidos das Lojas (admin) */
.pedido-card {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.pedido-card:hover {
    border-color: var(--primary);
}

.pedido-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 14.5px;
}

.pedido-status {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.pedido-status-pendente {
    background: var(--primary-tint);
    color: var(--primary-dark);
}

.pedido-status-confirmado {
    background: var(--success-tint);
    color: var(--success);
}

.pedido-status-cancelado {
    background: var(--danger-tint);
    color: var(--danger);
}

.pedido-card-date {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.pedido-card-meta {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 4px 0 10px;
}

.pedido-card-itens {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.pedido-item-line {
    font-size: 13px;
    color: var(--text);
}

.pedido-item-codigo {
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px;
}

.pedido-detalhe-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.pedido-detalhe-itens {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.pedido-detalhe-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.pedido-detalhe-item-info .codigo {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.pedido-detalhe-item-info .nome {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.pedido-detalhe-item .qty-control {
    flex-shrink: 0;
    margin-left: 0;
}

.pedido-detalhe-acoes {
    display: flex;
    gap: 10px;
}

.pedido-detalhe-acoes[hidden] {
    display: none;
}

.pedido-detalhe-acoes .btn {
    flex: 1;
}

/* Modal de confirmação genérico */
.confirm-panel {
    max-width: 380px;
    gap: 16px;
}

.confirm-panel h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.confirm-panel p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
