:root {
    color-scheme: light;
    --bg: #eef3ff;
    --bg-soft: #f7f9ff;
    --card: #ffffff;
    --text: #111827;
    --muted: #667085;
    --border: #dde3f0;
    --accent: #2e5bff;
    --accent-strong: #1b43d6;
    --danger: #c21f3a;
    --success-bg: #e9fdf1;
    --success-text: #067647;
    --error-bg: #fff1f3;
    --error-text: #c01048;
    --radius: 16px;
    --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.08);
    --shadow-strong: 0 20px 44px rgba(15, 23, 42, 0.14);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    background:
        radial-gradient(circle at 12% 0%, #dbe4ff 0%, transparent 40%),
        radial-gradient(circle at 88% 8%, #dff9ff 0%, transparent 42%),
        linear-gradient(180deg, #eff3ff 0%, #f5f7ff 45%, #ffffff 100%);
}

.container {
    width: min(1320px, 94vw);
    margin: 1.8rem auto 2.4rem;
}

.auth-container {
    width: min(520px, 94vw);
}

.auth-page {
    width: min(920px, 94vw);
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-card {
    max-width: 520px;
    width: 100%;
    align-self: center;
}

/* Vídeo YouTube (login, cadastro, cliente) */
.youtube-promo {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 1rem 1.15rem 1.1rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.youtube-promo-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
}

.youtube-promo-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.youtube-promo-link {
    font-size: 0.82rem;
}

.youtube-promo-frame {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    aspect-ratio: 16 / 9;
    max-height: min(52vh, 420px);
}

.youtube-promo-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.youtube-admin-preview-inner {
    max-height: 320px;
    margin-top: 0.5rem;
}

/* Captcha numérico */
.captcha-numeric {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px dashed var(--border);
    background: var(--bg-soft);
}

.captcha-numeric label {
    font-weight: 600;
}

.captcha-hint {
    margin: 0.35rem 0 0;
}

.card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.3rem;
    box-shadow: var(--shadow-soft);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.1rem 1.3rem;
    background: linear-gradient(120deg, #223cc5 0%, #2f5fff 52%, #4581ff 100%);
    border: 0;
    box-shadow: var(--shadow-strong);
}

.topbar h1,
.topbar .muted {
    color: #f8faff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.95rem;
}

.logo {
    width: 74px;
    height: 74px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: #fff;
}

.logo-placeholder {
    width: 74px;
    height: 74px;
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.55);
    display: grid;
    place-items: center;
    color: #ecf1ff;
    font-size: 0.78rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

h1,
h2 {
    margin: 0 0 0.9rem;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.05rem;
}

.muted {
    color: var(--muted);
    line-height: 1.4;
}

.mt-1 {
    margin-top: 0.85rem;
}

label {
    display: block;
    font-weight: 700;
    margin: 0.72rem 0 0.38rem;
    font-size: 0.9rem;
    color: #344054;
}

input,
select,
textarea,
button,
.link-button {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    min-height: 44px;
    padding: 0.68rem 0.85rem;
    font-size: 0.95rem;
    outline: none;
}

input,
select,
textarea {
    background: #fdfdff;
    color: var(--text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #7f9bff;
    box-shadow: 0 0 0 4px rgba(46, 91, 255, 0.16);
    background: #fff;
}

button,
.link-button {
    margin-top: 0.86rem;
    cursor: pointer;
    border: 0;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

button:hover,
.link-button:hover {
    filter: brightness(1.02);
    box-shadow: 0 10px 20px rgba(46, 91, 255, 0.3);
}

button:active,
.link-button:active {
    transform: translateY(1px);
}

button.secondary {
    background: #eef3ff;
    color: #243b8f;
    border: 1px solid #cfd9ff;
    box-shadow: none;
}

button.secondary:hover {
    background: #e2eaff;
    box-shadow: none;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.55rem;
    margin-bottom: 1rem;
    position: sticky;
    top: 10px;
    z-index: 40;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.tab-button {
    margin-top: 0;
    min-height: 42px;
    padding: 0.55rem 0.8rem;
    border-radius: 11px;
    background: #f2f5ff;
    color: #2340a3;
    border: 1px solid #d6defa;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.tab-button.active {
    background: linear-gradient(135deg, #2d5cff 0%, #173cc8 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 16px rgba(35, 79, 230, 0.34);
}

.tab-panel {
    margin-bottom: 1rem;
}

.js-tabs-enabled .tab-hidden {
    display: none;
}

.danger {
    background: linear-gradient(135deg, #c61f47 0%, #9e1236 100%);
}

.alert {
    margin: 0.9rem 0;
    padding: 0.86rem 0.92rem;
    border-radius: 12px;
    font-size: 0.92rem;
    border: 1px solid transparent;
}

.success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #acebc4;
}

.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: #ffc5d5;
}

.hidden {
    display: none;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 13px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    border-bottom: 1px solid #edf1f7;
    text-align: left;
    padding: 0.66rem 0.72rem;
    font-size: 0.89rem;
    vertical-align: top;
}

tbody tr:hover {
    background: #f8faff;
}

th {
    background: #f5f8ff;
    position: sticky;
    top: 0;
    z-index: 2;
    color: #334155;
}

.action-row {
    display: flex;
    gap: 0.38rem;
    flex-wrap: wrap;
    align-items: center;
}

.action-row .link-button {
    width: auto;
    min-width: 96px;
    margin-top: 0;
    padding: 0.45rem 0.64rem;
    min-height: 34px;
}

.inline-btn {
    min-height: 34px;
    width: auto;
    margin-top: 0;
    padding: 0.38rem 0.6rem;
    border-radius: 10px;
    font-size: 0.79rem;
    box-shadow: none;
}

.inline-btn.delete {
    background: linear-gradient(135deg, #cc2650 0%, #9d1237 100%);
}

.product-thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #dde4f4;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-pendente {
    background: #fff7df;
    color: #9f6700;
}

.status-aprovado {
    background: #e7fcef;
    color: #087443;
}

.status-cancelado {
    background: #ffe8ee;
    color: #af1239;
}

.status-info {
    background: #e0f0ff;
    color: #1a5fa8;
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f6f8ff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem;
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

.customer-main-grid {
    align-items: start;
}

@media (min-width: 1100px) {
    .customer-main-grid {
        grid-template-columns: minmax(280px, 360px) 1fr 1fr;
    }
}

.customer-payment-row {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.customer-payment-head h2 {
    margin-bottom: 0.35rem;
}

.customer-payment-lead {
    font-size: 0.88rem;
    max-width: 720px;
}

.customer-pay-details {
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem 0.85rem;
    background: #fafbff;
}

.customer-pay-details > summary {
    cursor: pointer;
    font-weight: 700;
    color: #1f2b59;
    list-style: none;
}

.customer-pay-details > summary::-webkit-details-marker {
    display: none;
}

.customer-pay-inner {
    margin-top: 0.85rem;
}

.customer-pay-qr {
    max-width: 200px;
    width: 100%;
    height: auto;
    display: block;
    margin-top: 0.75rem;
    border: 1px solid #dce3f5;
    border-radius: 12px;
}

.customer-pay-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.small {
    font-size: 0.82rem;
}

/* Customer active payment banner */
.customer-active-payment {
    border-left: 4px solid var(--accent);
    margin-bottom: 1rem;
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.customer-active-payment-head {
    flex: 1;
    min-width: 200px;
}

.customer-active-payment-head h2 {
    margin-bottom: 0.3rem;
}

.customer-active-payment-body {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.customer-active-payment-body .link-button {
    width: auto;
    min-width: 180px;
}

.customer-active-payment-body .customer-pay-qr {
    max-width: 180px;
    margin-top: 0;
}

.customer-tabs {
    grid-template-columns: repeat(4, 1fr);
}

/* Progress bar */
.progress-track {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 280px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.progress-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #dde3f0;
    border: 2px solid #ccd4e8;
    display: block;
    transition: background 0.2s, border-color 0.2s;
}

.progress-step.done .progress-dot {
    background: #0f9d58;
    border-color: #0f9d58;
}

.progress-step.active .progress-dot {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(46,91,255,0.18);
}

.progress-label {
    font-size: 0.62rem;
    color: var(--muted);
    text-align: center;
    max-width: 58px;
    line-height: 1.15;
    white-space: nowrap;
}

.progress-step.done .progress-label,
.progress-step.active .progress-label {
    color: var(--text);
    font-weight: 700;
}

.progress-line {
    flex: 1;
    height: 2px;
    background: #dde3f0;
    min-width: 12px;
    margin: 0 2px;
    margin-bottom: 14px;
}

/* ML-style status tabs */
.ml-orders-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.ml-orders-top-left h2 { margin-bottom: 0.2rem; }
.ml-orders-top-right { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.ml-orders-top-right .inline-btn { margin-top: 0; }

.ml-status-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ml-tab {
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-top: 0;
    min-height: auto;
    border-radius: 0;
    background: transparent;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    width: auto;
}

.ml-tab:hover {
    color: var(--accent);
    box-shadow: none;
    filter: none;
    transform: none;
}

.ml-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.ml-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #eef3ff;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 4px;
}

.ml-tab.active .ml-tab-count {
    background: var(--accent);
    color: #fff;
}

.ml-tools-details {
    margin-top: 1rem;
}

.ml-tools-details > summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--muted);
    list-style: none;
    font-size: 0.88rem;
}

.ml-tools-details > summary::-webkit-details-marker { display: none; }

.order-card {
    margin-bottom: 0.75rem;
    transition: box-shadow 0.15s ease;
}

.order-card:hover {
    box-shadow: var(--shadow-strong);
}

.order-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}

.order-card-check {
    flex-shrink: 0;
    cursor: pointer;
}

.order-card-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 18px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    accent-color: var(--accent);
}

.order-card-title {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-card-progress {
    margin-bottom: 0.6rem;
}

.order-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.order-card-body p {
    margin: 0.15rem 0;
}

.order-card-info,
.order-card-client {
    min-width: 0;
}

.order-card-footer {
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
}

@media (max-width: 600px) {
    .order-card-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .tabs {
        position: static;
        background: transparent;
        backdrop-filter: none;
    }

    .container {
        width: min(95vw, 1320px);
        margin-top: 1rem;
    }
}

/* Checkout com carrinho (cliente) */
.customer-checkout-layout {
    display: grid;
    grid-template-columns: 1fr min(380px, 100%);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 960px) {
    .customer-checkout-layout {
        grid-template-columns: 1fr;
    }
}

.catalog-quick-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
    max-height: min(62vh, 520px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.catalog-quick-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.catalog-quick-card.is-disabled {
    opacity: 0.55;
}

.catalog-quick-card-body {
    flex: 1;
    min-width: 0;
}

.catalog-quick-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
}

.catalog-quick-meta {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.catalog-quick-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.catalog-in-cart {
    font-size: 0.78rem;
    color: var(--muted);
}

.customer-cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.cart-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-lines {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

.cart-lines.hidden {
    display: none;
}

.cart-line {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 0.5rem 0.65rem;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.cart-line-info strong {
    display: block;
    font-size: 0.92rem;
}

.cart-line-qty {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.cart-qty-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.cart-qty-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.cart-qty-input {
    width: 3rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem;
    font-size: 0.9rem;
}

.cart-line-sub {
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
}

.cart-remove-btn {
    border: none;
    background: transparent;
    color: var(--danger);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.05rem;
    margin-top: 0.25rem;
}

.cart-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.cart-step-title {
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.btn-cart-checkout {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-weight: 700;
}

.cell-multiline {
    font-size: 0.82rem;
    line-height: 1.35;
}

.order-card-lines {
    margin: 0 0 0.35rem;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    color: var(--text);
}

.order-card-lines li {
    margin: 0.15rem 0;
}

@media (max-width: 520px) {
    .cart-line {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
    }

    .cart-line-qty {
        justify-content: flex-start;
    }

    .cart-remove-btn {
        align-self: flex-end;
    }
}
