:root {
    --brown-950: #2a1711;
    --brown-900: #3b2118;
    --brown-800: #512d20;
    --brown-700: #6a3d2b;
    --gold-500: #c99b45;
    --gold-300: #e1c27f;
    --cream-100: #fbf7f0;
    --cream-200: #f3ebdf;
    --white: #ffffff;
    --ink: #332b27;
    --muted: #756b65;
    --border: #e5ddd3;
    --success: #4f7a55;
    --shadow: 0 18px 50px rgba(59, 33, 24, 0.09);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--cream-100);
}

body {
    min-height: 100vh;
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: var(--brown-950);
    line-height: 1.12;
}

p {
    line-height: 1.65;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--brown-900);
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand small {
    display: block;
    margin-top: 1px;
    color: var(--gold-500);
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.brand__mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 50% 50% 48% 52% / 48% 45% 55% 52%;
    background: var(--gold-500);
    color: var(--brown-950);
    font-family: Georgia, serif;
    font-size: 1.45rem;
}

.brand--light,
.brand--sidebar {
    color: var(--white);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--gold-500);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.2rem;
    border: 1px solid var(--brown-800);
    border-radius: 12px;
    background: var(--brown-800);
    color: var(--white);
    cursor: pointer;
    font-weight: 750;
    transition: transform 160ms ease, background 160ms ease;
}

.button:hover {
    background: var(--brown-950);
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.button--secondary,
.button--ghost {
    border-color: var(--border);
    background: transparent;
    color: var(--brown-800);
}

.button--secondary:hover,
.button--ghost:hover {
    background: var(--cream-200);
    color: var(--brown-950);
}

.button--block {
    width: 100%;
}

.public-page {
    background:
        radial-gradient(circle at 85% 8%, rgba(201, 155, 69, 0.16), transparent 26rem),
        var(--cream-100);
}

.public-header {
    display: flex;
    max-width: 1160px;
    align-items: center;
    justify-content: space-between;
    margin: 0 auto;
    padding: 24px 28px;
}

.public-content {
    max-width: 1160px;
    margin: 0 auto;
    padding: 50px 28px 90px;
}

.hero {
    display: grid;
    min-height: 62vh;
    align-items: center;
    gap: 64px;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
}

.hero h1 {
    max-width: 800px;
    margin-bottom: 22px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.5rem, 6vw, 5.4rem);
    font-weight: 500;
    letter-spacing: -0.045em;
}

.hero p {
    max-width: 690px;
    color: var(--muted);
    font-size: 1.1rem;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.hero-card,
.public-card,
.card,
.stat-card {
    border: 1px solid rgba(229, 221, 211, 0.85);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 34px;
}

.hero-card__icon,
.empty-state__icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    margin-bottom: 20px;
    border-radius: 15px;
    background: var(--cream-200);
    color: var(--gold-500);
    font-weight: 900;
}

.check-list {
    display: grid;
    gap: 14px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

.check-list li {
    display: flex;
    gap: 10px;
    color: var(--muted);
}

.check-list li::before {
    color: var(--success);
    content: "✓";
    font-weight: 900;
}

.public-card {
    padding: clamp(28px, 6vw, 62px);
}

.public-card--narrow {
    max-width: 720px;
    margin: 40px auto;
}

.token-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 30px;
    padding: 18px 20px;
    border-radius: 12px;
    background: var(--cream-200);
}

.token-preview span {
    color: var(--muted);
    font-size: 0.86rem;
}

.app-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 260px minmax(0, 1fr);
    background: #f7f5f1;
}

.sidebar {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    padding: 28px 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
        var(--brown-950);
    color: rgba(255, 255, 255, 0.74);
}

.main-nav {
    display: grid;
    gap: 6px;
    margin-top: 50px;
}

.main-nav a {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.93rem;
    font-weight: 650;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.sidebar__footer {
    display: grid;
    gap: 4px;
    margin-top: auto;
    font-size: 0.76rem;
    letter-spacing: 0.06em;
}

.sidebar__footer strong {
    color: var(--white);
    font-size: 0.86rem;
}

.sidebar__footer span,
.user-summary span {
    color: var(--muted);
    text-transform: capitalize;
}

.app-main {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 26px 38px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
}

.topbar h1 {
    margin: 0;
    font-size: 1.65rem;
}

.topbar .eyebrow {
    margin-bottom: 5px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--cream-200);
    color: var(--brown-700);
    font-size: 0.76rem;
    font-weight: 750;
}

.status--rascunho {
    background: #ece8e4;
    color: #665c56;
}

.status--aguardando_preenchimento_cliente {
    background: #fff0c9;
    color: #7a5811;
}

.status--aguardando_revisao {
    background: #e8ddff;
    color: #5c3d92;
}

.status--aguardando_pagamento {
    background: #dcecff;
    color: #285c91;
}

.status--link_pagamento_enviado {
    background: #d6f1ef;
    color: #256c67;
}

.status--pago,
.status--entregue {
    background: #ddefdf;
    color: #336b3b;
}

.status--em_montagem {
    background: #ffe2c5;
    color: #8a4d12;
}

