.btn-primary-page {
    height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: .2s ease;
}

.btn-primary-page:hover {
    background: var(--primary-hover);
}

.btn-light {
    height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: #374151;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: .2s ease;
}

.btn-light:hover {
    background: var(--surface-2);
}

.page-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.page-card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.page-card-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.page-card-header p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.9rem;
}

.page-card-body {
    padding: 20px;
}

.toolbar-mov {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.toolbar-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.search-box-mov {
    position: relative;
    width: 100%;
    max-width: 420px;
}

.search-box-mov i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.92rem;
}

.search-box-mov input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 14px 0 42px;
    outline: none;
    transition: .2s ease;
    background: #fff;
}

.search-box-mov input:focus,
.select-filter:focus,
.form-group input:focus,
.form-group select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.select-filter {
    height: 46px;
    min-width: 180px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    background: #fff;
    outline: none;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-wrap-mov {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.table-mov {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.table-mov thead th {
    background: #f8fafc;
    color: #374151;
    text-align: left;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.table-mov tbody td {
    padding: 15px 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.92rem;
    color: #374151;
    vertical-align: middle;
}

.table-mov tbody tr:hover td {
    background: #fafcff;
}

.empty-row {
    text-align: center;
    color: var(--muted);
    padding: 26px !important;
}

.tipo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.tipo-entrada {
    background: #dcfce7;
    color: #166534;
}

.tipo-saida {
    background: #fee2e2;
    color: #b91c1c;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
    transition: .2s ease;
}

.action-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}

/* MODAIS */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 3000;
}

.modal-overlay.show {
    display: flex;
}

.modal-card {
    width: 100%;
    max-width: 760px;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.modal-card-xl {
    max-width: 980px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-header h3 {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text);
}

.modal-header p {
    margin-top: 4px;
    font-size: 0.9rem;
    color: var(--muted);
}

.modal-body {
    padding: 20px;
}

.form-grid-mov {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.form-group label span {
    color: #dc2626;
}

.form-group input,
.form-group select {
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    outline: none;
    transition: .2s ease;
    background: #fff;
}

.items-section {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    background: #fafcff;
}

.items-section-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.items-section-header h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.items-section-header p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.88rem;
}

.lista-itens-mov {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-mov-row {
    display: grid;
    grid-template-columns: 1.5fr 0.7fr auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.item-mov-row .field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-mov-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.item-mov-row select,
.item-mov-row input {
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 12px;
    outline: none;
    background: #fff;
}

.item-mov-actions {
    display: flex;
    align-items: center;
}

.item-mov-empty {
    text-align: center;
    padding: 26px 14px;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: #fff;
}

.modal-footer {
    margin-top: 22px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.detalhe-top {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.detalhe-box {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: #fafcff;
}

.detalhe-box strong {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.detalhe-box span {
    color: var(--text);
    font-weight: 600;
}

.detalhe-itens-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detalhe-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.detalhe-item strong {
    color: var(--text);
    display: block;
    margin-bottom: 4px;
}

.detalhe-item small {
    color: var(--muted);
}

@media (max-width: 820px) {
    .form-grid-mov {
        grid-template-columns: 1fr;
    }

    .item-mov-row {
        grid-template-columns: 1fr;
    }

    .detalhe-top {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .toolbar-mov {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-row {
        flex-direction: column;
    }

    .search-box-mov {
        max-width: none;
    }

    .toolbar-actions .btn-light,
    .btn-primary-page,
    .items-section-header .btn-light,
    .modal-footer button {
        width: 100%;
        justify-content: center;
    }

    .detalhe-item {
        flex-direction: column;
        align-items: flex-start;
    }
}