/* ── ScribeKare Design System ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  --navy: #0f1f3d;
  --navy-mid: #1a3560;
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --teal-subtle: #f0fdfa;
  --slate: #64748b;
  --slate-light: #94a3b8;
  --smoke: #f8fafc;
  --smoke-mid: #f1f5f9;
  --white: #ffffff;
  --danger: #ef4444;
  --warn: #f59e0b;
  --success: #10b981;
  --border: #e2e8f0;
  --border-mid: #cbd5e1;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.05);
  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

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

html {
  font-size: 15px;
}

body {
  overflow-x: hidden;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--smoke);
  color: var(--navy);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

p {
  color: var(--slate);
  font-size: 0.9rem;
}

/* ── Layout ── */
.app-shell {
  display: grid;
  grid-template-columns: 224px 1fr;
  grid-template-rows: auto 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  grid-column: 1 / -1;
  background: var(--white);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 28px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.topbar-brand {
  font-family: 'DM Mono', monospace;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 0;
}

.topbar-brand,
.topbar-brand:hover {
  text-decoration: none;
}

.topbar-brand span {
  color: var(--navy);
}

.topbar-doctor {
  font-size: 0.82rem;
  color: var(--slate);
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-doctor strong {
  color: var(--navy);
  font-weight: 600;
}

.topbar-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--slate);
  padding: 5px 13px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}

.btn-logout:hover {
  background: var(--smoke-mid);
  color: var(--navy);
  border-color: var(--border-mid);
}

/* ── Sidebar ── */
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 20px 0 24px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.sidebar-section-label {
  padding: 0 20px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--slate-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--slate);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  border-radius: 0;
  margin: 1px 0;
}

.nav-item:hover {
  background: var(--smoke);
  color: var(--navy);
  border-left-color: var(--border-mid);
}

.nav-item.active {
  color: var(--teal);
  border-left-color: var(--teal);
  background: var(--teal-subtle);
  font-weight: 600;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 16px;
}

/* ── Main Content ── */
.main-content {
  padding: 28px 32px;
  overflow-y: auto;
  background: var(--smoke);
}

/* ── Page header ── */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  color: var(--navy);
}

.page-header p {
  margin-top: 4px;
}

/* ── Cards ── */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#global-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--teal);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: width 0.25s ease, opacity 0.2s ease;
}

#global-loading-bar.active {
  opacity: 1;
  width: 75%;
  transition: width 3.5s cubic-bezier(0.1, 0.8, 0.4, 1), opacity 0.2s ease;
}

#global-loading-bar.active.done {
  width: 100%;
  transition: width 0.2s ease, opacity 0.2s ease;
}

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: box-shadow 0.2s;
  animation: fadeSlideIn 0.25s ease;
}

.mobile-section.active {
  animation: fadeSlideIn 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-header h2 {
  color: var(--navy);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease, transform 0.1s ease;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn:disabled {
  cursor: default;
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(13, 148, 136, 0.3);
}

.btn-primary:hover {
  background: #0b8078;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-navy {
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(15, 31, 61, 0.25);
}

.btn-navy:hover {
  background: var(--navy-mid);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 31, 61, 0.3);
}

.btn-outline {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--slate);
}

.btn-outline:hover {
  border-color: var(--border-mid);
  color: var(--navy);
  background: var(--smoke);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-lg {
  padding: 10px 22px;
  font-size: 0.925rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--navy);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  line-height: 1.5;
}

.form-control:hover {
  border-color: var(--border-mid);
}

.form-control:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

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

select.form-control {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 13px;
  padding-right: 34px;
  text-overflow: ellipsis;
}

select.form-control::-ms-expand {
  display: none;
}

/* ── Custom dropdown (themed open list, replaces native picker) ── */
.cs-wrapper {
  position: relative;
}

.cs-native {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.cs-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--navy);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cs-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.cs-trigger::after {
  content: "";
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-size: 13px;
  transition: transform 0.15s;
}

.cs-trigger:hover {
  border-color: var(--border-mid);
}

.cs-trigger.cs-placeholder {
  color: var(--slate-light);
}

