:root {
  --bc-bg: #faf7f5;
  --bc-surface: #ffffff;
  --bc-ink: #3a2f2c;
  --bc-muted: #7a6a64;
  --bc-line: #eadfd8;
  --bc-rose: #d4a5a0;
  --bc-rose-deep: #c48982;
  --bc-gold: #c9a27a;
  --bc-cream: #f3ebe4;
  --bc-rose-rgb: 212, 165, 160;
  --bc-gold-rgb: 201, 162, 122;
  --bc-shadow: 0 18px 45px rgba(90, 60, 50, 0.08);
  --bc-radius: 18px;
  /* Noto Sans Lao + Thai + Sarabun; system fallbacks when CDN offline */
  --bc-font: "Noto Sans Lao", "Noto Sans Thai", "Sarabun", "Segoe UI", "Tahoma", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--bc-font);
  color: var(--bc-ink);
  background:
    radial-gradient(circle at top left, rgba(var(--bc-rose-rgb), 0.22), transparent 32%),
    radial-gradient(circle at top right, rgba(var(--bc-gold-rgb), 0.18), transparent 28%),
    linear-gradient(180deg, color-mix(in srgb, var(--bc-surface) 88%, var(--bc-bg)), var(--bc-bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.bc-auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.bc-auth-shell {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--bc-surface);
  border: 1px solid var(--bc-line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--bc-shadow);
}

.bc-auth-visual {
  position: relative;
  min-height: 560px;
  background:
    linear-gradient(160deg, rgba(58, 47, 44, 0.28), rgba(58, 47, 44, 0.55)),
    linear-gradient(135deg, #f0ddd6, #e7cfc4 45%, #d9b7a8);
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.bc-auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.28), transparent 28%),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.16), transparent 24%);
}

.bc-auth-visual > * {
  position: relative;
  z-index: 1;
}

.bc-brand {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}

.bc-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.bc-brand-lockup__logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
}

.bc-brand-lockup__name {
  margin: 0;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bc-brand-lockup--login .bc-brand-lockup__logo {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.bc-brand-lockup--login {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 10px;
}

.bc-brand-lockup--login .bc-brand-lockup__name {
  font-size: 2rem;
  color: #fff;
}

.bc-brand-lockup--sidebar .bc-brand-lockup__logo {
  width: 36px;
  height: 36px;
  background: var(--bc-cream, #f7f0ec);
}

.bc-brand-lockup--sidebar .bc-brand-lockup__name {
  font-size: 1.05rem;
  margin: 0;
}

.bc-brand-lockup--dashboard .bc-brand-lockup__logo {
  width: 40px;
  height: 40px;
  background: var(--bc-cream, #f7f0ec);
}

.bc-sidebar__brand-link {
  display: block;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.bc-sidebar__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 20px;
}

.bc-auth-visual p {
  margin: 0;
  max-width: 22rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
}

.bc-auth-form-wrap {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bc-auth-form-wrap h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.bc-auth-form-wrap .bc-subtitle {
  margin: 0 0 28px;
  color: var(--bc-muted);
}

.bc-form-group {
  margin-bottom: 18px;
}

.bc-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.bc-input {
  width: 100%;
  border: 1px solid var(--bc-line);
  background: #fffaf7;
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  color: var(--bc-ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bc-input:focus {
  outline: none;
  border-color: var(--bc-rose);
  box-shadow: 0 0 0 4px rgba(212, 165, 160, 0.18);
}

.bc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

.bc-btn:active {
  transform: translateY(1px);
}

.bc-btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--bc-rose), var(--bc-rose-deep));
  color: #fff;
}

.bc-btn-primary:hover {
  opacity: 0.95;
}

.bc-btn-ghost {
  background: transparent;
  color: var(--bc-muted);
  border: 1px solid var(--bc-line);
}

.bc-alert {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.bc-alert-error {
  background: #fff1f0;
  color: #9b3b34;
  border: 1px solid #f0c7c2;
}

.bc-alert-success {
  background: #f3faf4;
  color: #2f6b3a;
  border: 1px solid #cfe6d4;
}

.bc-app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.bc-sidebar {
  background: #fff;
  border-right: 1px solid var(--bc-line);
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.bc-sidebar .bc-brand {
  font-size: 1.05rem;
  margin-bottom: 0;
}

.bc-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--bc-muted);
  margin-bottom: 6px;
}

.bc-nav-link.active,
.bc-nav-link:hover {
  background: var(--bc-cream);
  color: var(--bc-ink);
}

.bc-main {
  padding: 28px;
}

.bc-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.bc-card {
  background: #fff;
  border: 1px solid var(--bc-line);
  border-radius: var(--bc-radius);
  padding: 24px;
  box-shadow: var(--bc-shadow);
}

.bc-user-meta {
  color: var(--bc-muted);
  font-size: 0.95rem;
}

.bc-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--bc-line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
}

.bc-bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  color: var(--bc-muted);
  font-size: 0.85rem;
}

.bc-bottom-nav a.active {
  background: var(--bc-cream);
  color: var(--bc-ink);
}

.bc-error-page {
  text-align: center;
  max-width: 480px;
}

.bc-error-code {
  font-size: 4rem;
  font-weight: 700;
  color: var(--bc-rose);
  margin: 0;
}

.bc-loading {
  opacity: 0.7;
  pointer-events: none;
}

.bc-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bc-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}

.bc-filter-form .bc-input {
  min-width: 160px;
  max-width: 240px;
}

.bc-empty {
  text-align: center;
  padding: 48px 24px;
}

.bc-table-wrap {
  overflow-x: auto;
}

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

.bc-table th,
.bc-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--bc-line);
  text-align: left;
  vertical-align: top;
}

