html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f3f6fb;
    color: #172033;
    font-family: "Segoe UI", Arial, sans-serif;
}

a {
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f2744 0%, #0a1c33 100%);
    color: #fff;
    padding: 22px 18px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 6px 26px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 20px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: transparent;
    color: #08243d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    overflow: hidden;
    flex: 0 0 auto;
}

.brand-logo-box {
    box-shadow: 0 10px 24px rgba(45, 212, 191, .18);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.brand-title {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: .3px;
}

.brand-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,.68);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-section {
    margin: 18px 10px 8px;
    color: rgba(255,255,255,.48);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,.88);
    padding: 11px 12px;
    border-radius: 12px;
    transition: .2s ease;
    font-weight: 600;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.12);
}

.nav-item.disabled {
    opacity: .55;
    cursor: not-allowed;
}

.nav-icon {
    width: 24px;
    text-align: center;
}

.main-area {
    margin-left: 280px;
    min-height: 100vh;
    width: calc(100% - 280px);
}

.topbar {
    height: 82px;
    background: #fff;
    border-bottom: 1px solid #e5ebf3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 20px;
    font-weight: 800;
    color: #10213a;
}

.topbar-subtitle {
    color: #6b7890;
    font-size: 13px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f7f9fc;
    border: 1px solid #e5ebf3;
    padding: 8px 12px;
    border-radius: 16px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #10213a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.user-name {
    font-size: 13px;
    font-weight: 800;
}

.user-role {
    font-size: 12px;
    color: #6b7890;
}

