:root {
    --aidplus-bg: #f7f3ef;
    --aidplus-panel: #ffffff;
    --aidplus-panel-soft: #fff7ef;
    --aidplus-border: #eadccf;
    --aidplus-ink: #46312e;
    --aidplus-muted: #8b7368;
    --aidplus-primary: #b95c54;
    --aidplus-primary-strong: #93453e;
    --aidplus-accent: #d4a24f;
    --aidplus-warm: #f0c26d;
    --aidplus-danger: #c24646;
    --aidplus-shadow: 0 24px 60px rgba(90, 52, 41, 0.08);
    --aidplus-sidebar-bg: linear-gradient(180deg, #fffdfa 0%, #f8eee5 100%);
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(212, 162, 79, 0.18), transparent 24%),
        radial-gradient(circle at top right, rgba(185, 92, 84, 0.16), transparent 28%),
        var(--aidplus-bg);
    color: var(--aidplus-ink);
}

h1, h2, h3, h4, h5, .aidplus-brand-title, .aidplus-page-title, .aidplus-title {
    font-family: 'Space Grotesk', sans-serif;
}

.aidplus-body, .aidplus-auth-body {
    min-height: 100vh;
}

.aidplus-shell {
    display: flex;
    min-height: 100vh;
}

.aidplus-sidebar {
    width: 300px;
    background: var(--aidplus-sidebar-bg);
    color: var(--aidplus-ink);
    box-shadow: var(--aidplus-shadow);
    border-right: 1px solid rgba(185, 92, 84, 0.08);
}

.aidplus-sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 1.5rem;
    gap: 1rem;
}

.aidplus-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: inherit;
}

.aidplus-brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: linear-gradient(135deg, var(--aidplus-primary), #d27a70);
    color: #fff8f3;
}

.aidplus-brand-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.aidplus-brand-subtitle,
.aidplus-nav-section,
.aidplus-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
}

.aidplus-brand-subtitle,
.aidplus-nav-section {
    color: rgba(70, 49, 46, 0.55);
}

.aidplus-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.aidplus-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: rgba(255, 250, 246, 0.94);
    color: var(--aidplus-ink);
    border-bottom: 1px solid rgba(185, 92, 84, 0.12);
    backdrop-filter: blur(16px);
}

.aidplus-title {
    font-size: 1.2rem;
}

.aidplus-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: rgba(185, 92, 84, 0.08);
    color: var(--aidplus-primary-strong);
    border: 1px solid rgba(185, 92, 84, 0.12);
}

.aidplus-content {
    padding: 2rem;
}

.aidplus-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.aidplus-nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    color: rgba(70, 49, 46, 0.86);
    text-decoration: none;
    transition: all 0.2s ease;
}

.aidplus-nav-link:hover,
.aidplus-nav-link.active {
    background: linear-gradient(90deg, rgba(185, 92, 84, 0.12), rgba(212, 162, 79, 0.12));
    color: var(--aidplus-primary-strong);
    box-shadow: inset 0 0 0 1px rgba(185, 92, 84, 0.08);
}

.aidplus-search-shell .select2-container {
    width: 100% !important;
}

.aidplus-search-shell .select2-selection {
    border-radius: 14px !important;
    border: 1px solid rgba(185, 92, 84, 0.12) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    color: var(--aidplus-ink);
    min-height: 48px !important;
}

.aidplus-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.aidplus-page-title {
    font-size: 1.9rem;
}

.aidplus-stat-card,
.aidplus-panel,
.card {
    background: var(--aidplus-panel);
    border: 1px solid var(--aidplus-border);
    border-radius: 18px;
    box-shadow: var(--aidplus-shadow);
}

.card-header {
    padding: 1rem 1.25rem;
    background: transparent;
    border-bottom: 1px solid rgba(234, 220, 207, 0.8);
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.aidplus-stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.35rem;
    height: 100%;
}

.aidplus-stat-label {
    color: var(--aidplus-muted);
    font-size: 0.9rem;
}

.aidplus-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.aidplus-stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.82);
    font-size: 1.2rem;
}