.bc-table th {
  color: var(--bc-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.bc-actions {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.bc-actions a {
  color: var(--bc-rose-deep);
  font-weight: 600;
}

.bc-badge {
  display: inline-block;
  background: var(--bc-cream);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.85rem;
}

.bc-status {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
}

.bc-status.is-active {
  background: #eaf7ee;
  color: #2f6b3a;
}

.bc-status.is-inactive {
  background: #f4f1ef;
  color: #7a6a64;
}

.bc-pagination {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.bc-pagination a {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--bc-line);
  background: #fff;
}

.bc-pagination a.active {
  background: var(--bc-cream);
  border-color: var(--bc-rose);
}

.bc-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.bc-btn-danger {
  background: #c9786e;
  color: #fff;
}

.bc-avatar,
.bc-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--bc-line);
}

.bc-avatar-lg {
  width: 96px;
  height: 96px;
}

.bc-avatar-placeholder {
  display: grid;
  place-items: center;
  background: var(--bc-cream);
  font-size: 2rem;
  font-weight: 700;
  color: var(--bc-rose-deep);
}

.bc-dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 0;
}

.bc-dl dt {
  font-size: 0.85rem;
  color: var(--bc-muted);
  margin-bottom: 2px;
}

.bc-dl dd {
  margin: 0;
}

.bc-dl-full {
  grid-column: 1 / -1;
}

.bc-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0;
}

.bc-check small {
  display: block;
  color: var(--bc-muted);
}

.bc-permission-matrix {
  display: grid;
  gap: 16px;
}

.bc-permission-module {
  border: 1px solid var(--bc-line);
  border-radius: 16px;
  padding: 16px;
  background: #fffaf7;
}

.bc-permission-module h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.bc-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 12px;
}

.bc-medical-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f8e1df;
  color: #9b3b34;
  font-size: 0.8rem;
  font-weight: 700;
}

.bc-medical-banner {
  background: linear-gradient(135deg, #fff1f0, #ffe8e6);
  border: 1px solid #f0c7c2;
  border-radius: 16px;
  padding: 16px 18px;
  color: #7a2e28;
}

.bc-medical-banner__title {
  font-weight: 700;
  margin-bottom: 6px;
}

.bc-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag-color, #d4a5a0) 22%, white);
  color: var(--bc-ink);
  border: 1px solid color-mix(in srgb, var(--tag-color, #d4a5a0) 45%, white);
  font-size: 0.85rem;
}

.bc-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.bc-note-item {
  border: 1px solid var(--bc-line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
}

.bc-note-item.is-important {
  border-color: #e2b4ae;
  background: #fff8f7;
}

.bc-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bc-line);
}

.bc-stat-row:last-child {
  border-bottom: 0;
}

.bc-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bc-timeline li {
  position: relative;
  padding: 0 0 16px 16px;
  border-left: 2px solid var(--bc-line);
}

.bc-timeline li:last-child {
  padding-bottom: 0;
}

.bc-timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bc-rose);
}

