:root {
    font-family: system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    color: #182435;
    background: #f4f6f8;
    font-size: 15px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    display: grid;
    grid-template-columns: 230px minmax(0,1fr);
    min-height: 100vh;
    line-height: 1.5;
}

.sidebar {
    background: #172739;
    color: #fff;
    padding: 30px 22px;
    display: flex;
    flex-direction: column;
    gap: 38px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 19px;
    font-weight: 700;
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    background: #0f766e;
    border-radius: 10px;
    color: #fff;
    font-size: 24px;
}

.brand small {
    display: block;
    color: #b6c6d5;
    font-size: 11px;
    font-weight: 400;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar a {
    color: #dce7ee;
    text-decoration: none;
    padding: 11px 13px;
    border-radius: 7px;
}

.sidebar a:hover,.sidebar a:focus-visible {
    background: #2b4054;
    color: #fff;
}

.sidebar-footer {
    margin-top: auto;
    color: #b6c6d5;
    font-size: 11px;
}

main {
    padding: 36px;
    max-width: 1500px;
    width: 100%;
    margin: auto;
    align-self: start;
}

.page-header,.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.eyebrow {
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 1.4px;
    color: #0f766e;
    margin: 0 0 8px;
}

h1,h2,p {
    margin: 0;
}

h1 {
    font-size: 32px;
    letter-spacing: -1px;
}

h2 {
    font-size: 19px;
}

header p:not(.eyebrow),.panel-head p {
    color: #64748b;
    font-size: 14px;
}

.status,.tag {
    font-size: 12px;
    background: #e8f2ef;
    color: #12665a;
    padding: 6px 11px;
    border-radius: 6px;
}

.status.offline {
    background: #fce8e8;
    color: #a12626;
}

.tag {
    background: #edf1f5;
    color: #526275;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 14px;
    margin: 26px 0;
}

.metrics article,.panel {
    background: #fff;
    border: 1px solid #dfe5eb;
    border-radius: 11px;
    box-shadow: 0 2px 5px #18243505;
}

.metrics article {
    padding: 19px;
}

.metrics span {
    display: block;
    font-size: 12px;
    color: #5d6c7e;
}

.metrics strong {
    display: block;
    font-size: 26px;
    letter-spacing: -.7px;
    margin-top: 8px;
    overflow-wrap: anywhere;
}

.panel {
    padding: 23px;
    margin-bottom: 20px;
    scroll-margin-top: 20px;
}

.panel-head {
    margin-bottom: 18px;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
    font-size: 13px;
}

th {
    background: #f5f7fa;
    color: #5c6b7c;
    font-weight: 600;
}

th,td {
    padding: 13px 12px;
    border-bottom: 1px solid #edf0f3;
}

td:first-child {
    font-weight: 600;
}

.stock {
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 11px;
    background: #e5f4ee;
    color: #19664a;
}

.stock.low {
    background: #fff0dc;
    color: #8c4c08;
}

.empty {
    text-align: center;
    color: #64748b;
}

.actions {
    display: flex;
    gap: 6px;
}

.actions button {
    font-size: 12px;
    padding: 5px 9px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: #46576a;
    font-weight: 600;
}

input,select,button {
    font: inherit;
    border-radius: 6px;
}

input,select {
    padding: 9px 11px;
    border: 1px solid #d5dde5;
    background: white;
    min-width: 0;
    width: 100%;
    color: #182435;
}

button {
    border: 1px solid transparent;
    background: #0f766e;
    color: white;
    font-weight: 600;
    padding: 9px 14px;
    cursor: pointer;
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

button.secondary {
    background: #f3f5f7;
    color: #34465a;
    border-color: #d5dde5;
}

button.danger {
    background: #fff1f1;
    color: #a12626;
}

input:focus,select:focus,button:focus-visible {
    outline: 2px solid #0f766e;
    outline-offset: 2px;
}

.search {
    max-width: 420px;
    margin-bottom: 16px;
}

.inline {
    display: flex;
    gap: 8px;
}

.form-panel {
    margin: 15px 0;
    padding: 12px 14px;
    background: #f7f9fb;
    border: 1px solid #e4e9ef;
    border-radius: 8px;
}

.form-panel summary {
    cursor: pointer;
    color: #46576a;
    font-size: 13px;
    font-weight: 650;
}

.fields {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 12px;
}

.form-actions {
    display: flex;
    align-items: end;
    gap: 8px;
    flex-wrap: wrap;
}

#mensagem {
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid #a9d5c5;
    background: #e5f4ee;
    color: #19664a;
    border-radius: 7px;
}

#mensagem.erro {
    background: #fce8e8;
    border-color: #e4b4b4;
    color: #a12626;
}

