:root {
    --access-orange: #f47b20;
    --access-orange-deep: #d85f00;
    --access-green: #0b7a75;
    --access-ink: #182230;
    --access-muted: #6b7280;
    --access-bg: #f5f7fb;
    --access-card: rgba(255, 255, 255, 0.92);
    --access-line: rgba(24, 34, 48, 0.08);
    --shadow-soft: 0 18px 45px rgba(18, 28, 45, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(244, 123, 32, 0.18), transparent 24rem),
        radial-gradient(circle at bottom right, rgba(11, 122, 117, 0.16), transparent 28rem),
        var(--access-bg);
    color: var(--access-ink);
    overflow-x: hidden;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-shell {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    border-radius: 28px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(22px);
    box-shadow: var(--shadow-soft);
}

.login-hero {
    padding: 3rem;
    background:
        linear-gradient(160deg, rgba(24, 34, 48, 0.95), rgba(24, 34, 48, 0.78)),
        linear-gradient(135deg, var(--access-orange), var(--access-green));
    color: #fff;
    position: relative;
}

.login-hero::after {
    content: '';
    position: absolute;
    inset: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
}

.login-panel {
    padding: 3rem;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.metric-pill,
.summary-card,
.glass-card,
.table-card {
    border: 1px solid var(--access-line);
    border-radius: 22px;
    background: var(--access-card);
    box-shadow: var(--shadow-soft);
}

.metric-pill {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    background:
        linear-gradient(180deg, rgba(24, 34, 48, 0.98), rgba(12, 18, 27, 0.98)),
        linear-gradient(180deg, var(--access-orange), var(--access-green));
    color: #fff;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-content {
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-nav {
    min-height: 0;
    flex: 1 1 0;
    flex-wrap: nowrap;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--access-orange), #ffb066);
    color: #fff;
    font-weight: 800;
    font-size: 1.3rem;
}

.brand-name {
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-subtitle,
.eyebrow {
    color: rgba(24, 34, 48, 0.65);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    font-weight: 700;
}

.app-sidebar .brand-subtitle {
    color: rgba(255, 255, 255, 0.6);
}

.app-nav-link {
    border-radius: 16px;
    padding: clamp(0.62rem, 1.25vh, 0.9rem) 1rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.app-nav-link:hover,
.app-nav-link.active {
    color: #fff;
    background: rgba(244, 123, 32, 0.16);
    border-color: rgba(244, 123, 32, 0.28);
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 0.9rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
}

.app-main {
    padding: 1.5rem;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--access-line);
    box-shadow: var(--shadow-soft);
}

.mobile-header .brand-subtitle {
    color: var(--access-muted);
}

.mobile-menu-btn {
    min-width: 92px;
}

.mobile-nav-link {
    border-radius: 14px;
    padding: 0.9rem 1rem;
    color: var(--access-ink);
    background: #fff;
    border: 1px solid var(--access-line);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.mobile-nav-link.active,
.mobile-nav-link:hover {
    color: #fff;
    background: linear-gradient(135deg, var(--access-orange), var(--access-orange-deep));
    border-color: transparent;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.topbar > *,
.section-heading > *,
.mobile-header > * {
    min-width: 0;
}

.page-title {
    margin: 0.35rem 0 0;
    font-size: clamp(1.8rem, 2vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--access-line);
    box-shadow: var(--shadow-soft);
    font-weight: 700;
    max-width: 100%;
}

.notification-chip {
    color: var(--access-ink);
}

.nav-badge {
    min-width: 1.55rem;
    height: 1.55rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--access-orange);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}

.chip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--access-orange), var(--access-green));
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    padding: 1.2rem;
}

.summary-card .value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.summary-card .label {
    color: var(--access-muted);
    font-weight: 600;
}

.glass-card,
.table-card {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.chart-panel {
    padding: 1.1rem;
    border: 1px solid var(--access-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 28px rgba(18, 28, 45, 0.06);
}

.chart-shell {
    position: relative;
    height: clamp(220px, 32vh, 320px);
    min-height: 220px;
    max-height: 320px;
}

.chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.4rem;
    scrollbar-gutter: stable;
}

.chart-scroll .chart-shell {
    min-width: 100%;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
}

.table {
    --bs-table-bg: transparent;
    width: 100%;
}

.table > :not(caption) > * > * {
    padding: 0.9rem 0.75rem;
    vertical-align: top;
}

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

.table th,
.table td {
    white-space: normal;
    word-break: break-word;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-readable {
    min-width: 1280px;
}

.table-readable th,
.table-readable td {
    white-space: nowrap;
    word-break: normal;
}

.table-readable td .badge,
.table-readable td a,
.table-readable td span {
    white-space: nowrap;
}

.performance-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 54px;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-weight: 800;
    color: #fff;
}

.status-blue {
    background: #1d4ed8;
}

.status-yellow {
    background: #ca8a04;
}

.status-ash {
    background: #6b7280;
}

.status-green {
    background: #16a34a;
}

.status-red {
    background: #dc2626;
}

.hero-stat {
    font-size: clamp(2.2rem, 4vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-top: 2.5rem;
}

.form-control,
.form-select {
    border-radius: 14px;
    border-color: rgba(24, 34, 48, 0.12);
    min-height: 48px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(244, 123, 32, 0.55);
    box-shadow: 0 0 0 0.25rem rgba(244, 123, 32, 0.12);
}

.btn-primary {
    --bs-btn-bg: var(--access-orange);
    --bs-btn-border-color: var(--access-orange);
    --bs-btn-hover-bg: var(--access-orange-deep);
    --bs-btn-hover-border-color: var(--access-orange-deep);
    --bs-btn-active-bg: var(--access-orange-deep);
    --bs-btn-active-border-color: var(--access-orange-deep);
}

.btn-outline-primary {
    --bs-btn-color: var(--access-orange);
    --bs-btn-border-color: var(--access-orange);
    --bs-btn-hover-bg: var(--access-orange);
    --bs-btn-hover-border-color: var(--access-orange);
}

.btn-success {
    --bs-btn-bg: var(--access-green);
    --bs-btn-border-color: var(--access-green);
    --bs-btn-hover-bg: #0a6661;
    --bs-btn-hover-border-color: #0a6661;
}

.kanban-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.25rem;
}

.directory-records-card {
    grid-column: 1 / -1;
}

.report-card {
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid var(--access-line);
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(247,248,250,0.85));
}

.document-body {
    min-height: 100vh;
    background: #e9edf3;
}

.merged-ttr-document {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 1.5rem;
}

.document-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.merged-ttr-sheet {
    background: #fff;
    border: 1px solid rgba(24, 34, 48, 0.1);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-soft);
}