.cs-wrapper.cs-open .cs-trigger {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.cs-wrapper.cs-open .cs-trigger::after {
  transform: rotate(180deg);
}

.cs-wrapper.cs-disabled .cs-trigger {
  opacity: .6;
  cursor: not-allowed;
  background: var(--smoke);
}

.cs-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 200;
  background: var(--white);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.cs-wrapper.cs-open .cs-menu {
  display: block;
}

.cs-menu.cs-menu-up {
  top: auto;
  bottom: calc(100% + 4px);
}

.cs-option {
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--navy);
  cursor: pointer;
}

.cs-option:hover {
  background: var(--smoke-mid);
}

.cs-option-selected {
  background: var(--teal-subtle);
  color: var(--teal);
  font-weight: 600;
}

.cs-option-disabled {
  color: var(--slate-light);
  cursor: not-allowed;
}

.cs-search-wrap {
  position: sticky;
  top: 0;
  background: var(--white);
  padding: 2px 4px 6px;
  z-index: 1;
}

.cs-search-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  box-sizing: border-box;
}

.cs-search-input:focus {
  border-color: var(--teal);
}

.cs-no-results {
  padding: 12px;
  text-align: center;
  color: var(--slate-light);
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .cs-trigger {
    font-size: 16px;
    min-height: 42px;
  }

  .cs-option {
    font-size: 15px;
    padding: 12px;
  }
}

.rh-cal-wrap {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.rh-cal-main {
  flex: 1;
  min-width: 240px;
}

.rh-cal-side {
  flex: 0 0 220px;
  border-left: 1px solid var(--border);
  padding-left: 20px;
}

.rh-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rh-cal-header strong {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: var(--navy);
}

.rh-cal-nav-btn {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  width: 30px;
  height: 30px;
  font-size: 16px;
  cursor: pointer;
  color: var(--navy);
}

.rh-cal-nav-btn:hover {
  background: var(--smoke-mid);
}

.rh-cal-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.rh-cal-weekdays,
.rh-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.rh-cal-weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--slate-light);
  font-weight: 600;
  padding-bottom: 4px;
}

.rh-cal-day {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
}

.rh-cal-day:hover:not(:disabled):not(.selected) {
  background: var(--smoke-mid);
}

.rh-cal-day:disabled {
  color: var(--slate-light);
  opacity: 0.4;
  cursor: not-allowed;
}

.rh-cal-day.has-data::after {
  content: "";
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal);
}

.rh-cal-day.selected {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}

.rh-cal-day.selected.has-data::after {
  background: var(--white);
}

.rh-cal-day.empty {
  visibility: hidden;
  cursor: default;
}

.rh-month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.rh-month-btn {
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--navy);
  padding: 10px 4px;
}

.rh-month-btn:hover:not(:disabled):not(.selected) {
  background: var(--smoke-mid);
}

.rh-month-btn:disabled {
  color: var(--slate-light);
  opacity: 0.4;
  cursor: not-allowed;
}

.rh-month-btn.selected {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}

@media (max-width: 600px) {
  .rh-cal-side {
    flex: 1 1 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 16px;
    margin-top: 6px;
  }
}

.file-input-styled {
  font-size: 13px;
  color: var(--slate);
}

.file-input-styled::file-selector-button,
.file-input-styled::-webkit-file-upload-button {
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  margin-right: 12px;
}

.file-input-styled::file-selector-button:hover,
.file-input-styled::-webkit-file-upload-button:hover {
  background: var(--teal-light);
}

/* Number fields: no up/down spinner arrows (type the value; keyboard arrows still work) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

textarea.form-control {
  resize: vertical;
}

@media (max-width: 900px) {
  select.form-control {
    font-size: 16px;
    /* prevents iOS Safari auto-zoom on focus */
    min-height: 42px;
    background-color: var(--white);
  }

  .admissions-search-field {
    flex: 1 1 100%;
    max-width: none;
  }

  .admissions-search-field .form-control {
    min-height: 42px;
    font-size: 16px;
  }
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  background: var(--smoke);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--navy);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.1s;
}

tbody tr:hover {
  background: var(--smoke);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-teal {
  background: #ccfbf1;
  color: #0f766e;
}

.badge-navy {
  background: #dbeafe;
  color: #1e40af;
}

.badge-amber {
  background: #fef3c7;
  color: #b45309;
}

.badge-warn {
  background: #fef3c7;
  color: #92400e;
}

.badge-grey {
  background: var(--smoke-mid);
  color: var(--slate);
}

.badge-green {
  background: #d1fae5;
  color: #065f46;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

/* ── Toast ── */
#toast {
  position: fixed;
  top: 72px;
  right: 24px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--white);
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 340px;
  pointer-events: none;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

#toast.success {
  background: var(--success);
}

