* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #eff6ff; color: #1e293b; }

/* ══════════════════════
   LANGUAGE TOGGLE
══════════════════════ */
.lang-toggle-top { display: flex; gap: 4px; }
.lang-btn { padding: 5px 12px; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; color: #64748b; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.lang-btn.active { background: #1e40af; color: #fff; border-color: #1e40af; }

/* ══════════════════════
   LOGIN PAGE
══════════════════════ */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #eff6ff; padding: 24px; position: relative; }
.login-wrap .lang-toggle-top { position: absolute; top: 20px; right: 24px; }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(30,64,175,0.08); }
.login-logo { width: 52px; height: 52px; background: #1e40af; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #fff; margin: 0 auto 8px; }
.login-brand { text-align: center; font-size: 13px; font-weight: 700; color: #1e40af; letter-spacing: 1px; margin-bottom: 4px; }
.login-title { text-align: center; font-size: 20px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.login-sub { text-align: center; font-size: 13px; color: #64748b; margin-bottom: 28px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; margin-top: 16px; }
.login-card input,
.login-card select { width: 100%; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; color: #1e293b; background: #fff; outline: none; transition: border-color 0.15s; }
.login-card input:focus,
.login-card select:focus { border-color: #1e40af; box-shadow: 0 0 0 3px rgba(30,64,175,0.1); }
.login-btn { width: 100%; padding: 12px; background: #1e40af; color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 20px; transition: background 0.15s; }
.login-btn:hover { background: #1d4ed8; }
.login-btn:disabled { background: #94a3b8; cursor: not-allowed; }
.auth-warning { margin-top: 14px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #dc2626; text-align: center; }
.error-msg { font-size: 13px; color: #dc2626; text-align: center; margin-top: 8px; min-height: 18px; }
.login-footer { margin-top: 24px; font-size: 12px; color: #94a3b8; text-align: center; }

/* ══════════════════════
   APP SHELL
══════════════════════ */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* TOPBAR */
.topbar { height: 56px; background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.tb-logo { width: 32px; height: 32px; background: #1e40af; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; color: #fff; }
.tb-name { font-size: 14px; font-weight: 700; color: #0f172a; }
.tb-sub { font-size: 11px; color: #94a3b8; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.hamburger-btn { display: none; background: none; border: none; font-size: 20px; color: #1e293b; cursor: pointer; padding: 4px 8px; margin-right: 4px; }
.tb-account { position: relative; }
.tb-av { width: 34px; height: 34px; border-radius: 50%; background: #1e40af; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; border: none; cursor: pointer; }
.tb-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
  padding: 14px;
  min-width: 190px;
  z-index: 100;
}
.tb-dropdown.open { display: block; }
.tb-dropdown-name { font-size: 14px; font-weight: 700; color: #0f172a; }
.tb-dropdown-org { font-size: 12px; font-weight: 600; color: #475569; margin-top: 2px; }
.tb-dropdown-role { font-size: 12px; color: #94a3b8; margin-bottom: 12px; }
.tb-dropdown .signout-btn { width: 100%; justify-content: center; }
.signout-btn { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #dc2626; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.signout-btn:hover { background: #fef2f2; border-color: #fca5a5; }

/* APP BODY */
.app-body { display: flex; flex: 1; overflow: hidden; }

/* SIDEBAR */
.sidebar { width: 220px; min-width: 220px; background: #fff; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; padding: 20px 12px; overflow-y: auto; }
.sidebar-backdrop { display: none; }
.sb-section-label { font-size: 10px; font-weight: 700; color: #94a3b8; letter-spacing: 0.1em; text-transform: uppercase; padding: 0 8px; margin-bottom: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: 13px; font-weight: 500; color: #64748b; cursor: pointer; transition: all 0.12s; margin-bottom: 2px; }
.nav-item:hover { background: #eff6ff; color: #1e40af; }
.nav-item.active { background: #eff6ff; color: #1e40af; font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
#settingsToggle { justify-content: space-between; }
.sb-chevron { font-size: 11px; color: #94a3b8; margin-left: auto; }
.sb-settings-panel { padding: 4px 8px 4px; }
.sb-setting-label { font-size: 11px; color: #94a3b8; margin-bottom: 8px; }
.sb-setting { display: flex; gap: 8px; margin-bottom: 20px; }
.sb-setting-option { flex: 1; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #64748b; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.sb-setting-option.active { background: #1e40af; color: #fff; border-color: #1e40af; }
.sb-setting-option:hover:not(.active) { background: #eff6ff; color: #1e40af; }
.sb-secure { margin-top: auto; padding: 12px; background: #f0fdf4; border-radius: 10px; border: 1px solid #bbf7d0; display: flex; gap: 8px; align-items: flex-start; }
.sb-secure-icon { width: 20px; height: 20px; background: #059669; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; flex-shrink: 0; margin-top: 2px; }
.sb-secure-title { font-size: 12px; font-weight: 600; color: #065f46; margin-bottom: 3px; }
.sb-secure-sub { font-size: 10px; color: #64748b; line-height: 1.4; }

/* CONTENT */
.content { flex: 1; overflow-y: auto; padding: 28px; background: #f8fafc; }
.page-title { font-size: 24px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.page-sub { font-size: 14px; color: #64748b; margin-bottom: 24px; }

/* STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; position: relative; }
.stat-card .trend { position: absolute; top: 16px; right: 16px; font-size: 11px; font-weight: 600; color: #059669; background: #f0fdf4; padding: 2px 8px; border-radius: 99px; }
.stat-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.si-blue { background: #dbeafe; }
.si-green { background: #d1fae5; }
.si-amber { background: #fef3c7; }
.si-red { background: #fee2e2; }
.stat-value { font-size: 32px; font-weight: 700; color: #0f172a; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: #64748b; }

/* TABLE CARD */
.table-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; overflow-x: auto; }
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; }
.table-header h3 { font-size: 15px; font-weight: 600; color: #0f172a; }
.table-header p { font-size: 12px; color: #94a3b8; }
.add-btn { display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: #1e40af; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.add-btn:hover { background: #1d4ed8; }
.add-btn:disabled { background: #94a3b8; cursor: not-allowed; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; padding: 12px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; text-align: left; }
td { padding: 14px 20px; font-size: 14px; color: #374151; border-bottom: 1px solid #f1f5f9; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.empty-row td { text-align: center; color: #94a3b8; padding: 32px 20px; }

/* SEARCH BAR */
.search-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.search-input { flex: 1; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; color: #1e293b; background: #fff; outline: none; }
.search-input:focus { border-color: #1e40af; }
.filter-select { padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; color: #374151; background: #fff; outline: none; cursor: pointer; }

/* BADGES */
.badge { display: inline-block; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.badge-reported { background: #dbeafe; color: #1e40af; }
.badge-risk-screened { background: #fef3c7; color: #92400e; }
.badge-referred { background: #ede9fe; color: #4338ca; }
.badge-response-in-progress { background: #fef3c7; color: #92400e; }
.badge-resolved-closed { background: #d1fae5; color: #065f46; }
.badge-reopened { background: #fee2e2; color: #dc2626; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-accepted { background: #dbeafe; color: #1e40af; }
.badge-service-accessed { background: #d1fae5; color: #065f46; }
.badge-declined { background: #fee2e2; color: #dc2626; }
.badge-no-show { background: #fee2e2; color: #dc2626; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #dc2626; }
.badge-follow-up { background: #e0e7ff; color: #3730a3; }
.badge-risk-immediate { background: #fee2e2; color: #991b1b; }
.badge-risk-high { background: #ffedd5; color: #9a3412; }
.badge-risk-medium { background: #fef3c7; color: #92400e; }
.badge-risk-low { background: #d1fae5; color: #065f46; }
.badge-risk-unscreened { background: #f1f5f9; color: #64748b; }
.badge-capacity-accepting { background: #d1fae5; color: #065f46; }
.badge-capacity-at-capacity { background: #fef3c7; color: #92400e; }
.badge-capacity-not-accepting { background: #fee2e2; color: #dc2626; }

/* REPORTS / BAR CHARTS */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-chart-empty { color: #94a3b8; font-size: 13px; padding: 8px 0; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 56px; align-items: center; gap: 12px; }
.bar-label { font-size: 13px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 20px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; min-width: 4px; }
.bar-suppressed {
  height: 100%; width: 16px; border-radius: 4px;
  background: repeating-linear-gradient(45deg, #cbd5e1, #cbd5e1 3px, #e2e8f0 3px, #e2e8f0 6px);
}
.bar-value { font-size: 13px; font-weight: 600; color: #0f172a; text-align: right; font-variant-numeric: tabular-nums; }
.bar-value-suppressed { color: #94a3b8; font-weight: 500; }
.report-card { padding: 24px; margin-bottom: 20px; }
.report-card h3 { margin: 0 0 2px; }
.report-card .page-sub { margin: 0 0 16px; }
.hero-figure { font-size: 40px; font-weight: 700; color: #0f172a; line-height: 1.1; }

@media print {
  .topbar, .sidebar, .no-print { display: none !important; }
  .content { overflow: visible !important; }
  .report-card { break-inside: avoid; border: 1px solid #e2e8f0; box-shadow: none !important; }
}

.gov-banner {
  display: flex; align-items: center; gap: 16px;
  background: #f8fafc; border: 1px solid #cbd5e1; border-left: 4px solid #1e3a5f;
  border-radius: 10px; padding: 18px 22px; margin-bottom: 20px;
}
.gov-seal {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: #1e3a5f; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.gov-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #1e3a5f; margin-bottom: 2px; }
.tb-av-gov { background: #1e3a5f !important; }

/* ACTION BUTTONS */
.btn-assign { padding: 5px 12px; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 12px; color: #374151; cursor: pointer; font-weight: 500; margin-right: 4px; transition: all 0.12s; }
.btn-assign:hover { background: #f1f5f9; }
.btn-approve { padding: 5px 12px; background: #fff; border: 1px solid #bbf7d0; border-radius: 6px; font-size: 12px; color: #059669; cursor: pointer; font-weight: 500; transition: all 0.12s; }
.btn-approve:hover { background: #d1fae5; }
.btn-danger { padding: 5px 12px; background: #fff; border: 1px solid #fecaca; border-radius: 6px; font-size: 12px; color: #dc2626; cursor: pointer; font-weight: 500; transition: all 0.12s; }
.btn-danger:hover { background: #fef2f2; }
.btn-assign:disabled, .btn-approve:disabled, .btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* CONFIDENTIAL BANNER */
.conf-banner { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 16px; font-size: 13px; color: #dc2626; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-weight: 500; }
.info-banner { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 10px 16px; font-size: 13px; color: #1e40af; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-weight: 500; }
.success-banner { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 10px 16px; font-size: 13px; color: #059669; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-weight: 500; }

/* REPORTS */
.reports-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* MOBILE */
@media (max-width: 768px) {
  .hamburger-btn { display: block; }

  /* Sidebar becomes a slide-in drawer instead of just vanishing — it must
     stay reachable, not disappear with no way back to it. */
  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,0.15);
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-backdrop.active {
    display: block;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15,23,42,0.4);
    z-index: 80;
  }

  .content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 16px; }
  th, td { padding: 10px 12px; font-size: 12px; }
  .search-bar { flex-wrap: wrap; }
  .bar-row { grid-template-columns: 96px 1fr 48px; gap: 8px; }
  .bar-label { font-size: 12px; }
}

/* FORM STYLES */
.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field-full {
  grid-column: 1 / -1;
}
.form-field label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}
.form-field input,
.form-field select,
.form-field textarea {
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}
.field-readonly { background: #f1f5f9 !important; color: #64748b !important; font-weight: 600; }
.field-error { font-size: 12px; color: #dc2626; margin-top: 4px; min-height: 16px; }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}
.checkbox-item input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  padding: 0;
}

/* MODAL */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 460px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); }
.modal-title { font-size: 17px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.modal-sub { font-size: 13px; color: #64748b; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.credential-box { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 14px; font-family: monospace; font-size: 15px; color: #0f172a; margin: 14px 0; word-break: break-all; }

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .checkbox-grid { grid-template-columns: repeat(2,1fr); }
}
