:root {
    --aidf-navy: #0c1f46;
    --aidf-royal: #114da0;
    --aidf-blue: #0d3c84;
    --aidf-gold: #c9a43b;
    --aidf-teal: #0f6a73;
    --aidf-bg: #f4f6fa;
    --aidf-surface: #ffffff;
    --aidf-muted: #6e7a91;
    --aidf-border: #d9e0ed;
    --aidf-success: #147a4b;
    --aidf-danger: #a13232;
    --aidf-warning: #8b6a15;
    --aidf-radius: 12px;
    --aidf-shadow: 0 8px 20px rgba(11, 33, 72, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--aidf-bg);
    color: var(--aidf-navy);
    font-family: "Segoe UI", "Inter", "Roboto", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.92rem;
    line-height: 1.45;
}

a {
    color: var(--aidf-royal);
    text-decoration: none;
}

a:hover {
    color: var(--aidf-blue);
}

.aidf-public-bg {
    background: linear-gradient(180deg, #f8fbff 0%, #eff4fb 100%);
}

.aidf-card,
.card {
    border: 1px solid var(--aidf-border);
    border-radius: var(--aidf-radius);
    box-shadow: var(--aidf-shadow);
}

.aidf-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.aidf-section-title {
    font-size: 1.08rem;
    font-weight: 700;
    margin: 0;
}

.aidf-subtitle {
    color: var(--aidf-muted);
    margin: 0;
}

.aidf-navbar {
    background: var(--aidf-surface);
    border-bottom: 1px solid var(--aidf-border);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.aidf-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--aidf-navy);
}

.aidf-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(145deg, var(--aidf-navy), var(--aidf-royal));
}

.aidf-nav-link {
    color: var(--aidf-navy);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.45rem 0.65rem;
}

.aidf-nav-link:hover,
.aidf-nav-link:focus {
    color: var(--aidf-royal);
}

