html {
    background: #f3edf7;
}

body {
    background: #f3edf7;
    color: #29243a;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 16px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #2c2538;
    font-weight: 700;
}

input,
select,
textarea {
    max-width: none;
}

.form-control,
.form-select,
.btn {
    border-radius: 6px;
}

.form-control,
.form-select {
    border: 1px solid #d8dfe8;
    min-height: 56px;
    padding: 14px 16px;
    color: #2c2538;
    font-size: 1rem;
    background-color: #fff;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: #b66dff;
    box-shadow: 0 0 0 .18rem rgba(182,109,255,.24), 0 6px 18px rgba(154,85,255,.12);
}

.form-control::placeholder,
.form-select::placeholder {
    color: #8f8199;
}

.form-control-sm,
.form-select-sm {
    min-height: 40px;
    padding: 8px 12px;
    font-size: .9rem;
}

textarea.form-control {
    min-height: 118px;
    resize: vertical;
}

.form-label {
    color: #151126;
    font-size: .98rem;
    font-weight: 500;
    margin-bottom: 10px;
}

form .row {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}

form .mb-2 {
    margin-bottom: 1rem !important;
}

form .mb-3 {
    margin-bottom: 1.5rem !important;
}

.input-group .form-control,
.input-group .form-select,
.input-group .input-group-text,
.input-group .btn {
    min-height: 56px;
}

.input-group-text {
    border-color: #d8dfe8;
    background: #fbf8fd;
    color: #5c5068;
    font-weight: 700;
}

.btn-primary {
    background: linear-gradient(135deg, #da8cff 0%, #9a55ff 100%);
    border: 0;
    box-shadow: 0 7px 16px rgba(154,85,255,.24);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #c96cff 0%, #8438f4 100%);
    border: 0;
}

.btn {
    min-height: 46px;
    padding: 10px 18px;
    font-weight: 600;
}

.btn-sm {
    min-height: 34px;
    padding: 6px 12px;
    font-size: .875rem;
}

.btn-outline-primary {
    color: #9a55ff;
    border-color: #cfa9ff;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #fff;
    background: #9a55ff;
    border-color: #9a55ff;
}

.btn-outline-secondary {
    color: #554b61;
    border-color: #d8dfe8;
    background: #fff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: #9a55ff;
    border-color: #cfa9ff;
    background: #fbf7ff;
}

.nav-tabs {
    border-bottom: 1px solid #d8dfe8;
}

.nav-tabs .nav-link {
    min-height: 48px;
    padding: 12px 20px;
    border-radius: 7px 7px 0 0;
    color: #3f5064;
    font-weight: 700;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: #9a55ff;
}

.nav-tabs .nav-link.active {
    color: #151126;
    background: #fff;
    border-color: #d8dfe8 #d8dfe8 #fff;
}

.surface {
    background: #fff;
    border: 0;
    border-radius: 5px;
    box-shadow: 0 5px 24px rgba(92,73,115,.09);
}

.surface.p-3,
.surface.p-lg-4 {
    padding: 2.25rem !important;
}

.section-title {
    color: #252033;
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}

.section-kicker {
    color: #667789;
    font-size: .85rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.case-action-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
}

.case-action-toolbar .toolbar {
    flex: 1 1 520px;
}

.case-tool-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.case-tool-button .nav-icon {
    width: 24px;
    height: 24px;
    font-size: .78rem;
}

.responsive-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    vertical-align: middle;
    color: #4b4258;
}

.table thead th {
    background: #fbf8fd;
    border-bottom: 1px solid #eadff1;
    color: #5a5068;
    font-size: .82rem;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table tbody td {
    border-color: #f0e8f5;
    padding: 1rem .75rem;
}

.table tbody tr.row-action {
    cursor: pointer;
}

.table tbody tr.row-action:hover {
    background: #fbf7ff;
}

.crm-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.metric-card {
    min-height: 104px;
    padding: 24px 28px;
    overflow: hidden;
    position: relative;
}

.metric-card span {
    display: block;
    color: rgba(255,255,255,.9);
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    color: #fff;
    font-size: 1.95rem;
    line-height: 1;
}

.metric-card:before,
.metric-card:after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    pointer-events: none;
}

