:root {
    --fin-bg: #eef5ff;
    --fin-card: rgba(255, 255, 255, 0.84);
    --fin-main: #0f4f7f;
    --fin-accent: #0d8f76;
    --fin-text: #13324a;
    --fin-muted: #27445e;
    --fin-border: rgba(20, 68, 102, 0.24);
}

.fin-main {
    min-height: calc(100vh - 72px);
    background:
        radial-gradient(circle at 10% 20%, rgba(13, 143, 118, 0.16), transparent 45%),
        radial-gradient(circle at 90% 10%, rgba(15, 79, 127, 0.2), transparent 42%),
        linear-gradient(135deg, #dcecff 0%, #cbe2ff 45%, #d9f5ff 100%);
    padding: 24px 14px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 18px;
    width: 100%;
    max-width: 100%;
}

.fin-card {
    width: min(980px, 100%);
    margin: 0 auto;
    background: var(--fin-card);
    border: 1px solid var(--fin-border);
    border-radius: 18px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 18px 60px rgba(10, 40, 66, 0.22);
    padding: 20px;
    overflow: visible;
}

#loginCard {
    width: min(520px, 100%);
}

h1, h2, h3 {
    margin: 0;
    color: var(--fin-main);
}

.fin-sub {
    margin: 8px 0 18px;
    color: var(--fin-muted);
}

.fin-form-grid {
    display: grid;
    gap: 12px;
}

.fin-form-grid.period {
    grid-template-columns: 1fr 1fr 1fr auto;
    align-items: end;
}

label {
    color: var(--fin-text);
    font-weight: 600;
    display: grid;
    gap: 6px;
}