.aidf-hero {
    background: linear-gradient(130deg, #0c2048 0%, #0f4a9b 68%, #175fb8 100%);
    color: #fff;
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.aidf-hero h1 {
    font-size: 1.9rem;
    line-height: 1.2;
    margin-bottom: 0.9rem;
}

.aidf-trust-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
}

.aidf-trust-item {
    background: #fff;
    border: 1px solid var(--aidf-border);
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    font-size: 0.8rem;
    color: var(--aidf-muted);
}

.aidf-page-header {
    background: #fff;
    border: 1px solid var(--aidf-border);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}

.aidf-footer {
    background: #0c1f46;
    color: #c9d5ef;
    margin-top: 2rem;
    font-size: 0.86rem;
}

.aidf-footer a {
    color: #e7eefc;
}

.aidf-footer h6 {
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.aidf-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.aidf-sidebar {
    background: var(--aidf-navy);
    color: #cfe0ff;
    padding: 1rem 0.85rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.aidf-sidebar.staff {
    background: #0b4f57;
}

.aidf-sidebar.admin {
    background: #091735;
}

.aidf-sidebar .sidebar-title {
    color: #fff;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.88;
    margin: 0.95rem 0 0.55rem;
}

.aidf-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #dbe7ff;
    padding: 0.48rem 0.55rem;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 600;
}

.aidf-sidebar a:hover,
.aidf-sidebar a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.aidf-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.aidf-topbar {
    background: #fff;
    border-bottom: 1px solid var(--aidf-border);
    padding: 0.55rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
}

.aidf-topbar .search-input {
    max-width: 380px;
}

.aidf-content {
    padding: 0.95rem;
}

.aidf-kpi-card {
    padding: 0.8rem 0.9rem;
}

.aidf-kpi-label {
    color: var(--aidf-muted);
    font-size: 0.78rem;
    margin-bottom: 0.18rem;
}

.aidf-kpi-value {
    font-size: 1.23rem;
    font-weight: 700;
    margin: 0;
}

.aidf-table {
    font-size: 0.84rem;
}

.aidf-table thead th {
    color: #4b5974;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    border-bottom-width: 1px;
}

.aidf-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 50rem;
    padding: 0.15rem 0.48rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.aidf-status.success,
.aidf-status.approved,
.aidf-status.active,
.aidf-status.sent {
    background: #e7f7ef;
    color: var(--aidf-success);
}

.aidf-status.warning,
.aidf-status.pending,
.aidf-status.review {
    background: #fff7e2;
    color: var(--aidf-warning);
}

.aidf-status.danger,
.aidf-status.failed,
.aidf-status.rejected,
.aidf-status.inactive {
    background: #fdecec;
    color: var(--aidf-danger);
}

.aidf-status.info,
.aidf-status.processing {
    background: #e9f1ff;
    color: var(--aidf-royal);
}

.aidf-alert {
    border-radius: 9px;
    border-width: 1px;
    border-style: solid;
    padding: 0.62rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.84rem;
}

.aidf-alert-success { background: #ebfaf2; border-color: #9cd4b7; color: #145c3d; }
.aidf-alert-danger { background: #feeeee; border-color: #e3a9a9; color: #7d1e1e; }
.aidf-alert-warning { background: #fff8e9; border-color: #ecd29d; color: #76540f; }
.aidf-alert-info { background: #ecf3ff; border-color: #b6caec; color: #1d467e; }

.aidf-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.aidf-empty {
    border: 1px dashed var(--aidf-border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    color: var(--aidf-muted);
}

.aidf-security-note {
    margin-top: 0.7rem;
    font-size: 0.77rem;
    color: #5f6d87;
}

.aidf-auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 420px;
    background: #fff;
}

.aidf-auth-visual {
    padding: 2.2rem;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.aidf-auth-visual.customer { background: linear-gradient(130deg, #0e3576, #1a5bb4); }
.aidf-auth-visual.staff { background: linear-gradient(130deg, #0f5660, #1d7790); }
.aidf-auth-visual.admin { background: linear-gradient(130deg, #08152f, #122b57); }

.aidf-auth-card-wrap {
    padding: 1.3rem;
    background: #f7f9fd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aidf-auth-card {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border: 1px solid var(--aidf-border);
    border-radius: 12px;
    box-shadow: var(--aidf-shadow);
    padding: 1rem;
}

.aidf-auth-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.aidf-portal-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.73rem;
    border-radius: 999px;
    padding: 0.18rem 0.52rem;
    margin-bottom: 0.7rem;
}

.aidf-portal-tag.customer { background: #edf3ff; color: #184c98; }
.aidf-portal-tag.staff { background: #e8f8f8; color: #0f6470; }
.aidf-portal-tag.admin { background: #ebedf3; color: #293d65; }

.form-control,
.form-select {
    border-radius: 8px;
    border-color: #cfd8e7;
    font-size: 0.86rem;
    padding-top: 0.42rem;
    padding-bottom: 0.42rem;
}

.btn {
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--aidf-royal);
    border-color: var(--aidf-royal);
}

.btn-gold {
    background: var(--aidf-gold);
    border-color: var(--aidf-gold);
    color: #1f1a0f;
}

.btn-teal {
    background: var(--aidf-teal);
    border-color: var(--aidf-teal);
    color: #fff;
}

.aidf-btn-loading {
    pointer-events: none;
    opacity: 0.8;
}

.aidf-btn-loading::after {
    content: "";
    width: 0.8rem;
    height: 0.8rem;
    margin-left: 0.45rem;
    border: 2px solid rgba(255, 255, 255, 0.65);
    border-top-color: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: inline-block;
    animation: aidfSpin 0.8s linear infinite;
}

@keyframes aidfSpin {
    to { transform: rotate(360deg); }
}

.aidf-breadcrumb {
    font-size: 0.76rem;
    margin-bottom: 0.75rem;
}

.aidf-breadcrumb a {
    color: var(--aidf-muted);
}

.aidf-mobile-nav-toggle {
    display: none;
}

@media (max-width: 992px) {
    .aidf-trust-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .aidf-shell {
        grid-template-columns: 1fr;
    }

    .aidf-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 250px;
        transform: translateX(-101%);
        transition: transform 0.2s ease;
        z-index: 1040;
    }

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

    .aidf-mobile-nav-toggle {
        display: inline-flex;
    }

    .aidf-auth-shell {
        grid-template-columns: 1fr;
    }

    .aidf-auth-visual {
        min-height: 220px;
    }
}

@media (max-width: 576px) {
    .aidf-hero {
        padding: 1.2rem;
    }

    .aidf-hero h1 {
        font-size: 1.35rem;
    }

    .aidf-content {
        padding: 0.75rem;
    }
}
