:root { --app-accent: #0d6efd; --app-topbar-height: 4rem; }
.app-header.navbar {
  height: var(--app-topbar-height);
  padding-block: 0;
}
.app-header > .container-fluid { height: 100%; }
.sidebar-brand {
  height: var(--app-topbar-height);
  padding-block: 0;
}
.crud-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
}
.crud-grid .grid-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  vertical-align: middle;
  font-size: .875rem;
  line-height: 1;
  border-radius: 50%;
}
.crud-grid {
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  margin-bottom: 1rem;
  background: var(--bs-body-bg);
  overflow: auto;
}
.crud-grid .table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}
.crud-grid .table > :not(caption) > * {
  border: 0;
}
.crud-grid .table > :not(caption) > * > * {
  padding: .5rem;
  height: calc(2.5rem + 1px);
  line-height: 1.5rem;
  vertical-align: middle;
  white-space: nowrap;
  border: 0;
  border-inline-end: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
}
.crud-grid .table > :not(caption) > * > :last-child {
  border-inline-end: 0;
}
.crud-grid .table > thead > tr > th {
  background: var(--bs-tertiary-bg);
  color: var(--bs-emphasis-color);
  font-weight: 600;
  white-space: nowrap;
}
.crud-grid .table > tbody > tr:last-child > * {
  border-bottom: 0;
}
.app-dialog-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / 50%); z-index: 1100; }
.toastify.app-confirm-dialog { top: 50% !important; bottom: auto !important; left: 50% !important; right: auto !important; transform: translate(-50%, -50%) !important; margin: 0; padding: 0; width: 460px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid; border-radius: var(--bs-border-radius-lg); box-shadow: var(--bs-box-shadow-lg); cursor: default; z-index: 1110; }
.app-dialog-message { overflow-wrap: anywhere; white-space: pre-wrap; }
.toastify.app-toast { display: flex; align-items: flex-start; padding: 0; width: 360px; max-width: calc(100vw - 32px); border: 1px solid; border-inline-start-width: 4px; border-radius: var(--bs-border-radius); box-shadow: var(--bs-box-shadow); z-index: 1090; }
.app-toast-content { flex: 1; min-width: 0; }
.app-toast .toast-header { padding: .75rem 1rem; border-radius: 0; }
.app-toast .toast-close { color: var(--bs-body-color); opacity: .75; padding: .75rem; }
.app-toast .toast-body { padding: 1rem; overflow-wrap: anywhere; }
[data-bs-theme="light"] .app-sidebar { background-color: #fff !important; }
.app-brand-logo { width: 3rem; height: 3rem; object-fit: contain; flex-shrink: 0; }
.welcome-card { border-top: 3px solid var(--app-accent); }
.sidebar-menu .nav-link.disabled { opacity: .65; cursor: default; }
.htmx-indicator { visibility: hidden; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { visibility: visible; }
#main-content:focus { outline: none; }
.patient-photo-card { display: flex; flex-direction: column; align-items: center; gap: .75rem; width: fit-content; max-width: 100%; padding: 1rem; border: 1px solid var(--bs-border-color); border-radius: .75rem; background: var(--bs-tertiary-bg); }
.patient-photo-frame { width: 130px; height: 156px; flex-shrink: 0; overflow: hidden; border-radius: .5rem; background: var(--bs-body-bg); display: grid; place-items: center; }
.patient-photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.patient-photo-frame i { font-size: 3.5rem; color: var(--bs-secondary-color); }
.patient-camera-dialog { width: min(640px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; border: 1px solid var(--bs-border-color); border-radius: .85rem; padding: 1.25rem; background: var(--bs-body-bg); color: var(--bs-body-color); box-shadow: var(--bs-box-shadow-lg); }
.patient-camera-dialog::backdrop { background: rgb(0 0 0 / 60%); }
.patient-camera-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.patient-camera-stage { min-height: 180px; background: #111827; border-radius: .6rem; overflow: hidden; }
.patient-camera-stage video, .patient-camera-stage img { width: 100%; max-height: 55dvh; object-fit: contain; }
.clinic-login { width: min(400px, calc(100% - 2rem)); padding-block: 2rem; }
.clinic-login .login-logo { font-size: 1.75rem; overflow-wrap: anywhere; }
.clinic-login .login-logo a { color: var(--bs-body-color); text-decoration: none; }
.clinic-login .login-card-body { color: var(--bs-body-color); background: var(--bs-body-bg); border-radius: var(--bs-card-border-radius); }
.clinic-login #toggle-password { border-color: var(--bs-border-color); }
.login-page:has(.clinic-login) { min-height: 100vh; min-height: 100dvh; height: auto; }

.patient-identification-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: start; }
.patient-identification-layout > .patient-photo-card { grid-column: 2; grid-row: 1; margin-top: .75rem; }
.patient-identification-group { grid-column: 1; grid-row: 1; min-width: 0; margin-bottom: 0; }
.patient-editor-layout { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.patient-editor-content { min-width: 0; }
.patient-tools { padding-inline-end: 1rem; border-inline-end: 1px solid var(--bs-border-color); }
.patient-tools-menu { display: grid; gap: .5rem; }
.patient-tool { display: flex; align-items: center; gap: .6rem; min-height: 2.5rem; padding: .5rem .65rem; text-align: start; border-radius: .5rem; }
.patient-tool i { flex-shrink: 0; font-size: 1rem; }
.user-header-avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; overflow: hidden; background: var(--bs-secondary-bg); color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); }
.user-header-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.modal[id^="patient-"] .modal-footer { gap: .5rem; }
.modal[id^="patient-"] .modal-footer > * { margin: 0; }
.modal[id^="patient-"] .modal-footer > div:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
@media (max-width: 1199.98px) {
  .patient-editor-layout { grid-template-columns: minmax(0, 1fr); }
  .patient-tools { padding-inline-end: 0; padding-bottom: 1rem; border-inline-end: 0; border-bottom: 1px solid var(--bs-border-color); }
  .patient-tools-menu { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 767.98px) {
  .patient-identification-layout { grid-template-columns: minmax(0, 1fr); }
  .patient-identification-layout > .patient-photo-card { grid-column: 1; grid-row: 2; margin-top: 0; }
}
