:root {
    --ef-primaria: #0f6e6b;
    --ef-primaria-escura: #0a4f4d;
    --ef-fundo: #f4f6f6;
    --ef-superficie: #ffffff;
    --ef-texto: #1d2b2a;
    --ef-texto-suave: #5b6b6a;
    --ef-borda: #d9e1e0;
    --ef-erro: #b3261e;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--ef-texto);
    background: var(--ef-fundo);
}

h1 {
    font-size: 1.5rem;
    margin: 0 0 .25rem;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.1rem;
    margin: 0 0 .5rem;
}

.subtitle {
    color: var(--ef-texto-suave);
    margin: 0 0 1.5rem;
}

/* ---- Shell / layout ---- */
.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--ef-primaria-escura);
    color: #e7f1f0;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand-mark {
    font-size: 1.2rem;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.brand-tag {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    background: rgba(255, 255, 255, .15);
    padding: .1rem .4rem;
    border-radius: 3px;
}

.menu {
    flex: 1;
    overflow-y: auto;
    padding: .75rem 0;
}

.menu-group {
    margin-top: .75rem;
}

.menu-group-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(231, 241, 240, .55);
    padding: .25rem 1rem;
}

.menu-link {
    display: block;
    padding: .45rem 1rem;
    color: #e7f1f0;
    text-decoration: none;
    font-size: .9rem;
}

.menu-link:hover {
    background: rgba(255, 255, 255, .08);
}

.menu-link.active {
    background: var(--ef-primaria);
    color: #fff;
}

.menu-link-pendente {
    color: rgba(231, 241, 240, .4);
    cursor: not-allowed;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: .85rem;
}

.user-name {
    font-weight: 600;
}

.user-login {
    color: rgba(231, 241, 240, .6);
    margin-bottom: .5rem;
}

.btn-sair {
    color: #ffd9d6;
    text-decoration: none;
    font-size: .85rem;
}

.btn-sair:hover {
    text-decoration: underline;
}

.content {
    flex: 1;
    padding: 2rem 2.5rem;
    min-width: 0;
}

/* ---- Login ---- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--ef-primaria-escura), var(--ef-primaria));
}

.login-card {
    background: var(--ef-superficie);
    border-radius: 10px;
    padding: 2.5rem;
    width: min(380px, 90vw);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-brand h1 {
    margin: .25rem 0 0;
}

.login-brand p {
    color: var(--ef-texto-suave);
    font-size: .8rem;
    margin: .25rem 0 0;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.login-card label {
    font-size: .85rem;
    font-weight: 600;
    margin-top: .5rem;
}

.login-card input {
    padding: .55rem .7rem;
    border: 1px solid var(--ef-borda);
    border-radius: 6px;
    font-size: .95rem;
}

.login-card input:focus {
    outline: 2px solid var(--ef-primaria);
    border-color: transparent;
}

.login-card button {
    margin-top: 1.25rem;
    padding: .6rem;
    border: none;
    border-radius: 6px;
    background: var(--ef-primaria);
    color: #fff;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
}

.login-card button:hover {
    background: var(--ef-primaria-escura);
}

.login-erro {
    margin-top: .75rem;
    color: var(--ef-erro);
    font-size: .85rem;
}

/* ---- Cards / conteúdo ---- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    max-width: 900px;
}

.card {
    background: var(--ef-superficie);
    border: 1px solid var(--ef-borda);
    border-radius: 8px;
    padding: 1.25rem;
}

.card p {
    color: var(--ef-texto-suave);
    font-size: .9rem;
}

.card-pendente {
    opacity: .7;
}

.btn {
    display: inline-block;
    padding: .5rem 1rem;
    background: var(--ef-primaria);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--ef-primaria-escura);
}

.btn:disabled {
    opacity: .6;
    cursor: wait;
}

.btn-secundario {
    background: transparent;
    color: var(--ef-primaria);
    border: 1px solid var(--ef-primaria);
}

.btn-secundario:hover {
    background: rgba(15, 110, 107, .08);
}

/* ---- Impressão de OM ---- */
.busca-om {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.busca-om .campo {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.busca-om label {
    font-size: .8rem;
    font-weight: 600;
}

.busca-om input {
    padding: .5rem .7rem;
    border: 1px solid var(--ef-borda);
    border-radius: 6px;
    font-size: .95rem;
    width: 10rem;
}

.busca-om input:focus {
    outline: 2px solid var(--ef-primaria);
    border-color: transparent;
}

.ordem-card {
    max-width: 720px;
}

.ordem-card dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}

.ordem-card dt {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ef-texto-suave);
}