footer {
    font-size: 12px;
    color: #64748b;
    margin-top: 22px;
}

@media(max-width:1000px) {
    .metrics {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
    .fields {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
    main {
        padding: 24px;
    }
}

@media(max-width:700px) {
    body {
        display: block;
    }
    .sidebar {
        padding: 16px;
        gap: 12px;
    }
    .sidebar nav {
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
    }
    .sidebar a {
        padding: 6px 10px;
        font-size: 13px;
    }
    .sidebar-footer {
        display: none;
    }
    main {
        padding: 16px;
    }
    .panel {
        padding: 15px;
    }
    .metrics {
        gap: 8px;
    }
    .metrics article {
        padding: 12px;
    }
    .metrics strong {
        font-size: 21px;
    }
    .fields {
        grid-template-columns: 1fr;
    }
    h1 {
        font-size: 26px;
    }
}


.full { grid-column: 1 / -1; }
#carga-pedidos { min-height: 130px; }
@media(max-width:700px) { .full { grid-column: auto; } }

.filters {
    align-items: end;
    flex-wrap: wrap;
    margin: 12px 0 18px;
}

.filters label { min-width: 145px; }

.report-columns {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 22px;
}

.report-columns h3 {
    margin: 8px 0;
    font-size: 15px;
}

.actions {
    flex-wrap: wrap;
    min-width: 180px;
}

.actions button { white-space: nowrap; }

dialog {
    width: min(760px, calc(100% - 28px));
    max-height: 85vh;
    overflow: auto;
    border: 1px solid #cbd5df;
    border-radius: 10px;
    padding: 22px;
    color: #182435;
}

dialog::backdrop { background: #10203388; }

.detail-content dl {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) 2fr;
    gap: 8px 16px;
}

.detail-content dt { color: #526275; font-weight: 650; text-transform: capitalize; }
.detail-content dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

.order-totals {
    margin: 0;
    padding: 10px 12px;
    background: #f0f4f7;
    border-radius: 6px;
}

.order-totals small { display: block; color: #64748b; font-weight: 400; }

body:not(.authenticated) > :not(#login-screen) { display: none !important; }
body.authenticated #login-screen { display: none; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef3f7; }
.login-card { width: min(430px, 100%); display: grid; gap: 16px; padding: 34px; background: white; border: 1px solid #dce4eb; border-radius: 14px; box-shadow: 0 18px 50px #18304718; }
.login-card h1 { margin: 8px 0 0; font-size: 24px; }
.login-card label { display: grid; gap: 7px; font-weight: 600; }
.password-field { display: flex; gap: 8px; }
.password-field input { flex: 1; min-width: 0; }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.admin-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 24px; }
.permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; margin: 12px 0; }
.permission-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px; background: #f4f7f9; border-radius: 5px; }
.permission-item input { margin: 2px 0 0; }
.erro { color: #a32626; }

@media(max-width:700px) { .account { margin: 12px 0; } .login-card { padding: 24px; } }

@media(max-width:700px) {
    .report-columns { grid-template-columns: 1fr; }
    .detail-content dl { grid-template-columns: 1fr; gap: 3px; }
    .detail-content dd { margin-bottom: 10px; }
}