.tone-primary { background: linear-gradient(180deg, #fff1ef, #ffffff); }
.tone-success { background: linear-gradient(180deg, #fff8ef, #ffffff); }
.tone-warning { background: linear-gradient(180deg, #fff6e7, #ffffff); }
.tone-danger { background: linear-gradient(180deg, #ffefef, #ffffff); }
.tone-dark { background: linear-gradient(180deg, #f7f0eb, #ffffff); }

.table thead th {
    text-transform: uppercase;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    color: var(--aidplus-muted);
    border-bottom-width: 1px;
    background: #fffaf6;
}

.table > :not(caption) > * > * {
    padding: 0.9rem 1rem;
}

.table-hover > tbody > tr:hover > * {
    background: rgba(212, 162, 79, 0.08);
}

.btn {
    border-radius: 12px;
    font-weight: 600;
    box-shadow: none;
}

.btn-default {
    background: #f5ede5;
    color: var(--aidplus-ink);
    border-color: #e4d3c0;
}

.btn-primary,
.btn-info {
    background: var(--aidplus-primary);
    border-color: var(--aidplus-primary);
}

.btn-primary:hover,
.btn-info:hover,
.btn-primary:focus,
.btn-info:focus {
    background: var(--aidplus-primary-strong);
    border-color: var(--aidplus-primary-strong);
}

.btn-success,
.btn-warning {
    background: var(--aidplus-accent);
    border-color: var(--aidplus-accent);
    color: #3f2b16;
}

.btn-success:hover,
.btn-warning:hover,
.btn-success:focus,
.btn-warning:focus {
    background: #bf8e3f;
    border-color: #bf8e3f;
    color: #2f1d0b;
}

.btn-danger {
    background: var(--aidplus-danger);
    border-color: var(--aidplus-danger);
}

.btn-xs {
    padding: 0.45rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 10px;
}

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

.badge-info,
.label-info { background: #f8e3b7; color: #6d4f1b; }
.badge-secondary { background: #6c757d; color: #fff; }
.badge-warning { background: #f7e2ba; color: #6f5217; }
.badge-success { background: #e9d3af; color: #6b4920; }
.badge-danger { background: #f4cbc7; color: #842f29; }
.badge-primary { background: #ebc0bc; color: #7f3630; }
.badge-dark { background: #6b5550; color: #fff; }

.timeline-item {
    position: relative;
    padding: 0 0 1.5rem 1.5rem;
    border-left: 2px solid #d8e6f0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    background: var(--aidplus-primary);
    border-radius: 50%;
}

.ck-editor__editable, textarea {
    min-height: 150px;
}

.datatable { width: 100% !important; }
.aidplus-datatable { width: 100% !important; }
.select2 { width: 100% !important; }
.form-group .required::after { content: ' *'; color: var(--aidplus-danger); }
.opacity-50 { opacity: 0.5; }
.filter-form { background: var(--aidplus-panel-soft); padding: 1rem; border: 1px solid var(--aidplus-border); border-radius: 20px; }
.profile-card .avatar { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, var(--aidplus-primary), #d38374); color: white; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: bold; }
.empty-state { border: 1px dashed var(--aidplus-border); background: rgba(255,255,255,0.65); border-radius: 20px; padding: 2rem; text-align: center; color: var(--aidplus-muted); }

.aidplus-auth-body {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f4e2d4 0%, #fff8f2 38%, #e9b0a7 100%);
}

.aidplus-login-card {
    max-width: 480px;
    margin: 0 auto;
    background: rgba(255,255,255,0.96);
    border-radius: 28px;
    box-shadow: var(--aidplus-shadow);
    padding: 2rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 12px;
    border: 1px solid var(--aidplus-border);
    padding: 0.45rem 0.75rem;
}

.aidplus-datatable-toolbar .dt-buttons .btn {
    margin-left: 0.35rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 10px !important;
    border: 0 !important;
    margin: 0 0.15rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--aidplus-primary) !important;
    color: #fff !important;
}

table.dataTable.fixedHeader-floating,
table.dataTable.fixedHeader-locked {
    background-color: #fffaf6 !important;
}

.fixedHeader-floating thead th,
.fixedHeader-locked thead th {
    box-shadow: inset 0 -1px 0 var(--aidplus-border);
}

.table.dataTable thead .search,
.table.dataTable thead select.search {
    width: 100%;
    min-width: 120px;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--aidplus-border);
    border-radius: 10px;
    background: #fff;
}

.table-responsive {
    border-radius: 16px;
}

.dataTables_wrapper .dataTables_info {
    color: var(--aidplus-muted);
}

.info-box,
.small-box {
    position: relative;
    overflow: hidden;
    min-height: 140px;
    padding: 1.25rem;
    border: 1px solid var(--aidplus-border);
    border-radius: 18px;
    background: linear-gradient(180deg, #fffaf6, #ffffff);
    box-shadow: var(--aidplus-shadow);
}

.info-box {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.info-box-icon,
.small-box .icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    background: rgba(185, 92, 84, 0.12);
    color: var(--aidplus-primary);
}

.info-box-content,
.small-box .inner {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.info-box-text,
.small-box p {
    margin: 0;
    color: var(--aidplus-muted);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.info-box-number,
.small-box h3 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--aidplus-ink);
}

.small-box .icon {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
}

.small-box.bg-info,
.small-box.bg-success,
.small-box.bg-dark,
.info-box .bg-secondary,
.info-box .bg-info,
.info-box .bg-warning,
.info-box .bg-success,
.info-box .bg-primary,
.info-box .bg-danger,
.info-box .bg-dark {
    background: rgba(185, 92, 84, 0.12) !important;
    color: var(--aidplus-primary) !important;
}

@media (max-width: 991.98px) {
    .aidplus-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1045;
        max-width: 300px;
    }

    .aidplus-content,
    .aidplus-topbar {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .aidplus-page-header {
        flex-direction: column;
    }
}
