:root {
    --ink-900: #172033;
    --ink-700: #334155;
    --ink-500: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --teal: #0f766e;
    --accent: #f97316;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #e2e8f0;
    --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.07);
    --shadow-strong: 0 16px 34px rgba(15, 23, 42, 0.12);
    --radius-lg: 8px;
    --radius-md: 8px;
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: #2563eb;
    --bs-link-hover-color: #1d4ed8;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    color: var(--ink-900);
    background: #f5f7fb;
    font-family: 'Space Grotesk', sans-serif;
}

a {
    color: var(--bs-link-color);
}

a:hover {
    color: var(--bs-link-hover-color);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #e2e8f0;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 10px;
}

.bg-shape {
    display: none;
}

.app-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #172033;
    backdrop-filter: blur(12px);
}

.brand-dot {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.brand-text {
    color: #f8fafc;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    letter-spacing: 0;
}

.navbar-text {
    color: #dbeafe !important;
    font-weight: 500;
}

.avatar-fallback {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--teal));
    font-size: 0.9rem;
    font-weight: 700;
}

.app-main {
    position: relative;
}

.app-breadcrumb {
    margin-bottom: 1rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.app-breadcrumb .breadcrumb-item {
    font-size: 0.88rem;
    font-weight: 600;
}

.app-breadcrumb a {
    text-decoration: none;
}

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.card-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--line);
    background: #fff;
    color: var(--ink-900);
    font-family: 'Sora', sans-serif;
    font-size: 0.93rem;
    font-weight: 700;
}

.stat-card {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-dark), var(--teal));
    box-shadow: var(--shadow-strong);
}

.dashboard-chart-card .card-body {
    min-height: 300px;
}

.dashboard-chart {
    width: 100%;
    height: 260px;
    display: block;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
    transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
    filter: saturate(1.05);
}

.btn-primary {
    border: 0;
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    border: 0;
    background: var(--teal);
}

.btn-dark {
    border: 0;
    background: #172033;
}

.btn-soft {
    border: 1px solid rgba(219, 234, 254, 0.35);
    color: #eff6ff;
    background: rgba(37, 99, 235, 0.2);
}

.btn-soft:hover {
    color: #fff;
    background: rgba(37, 99, 235, 0.35);
}

.btn-export {
    border: 0;
    color: #fff;
    background: var(--accent);
}

.notif-dropdown .notif-bell-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.notif-menu {
    width: min(92vw, 380px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
}

.notif-menu-header,
.notif-menu-footer {
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.notif-menu-footer {
    justify-content: center;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.notif-menu-list {
    max-height: 360px;
    overflow-y: auto;
}

.notif-empty {
    padding: 1rem 0.9rem;
    color: var(--ink-500);
    font-size: 0.92rem;
}

.notif-item {
    display: block;
    padding: 0.72rem 0.9rem;
    border-bottom: 1px solid var(--line);
    color: #111827;
    text-decoration: none;
}

.notif-item:hover,
.notif-item.unread {
    background: #eff6ff;
}

.notif-item-title {
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.3;
}

.notif-item-message {
    margin-top: 0.2rem;
    color: #4b5563;
    font-size: 0.84rem;
    line-height: 1.25;
}

.notif-item-time {
    margin-top: 0.22rem;
    color: #6b7280;
    font-size: 0.76rem;
}

.form-control,
.form-select,
textarea {
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 0.58rem 0.72rem;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.18);
}

.form-label {
    margin-bottom: 0.35rem;
    color: var(--ink-700);
    font-weight: 700;
}

.field-hint,
.password-meter-label {
    margin-top: 0.25rem;
    color: var(--ink-500);
    font-size: 0.75rem;
}

.password-meter {
    height: 7px;
    margin-top: 0.4rem;
    border-radius: 99px;
    background: #e2e8f0;
    overflow: hidden;
}

.password-meter .fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #dc2626, var(--accent));
    transition: width 0.25s ease;
}

.table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table td,
.table th {
    vertical-align: middle;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 0;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.table thead th.sortable::after {
    content: '\2195';
    margin-left: 0.35rem;
    color: #64748b;
    font-size: 0.58rem;
}

.table thead th.sortable.sorted-asc::after {
    content: '\2191';
    color: var(--primary);
}

.table thead th.sortable.sorted-desc::after {
    content: '\2193';
    color: var(--primary);
}

.table tbody tr {
    border-bottom: 1px solid var(--line);
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--surface-soft);
}

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
}

.table-toolbar .meta {
    color: var(--ink-500);
    font-size: 0.78rem;
}

.table-toolbar .toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.table-filter-input {
    width: 220px;
    max-width: 100%;
}

.user-mgmt-stat-tile,
.metric-tile {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
    padding: 0.85rem 1rem;
}