.metric-card:before {
    width: 150px;
    height: 150px;
    right: -32px;
    top: -44px;
}

.metric-card:after {
    width: 190px;
    height: 190px;
    right: 42px;
    bottom: -92px;
}

.crm-grid > .metric-card:nth-child(3n+1),
.dashboard-grid > .dashboard-card:nth-child(3n+1) {
    background: linear-gradient(135deg, #ffbf96 0%, #fe7096 100%);
}

.crm-grid > .metric-card:nth-child(3n+2),
.dashboard-grid > .dashboard-card:nth-child(3n+2) {
    background: linear-gradient(135deg, #90caf9 0%, #047edf 100%);
}

.crm-grid > .metric-card:nth-child(3n),
.dashboard-grid > .dashboard-card:nth-child(3n) {
    background: linear-gradient(135deg, #84d9d2 0%, #07cdae 100%);
}

.activity-list {
    display: grid;
    gap: 10px;
}

.activity-item {
    border: 1px solid #eee6f4;
    border-radius: 5px;
    padding: 14px 16px;
    background: #fff;
}

.activity-title {
    font-weight: 800;
}

.activity-meta {
    color: #667789;
    font-size: .85rem;
}

.empty-state {
    border: 1px dashed #dacde5;
    border-radius: 5px;
    color: #667789;
    padding: 20px;
    text-align: center;
    background: #fbf8fd;
}

.alert {
    border-radius: 5px;
}

.badge {
    border-radius: 999px;
    font-weight: 700;
}

.list-group-item {
    border-color: #f0e8f5;
    padding: 1rem;
}

.text-muted {
    color: #8a7b95 !important;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-top: .5rem;
}

.form-actions .btn-primary {
    min-width: 180px;
}

.compact-form .form-control,
.compact-form .form-select {
    min-height: 46px;
    padding: 10px 14px;
}

.compact-form textarea.form-control {
    min-height: 90px;
}

.auth-form .btn-primary,
.full-width-action {
    width: 100%;
    min-height: 46px;
    font-size: 1.08rem;
}

.modal-content {
    border: 0;
    border-radius: 5px;
    box-shadow: 0 24px 70px rgba(65,35,90,.23);
}

.modal-header,
.modal-footer {
    background: #fbf8fd;
}

.modal-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #455466;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .07em;
    margin: 20px 0 12px;
    text-transform: uppercase;
}

.repository-shell {
    padding: 24px;
}

.repository-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.repo-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-weight: 800;
}

.repo-crumb {
    border: 0;
    background: transparent;
    color: #9a55ff;
    font-weight: 800;
    padding: 0;
}

.repo-divider {
    color: #b9a9c5;
}

.repo-grid-wrap {
    display: grid;
    gap: 24px;
}

.repo-section-title {
    color: #8a7b95;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .07em;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.repo-folder {
    min-height: 96px;
    border: 1px solid #f0e7f5;
    border-radius: 6px;
    background: #fff;
    color: #372d42;
    padding: 16px;
    text-align: left;
    box-shadow: 0 8px 22px rgba(92,73,115,.06);
}

.repo-folder:hover,
.repo-folder:focus {
    border-color: #d7bbff;
    box-shadow: 0 12px 26px rgba(154,85,255,.13);
}

.repo-folder-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: linear-gradient(135deg, #da8cff 0%, #9a55ff 100%);
    color: #fff;
    font-weight: 900;
    margin-bottom: 10px;
}

.repo-folder-name,
.repo-file-name {
    display: block;
    font-weight: 800;
}

.repo-folder-meta,
.repo-file-type {
    display: block;
    color: #8a7b95;
    font-size: .82rem;
    margin-top: 2px;
}

.repo-empty {
    border: 1px dashed #dacde5;
    border-radius: 6px;
    color: #8a7b95;
    padding: 18px;
    background: #fbf8fd;
}

.repo-table td {
    vertical-align: middle;
}

@media (max-width: 1100px) {
    .span-3,
    .span-4,
    .span-5,
    .span-6,
    .span-7,
    .span-8 {
        grid-column: span 6;
    }
}

@media (max-width: 720px) {
    .repository-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .span-3,
    .span-4,
    .span-5,
    .span-6,
    .span-7,
    .span-8,
    .span-12 {
        grid-column: span 1;
    }
}