#toast.error {
  background: var(--danger);
}

#toast.info {
  background: var(--navy-mid);
}

#error-boundary {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: var(--danger);
  color: var(--white);
  padding: 14px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}

#error-boundary button {
  background: var(--white);
  color: var(--danger);
  border: none;
  border-radius: var(--radius);
  padding: 6px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

#toast.warning {
  background: #b45309;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 61, 0.4);
  backdrop-filter: blur(4px);
  /* display:none when closed — not just opacity:0 — so a closed modal is
     fully removed from the render/paint tree. A page like
     admission-detail.html has ~20 of these; leaving them all permanently
     display:flex (even invisible) meant 20 backdrop-filter layers were
     continuously composited by the GPU at all times. On Android Chrome
     this is a known trigger for a compositor glitch that paints a flat
     grey wash over the screen instead of correctly hiding the layer —
     visible-but-non-interactive, since pointer-events:none still worked
     correctly underneath. */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

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

.modal-close {
  background: var(--smoke);
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--slate);
  line-height: 1;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--smoke-mid);
  color: var(--navy);
}

/* ── Search bar ── */
.search-wrap {
  position: relative;
}

.search-wrap input {
  padding-left: 36px;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-light);
  pointer-events: none;
}

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--teal-light));
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card .stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--navy);
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 4px;
}

.stat-card .stat-sub {
  font-size: 0.78rem;
  color: var(--slate-light);
  margin-top: 2px;
}

/* ── Recording UI ── */
.recorder-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--smoke);
  transition: all 0.25s ease;
}

.recorder-wrap.recording {
  border-color: #fca5a5;
  background: #fff5f5;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.06);
}

.recorder-wrap.paused .record-btn {
  opacity: 0.5;
}

.recorder-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.record-btn .record-icon-stop {
  width: 22px;
  height: 22px;
  background: currentColor;
  border-radius: 4px;
  display: inline-block;
}

.pause-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.pause-btn:hover {
  transform: scale(1.06);
}

.pause-icon-bars {
  display: flex;
  gap: 5px;
}

.pause-icon-bars span {
  width: 5px;
  height: 18px;
  background: currentColor;
  border-radius: 1px;
  display: inline-block;
}

/* Right-pointing triangle — CSS border-triangle trick, matches video-player "play" */
.pause-icon-play {
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 15px solid currentColor;
  margin-left: 3px;
}

.record-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
  position: relative;
}

.record-btn.idle {
  background: var(--teal);
  color: var(--white);
}

.record-btn.idle:hover {
  transform: scale(1.07);
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.35);
}

.record-btn.active {
  background: var(--danger);
  color: var(--white);
  animation: pulse 1.4s infinite;
}

.record-btn.active::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(239, 68, 68, 0.3);
  animation: ring-expand 1.4s infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  }

  50% {
    box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);
  }
}

@keyframes ring-expand {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.timer {
  font-family: 'DM Mono', monospace;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--navy);
  letter-spacing: 0.08em;
}

.recorder-wrap.recording .timer {
  color: var(--danger);
}

.record-status {
  font-size: 0.83rem;
  color: var(--slate);
  font-weight: 500;
  text-align: center;
}

.transcript-box {
  width: 100%;
  min-height: 110px;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--navy);
  resize: vertical;
  background: var(--white);
  outline: none;
  line-height: 1.7;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.transcript-box:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* ── Medicine rows ── */
.med-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
  padding: 12px;
  background: var(--smoke);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.btn-remove-med {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--slate-light);
  transition: all 0.15s;
  line-height: 1;
  font-size: 0.85rem;
}

.btn-remove-med:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff5f5;
}

/* ── Steps indicator ── */
.steps {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  box-shadow: var(--shadow-sm);
}

.step {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--slate-light);
  white-space: nowrap;
  transition: color 0.2s;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--smoke-mid);
  color: var(--slate-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  transition: all 0.2s;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.step.active .step-num {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.15);
}

