/* ════════════════════════════════════════════════════════════
   ProjeXt — Design System
   Fonts: DM Sans (body) + DM Serif Display (headings) + DM Mono
   ════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
    --navy: #0F172A;
    --navy-50: #F8FAFC;
    --navy-100: #F1F5F9;
    --navy-300: #CBD5E1;
    --navy-400: #94A3B8;
    --navy-500: #64748B;
    --navy-600: #475569;
    --navy-700: #334155;
    --navy-800: #1E293B;

    --amber: #F59E0B;
    --amber-dark: #D97706;
    --amber-light: #FEF3C7;

    --blue: #3B82F6;
    --blue-light: #EFF6FF;

    --green: #10B981;
    --green-light: #D1FAE5;

    --red: #EF4444;
    --red-light: #FEE2E2;

    --border: #E2E8F0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .08), 0 2px 4px rgba(0, 0, 0, .04);
    --transition: all .15s ease;

    --sidebar-w: 240px;
    --topbar-h: 60px;
}

/* ── Reset & Base ────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    color: var(--navy-800);
    background: var(--navy-50);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--navy);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    /* sidebar sendiri tidak scroll */
}

.sidebar-logo {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
    /* logo tidak menyusut, selalu tampil di atas */
}

.logo-mark {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: var(--amber);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    color: white;
    font-weight: 700;
}

.logo-text span {
    color: var(--amber);
}

.sidebar-nav {
    flex: 1;
    padding: .5rem .75rem;
    overflow-y: auto;
    /* hanya nav area yang scroll */
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

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

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

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

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .3);
}

.sidebar-section-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255, 255, 255, .3);
    padding: .6rem .5rem .2rem;
    margin-top: .25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 450;
    color: rgba(255, 255, 255, .55);
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 1px;
}

.sidebar-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .85);
}

.sidebar-link.active {
    background: rgba(255, 255, 255, .1);
    color: white;
    font-weight: 500;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
    /* footer tidak menyusut, selalu tampil di bawah */
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--amber);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: white;
}

.sidebar-user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, .4);
}

/* ── Main layout ─────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    /* di atas project-tabbar (z:90) */
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.2;
}

.topbar-breadcrumb {
    font-size: 11px;
    color: var(--navy-500);
    margin-top: 1px;
}

/* ── User dropdown ── */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 6px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    background: transparent;
}

.topbar-user:hover,
.topbar-user.show {
    background: var(--navy-50);
    border-color: var(--border);
}

.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--navy);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 700;
    flex-shrink: 0;
}

.topbar-user-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--navy);
    white-space: nowrap;
}

.topbar-user-meta {
    font-size: 10.5px;
    color: var(--navy-500);
    white-space: nowrap;
}

.topbar-chevron {
    width: 14px;
    height: 14px;
    color: var(--navy-400);
    transition: transform .2s;
    flex-shrink: 0;
}

.topbar-user.show .topbar-chevron {
    transform: rotate(180deg);
}

/* ── Notif bell ── */
.topbar-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: white;
    color: var(--navy-500);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
}

.topbar-btn:hover {
    background: var(--navy-50);
    color: var(--navy);
}

.topbar-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--red);
    color: white;
    font-size: 8px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid white;
}

/* ── Dropdown menu ── */
.topbar-dropdown {
    min-width: 220px;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    padding: 6px;
    z-index: 9999;
}

.topbar-dropdown .dropdown-header {
    padding: 8px 10px 6px;
    font-size: 11px;
    color: var(--navy-400);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.topbar-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--navy);
    border-radius: 6px;
    transition: background .1s;
}

.topbar-dropdown .dropdown-item:hover {
    background: var(--navy-50);
    color: var(--navy);
}

.topbar-dropdown .dropdown-item.text-danger:hover {
    background: rgba(220, 38, 38, .06);
    color: var(--red);
}

.topbar-dropdown .dropdown-item svg {
    flex-shrink: 0;
    opacity: .6;
}

.topbar-dropdown .dropdown-divider {
    margin: 4px 0;
    border-color: var(--border);
}

.topbar-tier-chip {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
    text-transform: uppercase;
}

.page-body {
    padding: 1.5rem;
    flex: 1;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--navy);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.25rem;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card {
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border);
}

.stat-card.navy {
    background: var(--navy);
    border-color: transparent;
}

.stat-card.blue {
    background: var(--blue-light);
    border-color: #BFDBFE;
}

.stat-card.green {
    background: var(--green-light);
    border-color: #6EE7B7;
}

.stat-card.amber {
    background: var(--amber-light);
    border-color: #FDE68A;
}

.stat-card.red {
    background: var(--red-light);
    border-color: #FECACA;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--navy-500);
    margin-bottom: .15rem;
}

.stat-card.navy .stat-label {
    color: rgba(255, 255, 255, .5);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    font-family: 'DM Serif Display', serif;
    line-height: 1.1;
}

.stat-card.navy .stat-value {
    color: white;
}

.stat-sub {
    font-size: 11.5px;
    color: var(--navy-500);
    margin-top: .2rem;
}

.stat-card.navy .stat-sub {
    color: rgba(255, 255, 255, .45);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
    font-size: 13.5px;
}

.btn-primary {
    background: var(--navy);
    border-color: var(--navy);
    color: white;
}

.btn-primary:hover {
    background: var(--navy-800);
    border-color: var(--navy-800);
    color: white;
}

.btn-amber {
    background: var(--amber);
    border-color: var(--amber);
    color: var(--navy);
}

