  :root {
    --navy: #0a1628;
    --navy-mid: #122240;
    --navy-light: #1a3260;
    --gold: #c9a227;
    --gold-light: #e8c55a;
    --gold-pale: #f5e4a8;
    --white: #f8f4ee;
    --white-pure: #ffffff;
    --gray: #8a9ab5;
    --gray-light: #d4dae6;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --card-bg: rgba(18, 34, 64, 0.85);
    --border: rgba(201, 162, 39, 0.25);
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: 'Crimson Pro', serif;
    background: var(--navy);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* Animated background */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
      radial-gradient(ellipse 80% 60% at 20% 10%, rgba(201,162,39,0.06) 0%, transparent 60%),
      radial-gradient(ellipse 60% 80% at 80% 80%, rgba(26,50,96,0.5) 0%, transparent 60%),
      linear-gradient(135deg, #060d1a 0%, #0a1628 50%, #0d1e3d 100%);
    z-index: -1;
  }

  /* ===== AUTH SCREEN ===== */
  #auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
  }

  .auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    backdrop-filter: blur(20px);
    box-shadow: 0 40px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(201,162,39,0.1) inset;
    animation: fadeUp 0.6s ease;
  }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .auth-logo {
    text-align: center;
    margin-bottom: 2rem;
  }

  .auth-logo img { width: 90px; height: 90px; object-fit: contain; }

  .auth-logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--gold);
    margin-top: 0.75rem;
    letter-spacing: 0.5px;
  }

  .auth-logo p {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.25rem;
  }

  .form-group { margin-bottom: 1.25rem; }

  .form-group label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gold);
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
  }

  .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(10,22,40,0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--white);
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    color-scheme: dark;
  }

  /* Number input — hide default spinners, show gold custom ones */
  input[type="number"].form-control { -moz-appearance: textfield; }
  input[type="number"].form-control::-webkit-outer-spin-button,
  input[type="number"].form-control::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
  }

  /* Date input — gold calendar icon */
  input[type="date"].form-control::-webkit-calendar-picker-indicator {
    filter: invert(72%) sepia(48%) saturate(600%) hue-rotate(3deg) brightness(95%) contrast(90%);
    cursor: pointer;
    opacity: 0.85;
  }
  input[type="date"].form-control::-webkit-calendar-picker-indicator:hover { opacity: 1; }

  /* Select — custom gold chevron arrow, hide native */
  select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23c9a227' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2.5rem;
  }

  .form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,162,39,0.15);
  }

  .form-control::placeholder { color: var(--gray); }

  select.form-control option { background: var(--navy-mid); }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, #a8851f 100%);
    color: var(--navy);
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    letter-spacing: 0.5px;
  }

  .btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(201,162,39,0.3);
  }

  .btn-secondary {
    background: rgba(201,162,39,0.1);
    color: var(--gold);
    border: 1px solid var(--border);
  }

  .btn-secondary:hover {
    background: rgba(201,162,39,0.2);
    border-color: var(--gold);
  }

  .btn-danger {
    background: rgba(231,76,60,0.15);
    color: #e74c3c;
    border: 1px solid rgba(231,76,60,0.3);
  }

  .btn-danger:hover { background: rgba(231,76,60,0.25); }

  .btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
  .btn-xs { padding: 0.3rem 0.7rem; font-size: 0.78rem; }

  .error-msg {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
  }

  /* ===== MAIN APP LAYOUT ===== */
  #app { display: none; }

  .app-layout {
    display: flex;
    min-height: 100vh;
  }

  /* Sidebar */
  .sidebar {
    width: 260px;
    background: rgba(8, 16, 32, 0.9);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
    backdrop-filter: blur(20px);
  }

  .sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(201,162,39,0.3) transparent;
  }

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

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

  .sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(201,162,39,0.3);
    border-radius: 2px;
  }

  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    overflow: hidden;
  }

  .sidebar-logo img { width: 54px; height: 54px; flex-shrink: 0; object-fit: contain; }

  .sidebar-logo-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .sidebar-logo-text h2 {
    font-family: 'Playfair Display', serif;
    font-size: 0.85rem;
    color: var(--gold);
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
  }

  .sidebar-logo-text span {
    font-size: 0.68rem;
    color: var(--gray);
    font-family: 'JetBrains Mono', monospace;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-section {
    padding: 0.5rem 1rem;
    margin-bottom: 0.25rem;
  }

  .nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--gray);
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray);
    font-size: 0.95rem;
    margin-bottom: 0.1rem;
  }

  .nav-item:hover { background: rgba(201,162,39,0.08); color: var(--white); }

  .nav-item.active {
    background: rgba(201,162,39,0.15);
    color: var(--gold);
    box-shadow: inset 3px 0 0 var(--gold);
  }

  .nav-item .icon { font-size: 1.1rem; width: 20px; text-align: center; }

  .sidebar-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(8, 16, 32, 0.95);
  }

  .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #a8851f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--navy);
    font-family: 'JetBrains Mono', monospace;
  }

  .user-details h4 { font-size: 0.85rem; color: var(--white); }
  .user-details span { font-size: 0.75rem; color: var(--gold); font-family: 'JetBrains Mono', monospace; }

  /* Main Content */
  .main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
  }

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

  .topbar-left h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--white);
  }

  .topbar-left p { color: var(--gray); font-size: 0.9rem; margin-top: 0.25rem; }

  .topbar-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

  .hamburger {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    color: var(--gold);
    cursor: pointer;
    font-size: 1.2rem;
  }

  /* Cards */
  .card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
  }

  .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--gold);
  }

  /* Stats Grid */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
  }

  .stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
  }

  .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  }

  .stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), transparent);
  }

  .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gray);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.5rem;
  }

  .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold);
    font-family: 'Playfair Display', serif;
    line-height: 1;
  }

  .stat-sub {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.4rem;
  }

  .stat-icon {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.5rem;
    opacity: 0.3;
  }

  /* Tables */
  .table-wrap { overflow-x: auto; }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
  }

  th {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gold);
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }

  td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(201,162,39,0.08);
    color: var(--white);
    vertical-align: middle;
  }

  tr:last-child td { border-bottom: none; }
  tr:hover td { background: rgba(201,162,39,0.04); }

  /* Badges */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
  }

  .badge-active { background: rgba(46,204,113,0.15); color: #2ecc71; border: 1px solid rgba(46,204,113,0.3); }
  .badge-planning { background: rgba(52,152,219,0.15); color: #3498db; border: 1px solid rgba(52,152,219,0.3); }
  .badge-on-hold { background: rgba(243,156,18,0.15); color: #f39c12; border: 1px solid rgba(243,156,18,0.3); }
  .badge-completed { background: rgba(201,162,39,0.15); color: var(--gold); border: 1px solid var(--border); }
  .badge-admin { background: rgba(201,162,39,0.15); color: var(--gold); border: 1px solid var(--border); }
  .badge-investor { background: rgba(52,152,219,0.15); color: #3498db; border: 1px solid rgba(52,152,219,0.3); }

  /* Progress bar */
  .progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.4rem;
  }

  .progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    transition: width 0.5s ease;
  }

  .progress-fill.over { background: linear-gradient(90deg, #e74c3c, #c0392b); }
  .progress-fill.warning { background: linear-gradient(90deg, #f39c12, #e67e22); }

  /* Grids */
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }

  /* Sections */
  .section { margin-bottom: 2rem; }

  .section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--white);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* Modal */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
  }

  .modal-overlay.show { display: flex; }

  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .modal {
    background: #0e1e38;
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
    box-shadow: 0 40px 80px rgba(0,0,0,0.5);
  }

  .modal-lg { max-width: 800px; }

  @keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }

  .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: var(--gold);
  }

  .modal-close {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 1.4rem;
    transition: color 0.2s;
    padding: 0.25rem;
  }

  .modal-close:hover { color: var(--white); }

  .modal-body { padding: 1.5rem; }

  .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
  }

  /* Form Row */
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  .form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

  /* Budget categories */
  .budget-category {
    background: rgba(10,22,40,0.5);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
  }

  .budget-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
  }

  .budget-cat-name { font-size: 0.9rem; color: var(--white); font-weight: 600; }
  .budget-cat-pct { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }

  /* Timeline */
  .timeline { position: relative; padding-left: 2rem; }

  .timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
  }

  .timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(201,162,39,0.06);
  }

  .timeline-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

  .timeline-dot {
    position: absolute;
    left: -1.75rem;
    top: 0.25rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid var(--navy);
    box-shadow: 0 0 0 3px rgba(201,162,39,0.2);
  }

  .timeline-dot.complete { background: #2ecc71; box-shadow: 0 0 0 3px rgba(46,204,113,0.2); }
  .timeline-dot.pending { background: var(--gray); box-shadow: 0 0 0 3px rgba(138,154,181,0.2); }

  .timeline-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--gold);
    margin-bottom: 0.25rem;
  }

  .timeline-title { font-size: 0.95rem; color: var(--white); margin-bottom: 0.25rem; }
  .timeline-desc { font-size: 0.85rem; color: var(--gray); }

  /* Dashboard chart containers */
  .chart-container { position: relative; width: 100%; height: 220px; }

  /* Notification/toast */
  .toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1a3260;
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    color: var(--white);
    font-size: 0.9rem;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    max-width: 320px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  }

  .toast.show { transform: translateY(0); opacity: 1; }

  /* Project card */
  .project-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
  }

  .project-card:hover {
    border-color: rgba(201,162,39,0.5);
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  }

  .project-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
  .project-card-title { font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--white); }
  .project-card-address { font-size: 0.82rem; color: var(--gray); margin-top: 0.2rem; }

  .project-card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
 /* .project-metricid — reserved for metric container styling */
  .project-metric-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--gray); font-family: 'JetBrains Mono', monospace; }
  .project-metric-value { font-size: 1rem; color: var(--gold); font-weight: 600; }

  /* Responsive */
  @media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1rem; }
    .hamburger { display: flex; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .topbar { flex-wrap: wrap; }
    .modal { max-width: 100%; }
  }

  @media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
  }

  /* Hidden utility */
  .hidden { display: none !important; }
  .text-gold { color: var(--gold); }
  .text-gray { color: var(--gray); }
  .text-success { color: var(--success); }
  .text-danger { color: var(--danger); }
  .text-warning { color: var(--warning); }
  .text-right { text-align: right; }
  .mono { font-family: 'JetBrains Mono', monospace; }
  .mt-1 { margin-top: 0.5rem; }
  .mt-2 { margin-top: 1rem; }
  .mt-3 { margin-top: 1.5rem; }
  .flex { display: flex; }
  .flex-between { display: flex; align-items: center; justify-content: space-between; }
  .gap-1 { gap: 0.5rem; }
  .gap-2 { gap: 1rem; }
  .flex-wrap { flex-wrap: wrap; }
  .w-full { width: 100%; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }

  .sidebar-overlay.show { display: block; }

  .role-restricted { opacity: 0.4; pointer-events: none; cursor: not-allowed; }