.step.done .step-num {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.step.active {
  color: var(--teal);
  font-weight: 600;
}

.step.done {
  color: var(--navy);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
  max-width: 60px;
  transition: background 0.3s;
  border-radius: 2px;
}

.step-line.done {
  background: var(--navy);
}

/* ── Spinner ── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--slate);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--smoke-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.empty-state-icon svg {
  opacity: 0.45;
}

.empty-state h3 {
  color: var(--slate);
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--slate-light);
  max-width: 280px;
  margin: 0 auto;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-mid);
}

/* ── Auth page ── */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-left {
  background: var(--navy);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 64px;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

/* CSS-only subtle geometric pattern */
.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(13, 148, 136, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(20, 184, 166, 0.10) 0%, transparent 50%);
  pointer-events: none;
}

.auth-left::after {
  content: '';
  position: absolute;
  bottom: -80px;
  right: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 2px solid rgba(13, 148, 136, 0.12);
  pointer-events: none;
}

.auth-left-inner {
  position: relative;
  z-index: 1;
}

.auth-logo {
  font-family: 'DM Mono', monospace;
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--teal-light);
  margin-bottom: 52px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.auth-logo span {
  color: var(--white);
}

.auth-tagline {
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 18px;
  letter-spacing: -0.025em;
  color: var(--white);
}

.auth-tagline em {
  color: var(--teal-light);
  font-style: normal;
}

.auth-sub {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.75;
  max-width: 360px;
}

.auth-features {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.7);
}

.auth-feature-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal-light);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

.auth-badge {
  margin-top: 48px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 30px;
  padding: 8px 16px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.auth-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: blink 2s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--smoke);
}

.auth-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.auth-box-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.auth-box-sub {
  font-size: 0.85rem;
  color: var(--slate);
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--slate);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.auth-tab.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.auth-tab:hover:not(.active) {
  color: var(--navy);
}

.err-msg {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 10px;
  text-align: center;
  min-height: 18px;
  font-weight: 500;
}

/* ── Phone input group ── */
.phone-prefix {
  padding: 9px 12px;
  background: var(--smoke-mid);
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 0.9rem;
  color: var(--slate);
  white-space: nowrap;
  font-weight: 500;
}

.phone-input-group {
  display: flex;
  align-items: stretch;
}

.phone-input-group .form-control {
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Hamburger menu (mobile sidebar toggle) ── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.15s;
}

.hamburger-btn:hover {
  background: var(--smoke-mid);
  border-color: var(--border-mid);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 61, 0.45);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.2s;
}

.sidebar-backdrop.open {
  display: block;
  opacity: 1;
}

#profile-menu-backdrop {
  background: transparent;
}

.mobile-back-link {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--teal);
  text-decoration: none;
  margin-bottom: 16px;
}

.mobile-back-link:hover {
  text-decoration: underline;
}

@media (min-width: 901px) {
  #sidebar-doctor-name {
    display: none;
  }

  .sidebar-signout-btn {
    display: none;
  }
}

/* Shared mobile tab-section switching, used on lab/nurse/receptionist etc. */
.mobile-section {
  display: none;
}

.mobile-section.active {
  display: block;
}

@media (min-width: 901px) {
  .mobile-section {
    display: block !important;
    margin-bottom: 20px;
  }
  
  #page-receptionist #section-home,
  #page-receptionist #section-patients,
  #page-receptionist #section-portal,
  #page-receptionist #section-availability {
    display: none !important;
  }

  #page-receptionist #section-home.d-active,
  #page-receptionist #section-patients.d-active,
  #page-receptionist #section-portal.d-active,
  #page-receptionist #section-availability.d-active {
    display: block !important;
  }
}

/* Shared "Today's Status" attendance block — same on every staff page */
.staff-att-status {
  text-align: center;
  padding: 24px 0 20px;
}

.staff-att-status .badge {
  font-size: 15px;
  padding: 8px 18px;
}

.staff-att-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.staff-att-actions select {
  width: 100% !important;
}

@media (max-width: 900px) {
  #location-toggle #loc-toggle-btn,
  #location-toggle #emergency-btn {
    flex: 1;
  }
  #att-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  #att-card-header #btn-mark-present {
    flex-shrink: 0;
  }

  .att-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .att-card .card-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1 1 auto;
  }

  .att-card .staff-att-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
    gap: 4px;
    flex: 0 0 auto;
  }

  .att-card .staff-att-actions {
    flex: 1 1 100%;
    margin-top: 12px;
    align-items: center;
  }
}

