:root {
    --primary: #176b45;
    --primary-dark: #105235;
    --primary-light: #e8f4ed;
    --background: #f5f7f5;
    --surface: #ffffff;
    --text: #26352d;
    --muted: #718076;
    --border: #e1e8e2;
    --sidebar-width: 255px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
}

button, input {
    font: inherit;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: white;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 28px;
}

.brand-icon {
    font-size: 30px;
}

.brand strong {
    display: block;
    font-size: 13px;
    letter-spacing: .4px;
}

.brand small {
    display: block;
    margin-top: 5px;
    color: #c4dfce;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.menu-link {
    display: block;
    padding: 13px 14px;
    border-radius: 9px;
    color: white;
    text-decoration: none;
    font-size: 14px;
}

.menu-link:hover,
.menu-link[href]:focus-visible {
    background: rgba(255,255,255,.13);
}

.menu-link.disabled {
    opacity: .5;
    cursor: not-allowed;
}

.menu-heading {
    font-size: 11px;
    color: #b1d2bd;
    margin: 22px 14px 8px;
    letter-spacing: 1px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 10px 0;
    color: #b1d2bd;
}

.main-area {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.topbar {
    height: 72px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    gap: 16px;
}

.topbar-title {
    font-weight: bold;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}

.logout-btn {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    padding: 8px 12px;
    cursor: pointer;
}

.content {
    max-width: 1500px;
    margin: auto;
    padding: 32px;
}

.page-heading {
    margin-bottom: 28px;
}

.page-heading h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.page-heading p,
.helper-text {
    color: var(--muted);
    font-size: 14px;
}

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

.stat-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
}

.stat-icon {
    font-size: 27px;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 30px;
    font-weight: bold;
    color: var(--primary-dark);
}

.stat-label {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
}

.panel h2 {
    font-size: 17px;
    margin: 0 0 20px;
}

.empty-state {
    text-align: center;
    padding: 40px 12px;
    color: var(--muted);
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text);
    margin-bottom: 6px;
}

.empty-state small {
    font-size: 13px;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-action {
    padding: 17px 12px;
    background: var(--primary-light);
    border-radius: 9px;
    font-size: 13px;
}

.quick-action.disabled {
    opacity: .55;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: 0;
    font-size: 24px;
    cursor: pointer;
}

.message {
    padding: 12px 16px;
    background: var(--primary-light);
    border-radius: 8px;
    margin-bottom: 20px;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .topbar {
        height: 64px;
        padding: 0 16px;
    }

    .content {
        padding: 20px 14px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-card,
    .panel {
        padding: 17px;
    }

    .page-heading h1 {
        font-size: 23px;
    }
}

@media (max-width: 380px) {
    .stats-grid,
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .topbar-title {
        display: none;
    }
}

.page-heading-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 11px 17px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.form-panel {
    max-width: 720px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 14px;
}

.form-group input:not([type="checkbox"]),
.form-group select,
.form-group textarea,
.filter-form input,
.filter-form select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--text);
}

.form-group textarea {
    min-height: 90px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
}

.field-error {
    color: #b42318;
    font-size: 13px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.filter-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 24px;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

.data-table th {
    color: var(--muted);
    font-size: 12px;
}

.data-table a {
    color: var(--primary);
    font-weight: 600;
}

.table-empty {
    text-align: center !important;
    color: var(--muted);
    padding: 35px !important;
}

.status-active,
.status-inactive {
    display: inline-block;
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 12px;
}

.status-active {
    background: #e8f4ed;
    color: #176b45;
}

.status-inactive {
    background: #f1f1f1;
    color: #777;
}

@media (max-width: 768px) {
    .page-heading-actions {
        align-items: flex-start;
        flex-direction: column;
    }

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

/* SPRINT 006 — MOVIMENTAÇÕES RECENTES */

.movement-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.movement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px;
    background: #f7faf8;
    border: 1px solid #e1e9e4;
    border-radius: 10px;
}

.movement-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.movement-info strong {
    color: #163d2b;
    font-size: 14px;
}

.movement-info span {
    color: #42564b;
    font-size: 13px;
}

.movement-info small {
    color: #718078;
    font-size: 12px;
}

.movement-type {
    font-size: 24px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .movement-item {
        padding: 12px;
    }

    .movement-info small {
        font-size: 11px;
    }
}


/* ========================================
   FTB ESTOQUE - SPRINT 008.1
   HISTÓRICO DE MOVIMENTAÇÕES
======================================== */

.historico-panel {
    margin-top: 20px;
    padding: 0;
    overflow: hidden;
}

.historico-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e9e6;
}

.historico-topo h2 {
    margin: 0;
    font-size: 18px;
    color: #18382c;
}

.historico-total {
    font-size: 13px;
    color: #68776e;
}

.historico-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.historico-tabela {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: 13px;
}

.historico-tabela th,
.historico-tabela td {
    padding: 14px 16px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #edf0ed;
}

.historico-tabela thead th {
    background: #f2f6f3;
    color: #294537;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.historico-tabela tbody tr:nth-child(even) {
    background: #fafcfb;
}

.historico-tabela tbody tr:hover {
    background: #edf7f0;
}

.historico-data {
    white-space: nowrap;
    color: #64736a;
}

.historico-produto {
    font-weight: 600;
    color: #243c2e;
}

.historico-responsavel {
    color: #41554a;
}

.col-quantidade,
.col-saldo {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.historico-tabela th.col-quantidade,
.historico-tabela td.col-quantidade,
.historico-tabela th.col-saldo,
.historico-tabela td.col-saldo {
    text-align: right;
}

.historico-unidade {
    margin-left: 4px;
    font-size: 11px;
    color: #7b887f;
}

.qtd-entrada {
    color: #16803c;
}

.qtd-retirada {
    color: #b42318;
}

/* Etiquetas */

.mov-tipo {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.mov-entrada {
    background: #e6f5eb;
    color: #16753a;
}

.mov-retirada {
    background: #fcebe9;
    color: #a82a22;
}

.mov-outro {
    background: #eef1f4;
    color: #59636e;
}

/* Observações */

.historico-observacao {
    min-width: 120px;
    max-width: 260px;
    overflow-wrap: anywhere;
    color: #6b756e;
}

.historico-vazio {
    text-align: center !important;
    padding: 36px !important;
    color: #758078;
}

/* Paginação */

.historico-paginacao {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 20px 0;
}

.historico-paginacao span {
    font-size: 13px;
    color: #66736b;
}

/* Mobile */

@media (max-width: 768px) {
    .historico-topo {
        padding: 16px;
    }

    .historico-tabela {
        min-width: 820px;
    }

    .historico-tabela th,
    .historico-tabela td {
        padding: 12px;
    }
}