.merged-ttr-header,
.ttr-entry-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.merged-ttr-header {
    border-bottom: 1px solid var(--access-line);
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
}

.merged-ttr-header h1,
.ttr-entry-header h2 {
    margin: 0.3rem 0;
    font-weight: 800;
    letter-spacing: 0;
}

.document-summary-grid,
.ttr-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
}

.document-summary-grid > div,
.ttr-meta-grid > div,
.document-note {
    padding: 0.85rem;
    border: 1px solid var(--access-line);
    border-radius: 8px;
    background: #f8fafc;
}

.document-summary-grid span,
.ttr-meta-grid span,
.document-note span {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--access-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.document-summary-grid strong,
.ttr-meta-grid strong,
.document-note strong {
    display: block;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.document-note {
    margin-top: 1rem;
}

.document-note.compact {
    margin-top: 0.85rem;
}

.merged-review-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid rgba(11, 122, 117, 0.18);
    border-radius: 10px;
    background: rgba(11, 122, 117, 0.06);
}

.ttr-entry-list {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.ttr-entry {
    break-inside: avoid;
    border: 1px solid var(--access-line);
    border-radius: 10px;
    padding: 1rem;
}

.ttr-review-control {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ttr-review-control .form-check {
    min-height: 0;
    margin: 0;
    padding: 0.35rem 0.65rem 0.35rem 2rem;
    border: 1px solid var(--access-line);
    border-radius: 8px;
    background: #fff;
    font-weight: 700;
}

.ttr-proof-frame {
    margin-top: 1rem;
    border: 1px dashed rgba(24, 34, 48, 0.18);
    border-radius: 8px;
    background: #f8fafc;
    padding: 0.75rem;
    text-align: center;
}

.ttr-proof-frame img {
    display: block;
    width: 100%;
    max-height: 820px;
    object-fit: contain;
    border-radius: 6px;
}

.notification-list {
    display: grid;
    gap: 0.85rem;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--access-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
}

.notification-item.unread {
    border-color: rgba(244, 123, 32, 0.34);
    background: rgba(244, 123, 32, 0.08);
}

.mini-label {
    font-size: 0.75rem;
    color: var(--access-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.empty-state {
    padding: 2.2rem 1.2rem;
    text-align: center;
    border: 1px dashed rgba(24, 34, 48, 0.14);
    border-radius: 18px;
    color: var(--access-muted);
}

.sticky-card {
    position: sticky;
    top: 1.5rem;
}

.profile-banner {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1rem;
}

.kpi-banner {
    background: linear-gradient(135deg, rgba(244, 123, 32, 0.16), rgba(11, 122, 117, 0.12));
}

@media (max-width: 1199px) {
    .summary-grid,
    .profile-banner,
    .kanban-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) and (max-height: 760px) {
    .app-sidebar {
        padding: 1rem;
        gap: 0.75rem;
    }

    .brand-icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .sidebar-nav.mt-4 {
        margin-top: 1rem !important;
    }

    .app-nav-link {
        border-radius: 14px;
        font-size: 0.92rem;
    }

    .sidebar-footer {
        padding: 0.75rem;
    }

    .sidebar-footer .btn {
        margin-top: 0.75rem !important;
    }
}

@media (max-width: 991px) {
    .login-shell,
    .app-shell,
    .summary-grid,
    .profile-banner,
    .kanban-grid {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        display: none;
    }

    .metric-strip {
        grid-template-columns: 1fr;
    }

    .sticky-card {
        position: static;
    }
}

@media (max-width: 575px) {
    .login-hero,
    .login-panel,
    .app-main,
    .app-sidebar {
        padding: 1.2rem;
    }

    .topbar,
    .section-heading,
    .notification-item,
    .mobile-header,
    .brand-mark {
        flex-direction: column;
        align-items: stretch;
    }

    .summary-grid,
    .profile-banner,
    .kanban-grid {
        grid-template-columns: 1fr;
    }

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

    .brand-icon {
        width: 44px;
        height: 44px;
    }

    .merged-ttr-document {
        padding: 0.75rem;
    }

    .merged-ttr-sheet {
        padding: 1rem;
    }

    .merged-ttr-header,
    .ttr-entry-header,
    .document-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 767px) {
    .mobile-stack-table thead {
        display: none;
    }

    .mobile-stack-table,
    .mobile-stack-table tbody,
    .mobile-stack-table tr,
    .mobile-stack-table td {
        display: block;
        width: 100%;
    }

    .mobile-stack-table tr {
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid var(--access-line);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 10px 28px rgba(18, 28, 45, 0.06);
    }

    .mobile-stack-table tr:last-child {
        margin-bottom: 0;
    }

    .mobile-stack-table td {
        border: 0;
        padding: 0.55rem 0;
        display: grid;
        grid-template-columns: minmax(110px, 42%) 1fr;
        gap: 0.75rem;
        align-items: start;
    }

    .mobile-stack-table td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-weight: 800;
        color: var(--access-muted);
    }

    .mobile-stack-table td[colspan] {
        display: block;
    }

    .mobile-stack-table td[colspan]::before {
        content: none;
    }

    .mobile-stack-table .badge {
        width: fit-content;
    }

    .table-readable {
        min-width: 1280px;
    }
}

@media print {
    body.document-body {
        background: #fff;
    }

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

    .merged-ttr-document {
        width: 100%;
        padding: 0;
    }

    .merged-ttr-sheet {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }

    .ttr-entry {
        page-break-inside: avoid;
    }
}