@media (min-width: 901px) {
  #att-card-header { display: flex; align-items: center; justify-content: space-between; }
  #att-card-header #btn-mark-present { flex-shrink: 0; }
}
@media (min-width: 901px) {
  .att-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .att-card .card-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 0 0 auto;
  }

  .staff-att-status {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 0;
    flex: 0 0 auto;
  }

  .staff-att-status #room-display,
  .staff-att-status [id$="-off-duty-time-line"] {
    margin-top: 0 !important;
  }

  .staff-att-status [id$="-off-duty-time-line"]:not(:empty) {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 12px;
    background: var(--smoke);
  }

  .staff-att-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin-left: auto;
  }

  .staff-att-actions select {
    width: 170px !important;
  }
}

@media (max-width: 900px) {
  .room-add-grid {
    grid-template-columns: 1fr !important;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-left {
    padding: 32px 24px 28px;
    min-height: auto;
  }

  .auth-sub,
  .auth-features,
  .auth-badge {
    display: none;
  }

  .auth-logo {
    margin-bottom: 12px;
    font-size: 1.1rem;
  }

  .auth-tagline {
    font-size: 1.25rem;
    margin-bottom: 0;
  }

  .auth-right {
    padding: 28px 20px 40px;
  }

  .auth-box {
    padding: 24px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: 100dvh;
  }

  .hamburger-btn {
    display: flex;
  }

  #bills-header-btn {
    display: flex;
    align-items: center;
  }

  .topbar-profile-btn {
    display: flex;
  }

  .topbar-brand {
    cursor: pointer;
  }

  .mobile-back-link {
    display: inline-flex;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 56px;
    left: 0;
    width: 260px;
    height: calc(100dvh - 56px);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .med-row {
    grid-template-columns: 1fr 1fr;
  }

  .main-content {
    padding: 20px 16px;
  }

  .steps {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .step,
  .step-line {
    flex-shrink: 0;
  }
}

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

  .steps {
    padding: 12px 16px;
  }

  .med-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "name brand" "dosage freq" "dur schedule" "remove remove";
  }

  .med-row .med-name {
    grid-area: name;
  }

  .med-row .med-brand {
    grid-area: brand;
  }

  .med-row .med-dosage {
    grid-area: dosage;
  }

  .med-row .med-freq {
    grid-area: freq;
  }

  .med-row .med-dur {
    grid-area: dur;
  }

  .med-row .med-schedule {
    grid-area: schedule;
  }

  .med-row .btn-remove-med {
    grid-area: remove;
    width: 100%;
  }

  #panel-1>div[style*="justify-content:flex-end"],
  #panel-2>div[style*="justify-content:space-between"],
  .success-panel>div[style*="justify-content:center"] {
    flex-direction: column;
  }

  #panel-1>div[style*="justify-content:flex-end"] button,
  #panel-2>div[style*="justify-content:space-between"] button,
  .success-panel>div[style*="justify-content:center"] button {
    width: 100%;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-brand {
    font-size: 0.95rem;
  }

  #topbar-doctor-name,
  #topbar-clinic,
  .topbar-divider {
    display: none;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .card-header>div:last-child {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-wrap {
    flex: 1 1 100%;
  }

  .search-wrap input {
    width: 100%;
    min-width: 0;
  }

  .card-header>div:last-child>.btn {
    width: 100%;
  }
}

/* ── Patient Portal additions ── */
.hosp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.hosp-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.hosp-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-mid);
}

.appt-type-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.appt-type-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--slate);
  background: var(--white);
}

.appt-type-btn.active {
  border-color: var(--teal);
  background: var(--teal-subtle);
  color: var(--teal);
}

/* ── Bottom Tab Nav (mobile) ── */
.bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .hamburger-btn {
    display: none;
  }

  .topbar-doctor {
    display: none;
  }

  #bills-header-btn {
    display: flex;
  }

  .topbar-profile-btn {
    display: flex;
    margin-left: 16px;
  }

  .topbar-right-group {
    margin-left: 5px;
  }

  /* Mobile: brand stays on the left, every header button sits on the right. */
  .topbar > :first-child {
    margin-right: auto;
  }

  #topbar-right-block {
    margin-left: 0 !important;
  }

  .topbar-brand {
    cursor: pointer;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: var(--white);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    z-index: 250;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--slate);
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    padding: 6px 4px 0;
  }

  .bottom-nav-item svg {
    width: 21px;
    height: 21px;
    stroke-width: 1.8;
  }

  .bottom-nav-item.active {
    color: var(--teal);
  }

  .bottom-nav-item.active svg {
    stroke-width: 2.2;
  }

  .main-content {
    padding-bottom: 76px;
  }
}

