* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #eef2f5;
    color: #172026;
    font-family: "Segoe UI", Arial, sans-serif;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-box {
    width: min(420px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid #d7dde2;
    border-radius: 8px;
    padding: 28px;
}

.login-box h1,
.topbar h1 {
    margin: 0;
    font-size: 30px;
}

.login-box p,
.topbar p {
    margin: 4px 0 20px;
    color: #5a6972;
}

label {
    display: block;
    margin: 10px 0 5px;
    color: #47545c;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c9d1d8;
    border-radius: 6px;
    padding: 10px;
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

button {
    border: 0;
    border-radius: 6px;
    padding: 10px 13px;
    background: #0f766e;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.secondary {
    background: #dfe6ea;
    color: #1f2a30;
}

.login-box button {
    width: 100%;
    margin-top: 16px;
}

.login-error,
.message.error {
    color: #b42318;
    font-weight: 700;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

main {
    padding: 0 24px 24px;
}

.panel {
    background: #fff;
    border: 1px solid #d7dde2;
    border-radius: 8px;
    padding: 18px;
}

h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

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

.report-grid article {
    background: #f7faf9;
    border: 1px solid #d9e3e0;
    border-radius: 8px;
    padding: 12px;
}

.report-grid span {
    display: block;
    color: #55636b;
    font-size: 12px;
    font-weight: 700;
}

.report-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
}

.report-controls {
    display: grid;
    grid-template-columns: minmax(120px, 170px) minmax(150px, 190px) minmax(150px, 190px) auto;
    align-items: end;
    gap: 8px 10px;
    margin-bottom: 10px;
}

.report-controls label {
    display: none;
}

.report-period-label {
    margin: 0 0 12px;
    color: #47545c;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.dashboard-grid article {
    background: #fff;
    border: 1px solid #d7dde2;
    border-radius: 8px;
    padding: 12px;
}

.dashboard-grid span {
    display: block;
    color: #55636b;
    font-size: 12px;
    font-weight: 700;
}

.dashboard-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(320px, 430px) 1fr;
    gap: 18px;
    margin-top: 18px;
}

.actions,
.orders-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.actions {
    justify-content: flex-end;
    margin-top: 14px;
}

.orders-head {
    justify-content: space-between;
}

.orders-meta {
    margin: -8px 0 0;
    color: #64727c;
    font-size: 13px;
    font-weight: 700;
}

.status-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.status-filter {
    border: 1px solid #c9d1d8;
    border-radius: 999px;
    background: #fff;
    color: #25313a;
    padding: 8px 11px;
    white-space: nowrap;
}

.status-filter.active {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

.search {
    margin-bottom: 12px;
}

.orders {
    max-height: 560px;
    overflow: auto;
}

.order {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border: 1px solid #e3e8ed;
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 12px;
    cursor: pointer;
}

.order:hover {
    border-color: #b8c4cc;
    background: #fbfcfd;
}

.order-main-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
}

.order-number {
    color: #0f5f73;
    font-weight: 800;
}

.order-customer {
    font-weight: 800;
}

.order-device {
    color: #46545d;
    font-weight: 700;
}

.customer-type {
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
}

.customer-type.cliente-final {
    background: #e8f0f7;
    color: #24506b;
}

.customer-type.lojista {
    background: #fef3c7;
    color: #92400e;
}

.order-summary {
    margin: 0;
    color: #52616a;
    font-size: 13px;
    line-height: 1.35;
}

.order-side {
    display: grid;
    justify-items: end;
    gap: 7px;
}

.order-date {
    color: #64727c;
    font-size: 12px;
    font-weight: 700;
}

.status-badge {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 9px;
    white-space: nowrap;
}

.status-badge.avaliacao {
    background: #e8f0f7;
    color: #24506b;
}

.status-badge.orcamento {
    background: #fff4d8;
    color: #7a4f00;
}

.status-badge.servico {
    background: #e9f7ef;
    color: #17603a;
}

.status-badge.pronto {
    background: #dcfce7;
    color: #166534;
}

.status-badge.nao-faz {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.garantia {
    background: #f1e8ff;
    color: #5b21b6;
}

.status-badge.finalizado {
    background: #eef1f3;
    color: #5c6870;
}

.order-info {
    display: block;
    color: #8a4b08;
    font-weight: 700;
}

.order-info.delivered {
    color: #166534;
}

.order-info.returned {
    color: #8a4b08;
}

.order-info.waiting-return {
    color: #991b1b;
}

.message {
    min-height: 24px;
    margin-top: 12px;
    color: #0f766e;
    font-weight: 700;
}

.modal {
    width: min(920px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    border: 0;
    border-radius: 8px;
    padding: 0;
    background: transparent;
}

.small-modal {
    width: min(520px, calc(100vw - 28px));
}

.modal::backdrop {
    background: rgba(15, 23, 42, 0.42);
}

.modal-panel {
    background: #fff;
    border: 1px solid #d7dde2;
    border-radius: 8px;
    padding: 18px;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.modal-head h2 {
    margin: 0;
}

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

.modal-form textarea {
    min-height: 210px;
}

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

    .report-grid {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }

    .report-controls {
        grid-template-columns: 1fr;
    }

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

    .order-side {
        justify-items: start;
    }

    .topbar,
    .topbar-actions,
    .modal-head {
        align-items: stretch;
        flex-direction: column;
    }

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