input {
    border: 1px solid var(--fin-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    background-clip: padding-box;
    background: #ffffff;
    color: #12344d;
}

select {
    border: 1px solid var(--fin-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: #ffffff;
    color: #12344d;
}

button {
    border: 0;
    border-radius: 10px;
    background: #0f4f7f;
    color: #fff;
    font-weight: 700;
    padding: 11px 14px;
    cursor: pointer;
    width: auto;
    min-height: 44px;
    margin: 0;
    box-sizing: border-box;
}

button.ghost {
    background: #ffffff;
    color: #0f4f7f;
    border: 1px solid rgba(15, 79, 127, 0.25);
}

.fin-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.fin-reset {
    margin-top: 16px;
    border-top: 1px dashed var(--fin-border);
    padding-top: 14px;
    display: grid;
    gap: 10px;
}

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

#userInfo {
    margin: 6px 0 0;
    color: var(--fin-muted);
}

.fin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.fin-tab {
    border: 1px solid rgba(15, 79, 127, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    color: #0f4f7f;
    padding: 9px 16px;
    min-height: 40px;
    font-weight: 700;
}

.fin-tab.is-active {
    background: linear-gradient(130deg, #0f4f7f, #1273b7);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(15, 79, 127, 0.28);
}

.fin-panel {
    animation: panelIn .28s ease;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpis {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 16px 0;
}

.kpi {
    border: 1px solid var(--fin-border);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.92);
}

.kpi span {
    display: block;
    color: var(--fin-muted);
    font-size: 13px;
}

.kpi strong {
    color: var(--fin-main);
    font-size: 20px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--fin-border);
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #ecf2f9;
    color: var(--fin-text);
    font-size: 14px;
}

th {
    background: #eaf4ff;
    color: #0f4064;
}

.empty {
    text-align: center;
    color: var(--fin-muted);
}

.fin-status {
    margin: 12px 0 0;
    color: var(--fin-muted);
    min-height: 20px;
}

.fin-status.error {
    color: #b42318;
}

.fin-status.ok {
    color: var(--fin-accent);
}

.fin-pedidos-head {
    margin-top: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.pedidos-filtros {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 180px 1fr 170px 170px;
    gap: 10px;
}

.pedidos-filtros label {
    display: grid;
    gap: 5px;
    color: #27445e;
    font-size: 12px;
    font-weight: 700;
}

.pedidos-filtros select,
.pedidos-filtros input {
    border: 1px solid var(--fin-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    background: #fff;
    color: #12344d;
}

.pedidos-cards {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}

.pedido-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    padding: 14px;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(234, 245, 255, 0.82));
    border: 1px solid rgba(15, 79, 127, 0.18);
    box-shadow:
        0 16px 30px rgba(13, 49, 79, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: transform .22s ease, box-shadow .22s ease;
}

.pedido-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow:
        0 22px 38px rgba(13, 49, 79, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.pedido-shine {
    position: absolute;
    top: -65%;
    left: -30%;
    width: 58%;
    height: 220%;
    transform: rotate(22deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shineMove 4.6s linear infinite;
    pointer-events: none;
}

@keyframes shineMove {
    0% { left: -42%; }
    100% { left: 140%; }
}

.pedido-topo {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.pedido-id {
    color: #154063;
    font-weight: 800;
    font-size: 15px;
}

.pedido-status {
    font-size: 12px;
    font-weight: 800;
    border-radius: 999px;
    padding: 4px 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.pedido-total {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 0.2px;
    color: #0f4f7f;
}

.pedido-meta {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.pedido-meta small {
    color: #48708f;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.pedido-meta strong {
    margin-top: 3px;
    display: block;
    color: #103856;
    font-size: 13px;
    line-height: 1.35;
}

.pedido-itens {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    padding: 9px;
    border-radius: 10px;
    border: 1px dashed rgba(64, 112, 149, 0.3);
    background: rgba(255, 255, 255, 0.62);
}

.pedido-itens small {
    color: #4c7798;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.35px;
}

.pedido-itens p {
    margin: 4px 0 0;
    color: #143b57;
    font-size: 13px;
    line-height: 1.35;
}

.pedido-empty {
    border: 1px dashed rgba(15, 79, 127, 0.28);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    color: #345f7e;
    background: rgba(255, 255, 255, 0.72);
    grid-column: 1 / -1;
}

.pedido-card.st-recebido {
    border-color: rgba(208, 42, 58, 0.62);
    background: linear-gradient(165deg, #fff4f6, #ffe6ea);
    box-shadow:
        0 16px 34px rgba(148, 20, 38, 0.22),
        0 0 0 1px rgba(208, 42, 58, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.pedido-card.st-recebido .pedido-status {
    background: rgba(208, 42, 58, 0.22);
    border-color: rgba(165, 32, 48, 0.4);
    color: #8f1a29;
}

.pedido-card.st-recebido .pedido-total {
    color: #8f1a29;
}

.pedido-card.st-preparo {
    border-color: rgba(255, 153, 0, 0.4);
    background: linear-gradient(165deg, #fffaf0, #fff2dd);
    box-shadow:
        0 14px 30px rgba(145, 87, 7, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.pedido-card.st-preparo .pedido-status {
    background: rgba(255, 153, 0, 0.16);
    color: #9a5b00;
}

.pedido-card.st-preparo .pedido-total {
    color: #8a5407;
}

.pedido-card.st-pronto {
    border-color: rgba(43, 127, 202, 0.5);
    background: linear-gradient(165deg, #f4f9ff, #e7f0ff);
    box-shadow:
        0 14px 30px rgba(27, 95, 156, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.pedido-card.st-pronto .pedido-status {
    background: rgba(43, 127, 202, 0.18);
    color: #1b5f9c;
}

.pedido-card.st-pronto .pedido-total {
    color: #1a5a93;
}

.pedido-card.st-entregue {
    border-color: rgba(13, 143, 118, 0.44);
    background: linear-gradient(165deg, #f2fffb, #e5f8f3);
    box-shadow:
        0 14px 30px rgba(13, 108, 90, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.pedido-card.st-entregue .pedido-status {
    background: rgba(13, 143, 118, 0.16);
    color: #0a6f5d;
}

.pedido-card.st-entregue .pedido-total {
    color: #0e6756;
}

.pedido-card.st-cancelado {
    border-color: rgba(56, 64, 75, 0.52);
    background: linear-gradient(165deg, #f6f7f9, #eceff3);
    box-shadow:
        0 14px 30px rgba(45, 51, 59, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    opacity: 0.9;
}

.pedido-card.st-cancelado .pedido-status {
    background: rgba(56, 64, 75, 0.2);
    color: #2d333b;
}

.pedido-card.st-cancelado .pedido-total {
    color: #2d333b;
}

.fin-footer {
    text-align: center;
    padding: 14px 10px 20px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    background: rgba(8, 52, 83, 0.88);
    border-top: 1px solid rgba(255, 255, 255, 0.28);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.fin-footer p {
    margin: 0;
}

@media (max-width: 760px) {
    .fin-main {
        padding: 12px 10px 24px;
        min-height: calc(100vh - 64px - 48px);
    }

    .fin-card {
        padding: 14px;
        border-radius: 14px;
    }

    .fin-form-grid,
    .fin-actions,
    .fin-reset,
    .kpis,
    .table-wrap,
    .pedidos-cards {
        width: 100%;
    }

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

    .fin-actions {
        flex-direction: column;
    }

    .fin-actions button,
    .fin-form-grid.period button,
    .fin-reset button,
    #btnLogout {
        width: 100%;
        max-width: 100%;
    }

    .fin-head {
        flex-direction: column;
        align-items: stretch;
    }

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

    .fin-tabs {
        width: 100%;
    }

    .fin-tab {
        flex: 1;
        text-align: center;
    }

    #loginCard {
        width: 100%;
    }

    table {
        min-width: 0;
    }

    .table-wrap {
        border: 0;
        overflow: visible;
    }

    thead {
        display: none;
    }

    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    tr {
        border: 1px solid var(--fin-border);
        border-radius: 12px;
        padding: 8px;
        margin-bottom: 8px;
        background: rgba(255, 255, 255, 0.52);
    }

    td {
        border: 0;
        padding: 6px 6px;
        font-size: 13px;
        overflow-wrap: anywhere;
    }

    td:nth-child(1)::before { content: "Data: "; font-weight: 700; }
    td:nth-child(2)::before { content: "Tipo: "; font-weight: 700; }
    td:nth-child(3)::before { content: "Valor: "; font-weight: 700; }
    td:nth-child(4)::before { content: "Forma: "; font-weight: 700; }
    td:nth-child(5)::before { content: "Obs/Ref: "; font-weight: 700; }

    td.empty {
        text-align: left;
    }

    td.empty::before {
        content: "";
    }

    .pedidos-cards {
        grid-template-columns: 1fr;
    }

    .pedidos-filtros {
        grid-template-columns: 1fr;
    }

    .pedido-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .fin-main {
        padding-left: 8px;
        padding-right: 8px;
    }

    .fin-card {
        padding: 12px;
    }

    input,
    button {
        font-size: 14px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }
}