.table-center {
  text-align: center;
}

/* ── Rooms list rows ── */
.room-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--white);
}

.room-row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.room-row-actions .cs-wrapper {
  min-width: 175px;
}

.room-row-actions input.form-control {
  min-width: 140px;
}

.room-row-actions .room-seq-input.form-control {
  min-width: 90px !important;
  max-width: 90px !important;
}

@media (max-width: 700px) {
  .room-row-actions {
    width: 100%;
  }

  .room-row-actions .cs-wrapper,
  .room-row-actions input.form-control {
    flex: 1 1 140px;
  }
}

/* ── Test catalog rows ── */
.test-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--white);
}

.test-row-main {
  flex: 1;
  min-width: 220px;
}

.test-row-meta {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: 90px;
}

.test-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .test-row-meta {
    align-items: flex-start;
  }
}

/* ── Responsive data cards (tables → cards on mobile) ── */
@media (max-width: 700px) {

  table.responsive-cards,
  table.responsive-cards thead,
  table.responsive-cards tbody,
  table.responsive-cards th,
  table.responsive-cards td,
  table.responsive-cards tr {
    display: block;
    width: 100%;
  }

  table.responsive-cards thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  table.responsive-cards tr {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    padding: 4px 14px;
    box-shadow: var(--shadow-sm);
  }

  table.responsive-cards td {
    border: none;
    border-bottom: 1px solid var(--smoke-mid);
    position: relative;
    padding: 10px 0 10px 46%;
    text-align: right;
    white-space: normal;
    font-size: 0.85rem;
  }

  table.responsive-cards td:last-child {
    border-bottom: none;
  }

  table.responsive-cards td:empty {
    display: none;
  }

  table.responsive-cards td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    top: 10px;
    width: 42%;
    padding-right: 10px;
    white-space: normal;
    text-align: left;
    font-weight: 600;
    color: var(--slate);
    font-size: 0.76rem;
  }

  table.responsive-cards td[data-label=""]::before,
  table.responsive-cards td:not([data-label])::before {
    content: none;
  }

  table.responsive-cards td[data-label=""],
  table.responsive-cards td:not([data-label]) {
    padding-left: 0;
    text-align: left;
  }

  /* The checked-in/est-time column is centered on desktop (see
     .col-checkin-time below) but must right-align once the table
     collapses into cards on mobile — this specific override wins over
     that desktop rule at this viewport since it's declared here with
     matching specificity but appears later in the cascade. */
  table.responsive-cards td.col-checkin-time {
    text-align: right;
  }

  table.responsive-cards .patient-name-line {
    justify-content: flex-end;
  }
}

.col-checkin-time {
  text-align: center;
}

/* ── Mobile profile button + dropdown ── */
.topbar-profile-btn {
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--smoke-mid);
  border: 1px solid var(--border);
  color: var(--navy);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

@media (min-width: 901px) {
  .topbar-profile-btn {
    display: flex;
    margin-left: 16px;
  }

  #bills-header-btn {
  margin-left: auto;
}

  .ward-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.ward-card:hover {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
  border-color: var(--teal, #14b8a6);
}

.ward-card-main {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.ward-avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--teal-subtle, #ccfbf1);
  color: var(--teal, #0d9488);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ward-card-side {
  flex-shrink: 0;
  text-align: right;
}

@media (max-width: 600px) {
  .ward-card {
    flex-wrap: wrap;
  }
  .ward-card-side {
    text-align: left;
    padding-left: 56px;
    width: 100%;
  }
}

  .topbar-doctor {
    margin-left: auto;
    margin-right: 16px;
  }

  .topbar-doctor .topbar-divider,
  #topbar-clinic,
  .topbar-doctor .notif-bell-btn,
  .topbar-doctor button[onclick="logout()"] {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .billing-filter-grid {
    grid-template-columns: 1fr !important;
  }

  .visit-detail-grid {
    grid-template-columns: 1fr !important;
  }
}

.topbar-profile-btn .profile-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--white);
  display: none;
}