.status--problema_entrega,
.status--cancelado {
    background: #f8dcd8;
    color: #8a342c;
}

.user-summary {
    display: grid;
    gap: 3px;
    text-align: right;
}

.user-summary strong {
    color: var(--brown-900);
}

.page-content {
    padding: 34px 38px;
}

.stat-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 24px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-grid--special {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-grid--statuses {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-grid--operations {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
    display: grid;
    gap: 8px;
    padding: 22px;
}

.stat-card--highlight {
    border-top: 4px solid var(--gold-500);
}

.stat-card--alert {
    border-top: 4px solid #a9473d;
}

.dashboard-section {
    margin: 36px 0;
}

.section-heading {
    margin-bottom: 18px;
}

.section-heading h2 {
    margin-bottom: 0;
}

.stat-card span,
.stat-card small {
    color: var(--muted);
}

.stat-card strong {
    color: var(--brown-900);
    font-family: Georgia, serif;
    font-size: 2.2rem;
}

.card {
    padding: 26px;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.card__header h2 {
    margin-bottom: 0;
}

.filter-bar {
    display: grid;
    align-items: end;
    gap: 14px;
    padding: 22px 0;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 0 0 22px;
}

.quick-filters a {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--cream-100);
    color: var(--brown-700);
    font-size: 0.8rem;
    font-weight: 750;
}

.priority--today { box-shadow: inset 4px 0 var(--gold-500); }
.priority--late { background: #fff2df; box-shadow: inset 4px 0 #c66a24; }
.priority--problem { background: #fff0ee; box-shadow: inset 4px 0 #a9473d; }
.priority--paid { box-shadow: inset 4px 0 #4f7a55; }
.priority--ready { background: #edf8ef; box-shadow: inset 4px 0 #4f7a55; }

.filter-bar label,
.order-form label {
    display: grid;
    gap: 8px;
    color: var(--brown-900);
    font-size: 0.84rem;
    font-weight: 700;
}

.filter-bar input,
.filter-bar select,
.order-form input,
.order-form select,
.order-form textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: var(--white);
    color: var(--ink);
}

.filter-bar input:focus,
.filter-bar select:focus,
.order-form input:focus,
.order-form select:focus,
.order-form textarea:focus {
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(201, 155, 69, 0.14);
}

.order-form {
    display: grid;
    gap: 22px;
}

.form-section {
    display: grid;
    gap: 24px;
}

.form-section__header h2,
.form-section__header p {
    margin-bottom: 0;
}

.form-section__header p {
    margin-top: 8px;
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid__wide {
    grid-column: 1 / -1;
}

.form-actions,
.page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.page-actions {
    margin-bottom: 20px;
}

.notice--error {
    border-color: #d7a6a0;
    background: #fff0ee;
    color: #7d2f28;
}

.notice--error ul {
    margin-bottom: 0;
}

.table-actions {
    display: flex;
    gap: 12px;
}

.table-actions a {
    color: var(--brown-700);
    font-weight: 750;
}

.table-actions a:hover {
    color: var(--gold-500);
}

.order-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.order-summary h2 {
    margin-bottom: 0;
}

.detail-grid {
    display: grid;
    gap: 22px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-card--wide {
    grid-column: 1 / -1;
}

.detail-card dl {
    display: grid;
    gap: 16px;
    margin: 0;
}

.detail-card dl div {
    display: grid;
    gap: 5px;
}

.detail-card dt {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.detail-card dd {
    margin: 0;
    line-height: 1.55;
}

.public-link-card {
    display: grid;
    gap: 20px;
    margin-bottom: 22px;
}

.public-link-card h2,
.public-link-card p {
    margin-bottom: 0;
}

.public-link-card p,
.public-link-box small {
    color: var(--muted);
}

.public-link-box {
    display: grid;
    gap: 9px;
}

.public-link-box label {
    color: var(--brown-900);
    font-size: 0.84rem;
    font-weight: 750;
}

.copy-field {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.copy-field input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--cream-100);
    color: var(--ink);
}

.customer-order {
    display: grid;
    max-width: 820px;
    gap: 22px;
    margin: 0 auto;
}

.customer-order__intro h1 {
    max-width: 680px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 5vw, 3.6rem);
    font-weight: 500;
    letter-spacing: -0.035em;
}

.order-preview {
    display: grid;
    gap: 12px;
    margin-top: 26px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-preview div {
    display: grid;
    gap: 4px;
    padding: 15px;
    border-radius: 12px;
    background: var(--cream-200);
}

.order-preview span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 750;
    text-transform: uppercase;
}

.customer-form {
    display: grid;
    gap: 28px;
}

.customer-form fieldset {
    display: grid;
    gap: 18px;
    margin: 0;
    padding: 0 0 28px;
    border: 0;
    border-bottom: 1px solid var(--border);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-form legend {
    width: 100%;
    margin-bottom: 18px;
    color: var(--brown-950);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
    font-weight: 700;
}

.customer-form label {
    display: grid;
    gap: 8px;
    color: var(--brown-900);
    font-size: 0.88rem;
    font-weight: 700;
}

.customer-form input,
.customer-form textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: var(--white);
    color: var(--ink);
}

.customer-form input:focus,
.customer-form textarea:focus {
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(201, 155, 69, 0.14);
}

.customer-form__wide {
    grid-column: 1 / -1;
}

.confirmation-check {
    display: flex !important;
    align-items: flex-start;
    gap: 10px !important;
    padding: 16px;
    border-radius: 12px;
    background: var(--cream-200);
}

.confirmation-check input {
    width: 20px;
    height: 20px;
    margin: 0;
}

.customer-form__submit {
    min-height: 52px;
    font-size: 1rem;
}

.order-actions {
    display: grid;
    gap: 22px;
    margin-bottom: 22px;
}

.action-grid {
    display: grid;
    gap: 14px;
}

.status-action-form {
    display: grid;
    align-items: end;
    gap: 12px;
    grid-template-columns: minmax(220px, 1fr) auto;
}

.status-action-form label,
.payment-card label {
    display: grid;
    gap: 8px;
    color: var(--brown-900);
    font-size: 0.84rem;
    font-weight: 700;
}

.status-action-form input,
.payment-card input,
.payment-card select,
.payment-card textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    color: var(--ink);
}

.button--danger {
    border-color: #8a342c;
    background: #8a342c;
}

.button--danger:hover {
    background: #68231e;
}

.paid-indicator {
    color: var(--success);
    font-weight: 800;
}

.payment-card {
    display: grid;
    gap: 22px;
}

.payment-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.payment-grid__wide {
    grid-column: 1 / -1;
}

.payment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
}

.history-card {
    display: grid;
    gap: 24px;
    margin-top: 22px;
}

.status-timeline {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.status-timeline li {
    display: grid;
    position: relative;
    gap: 14px;
    padding: 0 0 24px;
    grid-template-columns: 18px minmax(0, 1fr);
}

.status-timeline li:not(:last-child)::before {
    position: absolute;
    top: 14px;
    bottom: 0;
    left: 6px;
    width: 2px;
    background: var(--border);
    content: "";
}

.timeline-marker {
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    margin-top: 3px;
    border: 3px solid var(--gold-500);
    border-radius: 50%;
    background: var(--white);
}

.status-timeline strong,
.status-timeline span {
    display: block;
}

.status-timeline span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.8rem;
}

.status-timeline p {
    margin: 7px 0 0;
}

.delivery-notes-card {
    display: grid;
    gap: 20px;
}

.delivery-notes-card form,
.delivery-notes-card label {
    display: grid;
    gap: 10px;
}

.delivery-notes-card textarea {
    width: 100%;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
}

.queue-actions {
    display: grid;
    gap: 8px;
    min-width: 150px;
}

.queue-actions summary,
.text-button {
    color: var(--brown-700);
    cursor: pointer;
    font-weight: 750;
}

.queue-actions pre {
    max-width: 430px;
    max-height: 320px;
    overflow: auto;
    padding: 14px;
    border-radius: 10px;
    background: var(--brown-950);
    color: #fff;
    font-size: 0.78rem;
    white-space: pre-wrap;
}

.text-button {
    padding: 0;
    border: 0;
    background: none;
}

.print-status--pendente {
    background: #fff0c9;
    color: #7a5811;
}

.print-status--processando {
    background: #dcecff;
    color: #285c91;
}

.print-status--impresso {
    background: #ddefdf;
    color: #336b3b;
}

.print-status--erro {
    background: #f8dcd8;
    color: #8a342c;
}

.empty-state {
    display: flex;
    min-height: 300px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 48px 24px;
    text-align: center;
}

.empty-state p {
    max-width: 570px;
    margin-bottom: 0;
    color: var(--muted);
}

.empty-state--compact {
    min-height: 210px;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.print-sheet {
    max-width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 20mm;
    background: var(--white);
}

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

.notice {
    margin: 20px 0;
    padding: 12px 14px;
    border: 1px solid var(--gold-300);
    border-radius: 10px;
    background: #fff8e7;
    color: var(--brown-800);
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
    }

    .main-nav {
        grid-template-columns: repeat(2, 1fr);
        margin-top: 26px;
    }

    .sidebar__footer {
        margin-top: 24px;
    }

    .stat-grid--special,
    .stat-grid--statuses {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-bar,
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .public-header,
    .topbar,
    .card__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar,
    .page-content {
        padding-right: 20px;
        padding-left: 20px;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .stat-grid--special,
    .stat-grid--statuses {
        grid-template-columns: 1fr;
    }

    .user-summary {
        text-align: left;
    }

    .filter-bar,
    .form-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-grid__wide,
    .detail-card--wide {
        grid-column: auto;
    }

    .form-actions,
    .page-actions,
    .order-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .copy-field,
    .order-preview,
    .customer-form fieldset {
        grid-template-columns: 1fr;
    }

    .customer-form__wide {
        grid-column: auto;
    }

    .status-action-form,
    .payment-grid {
        grid-template-columns: 1fr;
    }

    .payment-grid__wide {
        grid-column: auto;
    }

    .payment-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .main-nav {
        grid-template-columns: 1fr;
    }

    .token-preview {
        align-items: flex-start;
        flex-direction: column;
    }
}