.user-mgmt-stat-tile .label,
.metric-label {
    color: var(--ink-500);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

.user-mgmt-stat-tile .value,
.metric-tile strong {
    color: var(--ink-900);
    font-family: 'Sora', sans-serif;
    font-size: 1.35rem;
    line-height: 1.15;
}

.metric-tile {
    min-height: 86px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.manage-actions-btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
}

.manage-dropdown-menu {
    z-index: 2000;
}

.modal-backdrop {
    z-index: 1080 !important;
}

.modal {
    z-index: 1090 !important;
}

.modal.show .modal-dialog {
    margin-left: auto;
    margin-right: auto;
}

.leave-review-modal-body,
.permission-access-modal .modal-body {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.leave-review-modal .modal-dialog,
.permission-access-modal .modal-dialog {
    max-height: calc(100vh - 1.5rem);
}

.leave-review-modal .modal-content,
.permission-access-modal .modal-content {
    max-height: calc(100vh - 1.5rem);
}

.assigned-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.7rem;
}

.assigned-access-tile {
    display: flex;
    align-items: center;
    padding: 0.72rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: #374151;
    font-weight: 700;
    text-decoration: none;
}

.assigned-access-tile:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--ink-900);
    text-decoration: none;
}

.badge-soft {
    color: var(--primary-dark);
    background-color: #eef6ff;
    font-weight: 800;
}

.list-group {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.list-group-item {
    padding: 0.78rem 0.95rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: #475569;
    font-weight: 700;
}

.list-group-item.active {
    border-color: transparent;
    background: var(--primary);
}

.app-alert {
    border: 0;
    border-radius: var(--radius-md);
}

.empty-state {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
}

.empty-state i {
    color: var(--primary);
    font-size: 1.5rem;
}

.empty-state p {
    margin: 0.2rem 0 0;
    color: var(--ink-500);
}

.lifecycle-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.lifecycle-page-head h1 {
    margin: 0;
    font-family: 'Sora', sans-serif;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.lifecycle-page-head p {
    margin: 0.35rem 0 0;
    max-width: 720px;
    color: var(--ink-500);
}

.lifecycle-page-actions {
    flex: 0 0 auto;
}

.lifecycle-metric-tile {
    min-height: 104px;
}

.lifecycle-metric-tile small {
    color: var(--ink-500);
    font-weight: 700;
}

.lifecycle-workspace > .card-body {
    padding: 1rem;
}

.lifecycle-tabs {
    gap: 0.45rem;
    padding: 0.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
}

.lifecycle-tabs .nav-link {
    border-radius: 7px;
    color: var(--ink-700);
    font-weight: 800;
}

.lifecycle-tabs .nav-link.active {
    background: var(--primary);
}

.lifecycle-stack {
    display: grid;
    gap: 1rem;
}

.lifecycle-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    overflow: hidden;
}

.lifecycle-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--line);
    background: #fbfdff;
}

.lifecycle-panel-title {
    min-width: 0;
}

.lifecycle-panel h2 {
    margin: 0;
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
}

.lifecycle-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.9rem;
    color: var(--ink-500);
    font-size: 0.84rem;
    font-weight: 700;
}

.lifecycle-meta-grid span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.lifecycle-meta-grid i {
    color: var(--primary);
}

.lifecycle-progress {
    width: min(220px, 100%);
    text-align: right;
}

.lifecycle-progress span {
    color: var(--ink-900);
    font-weight: 800;
}

.lifecycle-progress .progress {
    height: 8px;
    margin: 0.35rem 0;
    background: #e2e8f0;
}

.lifecycle-progress .progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--teal));
}

.process-note {
    margin: 1rem 1rem 0;
    padding: 0.75rem 0.9rem;
    border-left: 3px solid var(--accent);
    border-radius: 6px;
    background: #fff7ed;
    color: #7c2d12;
}

.lifecycle-task-list {
    overflow-x: auto;
}

.lifecycle-table {
    min-width: 920px;
}

.lifecycle-table td {
    padding: 0.78rem 0.75rem;
}

.lifecycle-table tbody tr:last-child {
    border-bottom: 0;
}

.lifecycle-task-title {
    color: var(--ink-900);
    font-weight: 800;
}

.owner-chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.65rem;
    padding: 0.18rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--ink-700);
    font-size: 0.78rem;
    font-weight: 800;
}

.task-edit-form {
    margin: 0;
}

.task-edit-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) minmax(120px, 0.7fr) minmax(130px, 0.7fr) minmax(140px, 0.8fr) minmax(180px, 1fr) auto;
    gap: 0.55rem;
    align-items: end;
}

.task-edit-grid .form-label {
    font-size: 0.72rem;
    margin-bottom: 0.22rem;
}

.task-edit-actions {
    display: flex;
    align-items: end;
    min-height: 2rem;
}

.lifecycle-edit-row {
    background: var(--surface-soft);
}

.lifecycle-edit-row > td {
    padding: 0;
}

.lifecycle-edit-panel {
    margin: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
}

.lifecycle-actions {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--line);
    background: #fbfdff;
}

.lifecycle-add-task-form {
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
}

.reveal-on-load {
    opacity: 0;
    transform: translateY(8px);
}

.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 991.98px) {
    .container-xl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .table thead th {
        font-size: 0.76rem;
    }

    .table-filter-input {
        width: 100%;
    }

    .table-toolbar {
        align-items: flex-start;
    }

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

    .lifecycle-page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .lifecycle-page-actions,
    .lifecycle-page-actions .btn {
        width: 100%;
    }

    .lifecycle-panel-header {
        flex-direction: column;
    }

    .lifecycle-progress {
        width: 100%;
        text-align: left;
    }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
