  :root {
    --navy: #001598;
    --navy-dark: #000b5e;
    --sky: #afcee9;
    --sky-light: #eaf3fb;
    --gold: #afcee9;
    --bg: #f4f7fb;
    --card: #ffffff;
    --border: #dfe7f3;
    --text: #101a3d;
    --muted: #555f7a;
    --green: #1c8a54;
    --red: #c0392b;
    --amber: #b9832e;
    --radius: 10px;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
  }
  .hidden { display: none !important; }

  /* ---------- Motion (subtle, professional) ---------- */
  @keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  main.animate-in { animation: fadeSlideIn 0.25s ease-out; }
  main .card { animation: fadeSlideIn 0.3s ease-out backwards; }
  .announcement-card { animation: fadeSlideIn 0.3s ease-out backwards; }
  .pill { transition: background-color 0.25s ease, color 0.25s ease; }
  .chip { transition: transform 0.12s ease; }
  .chip:hover { transform: translateY(-1px); }
  .pc-card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
  .pc-card:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.08); }
  .card table tbody tr { transition: background-color 0.12s ease; }
  @media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  }

  /* ---------- Login ---------- */
  #forcePasswordScreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
    padding: 24px;
  }
  #kioskScreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
    padding: 24px;
  }
  #loginScreen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
    padding: 32px;
  }
  .login-shell {
    display: flex;
    width: 100%;
    max-width: 960px;
    min-height: 540px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  }
  .login-panel-left {
    flex: 0 0 460px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 36px;
    background: #fff;
    position: relative;
  }
  .login-panel-left::after {
    content: '';
    position: absolute; top: 0; bottom: 0; right: 0; width: 5px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--navy) 55%, var(--gold) 100%);
  }
  .login-panel-right {
    flex: 1;
    background-image: url('bacomm-tatak.jpg');
    background-size: cover;
    background-position: center 46%;
  }
  .login-card {
    background: var(--card);
    border-radius: 14px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  }
  .login-panel-left .login-card { box-shadow: none; padding: 0; max-width: 360px; }
  .login-title {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.55;
    letter-spacing: .15px;
    margin: 0 0 6px;
  }
  .login-logo { display: block; width: 64px; height: 64px; margin: 0 auto 16px; }
  .login-title, .login-sub { text-align: center; }
  .login-nexus-logo { display: block; height: 22px; width: auto; margin: 0 auto 26px; }
  .login-sub {
    font-size: 12.5px;
    letter-spacing: .6px;
    color: var(--muted);
    margin: 0 0 26px;
  }
  .tab-switch {
    display: flex;
    background: #eef1f6;
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 22px;
  }
  .tab-switch button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--muted);
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s;
  }
  @media (max-width: 640px) {
    .tab-switch button { font-size: 11.5px; padding: 9px 6px; }
  }
  .eq-item-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: #fafbfe; }
  .eq-item-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .eq-item-num { font-size: 11px; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }
  .eq-item-remove { background: transparent; border: none; color: var(--red); font-size: 11.5px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
  .eq-item-remove:hover { text-decoration: underline; }
  .tab-switch button.active {
    background: var(--navy);
    color: #fff;
  }
  label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .3px;
    color: var(--muted);
    margin: 16px 0 7px;
  }
  input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  textarea { resize: vertical; line-height: 1.5; }
  input:focus, select:focus, textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0,21,152,0.10); }
  input[readonly] { background: #f0f2f6; color: var(--muted); cursor: not-allowed; }
  .pw-wrap { position: relative; }
  .pw-wrap input[type="password"], .pw-wrap input[type="text"] { padding-right: 40px; }
  .pw-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; cursor: pointer; padding: 4px;
    display: flex; align-items: center; justify-content: center; color: var(--muted);
  }
  .pw-toggle:hover { color: var(--navy); }
  .btn {
    width: 100%;
    margin-top: 22px;
    padding: 11px 0;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  }
  .btn:hover:not(:disabled) { background: var(--navy-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,21,152,0.18); }
  .btn:active:not(:disabled) { transform: translateY(0) scale(0.97); box-shadow: none; }
  .btn:disabled { cursor: not-allowed; opacity: 0.6; }
  .btn.small { width: auto; margin-top: 0; padding: 7px 14px; font-size: 12.5px; }
  .btn.outline { background: transparent; color: var(--navy); border: 1px solid var(--navy); }
  .btn.outline:hover:not(:disabled) { background: var(--sky-light); box-shadow: none; }
  .error-msg { color: var(--red); font-size: 12.5px; margin-top: 10px; min-height: 16px; }

  /* ---------- App shell ---------- */
  #appScreen { display: flex; min-height: 100vh; }
  .sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.4;
    padding: 0 6px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
  }
  .brand-seal { width: 34px; height: 34px; flex-shrink: 0; }
  .brand-nexus { height: 16px; width: auto; }
  .nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 3px;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  }
  .nav-btn.active, .nav-btn:hover { background: var(--sky-light); color: var(--navy); }
  .nav-btn:hover { transform: translateX(3px); }
  .nav-btn.nav-sub { padding-left: 26px; font-size: 13px; }
  .nav-group { margin-bottom: 3px; }
  .nav-group-header {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    text-align: left; background: transparent; border: none; padding: 10px 12px;
    border-radius: 8px; font-weight: 700; color: var(--muted);
    cursor: pointer; text-transform: uppercase; letter-spacing: 0.4px; font-size: 11.5px;
    transition: background-color 0.15s ease, color 0.15s ease;
  }
  .nav-group-header:hover { background: var(--sky-light); color: var(--navy); }
  .nav-group-chevron { transition: transform 0.2s ease; font-size: 10px; }
  .nav-group.open > .nav-group-header .nav-group-chevron { transform: rotate(180deg); }
  .nav-group.open > .nav-group-header { color: var(--navy); }
  .nav-group-items {
    max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
  }
  .nav-group.open > .nav-group-items { max-height: 400px; }
  .sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
  .who { font-size: 12px; color: var(--muted); padding: 0 6px 8px; }

  main { flex: 1; min-width: 0; padding: 28px 34px; max-width: 100%; width: 100%; box-sizing: border-box; }
  .card table { width: 100%; }
  h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.3px; margin: 0 0 5px; color: var(--navy); }
  .page-sub { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 24px; }
  .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(16,26,61,0.04), 0 4px 14px rgba(16,26,61,0.06);
  }
  .card h2 { font-size: 16px; font-weight: 700; margin: 0 0 16px; color: var(--navy); letter-spacing: -0.1px; }
  .dashboard-grid { display: grid; grid-template-columns: 3fr 1fr; gap: 20px; align-items: start; }
  .dashboard-side .card { position: sticky; top: 20px; }
  .quick-link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px;
    text-decoration: none; color: var(--text); font-weight: 600; font-size: 13.5px;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  }
  .quick-link:last-child { margin-bottom: 0; }
  .quick-link:hover { background: var(--sky-light); border-color: var(--sky); transform: translateX(2px); }
  .quick-link-arrow { color: var(--navy); font-size: 15px; }
  @media (max-width: 860px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-side .card { position: static; }
  }
  .target-picker-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--sky-light); margin-top: 4px; }
  .target-picker-box > label { display: block; font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
  .chip-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
  .chip {
    display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--sky);
    border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 12px; font-weight: 600; color: var(--navy);
  }
  .chip button {
    border: none; background: var(--sky-light); color: var(--navy); border-radius: 50%; width: 18px; height: 18px;
    font-size: 13px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
  }
  .chip button:hover { background: var(--red); color: #fff; }
  .target-picker-list {
    max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 12px; background: #fff;
  }
  .pc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .pc-card {
    border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center;
  }
  .pc-card.available { background: #e5f6ec; border-color: #bfe3cc; }
  .pc-card.occupied { background: #fdeeee; border-color: #f0c6c6; }
  .pc-name { font-weight: 700; color: var(--navy); font-size: 13.5px; margin-bottom: 6px; }
  .pc-status { font-weight: 600; font-size: 13px; }
  .pc-card.available .pc-status { color: var(--green); }
  .pc-card.occupied .pc-status { color: var(--red); }
  .pc-meta { font-size: 10.5px; color: var(--muted); margin: 2px 0 8px; }
  .pc-card .btn { width: 100%; margin-top: 8px; }
  @media (max-width: 640px) {
    .pc-grid { grid-template-columns: repeat(2, 1fr); }
  }
  .announcement-card {
    border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; background: #fff;
  }
  .announcement-card.pinned { border-color: #e8b93a; background: #fffaf0; }
  .announcement-card:last-child { margin-bottom: 0; }
  .announcement-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .announcement-title { font-weight: 700; color: var(--navy); font-size: 14px; }
  .announcement-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
  .announcement-body { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
  table { width: 100%; border-collapse: collapse; font-size: 14px; }
  th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); }
  th { color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; }
  .pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
  .pill.paid, .pill.cleared { background: #e5f6ec; color: var(--green); }
  .pill.unpaid, .pill.not-cleared { background: #fbe9e7; color: var(--red); }
  .pill.partial { background: #fbf1e0; color: var(--amber); }
  .pay-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
  .pay-stat { flex: 1 1 130px; background: var(--sky-light); border-radius: 10px; padding: 12px 16px; }
  .pay-stat .num { font-size: 20px; font-weight: 700; color: var(--navy); line-height: 1.2; }
  .pay-stat .lbl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; margin-top: 2px; }
  .pay-table tbody tr { transition: background .15s ease; }
  .pay-table tbody tr:hover { background: var(--sky-light); }
  .pay-row-paid td:first-child { box-shadow: inset 3px 0 0 var(--green); }
  .pay-row-unpaid td:first-child { box-shadow: inset 3px 0 0 var(--red); }
  .method-select { width: auto; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 16px; background: #fff; }
  /* Only rendered when actually printing (Save as PDF in the print dialog) —
     hidden the rest of the time. This uses the browser's own print rendering,
     which reliably reflects real content — unlike the html2canvas-based
     auto-download approach tried earlier, which produced blank PDFs. */
  #printArea { display: none; }
  @media print {
    body * { visibility: hidden; }
    #printArea, #printArea * { visibility: visible; }
    #printArea { display: block; position: absolute; top: 0; left: 0; width: 100%; }
  }
  .survey-wrap { max-width: 720px; margin: 0 auto; }
  .sq-drag-handle { cursor: grab; color: var(--muted); text-align: center; font-size: 16px; user-select: none; }
  .sq-drag-handle:active { cursor: grabbing; }
  tr[draggable="true"] { transition: background .15s ease; }
  tr[draggable="true"]:hover { background: var(--sky-light); }
  .survey-card { animation: surveyCardIn .35s ease both; }
  .survey-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .survey-section-title { font-size: 16px; font-weight: 700; color: var(--navy); margin: 0 0 18px; padding-bottom: 10px; border-bottom: 2px solid var(--sky-light); }
  .survey-progress-wrap { position: relative; }
  .survey-dots { display: flex; justify-content: space-between; margin-top: 6px; padding: 0 1px; }
  .survey-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--border); transition: all .25s ease; }
  .survey-dot.done { background: var(--green); }
  .survey-dot.active { background: var(--navy); transform: scale(1.5); }
  .survey-question { padding: 16px 0; border-bottom: 1px solid var(--border); animation: surveyQIn .3s ease both; }
  .survey-question:last-child { border-bottom: none; }
  .survey-question-text { font-size: 13.5px; font-weight: 600; margin: 0 0 12px; line-height: 1.4; }
  .survey-scale { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .survey-scale-label { font-size: 10.5px; color: var(--muted); max-width: 92px; line-height: 1.3; }
  .survey-scale-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; transition: transform .15s ease, color .15s ease; }
  .survey-scale-opt:hover { transform: scale(1.15); color: var(--navy); }
  .survey-scale-opt input { cursor: pointer; width: 17px; height: 17px; accent-color: var(--navy); }
  .survey-scale-opt input:checked + span { color: var(--navy); }
  .survey-page-body { animation: surveyPageIn .3s ease both; }
  @keyframes surveyPageIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
  @keyframes surveyQIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes surveyCardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
  .survey-intro-text { font-size: 13px; line-height: 1.6; color: var(--text); margin: 0 0 12px; }
  .survey-legend { background: var(--sky-light); border-radius: 10px; padding: 14px 16px; margin: 8px 0 20px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text); }
  .survey-privacy { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 4px; }
  .survey-consent { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text); }
  .survey-consent input { width: 17px; height: 17px; margin-top: 1px; cursor: pointer; accent-color: var(--navy); flex-shrink: 0; }
  .inline-form { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; align-items: flex-end; margin-bottom: 16px; padding-bottom: 4px; }
  .inline-form .field { display: flex; flex-direction: column; flex: 1 1 180px; min-width: 150px; }
  .inline-form label { margin: 0 0 4px; white-space: nowrap; }
  .inline-form input, .inline-form select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 16px; width: 100%; box-sizing: border-box; }
  .inline-form button { flex: 0 0 auto; white-space: nowrap; }

  /* ---------- Incident Report form ---------- */
  #incidentReportModal select,
  #incidentReportModal textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 16px; font-family: inherit; background: #fff; outline: none; box-sizing: border-box;
  }
  #incidentReportModal select:focus,
  #incidentReportModal textarea:focus { border-color: var(--navy); }
  #incidentReportModal textarea { resize: vertical; }
  .ir-section-title {
    font-size: 13px; font-weight: 700; color: var(--navy);
    margin: 26px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--sky-light);
  }
  .ir-section-title:first-of-type { margin-top: 0; }
  .ir-hint { font-weight: 400; color: var(--muted); font-size: 12px; }
  .ir-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .ir-grid .field { margin-bottom: 14px; }
  .ir-grid .field.full { grid-column: 1 / -1; }
  .ir-sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .ir-sig-grid .full { grid-column: 1 / -1; }
  .ir-sig { background: var(--sky-light); border-radius: 10px; padding: 12px 14px 10px; }
  .ir-sig label { margin: 0 0 8px; font-size: 11.5px; color: var(--navy); font-weight: 700; letter-spacing: 0; }
  .ir-sig input {
    width: 100%; border: none; border-bottom: 1.5px solid var(--sky); background: transparent;
    padding: 4px 2px 7px; font-size: 16px; font-style: italic; color: var(--text); outline: none; box-sizing: border-box;
  }
  .ir-sig input:focus { border-bottom-color: var(--navy); }
  @media (max-width: 480px) {
    .ir-grid, .ir-sig-grid { grid-template-columns: 1fr; }
  }
  a.res-link { color: var(--navy); font-weight: 600; text-decoration: none; }
  a.res-link:hover { text-decoration: underline; }
  .dropzone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 14px;
  }
  .dropzone:hover, .dropzone.drag-over { border-color: var(--navy); background: #f7f9fd; }
  .upload-status { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
  .upload-status.ok { color: var(--green); }
  .upload-status.err { color: var(--red); }
  .pagination { display: flex; gap: 6px; align-items: center; margin-top: 12px; font-size: 12.5px; }
  .pagination button { padding: 5px 12px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
  .pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
  .pagination span { color: var(--muted); }
  .stepper { display: flex; align-items: flex-start; overflow-x: auto; padding: 20px 4px 8px; gap: 0; }
  .step { display: flex; flex-direction: column; align-items: center; min-width: 110px; flex-shrink: 0; cursor: pointer; animation: fadeSlideIn 0.35s ease-out backwards; }
  .step-circle {
    width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: #fff; background: var(--border); flex-shrink: 0;
    transition: transform .18s ease, box-shadow .18s ease;
    animation: stepPop .45s cubic-bezier(.34,1.56,.64,1) both;
  }
  .step:hover .step-circle { transform: scale(1.12); box-shadow: 0 6px 16px rgba(0,21,152,0.25); }
  .step-circle.cleared { background: var(--green); animation: stepPop .45s cubic-bezier(.34,1.56,.64,1) both, checkGlow 1.4s ease-out .45s; }
  .step-circle.not-cleared { background: #cfd6e4; color: var(--muted); position: relative; }
  .step-circle.not-cleared::after {
    content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #cfd6e4;
    animation: stepPulse 2.2s ease-out infinite;
  }
  .step-line {
    flex: 1; height: 3px; background: var(--border); margin-top: 26px; min-width: 24px;
    position: relative; overflow: hidden;
  }
  .step-line.cleared::after {
    content: ''; position: absolute; inset: 0; background: var(--green);
    animation: lineFill .5s ease-out .3s both;
  }
  .step-label { font-size: 11.5px; font-weight: 600; text-align: center; margin-top: 8px; max-width: 110px; line-height: 1.3; }
  .step-meta { font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 3px; max-width: 110px; }
  .step-row { display: flex; align-items: center; width: 100%; }
  .step-detail {
    max-height: 0; overflow: hidden; opacity: 0; transition: max-height .25s ease, opacity .2s ease, margin-top .25s ease;
    font-size: 11.5px; background: var(--sky-light); border-radius: 8px; padding: 0 10px; margin-top: 0; text-align: left;
  }
  .step-detail.open { max-height: 120px; opacity: 1; padding: 8px 10px; margin-top: 8px; }
  .clearance-progress-track { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-top: 6px; }
  .clearance-progress-fill { height: 100%; background: var(--green); border-radius: 999px; width: 0; transition: width 1s cubic-bezier(.22,1,.36,1); }
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(16,26,61,0.55); display: flex; align-items: center; justify-content: center;
    padding: 24px; z-index: 200;
  }
  .modal-card {
    background: var(--card); border-radius: 14px; width: 100%; max-width: 720px; max-height: 85vh; overflow-y: auto;
    padding: 24px 26px; box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  }
  .modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
  .modal-header h2 { margin: 0; }
  @keyframes stepPop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  @keyframes checkGlow { 0% { box-shadow: 0 0 0 0 rgba(28,138,84,0.5); } 100% { box-shadow: 0 0 0 14px rgba(28,138,84,0); } }
  @keyframes stepPulse { 0% { opacity: .6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25); } }
  @keyframes lineFill { from { transform: translateX(-100%); } to { transform: translateX(0); } }

  /* ---------- Mobile: hamburger topbar (hidden on desktop) ---------- */
  .mobile-topbar { display: none; }
  .sidebar-backdrop { display: none; }

  /* ---------- Responsive ---------- */
  @media (max-width: 860px) {
    #appScreen { position: relative; }
    .mobile-topbar {
      display: flex; align-items: center; gap: 12px;
      position: sticky; top: 0; z-index: 60;
      background: #fff; border-bottom: 1px solid var(--border);
      padding: 12px 16px;
    }
    .mobile-topbar-brand { display: flex; align-items: center; gap: 8px; }
    .mobile-topbar-brand .brand-seal { width: 26px; height: 26px; }
    .mobile-topbar-brand .brand-nexus { height: 14px; width: auto; }
    .hamburger-btn {
      background: transparent; border: none; padding: 6px; cursor: pointer;
      display: flex; flex-direction: column; justify-content: center; gap: 4px; width: 32px; height: 32px;
    }
    .hamburger-btn span { display: block; height: 2px; width: 100%; background: var(--navy); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }

    #appScreen { flex-direction: column; }
    .sidebar {
      position: fixed; top: 0; left: 0; height: 100vh; width: 250px; max-width: 82vw;
      transform: translateX(-100%); transition: transform .25s ease; z-index: 100;
      box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    }
    .sidebar .brand { display: none; } /* shown instead in the mobile topbar */
    .mobile-nav-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop {
      display: block; position: fixed; inset: 0; background: rgba(16,26,61,0.45);
      opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 90;
    }
    .mobile-nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

    main { padding: 16px; }
    h1 { font-size: 18px; }
    .card { padding: 16px; }

    /* Stack filter/form rows instead of horizontal-scrolling them */
    .inline-form { flex-direction: column; align-items: stretch; overflow-x: visible; gap: 12px; }
    .inline-form .field { flex: 1 1 auto; width: 100%; }
    .inline-form button { width: 100%; }

    /* Contain wide tables with horizontal scroll instead of breaking the layout */
    .card table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    /* Long-text tables (e.g. survey question manager) should wrap instead of truncating off-screen */
    .card table.wrap-table { display: table; overflow-x: visible; white-space: normal; }
    .card table.wrap-table tbody, .card table.wrap-table thead, .card table.wrap-table tr { display: table-row-group; }
    .card table.wrap-table thead { display: table-header-group; }
    .card table.wrap-table tr { display: table-row; }
    .card table.wrap-table th, .card table.wrap-table td { display: table-cell; white-space: normal; word-break: break-word; }

    .modal-overlay { padding: 12px; }
    .modal-card { padding: 18px 16px; max-height: 90vh; }
    .modal-header h2 { font-size: 15px; }

    .login-card { padding: 28px 22px; }
    #loginScreen {
      padding: 16px;
      align-items: flex-start;
      overflow-y: auto;
      min-height: 100dvh; /* shrinks with the on-screen keyboard where supported; falls back to the 100vh set above where not */
    }
    .login-shell { box-shadow: 0 20px 50px rgba(0,0,0,0.25); border-radius: 16px; min-height: 0; margin-top: 24px; }
    .login-panel-right { display: none; }
    .login-panel-left { flex: 1 1 auto; padding: 28px 22px; }
    .login-panel-left::after { display: none; }
    .login-panel-left .login-card { max-width: 380px; }

    .pay-stats, .survey-legend { font-size: 12px; }
    .survey-scale-label { max-width: 76px; font-size: 10px; }
    .survey-scale-opt { font-size: 11px; }
  }

  @media (max-width: 480px) {
    main { padding: 12px; }
    .card { padding: 14px; }
    .btn.small { padding: 9px 12px; font-size: 12.5px; }
    /* Vertical stepper instead of a horizontal scroll strip — fits the screen without scrolling sideways */
    .stepper { flex-direction: column; overflow-x: visible; align-items: stretch; gap: 0; padding: 12px 4px; }
    .step-row { flex-direction: column; align-items: stretch; width: 100%; }
    .step {
      display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto auto;
      align-items: start; column-gap: 12px; row-gap: 2px; min-width: 0; width: 100%; padding: 8px 0;
    }
    .step-circle { grid-column: 1; grid-row: 1 / span 3; width: 40px; height: 40px; font-size: 15px; align-self: start; }
    .step-label { grid-column: 2; grid-row: 1; max-width: none; text-align: left; margin-top: 0; }
    .step-meta { grid-column: 2; grid-row: 2; max-width: none; text-align: left; margin-top: 0; }
    .step-detail { grid-column: 2; grid-row: 3; }
    .step-line { display: none; }
  }