.profile-menu {
  display: block;
  position: fixed;
  top: 62px;
  right: 12px;
  width: 240px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 260;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  transform-origin: top right;
}

.profile-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.profile-menu-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.profile-menu-header strong {
  display: block;
  font-size: 0.9rem;
}

.profile-menu-header span {
  font-size: 0.76rem;
  color: var(--slate);
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.85rem;
  color: var(--navy);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
}

.profile-menu-item:hover {
  background: var(--smoke-mid);
}

.profile-menu-item svg {
  width: 16px;
  height: 16px;
  color: var(--slate);
  flex-shrink: 0;
}

.profile-menu-item.danger {
  color: var(--danger);
}

.profile-menu-item.danger svg {
  color: var(--danger);
}

.profile-menu-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}

/* ── Mobile "More" full-screen menu ── */
.mobile-menu-sheet {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 300;
  flex-direction: column;
}

.mobile-menu-sheet.open {
  display: flex;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mobile-menu-header h2 {
  font-size: 1rem;
  margin: 0;
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--slate);
  cursor: pointer;
  width: 32px;
  height: 32px;
}

.mobile-menu-body {
  overflow-y: auto;
  padding: 8px 8px 24px;
  flex: 1;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 12px;
  background: none;
  border: none;
  border-radius: var(--radius);
  text-align: left;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

.mobile-menu-item:active {
  background: var(--smoke-mid);
}

.mobile-menu-item svg {
  width: 19px;
  height: 19px;
  color: var(--teal);
  flex-shrink: 0;
}

/* ── Medicine catalog filter row (fixes tiny squeezed search box) ── */
@media (max-width: 700px) {
  .med-filter-row {
    grid-template-columns: 1fr !important;
  }
}

/* ── Horizontally scrollable filter/chip rows (prevents page-level horizontal scroll) ── */
.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

.chip-scroll>* {
  flex: 0 0 auto;
}

.doc-filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--slate);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-filter-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.doc-filter-chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

/* ── Availability editor: modal + weekday chips + time preset chips ── */
.avail-modal {
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
}

.avail-section {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  background: var(--smoke, #f8fafc);
}

.avail-section-title {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy);
}

.avail-section-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--slate-light);
}

.avail-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avail-time-group {
  margin-bottom: 14px;
}

.avail-time-group-last {
  margin-bottom: 0;
}

.avail-time-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 8px;
}

.day-chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--slate);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.day-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
}

.day-chip.selected {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.35);
}

.preset-chip {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--slate);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.preset-chip:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
}

.preset-chip.selected {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.35);
}

.avail-unavail-section {
  border-top: 1px solid var(--border);
  background: transparent;
  padding: 16px 18px 18px;
  margin-top: 4px;
}

.avail-unavail-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.avail-unavail-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.avail-unavail-empty {
  color: var(--slate-light);
  font-size: 13px;
  padding: 8px 0;
}

.unavail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  font-size: 13px;
  transition: all 0.15s ease;
}

.unavail-item:hover {
  border-color: var(--teal);
  box-shadow: 0 1px 4px rgba(13, 148, 136, 0.12);
}

.avail-doctor-row {
  transition: all 0.15s ease;
}

.avail-doctor-row:hover {
  border-color: var(--teal) !important;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.12);
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .avail-modal {
    padding: 20px;
  }

  .avail-section {
    padding: 14px;
  }

  .day-chip {
    padding: 11px 8px;
    font-size: 0.85rem;
    flex: 1 1 auto;
    text-align: center;
  }

  .preset-chip {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
    padding: 11px 8px;
  }

  .avail-unavail-form {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .avail-unavail-form .form-group {
    width: 100%;
  }

  .avail-unavail-form .btn {
    width: 100%;
  }

  .unavail-item {
    flex-wrap: wrap;
  }
}

/* ── Staff row → real mobile card (not just a squeezed desktop row) ── */
@media (max-width: 900px) {
  .staff-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px !important;
    margin-bottom: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  }

  .staff-name-row {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .staff-stats-row {
    flex-wrap: wrap !important;
    gap: 8px 16px !important;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
  }

  .staff-row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    padding-top: 4px;
  }

  .staff-row-actions .btn {
    width: 100%;
  }
}