.ordem-card dd {
    margin: 0;
    font-weight: 600;
}

.info-template {
    font-size: .9rem;
    color: var(--ef-texto-suave);
}

.acoes {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
}

.nota {
    margin-top: 1rem;
    font-size: .8rem;
    color: var(--ef-texto-suave);
}

.alerta {
    padding: .75rem 1rem;
    border-radius: 6px;
    font-size: .9rem;
    max-width: 720px;
}

.alerta-erro {
    background: #fdecea;
    color: var(--ef-erro);
    border: 1px solid #f5c6c2;
}

/* ---- Tabelas ---- */
.tabela-scroll {
    overflow: auto;
    background: var(--ef-superficie);
    border: 1px solid var(--ef-borda);
    border-radius: 8px;
}

.tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.tabela th {
    position: sticky;
    top: 0;
    background: var(--ef-fundo);
    text-align: left;
    padding: .5rem .65rem;
    border-bottom: 2px solid var(--ef-borda);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ef-texto-suave);
    white-space: nowrap;
}

.tabela td {
    padding: .45rem .65rem;
    border-bottom: 1px solid var(--ef-borda);
    vertical-align: top;
}

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

.tabela-selecionavel tbody tr {
    cursor: pointer;
}

.tabela-selecionavel tbody tr:hover {
    background: rgba(15, 110, 107, .06);
}

.tabela .linha-ativa,
.tabela-selecionavel tbody tr.linha-ativa {
    background: rgba(15, 110, 107, .14);
}

.tabela .nowrap {
    white-space: nowrap;
}

.tabela .vazio {
    text-align: center;
    color: var(--ef-texto-suave);
    padding: 1.5rem;
}

.menu-pai {
    font-weight: 700;
}

.menu-filho {
    padding-left: 1.75rem !important;
}

/* ---- Admin: layout em duas colunas ---- */
.admin-duas-colunas {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
    gap: 1rem;
    align-items: start;
}

@@media (max-width: 1000px) {
    .admin-duas-colunas {
        grid-template-columns: 1fr;
    }
}

.painel-lateral label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    margin: .75rem 0 .25rem;
}

.select,
.painel-lateral select {
    width: 100%;
    padding: .5rem .6rem;
    border: 1px solid var(--ef-borda);
    border-radius: 6px;
    font-size: .9rem;
    background: var(--ef-superficie);
}

/* ---- Modais ---- */
.modal-fundo {
    position: fixed;
    inset: 0;
    background: rgba(10, 30, 29, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: var(--ef-superficie);
    border-radius: 10px;
    padding: 1.5rem;
    width: min(520px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 50px rgba(0, 0, 0, .3);
}

.modal label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    margin: .75rem 0 .25rem;
}

.modal input,
.modal textarea,
.modal select {
    width: 100%;
    padding: .5rem .6rem;
    border: 1px solid var(--ef-borda);
    border-radius: 6px;
    font-size: .9rem;
    font-family: inherit;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus {
    outline: 2px solid var(--ef-primaria);
    border-color: transparent;
}

.linha-dupla {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.linha-com-botao {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.linha-com-botao input {
    flex: 1;
}

.linha-checkbox {
    display: flex !important;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
}

.linha-checkbox input {
    width: auto !important;
}

.alerta-ok {
    background: #e8f5ee;
    color: #14653a;
    border: 1px solid #bfe5cf;
}

.login-info {
    font-size: .88rem;
    color: var(--ef-texto-suave);
    margin: 0 0 1rem;
}

.login-sucesso {
    margin-top: .75rem;
    color: #14653a;
    font-size: .85rem;
}

/* ---- Framework ---- */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--ef-erro);
}

.validation-message {
    color: var(--ef-erro);
}

#blazor-error-ui {
    background: #fffbe6;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #1d2b2a;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: .75rem;
    top: .5rem;
}
