:root {
    --forest: #1E3A8A; --forest-mid: #1D4ED8; --forest-light: #3B82F6;
    --sage: #93C5FD; --sage-light: #DBEAFE; --cream: #F8F4EE;
    --cream-dark: #EDE8DF; --warm-white: #FEFCF8; --gold: #C9A84C;
    --gold-light: #E8D5A0; --text-dark: #1A1A18; --text-mid: #3D3D38;
    --text-muted: #7A7A72; --border: rgba(30,58,138,0.12); --shadow: 0 2px 20px rgba(30,58,138,0.08);
  }
  * { margin:0; padding:0; box-sizing:border-box; }
  body { font-family: Arial, Helvetica, sans-serif; background:var(--cream); color:var(--text-dark); min-height:100vh; }
  .dashboard-page, .dashboard-page * { font-family: Arial !important; }

  /* SIDEBAR */
  .sidebar {
    width: 240px; background: var(--forest); min-height:100vh;
    display:flex; flex-direction:column; position:fixed; inset:0 auto 0 0; height:100vh;
    flex-shrink:0; overflow:hidden; z-index:100;
  }
  .sidebar-brand {
    padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .sidebar-brand .name {
    font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#fff; font-weight:600;
  }
  .sidebar-brand .sub { font-size:10px; color:var(--sage); opacity:0.8; letter-spacing:0.04em; margin-top:2px; }
  .sidebar-nav { padding:16px 12px; flex:1; overflow:hidden; }
  .nav-section-label { font-size:10px; text-transform:uppercase; letter-spacing:0.08em; color:var(--sage); opacity:0.6; padding:8px 10px 6px; }
  .nav-item {
    display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px;
    color:rgba(183,228,199,0.7); font-size:13px; text-decoration:none; margin-bottom:2px;
    transition:all 0.2s; cursor:pointer;
  }
  .nav-item:hover { background:rgba(255,255,255,0.08); color:#fff; transform:translateX(3px); }
  .nav-item.active { background:rgba(255,255,255,0.12); color:#fff; font-weight:500; }
  .nav-item svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; flex-shrink:0; }
  .sidebar-user {
    padding:16px 20px; border-top:1px solid rgba(255,255,255,0.08);
    display:flex; align-items:center; gap:10px;
  }
  .avatar {
    width:34px; height:34px; border-radius:50%; background:var(--forest-light);
    display:flex; align-items:center; justify-content:center; font-size:12px;
    font-weight:600; color:#fff; flex-shrink:0;
  }
  .sidebar-user .avatar { overflow:hidden; }
  .sidebar-user .avatar img { display:block; width:100%; height:100%; object-fit:cover; }
  .sidebar-user .uname { font-size:12px; font-weight:500; color:#fff; }
  .sidebar-user .urole { font-size:10px; color:var(--sage); }
  .logout-link { font-size:11px; color:rgba(183,228,199,0.5); text-decoration:none; margin-left:auto; }
  .logout-link:hover { color:var(--sage); }

  /* MAIN */
  .main { margin-left:240px; display:flex; flex-direction:column; min-width:0; }
  .public-application .main { margin-left:0; }
  .sidebar-toggle, .sidebar-overlay { display:none; }
  .sidebar.is-open ~ .sidebar-toggle { opacity:0; pointer-events:none; }
  .topbar {
    background:var(--warm-white); border-bottom:1px solid var(--border);
    padding:0 32px; height:60px; display:flex; align-items:center; justify-content:space-between;
    position:sticky; top:0; z-index:50;
  }
  .topbar h1 { font-size:16px; font-weight:500; color:var(--text-dark); }
  .topbar-right { display:flex; align-items:center; gap:12px; }
  .notif-btn {
    width:36px; height:36px; border:1px solid var(--border); border-radius:8px;
    display:flex; align-items:center; justify-content:center; cursor:pointer;
    background:var(--cream); position:relative; transition:background 0.2s;
    padding:0; font:inherit; color:inherit; outline:none; text-align:center;
  }
  .notif-btn:hover { background:var(--cream-dark); }
  .notif-btn svg { width:16px; height:16px; fill:none; stroke:var(--text-mid); stroke-width:1.8; }
  .notif-dot { position:absolute; top:8px; right:8px; width:7px; height:7px; background:#EF4444; border-radius:50%; border:1.5px solid var(--warm-white); }
  .session-tag { font-size:11px; color:var(--text-muted); background:var(--cream); border:1px solid var(--border); padding:4px 10px; border-radius:6px; }
  .session-tag strong { color:var(--forest); }

  /* CONTENT */
  .content { padding:32px; flex:1; }
  .welcome-banner {
    background:var(--forest); border-radius:16px; padding:28px 32px;
    display:flex; align-items:center; justify-content:space-between; margin-bottom:24px;
  }
  .welcome-banner h2 { font-family: Arial, Helvetica, sans-serif; font-size:22px; color:#fff; margin-bottom:4px; }
  .welcome-banner p { font-size:13px; color:var(--sage-light); opacity:0.85; }
  .client-id-badge {
    background:rgba(255,255,255,0.1); border:1px solid rgba(255,255,255,0.15);
    border-radius:10px; padding:12px 18px; text-align:right;
  }
  .client-id-badge .label { font-size:10px; color:var(--sage); letter-spacing:0.06em; text-transform:uppercase; }
  .client-id-badge .id { font-family: Arial, Helvetica, sans-serif; font-size:18px; color:#fff; margin-top:2px; }
  .verified-tag { display:inline-flex; align-items:center; gap:4px; font-size:10px; color:var(--sage); margin-top:4px; }
  .verified-tag svg { width:12px; height:12px; }

  /* METRICS */
  .metrics { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:24px; }
  .metric-card {
    background:var(--warm-white); border:1px solid var(--border); border-radius:12px;
    padding:18px 20px;
  }
  .metric-card .m-label { font-size:11px; color:var(--text-muted); margin-bottom:8px; }
  .metric-card .m-value { font-family: Arial, Helvetica, sans-serif; font-size:26px; color:var(--forest); }
  .metric-card .m-sub { font-size:11px; color:var(--text-muted); margin-top:4px; }

  /* GRID */
  .dash-grid { display:grid; grid-template-columns:1fr 340px; gap:20px; }
  .card {
    background:var(--warm-white); border:1px solid var(--border); border-radius:14px; overflow:hidden;
  }
  .card-header {
    padding:18px 22px; border-bottom:1px solid var(--border);
    display:flex; align-items:center; justify-content:space-between;
  }
  .card-header h3 { font-size:14px; font-weight:500; color:var(--text-dark); }
  .card-body { padding:16px 22px; }
  .btn-sm {
    font-size:12px; color:var(--forest); background:var(--cream); border:1px solid var(--border);
    padding:5px 12px; border-radius:7px; cursor:pointer; font-family: Arial, Helvetica, sans-serif;
    text-decoration:none; transition:background 0.2s;
  }
  .btn-sm:hover { background:var(--cream-dark); }
  .btn-sm-primary {
    font-size:12px; color:#fff; background:var(--forest); border:none;
    padding:5px 12px; border-radius:7px; cursor:pointer; font-family: Arial, Helvetica, sans-serif;
    text-decoration:none; transition:background 0.2s;
  }
  .btn-sm-primary:hover { background:var(--forest-mid); }

  /* REQUESTS TABLE */
  .req-table { width:100%; border-collapse:collapse; }
  .req-table th { font-size:11px; color:var(--text-muted); text-align:left; padding:8px 0; border-bottom:1px solid var(--border); font-weight:500; text-transform:uppercase; letter-spacing:0.04em; }
  .req-table td { font-size:13px; color:var(--text-mid); padding:13px 0; border-bottom:1px solid var(--border); vertical-align:middle; }
  .req-table tr:last-child td { border-bottom:none; }
  .ref-num { font-size:11px; color:var(--text-muted); margin-top:2px; }

  /* STATUS BADGES */
  .badge { display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:600; padding:3px 9px; border-radius:20px; }
  .badge-processing { background:#FEF3C7; color:#92400E; }
  .badge-approved { background:#D1FAE5; color:#065F46; }
  .badge-ready { background:#DBEAFE; color:#1E40AF; }
  .badge-rejected, .badge-disqualified { background:#FEE2E2; color:#991B1B; }
  .badge-submitted { background:var(--cream-dark); color:var(--text-mid); }

  /* APPLY FORM */
  .apply-form { display:flex; flex-direction:column; gap:14px; }
  .form-group label { display:block; font-size:12px; font-weight:500; color:var(--text-mid); margin-bottom:5px; }
  .form-group select, .form-group input, .form-group textarea {
    width:100%; padding:9px 12px; border:1px solid var(--border); border-radius:8px;
    font-size:13px; color:var(--text-dark); background:var(--cream);
    font-family: Arial, Helvetica, sans-serif; outline:none; transition:border-color 0.2s;
  }
  .form-group select:focus, .form-group input:focus, .form-group textarea:focus {
    border-color:var(--forest-light); background:var(--warm-white);
  }
  .form-group textarea { resize:vertical; min-height:70px; }
  .location-dropdown { position:relative; display:block; }
  .location-dropdown input { padding-right:36px; }
  .location-dropdown::after {
    content:'⌄'; position:absolute; right:12px; top:50%; transform:translateY(-55%);
    color:var(--text-muted); font-size:18px; line-height:1; pointer-events:none;
  }
  .profile-page .location-dropdown::after { display:none; }
  .profile-page .location-dropdown input { padding-right:12px; }
  .profile-address-fields {
    min-width: 0;
    margin: 8px 0 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
  }
  .profile-address-fields legend { padding: 0 6px; font-weight: 600; color: var(--forest); }
  .profile-address-fields > .form-hint { margin: 0 0 12px; line-height: 1.5; }
  .profile-photo-field { display:flex; align-items:center; gap:16px; padding:16px; margin-bottom:18px; border:1px solid var(--border); border-radius:10px; background:var(--warm-white); }
  .profile-photo-preview { width:76px; height:76px; flex:none; display:flex; align-items:center; justify-content:center; overflow:hidden; border-radius:50%; background:var(--forest-light); color:#fff; font-size:24px; font-weight:700; }
  .profile-photo-preview img { width:100%; height:100%; object-fit:cover; }
  .profile-photo-control { display:grid; min-width:0; gap:6px; }
  .profile-photo-control label { font-size:13px; font-weight:600; color:var(--text-dark); }
  .profile-photo-control input { max-width:100%; font-size:12px; }
  .profile-photo-save { justify-self:start; min-height:38px; padding:8px 14px; }
  @media (max-width: 480px) {
    .profile-photo-field { align-items:flex-start; flex-direction:column; }
  }
  .upload-area {
    border:1.5px dashed var(--border); border-radius:8px; padding:16px;
    text-align:center; cursor:pointer; transition:border-color 0.2s; background:var(--cream);
  }
  .upload-area:hover { border-color:var(--forest-light); }
  .upload-area svg { width:22px; height:22px; fill:none; stroke:var(--text-muted); stroke-width:1.5; margin:0 auto 6px; display:block; }
  .upload-area p { font-size:12px; color:var(--text-muted); }

  /* NOTIF LIST */
  .notif-item { display:flex; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); align-items:flex-start; }
  .notif-item:last-child { border-bottom:none; }
  .notif-dot-icon { width:8px; height:8px; border-radius:50%; background:var(--forest-light); margin-top:5px; flex-shrink:0; }
  .notif-text { font-size:12px; color:var(--text-mid); line-height:1.5; }
  .notif-time { font-size:11px; color:var(--text-muted); margin-top:2px; }

  /* PROGRESS TRACKER */
  .progress-track { display:flex; flex-direction:column; gap:0; }
  .progress-step { display:flex; gap:14px; align-items:flex-start; }
  .progress-line-wrap { display:flex; flex-direction:column; align-items:center; }
  .step-circle {
    width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center;
    flex-shrink:0; font-size:11px; font-weight:600;
  }
  .step-circle.done { background:var(--forest); color:#fff; }
  .step-circle.current { background:var(--gold-light); color:var(--text-dark); border:2px solid var(--gold); }
  .step-circle.pending { background:var(--cream-dark); color:var(--text-muted); }
  .step-vline { width:1.5px; background:var(--border); flex:1; min-height:24px; margin:3px 0; }
  .step-body { padding-bottom:20px; }
  .step-body .step-title { font-size:13px; font-weight:500; color:var(--text-dark); }
  .step-body .step-desc { font-size:11px; color:var(--text-muted); margin-top:2px; }

  @media (max-width: 900px) {
    .sidebar { width:min(240px, 86vw); transform:translateX(-100%); transition:transform 0.25s ease; }
    .sidebar.is-open { transform:translateX(0); }
    .main { margin-left:0; }
    .sidebar-toggle {
      display:inline-flex; position:fixed; top:14px; left:14px; width:42px; height:42px;
      align-items:center; justify-content:center; border:1px solid var(--border); border-radius:8px;
      background:var(--warm-white); color:var(--text-dark); cursor:pointer; z-index:110;
      box-shadow:0 2px 12px rgba(30,58,138,0.12);
    }
    .sidebar-toggle svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:2; }
    .sidebar-overlay { display:block; position:fixed; inset:0; background:rgba(15,23,42,0.42); opacity:0; pointer-events:none; transition:opacity 0.25s ease; z-index:90; }
    .sidebar-overlay.is-visible { opacity:1; pointer-events:auto; }
    .main { min-width:0; }
    .topbar { padding:16px 16px 16px 68px; }
    .content { padding:20px 16px 28px; }
    .welcome-banner { flex-direction:column; align-items:flex-start; gap:16px; padding:22px 22px 24px; }
    .client-id-badge { width:100%; text-align:left; }
    .metrics { grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns:1fr; }
    .card-header { flex-direction:column; align-items:flex-start; gap:10px; }
    .btn-sm, .btn-sm-primary { width:auto; }
    .req-table th, .req-table td { padding:10px 0; }
  }

  @media (max-width: 640px) {
    .topbar { height:auto; padding:14px 14px 16px 68px; }
    .topbar h1 { font-size:15px; }
    .topbar-right { flex-direction:column; align-items:flex-start; gap:8px; }
    .welcome-banner { padding:18px; }
    .welcome-banner h2 { font-size:20px; }
    .metrics { grid-template-columns:1fr; }
    .sidebar-user { flex-wrap:wrap; gap:10px; }
    .logout-link { margin-left:0; margin-top:8px; }
    .session-tag { display:block; }
    .card { border-radius:12px; }
    .card-header, .card-body { padding:16px; }
    .dash-grid, .dash-grid > * { min-width:0; }
    .card-header > div { width:100%; max-width:100%; }
    .card-header > div .btn-sm, .card-header > div .btn-sm-primary { flex:1 1 140px; text-align:center; }
    .apply-form { width:100%; }
    .apply-form .btn-sm, .apply-form .btn-sm-primary { width:100%; text-align:center; }
    .access-summary { flex-wrap:wrap; }
    .access-summary > div:nth-child(2) { min-width:0; flex:1 1 120px; }
    .access-summary .badge { margin-left:0 !important; }
    .req-table { width:100%; min-width:0; table-layout:fixed; }
    .req-table th, .req-table td { overflow-wrap:anywhere; word-break:break-word; }
    .form-group label, .form-group input, .form-group textarea, .form-group select { font-size:13px; }
  }

  @media (max-width: 480px) {
    .content { padding:14px 10px 24px; }
    .welcome-banner { padding:16px; border-radius:12px; }
    .welcome-banner h2 { font-size:18px; }
    .client-id-badge { padding:10px 12px; }
    .card-header, .card-body { padding:14px; }
    .form-row { display:flex; flex-direction:column; gap:0; }
    .form-row > * { min-width:0; width:100%; }
    .table-wrapper { overflow-x:auto; }
    .req-table { min-width:0; }
  }

  html, body { width: 100%; min-width: 0; overflow-x: hidden; }
  img, video, iframe, svg { max-width: 100%; }
  input, select, textarea, button { max-width: 100%; min-width: 0; }
  .main, .content, .card, .welcome-banner, .dash-grid, .form-group, .form-row { min-width: 0; max-width: 100%; }
  .welcome-banner h2, .welcome-banner p, .session-tag, .card-header h3, .alert { overflow-wrap: anywhere; }

  @media (max-width: 900px) {
    .sidebar-nav, .main, .topbar, .content { width: 100%; }
  }

  @media (max-width: 640px) {
    .topbar, .topbar-right, .card-header, .welcome-banner { align-items: stretch; }
    .topbar-right { width: 100%; }
    .session-tag { white-space: normal; }
    .form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
  }

  /* Dashboard motion */
  @keyframes dashboard-fade-up {
    from { opacity:0; transform:translateY(14px); }
    to { opacity:1; transform:translateY(0); }
  }
  @keyframes dashboard-fade-in {
    from { opacity:0; }
    to { opacity:1; }
  }
  .content > * {
    animation:dashboard-fade-up .55s cubic-bezier(.22,1,.36,1) both;
  }
  .content > *:nth-child(2) { animation-delay:.08s; }
  .content > *:nth-child(3) { animation-delay:.16s; }
  .content > *:nth-child(4) { animation-delay:.24s; }
  .welcome-banner {
    position:relative;
    overflow:hidden;
    box-shadow:0 14px 30px rgba(30,58,138,.14);
  }
  .welcome-banner::after {
    content:"";
    position:absolute;
    width:220px;
    height:220px;
    right:-70px;
    top:-125px;
    border:1px solid rgba(255,255,255,.14);
    border-radius:50%;
    box-shadow:0 0 0 22px rgba(255,255,255,.04), 0 0 0 44px rgba(255,255,255,.03);
    pointer-events:none;
    animation:dashboard-fade-in 1s ease .45s both;
  }
  .client-id-badge,
  .metric-card,
  .card {
    transition:transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  }
  .metric-card {
    animation:dashboard-fade-up .55s cubic-bezier(.22,1,.36,1) both;
  }
  .metric-card:nth-child(2) { animation-delay:.08s; }
  .metric-card:nth-child(3) { animation-delay:.16s; }
  .metric-card:nth-child(4) { animation-delay:.24s; }
  .metric-card:hover,
  .card:hover {
    transform:translateY(-4px);
    border-color:rgba(59,130,246,.3);
    box-shadow:0 14px 30px rgba(30,58,138,.12);
  }
  .client-id-badge:hover { transform:translateY(-2px); }
  .metric-card .m-value { transition:color .25s ease, transform .25s ease; }
  .metric-card:hover .m-value { color:var(--forest-mid); transform:scale(1.04); }
  .card-header h3 { transition:color .2s ease; }
  .card:hover .card-header h3 { color:var(--forest-mid); }
  .btn-sm, .btn-sm-primary, .notif-btn, .upload-area {
    transition:transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  }
  .btn-sm:hover, .btn-sm-primary:hover, .notif-btn:hover {
    transform:translateY(-2px);
    box-shadow:0 6px 14px rgba(30,58,138,.14);
  }
  .upload-area:hover {
    transform:scale(1.01);
    box-shadow:0 6px 16px rgba(30,58,138,.08);
  }
  .req-table tbody tr { transition:background-color .2s ease, transform .2s ease; }
  .req-table tbody tr:hover { background:rgba(219,234,254,.22); }
  .notif-dot { animation:dashboard-notification-pulse 2s ease-in-out infinite; }
  @keyframes dashboard-notification-pulse {
    0%, 100% { box-shadow:0 0 0 0 rgba(239,68,68,.35); }
    50% { box-shadow:0 0 0 5px rgba(239,68,68,0); }
  }
  @media (prefers-reduced-motion: reduce) {
    .content > *, .metric-card, .welcome-banner::after { animation:none; }
    .notif-dot { animation:none; }
    .client-id-badge, .metric-card, .card, .btn-sm, .btn-sm-primary, .notif-btn, .upload-area {
      transition:none;
    }
  }

  /* Dashboard visual system */
  body {
    background:
      radial-gradient(circle at 92% 0%, rgba(59,130,246,.1), transparent 28rem),
      linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  }
  .topbar {
    background:rgba(255,255,255,.84);
    backdrop-filter:blur(16px);
    border-bottom-color:rgba(148,163,184,.22);
  }
  .content { max-width:1600px; width:100%; padding:38px clamp(18px, 4vw, 56px) 56px; }
  .welcome-banner {
    background:
      radial-gradient(circle at 88% 20%, rgba(96,165,250,.35), transparent 18rem),
      linear-gradient(120deg, #172554 0%, #1e3a8a 52%, #2563b6 100%);
    border:1px solid rgba(255,255,255,.13);
    box-shadow:0 20px 42px rgba(30,58,138,.2);
  }
  .welcome-banner h2 { font-size:clamp(22px, 3vw, 30px); letter-spacing:-.035em; }
  .client-id-badge {
    background:rgba(255,255,255,.12);
    border-color:rgba(255,255,255,.24);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.13);
  }
  .metric-card {
    position:relative;
    overflow:hidden;
    min-height:124px;
    padding:20px;
    border-color:rgba(148,163,184,.24);
    border-radius:16px;
    background:linear-gradient(145deg, #fff, #f8fbff);
    box-shadow:0 12px 30px rgba(15,23,42,.055);
  }
  .metric-card::before {
    content:"";
    position:absolute;
    left:0;
    top:0;
    width:4px;
    height:100%;
    background:linear-gradient(#2563eb, #60a5fa);
  }
  .metric-card .m-value {
    font-size:32px;
    font-weight:700;
    letter-spacing:-.05em;
  }
  .card {
    border-color:rgba(148,163,184,.24);
    border-radius:16px;
    box-shadow:0 12px 30px rgba(15,23,42,.055);
  }
  .card-header { background:rgba(255,255,255,.58); }
  .card-header h3 { color:#1e3a8a; font-weight:650; }
  .btn-sm-primary {
    background:linear-gradient(110deg, #1e3a8a, #2563b6);
    box-shadow:0 6px 14px rgba(30,58,138,.18);
  }
  .apply-form .form-group select:focus,
  .apply-form .form-group textarea:focus {
    box-shadow:0 0 0 4px rgba(59,130,246,.12);
  }

  /* Keep the application form stable while a program-specific workflow is shown. */
  .apply-page .content {
    width:100%;
    max-width:1100px;
    margin:0 auto;
  }
  .apply-page .content > .panel-card {
    width:100%;
    min-width:0;
  }
  .apply-page form,
  .apply-page .form-group,
  .apply-page .form-group select {
    width:100%;
    min-width:0;
  }
  .apply-page .form-group select {
    display:block;
    min-height:50px;
    font-size:14px;
    line-height:1.35;
    padding-top:14px;
    padding-bottom:14px;
  }
  .apply-page form > .panel-card {
    width:100%;
    min-width:0;
  }
  .apply-page .process-grid {
    width:100%;
    min-width:0;
    grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  }
  .apply-page .process-card {
    min-width:0 !important;
    width:100%;
  }
  .apply-page .panel-card h1,
  .apply-page .panel-card h3,
  .apply-page .panel-copy {
    overflow-wrap:anywhere;
  }
/* Scroll-in reveal for citizen content cards. */
.scroll-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 450ms ease, transform 450ms ease;
  transition-delay: var(--reveal-delay, 0ms);
}

.scroll-reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .scroll-reveal,
  .scroll-reveal.is-revealed {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