.content-area {
    padding: 28px 32px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.page-kicker {
    color: #0d9488;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 800;
    margin-bottom: 6px;
}

.page-title {
    font-size: 30px;
    font-weight: 850;
    color: #10213a;
    margin: 0;
}

.page-description {
    color: #6b7890;
    margin-top: 8px;
    max-width: 760px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e5ebf3;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 14px 34px rgba(16, 33, 58, .06);
}

.stat-label {
    color: #6b7890;
    font-size: 13px;
    font-weight: 700;
}

.stat-value {
    font-size: 28px;
    font-weight: 850;
    color: #10213a;
    margin-top: 6px;
}

.card-clean {
    background: #fff;
    border: 1px solid #e5ebf3;
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(16, 33, 58, .06);
}

.card-header-clean {
    padding: 18px 22px;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.card-body-clean {
    padding: 22px;
}

.btn-primary-soft {
    border: 0;
    color: #fff;
    background: #0f766e;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(15, 118, 110, .22);
}

.btn-primary-soft:hover {
    color: #fff;
    background: #0d9488;
}

.btn-light-soft {
    border: 1px solid #d9e2ef;
    color: #10213a;
    background: #fff;
    padding: 9px 14px;
    border-radius: 12px;
    font-weight: 750;
}

.btn-light-soft:hover {
    background: #f3f6fb;
    color: #10213a;
}

.form-control,
.form-select {
    border-radius: 12px;
    border-color: #d9e2ef;
    padding: 10px 12px;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 .2rem rgba(13, 148, 136, .15);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    color: #6b7890;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid #eef2f7;
    padding: 14px 16px;
}

.table tbody td {
    vertical-align: middle;
    padding: 16px;
    border-color: #eef2f7;
}

.badge-status {
    padding: 7px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
}

.badge-active {
    color: #047857;
    background: #d1fae5;
}

.badge-inactive {
    color: #b91c1c;
    background: #fee2e2;
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 42px 20px;
    color: #6b7890;
}

.form-section-title {
    font-size: 18px;
    font-weight: 850;
    color: #10213a;
    margin-bottom: 4px;
}

.form-section-subtitle {
    color: #6b7890;
    margin-bottom: 22px;
}

.detail-line {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid #eef2f7;
}

.detail-label {
    color: #6b7890;
    font-weight: 700;
}

.detail-value {
    color: #10213a;
    font-weight: 800;
    text-align: right;
}

@media (max-width: 992px) {
    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
    }

    .app-shell {
        display: block;
    }

    .main-area {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        height: auto;
        padding: 18px;
        align-items: flex-start;
        flex-direction: column;
    }

    .content-area {
        padding: 20px;
    }

    .page-header {
        flex-direction: column;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 576px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

.mobile-menu-button,
.mobile-overlay {
    display: none;
}

.btn-logout {
    border: 1px solid #d9e2ef;
    background: #fff;
    color: #10213a;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
}

.btn-logout:hover {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f2744 0%, #0d9488 100%);
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 26px;
    padding: 30px;
    box-shadow: 0 24px 70px rgba(8, 36, 61, .25);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login-title {
    font-size: 28px;
    font-weight: 850;
    color: #10213a;
    margin: 0;
}

.login-subtitle,
.login-help {
    color: #6b7890;
}

.login-help {
    margin-top: 20px;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 992px) {
    body.menu-open {
        overflow: hidden;
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid #d9e2ef;
        border-radius: 14px;
        background: #fff;
        color: #10213a;
        font-size: 22px;
        font-weight: 800;
        flex: 0 0 auto;
    }

    .mobile-overlay.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(15, 23, 42, .48);
    }

    .sidebar {
        position: fixed;
        width: 82vw;
        max-width: 320px;
        min-height: 100vh;
        transform: translateX(-105%);
        transition: transform .2s ease;
        z-index: 100;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .app-shell {
        display: block;
    }

    .main-area {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        min-height: 74px;
        height: auto;
        padding: 14px 16px;
        align-items: center;
        flex-direction: row;
        gap: 12px;
    }

    .topbar-heading {
        min-width: 0;
        flex: 1;
    }

    .topbar-title {
        font-size: 17px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-subtitle,
    .user-info {
        display: none;
    }

    .topbar-user {
        padding: 6px;
        gap: 6px;
    }

    .user-avatar {
        width: 34px;
        height: 34px;
        border-radius: 11px;
        font-size: 13px;
    }

    .content-area {
        padding: 16px;
    }

    .card-header-clean {
        align-items: flex-start;
        flex-direction: column;
    }

    .table-responsive-mobile {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: 680px;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 24px;
    }

    .login-shell {
        align-items: stretch;
        padding: 14px;
    }

    .login-card {
        align-self: center;
        padding: 22px;
        border-radius: 22px;
    }

    .btn-logout {
        padding: 7px 9px;
    }
}

.recebimento-lista-mobile {
    display: none;
}

.recebimento-card {
    background: #fff;
    border: 1px solid #e5ebf3;
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 12px 30px rgba(16, 33, 58, .06);
}

.recebimento-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.assinatura-box {
    width: 100%;
    min-height: 192px;
    border: 2px dashed #94a3b8;
    border-radius: 18px;
    background: #fff;
    overflow: hidden;
    touch-action: none;
}

.assinatura-box canvas {
    display: block;
    width: 100%;
    height: 190px;
    cursor: crosshair;
    touch-action: none;
}

.assinatura-salva {
    border: 1px solid #d9e2ef;
    border-radius: 16px;
    background: #fff;
    padding: 10px;
    max-width: 520px;
}

.assinatura-salva img {
    display: block;
    width: 100%;
    max-height: 190px;
    object-fit: contain;
}

.recebimento-resumo {
    background: #f8fafc;
    border: 1px solid #e5ebf3;
    border-radius: 16px;
    padding: 14px;
    line-height: 1.8;
}

@media (max-width: 768px) {
    .recebimento-lista-mobile {
        display: block;
    }

    .recebimento-tabela-desktop {
        display: none;
    }

    .recebimento-card-grid {
        grid-template-columns: 1fr;
    }

    .recebimento-confirmacao-card .card-body {
        padding: 16px;
    }

    .recebimento-itens-table .table {
        min-width: 0;
    }
}
