        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #f5f5f5;
            line-height: 1.4;
        }

        .container {
            max-width: 480px;
            margin: 0 auto;
            background: white;
            min-height: 100vh;
        }

        /* Begin: Login sections */
        :root{
            --gold:#f3c811; --gold-700:#e2b500;
            --teal:#0a7c7c; --blue:#003366;
            --ink:#222; --muted:#666; --border:#e7e9ee;
            --radius:14px;
            --grey:#e4e3e0;
        }
        .screen{
            min-height:100svh;            /* safe for mobile URL bar */
            display:flex; flex-direction:column; align-items:center;
            padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
        }
        .wrap {
            width:100%; max-width:440px; margin:auto;  /* center and cap width */
        }
        .wrap .logo{ display:grid; justify-items:center; gap:6px; margin:10vh 0 16px; }
        .wrap .logo img{ height:46px; width:auto }
        .wrap .powered{ font-size:12px; color:#7a7a7a }

        .wrap h1{ font-weight:800; font-size:20px; margin:6px 0 4px; text-align:center }
        .wrap p.sub{ color:#5c5c5c; text-align:center; margin:0 0 18px }
        .wrap p.sub2{ color:#5c5c5c; text-align:center; margin:0 0 18px; font-size:.9em }


        form#login-form { margin-top:20px}
        .wrap .fields{ display:grid; gap:12px }
        .wrap .field{ display:grid; gap:6px }
        .wrap .field label{ font-size:13px; color:#333 }
        .wrap .input{
            width:100%; padding:13px 14px; border:1px solid var(--border); border-radius:var(--radius);
            font-size:18px; background:#fff; transition:border .15s, box-shadow .15s;
        }
        .wrap .input:focus{ outline:none; border-color:#b9c4ff; box-shadow:0 0 0 3px rgba(95,130,255,.18) }

        .wrap .btn{
            display:inline-block; width:100%; padding:14px 16px; border-radius:12px; border:0;
            font-weight:700; font-size:16px; cursor:pointer; transition:filter .15s;
        }
        .wrap .btn-primary{ background:var(--gold); color:#111 }
        .wrap .btn-primary:hover{ filter:brightness(.98) }
        .wrap .btn.btn-primary.btn-upl:disabled{
            background: #6c757d;
            cursor: not-allowed;
        }
        .wrap .btn.btn-primary.btn-verf:disabled{
            background: #6c757d;
            cursor: not-allowed;
        }

        .wrap .links{ margin-top:8px; text-align:right; font-size:14px }
        .wrap .links a{ color:var(--teal); text-decoration:none }
        .wrap .links a:hover{ text-decoration:underline }


        /* 2FA */
        .wrap .otp-wrap{ display:grid; gap:14px }
        .wrap .otp{ display:flex; justify-content:center; gap:10px; margin:2px 0 4px }
        .wrap .otp input{
            width:42px; height:48px; text-align:center; font-size:22px; font-weight:700;
            border:1px solid var(--border); border-radius:10px; transition:border .15s, box-shadow .15s;
        }
        .wrap .otp input:focus{ outline:none; border-color:#b9c4ff; box-shadow:0 0 0 3px rgba(95,130,255,.18) }
        .wrap .dash{ width:16px; align-self:center; color:#999 }

        .wrap .options{ display:grid; gap:8px; justify-items:center; margin-top:6px; font-size:14px }
        .wrap .trust{ display:flex; align-items:center; gap:8px; color:#444 }
        .wrap .options a{ color:var(--teal); text-decoration:none }
        .wrap .options a:hover{ text-decoration:underline }


        .hidden{ display:none /*!important*/ }
        .wrap .error{ border-color:#e74c3c !important; box-shadow:0 0 0 3px rgba(231,76,60,.16) !important }
        /*  End: Login sections  */


        /* Header */
        .header {
            background: linear-gradient(135deg, #f3c811 0%, #e2b500 100%);
            color: #333;
            padding: 12px 16px;
            position: fixed;
            left: 0; right: 0;
            top: 0;
            z-index: 100;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
            max-width: 480px;
            margin: 0 auto;
        }
        .header-left {
            flex: 0 0 60px;
            display: flex;
            align-items: center;
        }

        .logo {
            font-size: 14px;
            font-weight: bold;
            color: #333;
        }

        .header-center {
            display: flex;
            flex-direction: column;
            align-items: center;
            flex: 1;
            margin: 0 8px;
        }

        .header h1 {
            font-size: 16px;
            font-weight: 600;
            margin: 0;
        }

        .user-info {
            font-size: 12px;
            opacity: 0.8;
            margin: 0;
        }

        .header-right {
            flex: 0 0 80px;
            display: flex;
            justify-content: flex-end;
        }


         /* START refresh button css */
        .refresh-btn {
            background: rgba(255,255,255,0.2);
            border: 1px solid rgba(255,255,255,0.3);
            border-radius: 6px;
            padding: 8px 10px;
            color: #333;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 4px;
            white-space: nowrap;
            min-width: 70px;
        }

        .refresh-btn:hover {
            background: rgba(255,255,255,0.3);
            border-color: rgba(255,255,255,0.5);
        }

        .refresh-btn.loading {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .refresh-btn.loading .refresh-icon {
            animation: spin 1s linear infinite;
        }

        .refresh-icon {
            font-size: 14px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Loading Overlay */
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.1);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .loading-spinner {
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            text-align: center;
        }

        .spinner {
            border: 3px solid #f3f3f3;
            border-top: 3px solid #f3c811;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 0 auto 10px;
        }

        .refreshing .referral-list {
            opacity: 0.6;
            transition: opacity 0.3s;
        }

        /* END refresh button css */

        /* Stats Bar */
        .stats-bar {
            background: white;
            padding: 12px 16px;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-around;
            position: fixed;
            top: 70px;
            left: 0;
            right: 0;
            z-index: 99;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        .referral-list {
            padding-top:140px;

        }

        .stat {
            text-align: center;
        }

        .stat-number {
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }

        .stat-label {
            font-size: 11px;
            color: #666;
            margin-top: 2px;
        }

        .urgent { color: #dc3545; }
        .semi-urgent { color: #fd7e14; }
        .non-urgent { color: #28a745; }

        /* List View */
        .list-view {
            padding: 0;
        }

        .referral-item {
            background: white;
            border-bottom: 1px solid #eee;
            padding: 16px;
            cursor: pointer;
            transition: background 0.2s;
            position: relative;
        }

        .referral-item:hover {
            background: #f8f9fa;
        }

        .admin-note-indicator {
            display:inline;
            margin-left:2px;
            font-size: 13px;
        }

        .referral-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 8px;
        }

        .patient-info {
            flex: 1;
        }

        .patient-name {
            position:relative;
            font-size: 16px;
            font-weight: 600;
            color: #333;
            margin-bottom: 4px;
        }

        .patient-details {
            font-size: 13px;
            color: #666;
        }

        .age-gender {
            margin-right: 12px;
        }

        .priority-badge {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 500;
            text-transform: uppercase;
        }

        .priority-gp-routine {
            background: #ffed9f;
            color: #64748b;
            border: 1px solid #e2e8f0;

        }

        .priority-gp-urgent {
            background: #fef2f2;
            color: #b91c1c;
            border: 1px solid #fecaca;
        }

        .priority-gp-semi-urgent {
            background: #fef3c7;
            color: #d97706;
            border: 1px solid #fde68a;
        }

        .referral-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 8px;
        }

        .time-info {
            font-size: 12px;
            color: #666;
        }

        .rid {
            font-size: 12px;
            color: #17a2b8;
            font-weight: 600;
        }

        /* Detail View */
        .detail-view {
            display: none;
            background: white;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 200;
            overflow-y: auto;
        }

        .detail-header {
            background: linear-gradient(135deg, #f3c811 0%, #e2b500 100%);
            color: #333;
            padding: 12px 16px;
            position: sticky;
            top: 0;
            z-index: 201;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .back-btn {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            padding: 4px;
            border-radius: 4px;
            transition: background 0.2s;
        }

        .back-btn:hover {
            background: rgba(0,0,0,0.1);
        }

        .detail-title {
            font-size: 16px;
            font-weight: 600;
        }

        .detail-content {
            padding: 0;
        }

        /* Patient Summary Card */
        .patient-summary {
            background: #f8f9fa;
            padding: 16px;
            border-bottom: 1px solid #eee;
        }

        .summary-row {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .summary-row:last-child {
            margin-bottom: 0;
        }

        .summary-label {
            font-size: 13px;
            color: #666;
            font-weight: 500;
        }

        .summary-value {
            font-size: 13px;
            color: #333;
            font-weight: 600;
        }

        /* PDF Preview */
        .pdf-section {
            padding: 16px;
            border-bottom: 1px solid #eee;
        }

        .section-title {
            font-size: 14px;
            font-weight: 600;
            color: #333;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .pdf-preview {
            background: #f8f9fa;
            border: 2px dashed #dee2e6;
            border-radius: 8px;
            padding: 24px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
        }

        .pdf-preview:hover {
            border-color: #f3c811;
            background: #fff8e1;
        }

        .pdf-icon {
            font-size: 32px;
            margin-bottom: 8px;
        }

        .pdf-text {
            font-size: 13px;
            color: #666;
        }

        /* Triage Actions */
        .triage-section {
            padding: 16px;
        }

        .urgency-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 16px;
        }

        .urgency-btn {
            padding: 16px 12px;
            border: 2px solid;
            border-radius: 8px;
            background: white;
            cursor: pointer;
            text-align: center;
            font-size: 13px;
            font-weight: 600;
            transition: all 0.2s;
            position: relative;
        }

        .urgency-btn.urgent {
            border-color: #dc3545;
            color: #dc3545;
        }

        .urgency-btn.urgent:hover,
        .urgency-btn.urgent.selected {
            background: #dc3545;
            color: white;
        }

        .urgency-btn.semi-urgent {
            border-color: #fd7e14;
            color: #fd7e14;
        }

        .urgency-btn.semi-urgent:hover,
        .urgency-btn.semi-urgent.selected {
            background: #fd7e14;
            color: white;
        }

        .urgency-btn.non-urgent {
            border-color: #28a745;
            color: #28a745;
        }

        .urgency-btn.non-urgent:hover,
        .urgency-btn.non-urgent.selected {
            background: #28a745;
            color: white;
        }

        .urgency-btn.reject {
            border-color: #6c757d;
            color: #6c757d;
        }

        .urgency-btn.reject:hover,
        .urgency-btn.reject.selected {
            background: #6c757d;
            color: white;
        }

        /* Additional Options */
        .additional-options {
            margin-top: 16px;
            padding-top: 16px;
            border-top: 1px solid #eee;
        }

        .option-btn {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid #dee2e6;
            border-radius: 6px;
            background: white;
            color: #495057;
            font-size: 14px;
            cursor: pointer;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .option-btn:hover {
            border-color: #f3c811;
            background: #fff8e1;
        }

        /* Admin Notes Section */
        .admin-notes-section {
            background: #e3f2fd;
            border-left: 4px solid #17a2b8;
            padding: 16px;
            margin-bottom: 16px;
        }

        .admin-note {
            background: white;
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        .admin-note:last-child {
            margin-bottom: 0;
        }

        .note-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }

        .note-author {
            font-size: 12px;
            font-weight: 600;
            color: #17a2b8;
        }

        .note-time {
            font-size: 11px;
            color: #666;
        }

        .note-content {
            font-size: 14px;
            color: #333;
            line-height: 1.4;
        }

        .note-priority {
            display: inline-block;
            background: #fff3cd;
            color: #856404;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 10px;
            font-weight: 600;
            margin-top: 4px;
        }

        .notes-textarea {
            width: 100%;
            min-height: 80px;
            padding: 12px;
            border: 1px solid #dee2e6;
            border-radius: 6px;
            font-size: 14px;
            font-family: inherit;
            resize: vertical;
        }

        .notes-textarea.error{border-color:#e74c3c !important; box-shadow:0 0 0 3px rgba(231,76,60,.16) !important}

        .notes-textarea:focus {
            outline: none;
            border-color: #f3c811;
            box-shadow: 0 0 0 2px rgba(243, 200, 17, 0.2);
        }

        /* Action Buttons */
        .action-buttons {
            padding: 16px;
            background: white;
            border-top: 1px solid #eee;
            position: sticky;
            bottom: 0;
            display: flex;
            gap: 12px;
        }

        .btn {
            flex: 1;
            padding: 14px 20px;
            border: none;
            border-radius: 6px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .btn-save {
            background: #28a745;
            color: white;
        }

        .btn-save:hover {
            background: #218838;
        }

        .btn-save:disabled {
            background: #6c757d;
            cursor: not-allowed;
        }

        .btn-cancel {
            background: #6c757d;
            color: white;
        }

        .btn-cancel:hover {
            background: #5a6268;
        }

        /* Animation */
        .slide-in {
            animation: slideIn 0.3s ease-out;
        }

        @keyframes slideIn {
            from {
                transform: translateX(100%);
            }
            to {
                transform: translateX(0);
            }
        }

        /* Responsive adjustments */
        @media (max-width: 360px) {
            .urgency-grid {
                grid-template-columns: 1fr;
            }

            .action-buttons {
                flex-direction: column;
            }
        }



        /* User menu */
        .user-menu { position: relative; margin-top: 4px; }
        .user-menu-btn {
            display: inline-flex; align-items: center; gap: 6px;
            background: rgba(255,255,255,0.22); border: 1px solid rgba(255,255,255,0.35);
            color: #333; padding: 8px 10px; border-radius: 6px; font-size: 12px;
        }
        .user-menu-btn:focus { outline: 2px solid #333; outline-offset: 2px; }
        .user-avatar {
            width: 20px; height: 20px; border-radius: 50%;
            background: #fff; color: #333; display: inline-flex; align-items: center; justify-content: center;
            font-weight: 700; font-size: 11px;
        }
        .user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .user-caret { font-size: 10px; transform: translateY(1px); }

        .menu-list {
            position: absolute; top: calc(100% + 6px); right: 0;
            background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.12); padding: 6px; list-style: none;
            min-width: 180px; display: none; z-index: 2000;
        }
        .menu-list.open { display: block; }
        .menu-item {
            display: block; width: 100%; text-align: left;
            padding: 10px 12px; border-radius: 8px; font-size: 14px; color: #111; text-decoration: none; background: none; border: none;
        }
        .menu-item:hover, .menu-item:focus { background: #f5f5f5; outline: none; }
        .menu-item-danger { color: #c1121f; font-weight: 600; }
        .menu-item-danger:hover { background: #fef2f2; }
        li.user-title-label { padding:5px 10px; text-transform: uppercase;
            color: #888;
            padding: 8px 12px;
            border-bottom: 1px solid #eee;cursor: default;       /* makes it clear it's not clickable */
            user-select: none;}

        .page-title {
            background: #fff;
            padding: 14px 16px;
            font-size: 16px;
            font-weight: 600;
            color: #333;
            border-bottom: 1px solid #eee;
            position: sticky;
            top: 56px; /* height of header */
            z-index: 98;
        }










div.dv_obj_cnt_outer{
    position:fixed;
    width:100%;
    height:100%;
    top:0;
    left:0;
    z-index:999999;
    background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(11,11,11,0.1)), to(rgba(11,11,11,0.6))) repeat-x rgba(11,11,11,0.2);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}


body.overlay-active {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}
/* Navigation Buttons */
.pdf-nav-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
  touch-action: manipulation;
}

.pdf-nav-button.visible {
  opacity: 1;
  visibility: visible;
}

.pdf-nav-button:active {
  transform: translateY(-50%) scale(0.95);
  background: rgba(0, 0, 0, 0.9);
}

.pdf-nav-button.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pdf-prev-button {
  left: 20px;
}

.pdf-next-button {
  right: 20px;
}

/* Page Indicator */
.pdf-page-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
}

.pdf-page-indicator.visible {
  opacity: 1;
  visibility: visible;
}

.pdf-page-indicator .separator {
  margin: 0 8px;
  opacity: 0.7;
}

/* Touch Feedback */
.pdf-touch-feedback {
  position: absolute;
  pointer-events: none;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pdf-touch-feedback.show {
  opacity: 1;
}

.pdf-touch-feedback.swipe-left {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.pdf-touch-feedback.swipe-right {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.pdf-touch-feedback.tap-next {
  transform: translate(-50%, -50%);
}

.pdf-touch-feedback.tap-previous {
  transform: translate(-50%, -50%);
}

.pdf-touch-feedback.success {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.swipe-icon, .tap-icon, .success-icon {
  font-size: 24px;
  color: white;
  background: rgba(0, 0, 0, 0.7);
  padding: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
}

.swipe-text {
  color: white;
  font-size: 12px;
  text-align: center;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: 4px;
}

.success-icon {
  background: rgba(76, 175, 80, 0.9);
}

/* Loading State */
.pdf-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 16px;
  text-align: center;
}

.pdf-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .pdf-nav-button {
    width: 44px;
    height: 44px;
  }

  .pdf-prev-button {
    left: 10px;
  }

  .pdf-next-button {
    right: 10px;
  }

  .pdf-page-indicator {
    bottom: 10px;
    font-size: 12px;
    padding: 6px 12px;
  }

  .mobile-pdf-container {
    padding: 10px;
  }
}

/* Accessibility */
.pdf-nav-button:focus {
  outline: 2px solid #4299e1;
  outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .mobile-pdf-container {
    background: #1a202c;
  }
}
/***  End: pdf navigation styles  ***/




