:root {
    --dd-primary: #2563eb;
    --dd-primary-dark: #1e40af;
    --dd-bg: #f3f6fb;
    --dd-sidebar: #111827;
    --dd-sidebar-soft: #1f2937;
    --dd-text: #111827;
    --dd-muted: #6b7280;
    --dd-border: #e5e7eb;
    --dd-white: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--dd-bg);
    color: var(--dd-text);
}

a {
    text-decoration: none;
}

/* Login */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.20), transparent 30%),
        linear-gradient(135deg, #eff6ff 0%, #f8fafc 45%, #e0f2fe 100%);
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: var(--dd-white);
    border-radius: 28px;
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, 0.65);
}

.brand-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--dd-primary), #0ea5e9);
    color: var(--dd-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.login-brand h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.login-brand p {
    color: var(--dd-muted);
    margin: 6px 0 0;
    font-size: 14px;
}

.btn-login {
    min-height: 48px;
    border-radius: 14px;
    font-weight: 600;
}

.login-footer {
    color: var(--dd-muted);
}

/* App Layout */
.app-wrapper {
    min-height: 100vh;
    display: flex;
}

.app-sidebar {
    width: 280px;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--dd-sidebar), #0f172a);
    color: var(--dd-white);
    position: fixed;
    inset: 0 auto 0 0;
    padding: 22px;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.sidebar-logo {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.sidebar-brand strong,
.sidebar-brand span {
    display: block;
    line-height: 1.1;
}

.sidebar-brand span {
    color: rgba(255, 255, 255, 0.68);
    font-size: 13px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 16px;
    transition: all 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--dd-white);
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
}

.disabled-link {
    opacity: 0.55;
    pointer-events: none;
}

.sidebar-footer {
    margin-top: auto;
}

.store-badge {
    background: rgba(255, 255, 255, 0.12);
    color: var(--dd-white);
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
}

/* Main */
.app-main {
    width: 100%;
    min-height: 100vh;
    margin-left: 280px;
}

.app-topbar {
    min-height: 82px;
    background: var(--dd-white);
    border-bottom: 1px solid var(--dd-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 22px;
    font-weight: 700;
}

.topbar-user {
    align-items: center;
    gap: 12px;
}

.topbar-user strong,
.topbar-user small {
    display: block;
    line-height: 1.2;
}

.topbar-user small {
    color: var(--dd-muted);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    background: var(--dd-primary);
    color: var(--dd-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.app-content {
    padding: 28px;
}

/* Cards */
.dashboard-card,
.content-card {
    background: var(--dd-white);
    border: 1px solid var(--dd-border);
    border-radius: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.dashboard-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.dashboard-card-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex: 0 0 auto;
}

.dashboard-card span,
.dashboard-card small {
    display: block;
}

.dashboard-card span {
    color: var(--dd-muted);
    font-size: 13px;
}

.dashboard-card strong {
    display: block;
    font-size: 28px;
    line-height: 1.1;
}

.dashboard-card small {
    color: var(--dd-muted);
    font-size: 12px;
}

.content-card {
    padding: 22px;
}

.content-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.content-card-header h5 {
    font-weight: 700;
    margin: 0;
}

.content-card-header p {
    color: var(--dd-muted);
    margin: 4px 0 0;
    font-size: 14px;
}

.bg-soft-primary {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.bg-soft-success {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.bg-soft-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
}

.bg-soft-info {
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
}

/* Mobile menu */
.mobile-sidebar {
    background: var(--dd-sidebar);
    color: var(--dd-white);
}

.mobile-link {
    color: rgba(255, 255, 255, 0.78);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 16px;
    margin-bottom: 8px;
}

.mobile-link.active {
    color: var(--dd-white);
    background: rgba(255, 255, 255, 0.12);
}

.mobile-link i {
    width: 22px;
    text-align: center;
}

/* Forms */
.form-control,
.input-group-text,
.form-select {
    border-radius: 14px;
}

.input-group .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Responsive */
@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
    }

    .app-topbar {
        padding: 14px 16px;
        min-height: 72px;
    }

    .app-content {
        padding: 18px;
    }

    .topbar-title {
        font-size: 18px;
    }

    .content-card,
    .dashboard-card {
        border-radius: 20px;
    }

    .login-card {
        padding: 26px;
        border-radius: 24px;
    }

    .table> :not(caption)>*>* {
        padding: 0.95rem 0.85rem;
    }

    .badge {
        font-weight: 600;
        border-radius: 999px;
        padding: 0.45rem 0.7rem;
    }

    .lojas-check-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .loja-check-item {
        border: 1px solid var(--dd-border);
        border-radius: 18px;
        padding: 14px;
        background: #f8fafc;
    }

    .loja-check-item .form-check-label {
        cursor: pointer;
    }

    .btn {
        border-radius: 14px;
    }

    .btn-sm {
        border-radius: 11px;
    }

    @media (max-width: 767.98px) {
        .content-card-header {
            flex-direction: column;
            gap: 14px;
        }

        .content-card-header .btn {
            width: 100%;
        }

        .table-responsive {
            border-radius: 16px;
            border: 1px solid var(--dd-border);
        }
    }

    .document-mini-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .client-avatar-large {
        width: 74px;
        height: 74px;
        border-radius: 24px;
        background: linear-gradient(135deg, var(--dd-primary), #0ea5e9);
        color: var(--dd-white);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 30px;
        font-weight: 700;
    }

    .detail-box {
        border: 1px solid var(--dd-border);
        background: #f8fafc;
        border-radius: 18px;
        padding: 15px;
        height: 100%;
    }

    .detail-box span {
        display: block;
        color: var(--dd-muted);
        font-size: 12px;
        margin-bottom: 5px;
    }

    .detail-box strong {
        display: block;
        font-size: 14px;
        font-weight: 600;
        word-break: break-word;
    }

    .document-tabs {
        gap: 8px;
    }

    .document-tabs .nav-link {
        border-radius: 999px;
    }

    .empty-state {
        border: 1px dashed var(--dd-border);
        background: #f8fafc;
        border-radius: 22px;
        padding: 36px 20px;
        text-align: center;
    }

    .empty-state-icon {
        width: 70px;
        height: 70px;
        border-radius: 24px;
        background: rgba(37, 99, 235, 0.10);
        color: var(--dd-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        margin: 0 auto 16px;
    }

    .empty-state h5 {
        font-weight: 700;
        margin-bottom: 6px;
    }

    .empty-state p {
        color: var(--dd-muted);
        margin: 0 auto;
        max-width: 560px;
    }

    @media (max-width: 767.98px) {
        .btn-group {
            display: grid;
            gap: 6px;
            width: 100%;
        }

        .btn-group .btn {
            border-radius: 12px !important;
        }

        .document-tabs {
            overflow-x: auto;
            flex-wrap: nowrap;
            padding-bottom: 4px;
        }

        .document-tabs .nav-item {
            flex: 0 0 auto;
        }
    }

    .client-mini-card {
        display: flex;
        align-items: center;
        gap: 12px;
        border: 1px solid var(--dd-border);
        background: #f8fafc;
        border-radius: 20px;
        padding: 14px;
    }

    .client-mini-avatar {
        width: 48px;
        height: 48px;
        border-radius: 16px;
        background: linear-gradient(135deg, var(--dd-primary), #0ea5e9);
        color: var(--dd-white);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
    }

    .client-mini-card strong,
    .client-mini-card small {
        display: block;
    }

    .client-mini-card small {
        color: var(--dd-muted);
    }

    .capture-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .capture-button {
        border: 2px dashed var(--dd-border);
        border-radius: 24px;
        padding: 22px;
        background: #f8fafc;
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: center;
        display: block;
    }

    .capture-button:hover {
        border-color: var(--dd-primary);
        background: #eff6ff;
    }

    .capture-button i {
        width: 62px;
        height: 62px;
        border-radius: 22px;
        background: rgba(37, 99, 235, 0.10);
        color: var(--dd-primary);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 26px;
        margin-bottom: 12px;
    }

    .capture-button span {
        display: block;
        font-weight: 700;
        font-size: 16px;
    }

    .capture-button small {
        display: block;
        color: var(--dd-muted);
        margin-top: 4px;
    }

    .selected-file-box {
        border: 1px solid var(--dd-border);
        background: #ffffff;
        border-radius: 16px;
        padding: 12px 14px;
        color: var(--dd-muted);
        font-size: 14px;
    }

    .preview-wrapper {
        border: 1px solid var(--dd-border);
        border-radius: 22px;
        padding: 10px;
        background: #ffffff;
    }

    .preview-wrapper img {
        width: 100%;
        max-height: 430px;
        object-fit: contain;
        border-radius: 16px;
    }

    .document-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .document-list-item {
        border: 1px solid var(--dd-border);
        background: #ffffff;
        border-radius: 22px;
        padding: 16px;
        display: flex;
        gap: 14px;
    }

    .document-type-icon {
        width: 50px;
        height: 50px;
        border-radius: 18px;
        background: rgba(37, 99, 235, 0.10);
        color: var(--dd-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        flex: 0 0 auto;
    }

    .document-list-content {
        flex: 1;
        min-width: 0;
    }

    .document-list-content h6 {
        font-weight: 700;
        margin: 0 0 4px;
    }

    .document-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 14px;
        color: var(--dd-muted);
        font-size: 12px;
    }

    .document-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        justify-content: flex-end;
        align-items: flex-start;
    }

    .document-description {
        border-left: 3px solid var(--dd-border);
        padding-left: 10px;
        color: var(--dd-muted);
        font-size: 13px;
    }

    .document-summary-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .document-summary-list>div {
        border: 1px solid var(--dd-border);
        background: #f8fafc;
        border-radius: 16px;
        padding: 12px 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .document-summary-list span {
        color: var(--dd-muted);
        font-size: 13px;
    }

    .document-summary-list strong {
        font-size: 20px;
    }

    @media (max-width: 767.98px) {
        .mobile-capture-card {
            margin-left: -6px;
            margin-right: -6px;
        }

        .capture-button {
            padding: 24px 16px;
        }

        .capture-button i {
            width: 72px;
            height: 72px;
            font-size: 30px;
        }

        .document-list-item {
            flex-direction: column;
        }

        .document-type-icon {
            width: 54px;
            height: 54px;
        }

        .document-actions {
            display: grid;
            grid-template-columns: 1fr;
            width: 100%;
        }

        .document-actions .btn,
        .document-actions form,
        .document-actions button {
            width: 100%;
        }
    }

    .dashboard-quick-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }

    .quick-action-card {
        border: 1px solid var(--dd-border);
        background: #f8fafc;
        border-radius: 18px;
        padding: 14px;
        display: flex;
        gap: 12px;
        align-items: center;
        color: var(--dd-text);
        transition: all 0.2s ease;
    }

    .quick-action-card:hover {
        border-color: var(--dd-primary);
        background: #eff6ff;
        color: var(--dd-text);
        transform: translateY(-1px);
    }

    .quick-action-card i {
        width: 42px;
        height: 42px;
        border-radius: 15px;
        background: rgba(37, 99, 235, 0.10);
        color: var(--dd-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    .quick-action-card strong,
    .quick-action-card span {
        display: block;
    }

    .quick-action-card strong {
        font-size: 14px;
    }

    .quick-action-card span {
        color: var(--dd-muted);
        font-size: 12px;
    }

    .dashboard-type-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .dashboard-type-item {
        border: 1px solid var(--dd-border);
        background: #f8fafc;
        border-radius: 17px;
        padding: 13px 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .dashboard-type-item>div {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .dashboard-type-item i {
        width: 38px;
        height: 38px;
        border-radius: 14px;
        background: rgba(37, 99, 235, 0.10);
        color: var(--dd-primary);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dashboard-type-item span {
        font-size: 14px;
        font-weight: 600;
    }

    .dashboard-type-item strong {
        font-size: 22px;
    }

    .dashboard-recent-list,
    .dashboard-client-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .dashboard-recent-item {
        border: 1px solid var(--dd-border);
        background: #ffffff;
        border-radius: 20px;
        padding: 14px;
        display: flex;
        gap: 12px;
    }

    .dashboard-recent-icon {
        width: 46px;
        height: 46px;
        border-radius: 16px;
        background: rgba(37, 99, 235, 0.10);
        color: var(--dd-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        font-size: 20px;
    }

    .dashboard-recent-content {
        flex: 1;
        min-width: 0;
    }

    .dashboard-recent-content h6 {
        font-weight: 700;
        margin: 0 0 3px;
    }

    .dashboard-recent-content p {
        color: var(--dd-text);
        font-size: 14px;
        margin: 0 0 4px;
    }

    .dashboard-recent-content p span {
        color: var(--dd-muted);
    }

    .dashboard-recent-actions {
        display: flex;
        gap: 6px;
        align-items: flex-start;
        justify-content: flex-end;
    }

    .dashboard-client-item {
        border: 1px solid var(--dd-border);
        background: #ffffff;
        border-radius: 18px;
        padding: 13px;
        display: flex;
        gap: 12px;
        color: var(--dd-text);
        transition: all 0.2s ease;
    }

    .dashboard-client-item:hover {
        border-color: var(--dd-primary);
        background: #eff6ff;
        color: var(--dd-text);
    }

    .dashboard-client-avatar {
        width: 44px;
        height: 44px;
        border-radius: 16px;
        background: linear-gradient(135deg, var(--dd-primary), #0ea5e9);
        color: var(--dd-white);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        flex: 0 0 auto;
    }

    .dashboard-client-item strong,
    .dashboard-client-item span,
    .dashboard-client-item small {
        display: block;
    }

    .dashboard-client-item span {
        color: var(--dd-muted);
        font-size: 13px;
    }

    .dashboard-client-item small {
        color: var(--dd-muted);
        font-size: 12px;
    }

    .dashboard-empty {
        padding: 26px 18px;
    }

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

        .dashboard-recent-item {
            flex-direction: column;
        }

        .dashboard-recent-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            width: 100%;
        }

        .dashboard-recent-actions .btn {
            width: 100%;
        }
    }
}