.btn-amber:hover {
    background: var(--amber-dark);
    border-color: var(--amber-dark);
    color: var(--navy);
}

.btn-outline-navy {
    border: 1.5px solid var(--navy);
    color: var(--navy);
    background: transparent;
}

.btn-outline-navy:hover {
    background: var(--navy);
    color: white;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--navy-600);
}

.btn-ghost:hover {
    background: var(--navy-100);
    color: var(--navy);
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-control,
.form-select {
    border-radius: var(--radius-md);
    border-color: var(--border);
    font-size: 13.5px;
    padding: .5rem .75rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--navy-400);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .06);
    outline: none;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--navy-700);
    margin-bottom: .3rem;
}

.form-text {
    font-size: 11.5px;
    color: var(--navy-500);
    margin-top: .25rem;
}

.input-group-text {
    border-color: var(--border);
    border-radius: var(--radius-md);
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-navy {
    background: var(--navy-100);
    color: var(--navy-700);
}

.badge-blue {
    background: var(--blue-light);
    color: #1E40AF;
}

.badge-green {
    background: var(--green-light);
    color: #065F46;
}

.badge-amber {
    background: var(--amber-light);
    color: #92400E;
}

.badge-red {
    background: var(--red-light);
    color: #991B1B;
}

/* ── Alert PM panels ─────────────────────────────────────────── */
.alert-pm {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: .75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.6;
}

.alert-pm.info {
    background: #EFF6FF;
    border-left: 3px solid var(--blue);
    color: #1E40AF;
}

.alert-pm.success {
    background: var(--green-light);
    border-left: 3px solid var(--green);
    color: #065F46;
}

.alert-pm.warning {
    background: var(--amber-light);
    border-left: 3px solid var(--amber);
    color: #92400E;
}

.alert-pm.danger {
    background: var(--red-light);
    border-left: 3px solid var(--red);
    color: #991B1B;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table {
    font-size: 13.5px;
}

.table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--navy-500);
    padding: .625rem 1rem;
    background: var(--navy-50);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-hover tbody tr:hover td {
    background: var(--navy-50);
}

/* ── Progress bar ────────────────────────────────────────────── */
.progress {
    height: 6px;
    background: var(--navy-100);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar {
    border-radius: 99px;
    transition: width .4s ease;
}

/* ── Mono text ───────────────────────────────────────────────── */
.mono {
    font-family: 'DM Mono', monospace;
}

/* ── Select2 overrides ───────────────────────────────────────── */
.select2-container--default .select2-selection--single {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    height: 38px;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px;
    font-size: 13.5px;
    color: var(--navy-800);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

/* ── Dropdown ────────────────────────────────────────────────── */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    padding: .35rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: .45rem .75rem;
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
    gap: 3px;
}

.page-link {
    border-radius: var(--radius-sm) !important;
    border-color: var(--border);
    color: var(--navy-600);
    font-size: 13px;
    padding: .3rem .65rem;
}

.page-item.active .page-link {
    background: var(--navy);
    border-color: var(--navy);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 0px;
    }

    .sidebar {
        transform: translateX(-240px);
        transition: transform .25s ease;
        width: 240px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PROJECT TAB BAR
   Menggantikan sidebar contextual links — muncul di bawah topbar
   saat berada di dalam suatu project
════════════════════════════════════════════════════════════════ */

.project-tabbar {
    position: sticky;
    top: var(--topbar-h);
    /* stick di bawah topbar */
    z-index: 80;
    background: var(--navy);
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    padding: 0;
}

/* ── Identity row (kode, nama, status) ── */
.project-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 1.5rem 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.project-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    color: rgba(255, 255, 255, .45);
    text-decoration: none;
    transition: var(--transition);
    flex-shrink: 0;
}

.project-back:hover {
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .9);
}

.project-code-badge {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: rgba(255, 255, 255, .4);
    background: rgba(255, 255, 255, .07);
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.project-name-label {
    font-size: 13.5px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.project-status-pill {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 8px;
    border-radius: 99px;
    flex-shrink: 0;
}

.project-status-active {
    background: rgba(16, 185, 129, .2);
    color: #34D399;
}

.project-status-on_hold {
    background: rgba(245, 158, 11, .2);
    color: var(--amber);
}

.project-status-completed {
    background: rgba(59, 130, 246, .2);
    color: #60A5FA;
}

.project-status-cancelled {
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .4);
}

/* ── Tab row ── */
.project-tabs {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 1.5rem;
    gap: 0;
}

.project-tabs::-webkit-scrollbar {
    display: none;
}

.project-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 13px;
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, .45);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    transition: color .15s, border-color .15s;
    cursor: pointer;
    flex-shrink: 0;
}

.project-tab:hover {
    color: rgba(255, 255, 255, .85);
}

.project-tab.active {
    color: var(--amber);
    border-bottom-color: var(--amber);
    font-weight: 500;
}

.project-tab.disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: auto;
    /* allow tooltip */
}

.tab-pro-badge {
    font-size: 8px;
    font-weight: 700;
    background: rgba(245, 158, 11, .2);
    color: var(--amber);
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Adjust main content saat ada tabbar ── */
.project-tabbar+.page-body,
.project-tabbar~* .page-body {
    padding-top: 1.25rem;
}

/* topbar styles merged above */

/* ── Mobile: collapse ke hamburger ── */
@media (max-width: 768px) {
    .project-tabs {
        padding: 0 1rem;
    }

    .project-identity {
        padding: 8px 1rem;
    }

    .project-name-label {
        font-size: 12.5px;
    }
}