:root {
    --a360-navy: #10233f;
    --a360-navy-soft: #18385f;
    --a360-teal: #0f8f87;
    --a360-teal-dark: #0a6f69;
    --a360-cyan: #37b9b1;
    --a360-gold: #e7a33e;
    --a360-canvas: #f3f6f9;
    --a360-surface: #ffffff;
    --a360-text: #17263a;
    --a360-muted: #6b7b8f;
    --a360-border: #dfe7ef;
    --a360-sidebar: 276px;
    --a360-radius: 18px;
    --a360-shadow: 0 12px 35px rgba(16, 35, 63, .08);
}

[data-bs-theme="dark"] {
    --a360-canvas: #0c1727;
    --a360-surface: #142238;
    --a360-text: #edf4fb;
    --a360-muted: #9db0c6;
    --a360-border: #243a56;
    --a360-shadow: 0 14px 40px rgba(0, 0, 0, .25);
}

html,
body {
    min-height: 100%;
}

body {
    background: var(--a360-canvas);
    color: var(--a360-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: -.01em;
}

a {
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--a360-sidebar);
    padding: 20px 16px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 12% 4%, rgba(55, 185, 177, .18), transparent 30%),
        linear-gradient(180deg, #10233f 0%, #0c1c33 100%);
    color: #fff;
    z-index: 1035;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--a360-cyan), var(--a360-teal));
    box-shadow: 0 8px 24px rgba(55, 185, 177, .28);
    font-size: 1.25rem;
}

.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: 2px;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    flex-shrink: 0;
}

.login-story .brand-logo {
    width: 70px;
    height: 70px;
}

.brand-title {
    color: #fff;
    font-weight: 800;
    letter-spacing: -.04em;
}

.brand-subtitle {
    color: rgba(255, 255, 255, .56);
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sidebar-label {
    margin: 24px 12px 8px;
    color: rgba(255, 255, 255, .42);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, .7);
    border-radius: 12px;
    padding: 11px 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .92rem;
    font-weight: 600;
    transition: .18s ease;
}

.sidebar .nav-link i {
    width: 22px;
    font-size: 1.05rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, .1);
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    box-shadow: inset 3px 0 0 var(--a360-cyan);
}

.sidebar-profile {
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 16px;
    background: rgba(255, 255, 255, .05);
}

.app-main {
    margin-left: var(--a360-sidebar);
    min-width: 0;
}

.app-topbar {
    height: 76px;
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--a360-surface) 88%, transparent);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--a360-border);
}

.content-wrap {
    padding: 28px;
}

.page-eyebrow {
    color: var(--a360-teal);
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: .72rem;
}

.page-title {
    font-weight: 800;
    letter-spacing: -.04em;
    margin: 3px 0 0;
}

.min-w-0 { min-width: 0 !important; }

.page-title,
.criterion-row,
.card-soft {
    overflow-wrap: anywhere;
}

.evidence-selection-grid > [class*="col-"] {
    min-width: 0;
}

.evidence-option {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.evidence-option:hover {
    border-color: color-mix(in srgb, var(--a360-teal) 45%, var(--a360-border)) !important;
    box-shadow: 0 8px 20px rgba(16, 35, 63, .06);
}

.evidence-option-content {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.evidence-option-title {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    overflow-wrap: anywhere;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

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

.metric-card {
    padding: 20px;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.2rem;
}

.metric-value {
    margin-top: 16px;
    font-size: 1.75rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.04em;
}

.metric-label {
    margin-top: 7px;
    color: var(--a360-muted);
    font-size: .84rem;
}

.bg-soft-primary { background: rgba(13, 110, 253, .12); color: #0d6efd; }
.avatar-sm {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--a360-primary), var(--a360-accent));
    color: #fff;
    font-weight: 800;
}

.feature-option {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bs-body-bg) 86%, var(--a360-primary) 3%);
}

.evidence-file-list {
    max-width: 620px;
    max-height: 116px;
    overflow: auto;
}

.evidence-file-list:empty { display: none; }

.evidence-file-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .35rem .65rem;
    margin-top: .35rem;
    border-radius: 9px;
    background: var(--bs-tertiary-bg);
}