/* ── Notification Bell & Panel ── */
.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  color: var(--navy);
}

.notif-bell-btn:hover {
  color: var(--teal);
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #dc2626;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.notif-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 380px;
  max-width: 92vw;
  background: var(--white);
  z-index: 201;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.notif-panel.open {
  transform: translateX(0);
}

.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.notif-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.notif-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--smoke-mid);
  cursor: pointer;
}

.notif-item:hover {
  background: var(--smoke-mid);
}

.notif-item.unread {
  background: #eff6ff;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-item-message {
  font-size: 12.5px;
  color: var(--slate);
  margin-top: 3px;
}

/* ── Staff Chat Widget ── */
.topbar-right-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.chat-header-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  color: var(--navy);
}

.chat-header-btn:hover {
  color: var(--teal);
}

.chat-header-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #dc2626;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.suggestion-header-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 7px 14px 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.suggestion-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.suggestion-card.has-unread {
  border-color: #0d9488;
  background: #f0fdfa;
}

.suggestion-filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.suggestion-header-btn:hover {
  filter: brightness(1.08);
}

.suggestion-header-btn span {
  display: none;
}

@media (min-width: 900px) {
  .suggestion-header-btn span {
    display: inline;
  }
}

.suggestion-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.suggestion-backdrop.open {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.suggestion-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 301;
  background: var(--white);
  width: 100%;
  max-width: 560px;
  height: min(760px, 90vh);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  transform: translate(-50%, calc(-50% + 20px)) scale(0.98);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
}

.suggestion-panel.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: all;
}

.suggestion-panel .chat-panel-body {
  overflow-y: auto;
}

.chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.chat-backdrop.open {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.chat-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 301;
  background: var(--white);
  width: 100%;
  max-width: 420px;
  height: min(680px, 88vh);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  transform: translate(-50%, calc(-50% + 20px)) scale(0.98);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
}

.chat-panel.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: all;
}

.chat-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.chat-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-search-bar {
  padding: 10px 16px;
  flex: 0 0 auto;
}

.chat-search-bar input {
  width: 100%;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
}

.chat-filter-tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 10px;
  flex: 0 0 auto;
}

.chat-filter-tab {
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
}

.chat-filter-tab.active {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}

.chat-thread-list {
  flex: 1;
  overflow-y: auto;
}

.chat-thread-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--smoke-mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-thread-item:hover {
  background: var(--smoke-mid);
}

.chat-thread-item.unread {
  background: #eff6ff;
}

.chat-thread-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal-subtle), #dff5f0);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.chat-thread-info {
  flex: 1;
  min-width: 0;
}

.chat-thread-name {
  font-size: 13.5px;
  font-weight: 700;
}

.chat-thread-role {
  font-size: 11px;
  color: var(--slate);
  font-weight: 500;
  text-transform: capitalize;
  margin-left: 4px;
}

.chat-thread-preview {
  font-size: 12.5px;
  color: var(--slate);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-thread-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
}

.chat-thread-time {
  font-size: 10.5px;
  color: var(--slate-light);
  white-space: nowrap;
}

.chat-thread-unread-dot {
  background: #dc2626;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex: 0 0 auto;
}

.chat-messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: var(--teal);
  color: var(--white);
  border-bottom-right-radius: 3px;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: var(--smoke-mid);
  color: var(--navy);
  border-bottom-left-radius: 3px;
}

.chat-bubble-time {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 3px;
  display: block;
}

.chat-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  text-decoration: none;
  color: inherit;
  font-size: 12px;
}

.chat-bubble.theirs .chat-attachment {
  background: rgba(15, 31, 61, 0.06);
}

.chat-attachment-img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 8px;
  display: block;
  margin-bottom: 4px;
}

.chat-compose-file-btn {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  cursor: pointer;
  color: var(--slate);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-compose-file-btn:hover {
  color: var(--teal);
  border-color: var(--teal);
}


.chat-compose {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.chat-compose input {
  flex: 1;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
}

.chat-compose button {
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}

.chat-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--navy);
  font-size: 18px;
  padding: 4px 8px;
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.notif-dot.critical {
  background: #dc2626;
}

.notif-dot.warning {
  background: #d97706;
}

.notif-dot.info {
  background: #2563eb;
}