.bc-timeline__time {
  font-size: 0.8rem;
  color: var(--bc-muted);
  margin-bottom: 2px;
}

.bc-link-btn {
  border: 0;
  background: transparent;
  color: var(--bc-rose-deep);
  font: inherit;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.bc-appt-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--st-color, #d4a5a0) 22%, white);
  border: 1px solid color-mix(in srgb, var(--st-color, #d4a5a0) 50%, white);
  font-size: 0.85rem;
  font-weight: 600;
}

.bc-queue-col {
  min-height: 320px;
}

.bc-queue-card {
  border: 1px solid var(--bc-line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fffaf7;
}

.bc-queue-no {
  font-size: 1.2rem;
  color: var(--bc-rose-deep);
}

#appointmentCalendar {
  min-height: 0;
  width: 100%;
  max-width: 100%;
}

.bc-calendar-toolbar {
  align-items: flex-start;
}

.bc-btn-primary.bc-btn-with-icon {
  width: auto;
}

@media (max-width: 900px) {
  .bc-table thead {
    display: none;
  }

  .bc-table tr {
    display: block;
    border: 1px solid var(--bc-line);
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 12px;
  }

  .bc-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 8px 4px;
  }

  .bc-table td::before {
    content: attr(data-label);
    color: var(--bc-muted);
    font-weight: 600;
  }

  .bc-dl {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .bc-auth-shell {
    grid-template-columns: 1fr;
  }

  .bc-auth-visual {
    min-height: 220px;
    padding: 32px 28px;
  }

  .bc-auth-form-wrap {
    padding: 32px 24px 40px;
  }
}

/* STEP 7.3 — Notification bell + center */
.bc-notification-bell {
  position: relative;
}

.bc-notification-bell__toggle {
  position: relative;
}

.bc-notification-bell__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #c45c5c;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.bc-notification-bell__badge.is-empty {
  display: none;
}

.bc-notification-bell__menu {
  width: min(360px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--bc-line);
  border-radius: var(--bc-radius);
  box-shadow: var(--bc-shadow);
  overflow: hidden;
}

.bc-notification-bell__head,
.bc-notification-bell__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #faf8f7;
  border-bottom: 1px solid var(--bc-line);
}

.bc-notification-bell__foot {
  border-bottom: 0;
  border-top: 1px solid var(--bc-line);
  justify-content: center;
}

.bc-notification-bell__all {
  font-weight: 600;
  color: var(--bc-rose-deep);
}

.bc-notification-bell__list {
  max-height: 360px;
  overflow: auto;
}

.bc-notification-bell__empty {
  padding: 20px 14px;
  text-align: center;
}

.bc-notification-bell__item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--bc-line);
}

.bc-notification-bell__item:last-child {
  border-bottom: 0;
}

.bc-notification-bell__item-body {
  flex: 1;
  min-width: 0;
}

.bc-notification-bell__item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.bc-notification-bell__link {
  color: var(--bc-rose-deep);
  font-weight: 600;
}

.bc-notification-bell__item.severity-critical,
.bc-notification-center__item.severity-critical {
  border-left: 3px solid #c45c5c;
}

.bc-notification-bell__item.severity-warning,
.bc-notification-center__item.severity-warning {
  border-left: 3px solid #c49a3c;
}

.bc-notification-bell__item.severity-action_required,
.bc-notification-center__item.severity-action_required {
  border-left: 3px solid #6b7bb8;
}

.bc-notification-center__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bc-notification-center__item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px;
  border: 1px solid var(--bc-line);
  border-radius: 12px;
  background: #fff;
}

.bc-notification-center__item.is-unread {
  background: #fffaf8;
}

.bc-notification-center__main {
  flex: 1;
  min-width: 220px;
}

.bc-notification-center__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.bc-notification-severity {
  text-transform: none;
}

.bc-btn-sm {
  padding: 4px 10px;
  font-size: 0.85rem;
}

.bc-ack-modal .modal-header {
  border-bottom: 1px solid var(--bc-line);
}

.bc-ack-modal .modal-footer {
  border-top: 1px solid var(--bc-line);
  justify-content: flex-end;
}