.derived-evidence-row > td:first-child {
    border-left: 3px solid #f0ad4e;
}
.bg-soft-success { background: rgba(15, 143, 135, .13); color: var(--a360-teal); }
.bg-soft-warning { background: rgba(231, 163, 62, .16); color: #b6710e; }
.bg-soft-danger { background: rgba(220, 53, 69, .12); color: #dc3545; }

.btn-primary {
    --bs-btn-bg: var(--a360-teal);
    --bs-btn-border-color: var(--a360-teal);
    --bs-btn-hover-bg: var(--a360-teal-dark);
    --bs-btn-hover-border-color: var(--a360-teal-dark);
    --bs-btn-active-bg: var(--a360-teal-dark);
    --bs-btn-active-border-color: var(--a360-teal-dark);
    box-shadow: 0 8px 22px rgba(15, 143, 135, .18);
}

.btn {
    border-radius: 11px;
    font-weight: 650;
}

.form-control,
.form-select {
    min-height: 46px;
    border-radius: 11px;
    border-color: var(--a360-border);
    background-color: var(--a360-surface);
}

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

.form-control:focus,
.form-select:focus {
    border-color: var(--a360-cyan);
    box-shadow: 0 0 0 .25rem rgba(55, 185, 177, .16);
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: .75rem;
    font-weight: 750;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
}

.progress {
    --bs-progress-height: 8px;
    --bs-progress-bg: color-mix(in srgb, var(--a360-border) 78%, transparent);
    border-radius: 999px;
}

.progress-bar {
    background: linear-gradient(90deg, var(--a360-teal), var(--a360-cyan));
    border-radius: 999px;
}

.table-modern {
    --bs-table-bg: transparent;
    margin: 0;
}

.table-modern > :not(caption) > * > * {
    padding: 14px 16px;
    border-bottom-color: var(--a360-border);
    vertical-align: middle;
}

.table-modern thead th {
    color: var(--a360-muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    white-space: nowrap;
}

.program-table-wrap {
    padding-bottom: 4px;
}

.program-table {
    min-width: 980px;
}

.users-table {
    min-width: 900px;
}

.program-table th,
.program-table td,
.program-table .btn,
.program-table .badge {
    word-break: normal;
    overflow-wrap: normal;
}

.program-table .btn,
.program-table .badge {
    white-space: nowrap;
}

.program-table th:nth-child(6),
.program-table td:nth-child(6) {
    min-width: 96px;
}

.program-table th:last-child,
.program-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
    min-width: 136px;
    background: var(--a360-surface);
    box-shadow: -10px 0 16px -16px rgba(20, 38, 52, .7);
}

.program-table thead th:last-child {
    z-index: 3;
}

.program-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    white-space: nowrap;
}

.program-actions form {
    display: inline-flex;
    margin: 0;
}

.program-actions .btn {
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
}

@media (max-width: 1399.98px) {
    .program-table {
        width: 100%;
        min-width: 0;
    }

    .program-table th:nth-child(2),
    .program-table td:nth-child(2),
    .program-table th:nth-child(3),
    .program-table td:nth-child(3) {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .program-table th:nth-child(4),
    .program-table td:nth-child(4),
    .program-table th:nth-child(5),
    .program-table td:nth-child(5) {
        display: none;
    }

    .program-table th:first-child,
    .program-table td:first-child {
        min-width: 0;
    }

    .program-table th:nth-child(6),
    .program-table td:nth-child(6) {
        min-width: 84px;
    }

    .program-table th:last-child,
    .program-table td:last-child {
        min-width: 128px;
    }
}

.criterion-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 16px;
    align-items: center;
    padding: 15px 18px;
    border-bottom: 1px solid var(--a360-border);
    color: inherit;
    transition: .15s ease;
}

.criterion-row:last-child { border-bottom: 0; }
.criterion-row:hover { background: rgba(15, 143, 135, .045); }

.criterion-row.bulk-selectable {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.criterion-row.bulk-selectable > a {
    color: inherit;
    text-decoration: none;
}

.criterion-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 32px;
    padding: 0 10px;
    border-radius: 9px;
    color: var(--a360-teal-dark);
    background: rgba(55, 185, 177, .12);
    font-weight: 800;
    font-size: .8rem;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 1rem;
    font-weight: 800;
}

.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 7px;
    bottom: 7px;
    width: 2px;
    background: var(--a360-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 18px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -25px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--a360-teal);
    border: 3px solid var(--a360-surface);
    box-shadow: 0 0 0 1px var(--a360-teal);
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--a360-muted);
}

.empty-state i {
    font-size: 2.25rem;
    color: var(--a360-teal);
}

.drop-zone {
    padding: 28px;
    border: 2px dashed var(--a360-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--a360-canvas) 72%, transparent);
    text-align: center;
    transition: .18s ease;
}

.drop-zone.dragover {
    border-color: var(--a360-teal);
    background: rgba(15, 143, 135, .07);
}

.analysis-panel {
    border-left: 4px solid var(--a360-teal);
}

.login-page {
    height: 100vh;
    max-height: 100vh;
    padding: 28px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 10%, rgba(55, 185, 177, .24), transparent 30%),
        radial-gradient(circle at 90% 90%, rgba(34, 91, 148, .28), transparent 28%),
        #0b1a2f;
}

.login-shell {
    width: min(1080px, 100%);
    max-height: 100%;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 26px;
    background: var(--a360-surface);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .28);
}

.login-story {
    max-height: 100%;
    padding: 52px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(150deg, rgba(15, 143, 135, .94), rgba(16, 35, 63, .98)),
        #10233f;
}

.login-story::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    right: -80px;
    bottom: -80px;
    border: 42px solid rgba(255, 255, 255, .07);
    border-radius: 50%;
}

.login-form-panel {
    padding: 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.feature-pill {
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 13px;
    background: rgba(255, 255, 255, .07);
    backdrop-filter: blur(12px);
}

.mobile-header {
    display: none;
}

.ghost-banner {
    background: #d97706;
    color: #fff;
    font-size: .875rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

@media (max-width: 991.98px) {
    .sidebar { display: none; }
    .app-main { margin-left: 0; }
    .mobile-header { display: flex; }
    .content-wrap { padding: 20px; }
    .criterion-row { grid-template-columns: minmax(0, 1fr) auto; }
    .criterion-row.bulk-selectable { grid-template-columns: auto minmax(0, 1fr) auto; }
    .criterion-row .analysis-score { display: none; }
}

@media (max-width: 767.98px) {
    .login-page { padding: 0; }
    .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
    .login-story { min-height: auto; padding: 28px; }
    .login-story .feature-grid { display: none !important; }
    .login-form-panel { padding: 32px 24px; }
    .content-wrap { padding: 16px; }
    .app-topbar { height: 66px; }
    .page-title { font-size: 1.55rem; }
    .criterion-row { padding: 13px 14px; }
    .table-responsive { border-radius: var(--a360-radius); }

    .users-table { min-width: 0; width: 100%; table-layout: fixed; }
    .users-table th:last-child, .users-table td:last-child { width: 84px; }
    .users-table th:nth-child(2),
    .users-table td:nth-child(2),
    .users-table th:nth-child(3),
    .users-table td:nth-child(3),
    .users-table th:nth-child(4),
    .users-table td:nth-child(4),
    .users-table th:nth-child(5),
    .users-table td:nth-child(5),
    .users-table th:nth-child(6),
    .users-table td:nth-child(6) {
        display: none;
    }
    .users-table td:first-child .d-flex { min-width: 0; }
    .users-table td:first-child .fw-bold,
    .users-table td:first-child .small.text-secondary {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .org-table { min-width: 0; width: 100%; table-layout: fixed; }
    .org-table th:nth-child(4), .org-table td:nth-child(4) { width: 112px; }
    .org-table th:last-child, .org-table td:last-child { width: 108px; }
    .org-table th:nth-child(2),
    .org-table td:nth-child(2),
    .org-table th:nth-child(3),
    .org-table td:nth-child(3),
    .org-table th:nth-child(5),
    .org-table td:nth-child(5),
    .org-table th:nth-child(6),
    .org-table td:nth-child(6),
    .org-table th:nth-child(7),
    .org-table td:nth-child(7) {
        display: none;
    }
}

@media print {
    .no-print { display: none !important; }
}
