:root {
  --app-bg: #07111f;
  --app-bg-soft: #0d1b2c;
  --app-surface: rgba(9, 18, 34, 0.78);
  --app-surface-light: rgba(255, 255, 255, 0.08);
  --app-border: rgba(255, 255, 255, 0.12);
  --app-text: #e7edf7;
  --app-text-muted: #a8b5ca;
  --app-primary: #35c7a3;
  --app-primary-dark: #1ea986;
  --app-accent: #67a7ff;
  --app-danger: #ff7e8a;
  --app-shadow: 0 24px 80px rgba(1, 8, 20, 0.45);
  --scrollbar-size: 10px;
  --scrollbar-radius: 999px;
  --scrollbar-thumb: rgba(22, 56, 102, 0.34);
  --scrollbar-thumb-hover: rgba(22, 56, 102, 0.58);
  --scrollbar-track: rgba(19, 41, 72, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--app-text);
  background:
    radial-gradient(circle at top left, rgba(103, 167, 255, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(53, 199, 163, 0.16), transparent 24%),
    linear-gradient(135deg, #06101d 0%, #0a1728 50%, #0f1f36 100%);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  background: rgba(5, 12, 24, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.app-header-inner,
.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-header-inner {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--app-text);
}

.app-brand strong,
.app-brand small {
  display: block;
}

.app-brand strong {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-brand small,
.app-nav a,
.app-footer {
  color: var(--app-text-muted);
}

.app-brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  color: #04101d;
  font-size: 1.45rem;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(53, 199, 163, 0.28);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-nav a {
  padding: 0.6rem 1rem;
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.app-nav a:hover {
  color: var(--app-text);
  background: rgba(255, 255, 255, 0.06);
}

.app-main {
  flex: 1;
}

.page-container {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.app-footer {
  padding: 1rem 0 1.5rem;
  font-size: 0.9rem;
}

.auth-page {
  background: #f5f5f5;
}

.auth-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 12px 40px rgba(0, 0, 0, 0.08);
  padding: 2.75rem 2.5rem 2.25rem;
}

.auth-card-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.auth-card-logo-icon {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: #0f6cbd;
  color: #ffffff;
}

.auth-card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-card-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  color: #1b1b1b;
  letter-spacing: -0.01em;
}

.auth-card-header p {
  margin: 0;
  font-size: 0.9rem;
  color: #616161;
  font-weight: 400;
}

.auth-form {
  display: grid;
  gap: 1.25rem;
}

.auth-field-group {
  display: grid;
  gap: 0.5rem;
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-field-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #242424;
}

.auth-forgot-link {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 500;
  color: #0f6cbd;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s;
}

.auth-forgot-link:hover,
.auth-forgot-link[aria-expanded="true"] {
  color: #0a548a;
  text-decoration: underline;
}

.auth-forgot-link:focus-visible {
  outline: 2px solid rgba(15, 108, 189, 0.2);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

.auth-input-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 0.875rem;
  color: #9e9e9e;
  pointer-events: none;
  flex-shrink: 0;
}

.auth-input {
  width: 100%;
  height: 2.875rem;
  padding: 0 0.875rem 0 2.75rem;
  border: 1px solid #d1d1d1;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #1b1b1b;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input::placeholder {
  color: #afafaf;
  font-weight: 400;
}

.auth-input:hover {
  border-color: #b0b0b0;
}

.auth-input:focus {
  border-color: #0f6cbd;
  box-shadow: 0 0 0 1px #0f6cbd;
}

.auth-input-shell-password .auth-input {
  padding-right: 3rem;
}

.auth-password-toggle {
  position: absolute;
  right: 0.5rem;
  width: 2.125rem;
  height: 2.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: #9e9e9e;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-password-toggle:hover {
  background: #f5f5f5;
  color: #616161;
}

.auth-password-toggle.is-visible {
  color: #0f6cbd;
}

.auth-password-toggle.is-visible .auth-eye-open {
  display: none;
}

.auth-password-toggle.is-visible .auth-eye-closed {
  display: block !important;
}

.auth-error-msg {
  background: #fef0f1;
  color: #c4314b;
  border: 1px solid #eeacb2;
  border-radius: 0.5rem;
  padding: 0.7rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
}

.auth-submit-btn {
  width: 100%;
  height: 2.875rem;
  margin-top: 0.5rem;
  border: none;
  border-radius: 0.5rem;
  background: #0f6cbd;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-submit-btn:hover {
  background: #0a548a;
}

.auth-submit-btn:active {
  background: #084272;
}

.auth-submit-btn:focus-visible {
  outline: 2px solid #0f6cbd;
  outline-offset: 2px;
}

.auth-submit-btn:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
}

.auth-forgot-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #dce9f8;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 100%);
  display: grid;
  gap: 1rem;
}

.auth-forgot-panel-header {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.auth-forgot-panel-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #17365f;
}

.auth-forgot-panel-header p {
  margin: 0;
  color: #60758f;
  font-size: 0.84rem;
}

.auth-forgot-panel-icon {
  width: 2.6rem;
  height: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #0f6cbd 0%, #35c7a3 100%);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 12px 24px rgba(15, 108, 189, 0.18);
}

.auth-forgot-steps {
  display: grid;
  gap: 0.7rem;
}

.auth-forgot-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.8rem 0.85rem;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 108, 189, 0.08);
}

.auth-forgot-step > span {
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #0f6cbd;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.auth-forgot-step strong,
.auth-forgot-note strong {
  display: block;
  color: #17365f;
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-forgot-step small,
.auth-forgot-note span {
  display: block;
  margin-top: 0.2rem;
  color: #60758f;
  font-size: 0.8rem;
  line-height: 1.45;
}

.auth-forgot-note {
  padding: 0.85rem 0.9rem;
  border-radius: 0.8rem;
  background: rgba(15, 108, 189, 0.06);
  border: 1px dashed rgba(15, 108, 189, 0.2);
}

.auth-card-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e8e8e8;
  text-align: center;
  font-size: 0.78rem;
  color: #9e9e9e;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus,
.auth-password-toggle:focus {
  box-shadow: 0 0 0 0.1rem rgba(247, 248, 252, 0.9), 0 0 0 0.25rem rgba(15, 108, 189, 0.18);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  text-align: start;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.5rem 1.75rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
  }

  .auth-card-header h1 {
    font-size: 1.4rem;
  }

  .auth-label-row,
  .auth-forgot-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

.dashboard-page {
  background: #eef3f9;
  color: #2d3a4a;
  overflow-x: hidden;
}

.master-shell {
  min-height: 100vh;
  position: relative;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: linear-gradient(180deg, #edf3fb 0%, #f7faff 100%);
}

.master-sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  width: 280px;
  max-width: calc(100vw - 2rem);
  height: 100dvh;
  padding: 1rem;
  background: linear-gradient(180deg, #0a2341 0%, #143865 56%, #173f72 100%);
  color: #d8e4f3;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 24px 0 50px rgba(7, 20, 39, 0.18);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 1040;
}

.master-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 0.9rem;
}

.master-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
  min-width: 0;
  padding: 0;
  color: #fff;
  font-size: 0.82rem;
}

.master-sidebar-close {
  width: 2.3rem;
  height: 2.3rem;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.master-sidebar-brand-icon {
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.55rem;
  background: #efc14b;
  color: #0d2748;
  font-size: 0.8rem;
  font-weight: 800;
}

.master-sidebar-brand strong,
.master-sidebar-brand small {
  display: block;
}

.master-sidebar-brand small,
.master-sidebar-label {
  color: rgba(216, 228, 243, 0.6);
}

.master-sidebar-nav {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 1.4rem;
  padding: 0.25rem 0.1rem 1rem;
  overflow-y: auto;
}

.master-sidebar-group {
  display: grid;
  gap: 0.35rem;
}

.master-sidebar-label {
  padding: 0 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.master-sidebar-group a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.85rem;
  padding: 0.72rem 0.9rem;
  color: #d8e4f3;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 0.9rem;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.master-sidebar-group a:hover,
.master-sidebar-group a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(239, 193, 75, 0.18);
  transform: translateX(2px);
}

.master-nav-icon {
  width: 0.85rem;
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.9;
}

.master-sidebar-footer {
  display: grid;
  flex: 0 0 auto;
  gap: 0.8rem;
  margin-top: auto;
  padding-top: 1rem;
  background: linear-gradient(180deg, rgba(10, 35, 65, 0) 0%, rgba(23, 63, 114, 0.92) 18%, rgba(23, 63, 114, 1) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.master-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.2rem;
}

.master-sidebar-user strong,
.master-sidebar-user small {
  display: block;
}

.master-sidebar-user strong {
  color: #fff;
  font-size: 0.82rem;
}

.master-sidebar-user small {
  color: rgba(216, 228, 243, 0.68);
  font-size: 0.68rem;
}

.master-signout {
  margin: 0;
  min-height: 2.9rem;
  padding: 0.75rem 0.95rem;
  border: none;
  border-radius: 0.85rem;
  background: #ffe2de;
  color: #d85a46;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  width: 100%;
}

.master-main-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: transparent;
  overflow-x: clip;
  overflow-y: visible;
}

.master-topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  padding: 1.2rem 1.5rem 1rem;
  background: rgba(247, 250, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(20, 56, 101, 0.08);
  box-shadow: 0 10px 24px rgba(18, 45, 82, 0.06);
  color: #17365f;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.master-topbar-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}

.master-topbar-secondary {
  width: 100%;
  min-width: 0;
}

.master-topbar-start,
.master-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.master-topbar-actions {
  margin-left: auto;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.master-topbar-start {
  min-width: 0;
  flex: 1 1 auto;
}

.master-nav-toggle {
  width: 2.9rem;
  height: 2.9rem;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  border: 0;
  border-radius: 0.9rem;
  background: #173f72;
  color: #fff;
  box-shadow: 0 10px 20px rgba(23, 63, 114, 0.18);
  cursor: pointer;
}

.master-nav-toggle span {
  width: 1.1rem;
  height: 0.12rem;
  border-radius: 999px;
  background: currentColor;
}

.master-topbar-page {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.master-topbar-page-label {
  color: #6e7f95;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.master-topbar-page strong {
  color: #17365f;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}

.master-topbar-page small {
  color: #7d8ea3;
  font-size: 0.8rem;
  line-height: 1.5;
}

.master-topbar-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 2.8rem;
  min-width: 7.75rem;
  padding: 0.45rem 0.9rem;
  border-radius: 0.9rem;
  background: #ffffff;
  color: #17365f;
  border: 1px solid #e6edf7;
  box-shadow: 0 10px 20px rgba(18, 45, 82, 0.05);
  line-height: 1.3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.master-scrollbar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.8rem;
  padding: 0.45rem 0.8rem;
  border: 0;
  border-radius: 0.9rem;
  background: #ffffff;
  color: #17365f;
  border: 1px solid #e6edf7;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.master-scrollbar-toggle:hover {
  background: #f0f6ff;
  transform: translateY(-1px);
}

.master-scrollbar-toggle[aria-pressed="true"] {
  background: #fff5d8;
  color: #8a6400;
}

.master-scrollbar-toggle-icon {
  font-size: 0.9rem;
}

.master-scrollbar-toggle-text {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.master-topbar-clock strong {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.master-topbar-clock small {
  font-size: 0.6rem;
  color: #7d8ea3;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.master-topbar-shift {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.45rem;
  min-height: 2.8rem;
  min-width: 10rem;
  padding: 0.45rem 0.9rem;
  border-radius: 0.9rem;
  background: #ffffff;
  border: 1px solid #e6edf7;
  box-shadow: 0 10px 20px rgba(18, 45, 82, 0.05);
  line-height: 1.3;
}

.master-topbar-shift .shift-icon {
  font-size: 1rem;
}

.master-topbar-shift .shift-info {
  display: flex;
  flex-direction: column;
}

.master-topbar-shift .shift-info strong {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.master-topbar-shift .shift-info small {
  font-size: 0.6rem;
  color: #7d8ea3;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.master-profile-pill {
  flex: 0 0 auto;
  min-width: 11rem;
}

.master-topbar-shift[data-shift-type="morning"] {
  background: rgba(255, 183, 77, 0.18);
}

.master-topbar-shift[data-shift-type="evening"] {
  background: rgba(129, 162, 255, 0.18);
}

.master-topbar-shift[data-shift-type="night"] {
  background: rgba(149, 117, 205, 0.18);
}

.master-topbar-shift.no-shift {
  opacity: 0.5;
}

.master-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.85rem;
  margin-left: 0;
  min-width: 0;
}

.master-topbar-logo {
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: #143865;
  font-size: 0.82rem;
  font-weight: 800;
}

.master-topbar-brand strong,
.master-topbar-brand small {
  display: block;
}

.master-topbar-brand small,
.master-topbar-meta {
  color: rgba(255, 255, 255, 0.74);
}

.master-topbar-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.75rem;
  text-align: center;
}

.master-profile-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  min-height: 2.8rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: #ffffff;
  color: #17365f;
  border: 1px solid #e6edf7;
  box-shadow: 0 10px 20px rgba(18, 45, 82, 0.05);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.master-profile-pill:hover,
.master-profile-pill[aria-expanded="true"] {
  background: #f0f6ff;
  border-color: #cfe0f3;
}

.master-profile-pill:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.18), 0 10px 20px rgba(18, 45, 82, 0.05);
}

.master-profile-pill > span {
  display: flex;
  flex-direction: column;
}

.master-profile-menu {
  position: relative;
  flex: 0 0 auto;
}

.master-profile-dropdown {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: min(19rem, 90vw);
  padding: 0;
  border-radius: 0.5rem;
  background: #ffffff;
  border: 1px solid #e6edf7;
  box-shadow: 0 20px 40px rgba(18, 45, 82, 0.12);
  z-index: 1100;
  overflow: hidden;
}

.master-profile-dropdown-body {
  display: block;
  padding: 1rem;
}

.master-profile-dropdown-loading,
.master-profile-dropdown-error {
  color: #6e7f95;
  font-size: 0.85rem;
}

.master-profile-dropdown-error {
  color: #b42318;
}

.master-profile-dropdown-header {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.master-profile-dropdown-avatar,
.master-profile-dropdown-avatar-img {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 0.25rem;
  border: 1px solid #d5dfe9;
  background: #eef3f9;
}

.master-profile-dropdown-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #143865;
  font-size: 1.6rem;
  font-weight: 800;
}

.master-profile-dropdown-avatar-img {
  object-fit: cover;
}

.master-profile-dropdown-heading {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  padding-top: 0.15rem;
}

.master-profile-dropdown-heading strong {
  color: #17365f;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.master-profile-dropdown-heading small {
  color: #4f5f74;
  font-size: 0.78rem;
}

.master-profile-dropdown-meta {
  color: #7d8ea3;
  font-size: 0.74rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.master-profile-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.master-profile-dropdown-grid > div {
  display: grid;
  gap: 0.18rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.85rem;
  background: #f8fbff;
  border: 1px solid #edf3fa;
}

.master-profile-dropdown-grid span {
  color: #7d8ea3;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.master-profile-dropdown-grid strong {
  color: #17365f;
  font-size: 0.82rem;
  line-height: 1.4;
  word-break: break-word;
}

.master-profile-dropdown-grid-full {
  grid-column: 1 / -1;
}

.master-profile-dropdown-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 0;
  padding: 0.7rem 0.5rem;
  border-top: 1px solid #edf3fa;
}

.master-profile-dropdown-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.3rem;
  padding: 0.4rem 0.55rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #3d4654;
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.master-profile-dropdown-link:hover {
  background: transparent;
  color: #1f6fb2;
}

.master-profile-dropdown-link-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.master-profile-dropdown-link.danger {
  background: transparent;
  color: #3d4654;
  border-color: transparent;
}

.master-profile-dropdown-link.danger:hover {
  color: #c83f3f;
}

.account-profile-card {
  display: grid;
  gap: 1.25rem;
}

.account-profile-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #edf3fa;
}

.account-profile-avatar,
.account-profile-avatar-img {
  width: 5rem;
  height: 5rem;
  border-radius: 1.2rem;
  background: #eef3f9;
  border: 1px solid #d5dfe9;
}

.account-profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #143865;
  font-size: 2rem;
  font-weight: 800;
}

.account-profile-avatar-img {
  object-fit: cover;
}

.account-profile-hero h2 {
  margin: 0;
  color: #17365f;
  font-size: 1.2rem;
}

.account-profile-hero p {
  margin: 0.2rem 0 0;
}

.account-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.account-profile-note {
  margin: 0;
  color: #7d8ea3;
  font-size: 0.78rem;
}

.account-profile-readonly {
  background: #f8fbff;
}

.master-profile-avatar {
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: #143865;
  font-size: 0.72rem;
  font-weight: 800;
}

.master-profile-avatar-img {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.master-profile-pill strong,
.master-profile-pill small {
  display: block;
}

.master-profile-pill small {
  color: #7d8ea3;
  font-size: 0.6rem;
}

.master-content-shell {
  flex: 1 1 auto;
  min-height: calc(100dvh - 5.75rem);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.master-content {
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
  padding: 1.5rem;
  overflow-x: hidden;
}

.master-footer {
  display: flex;
  margin-top: auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem 1.25rem;
  color: #7d8ea3;
  font-size: 0.78rem;
}

.master-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 17, 31, 0.48);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1035;
}

.master-sidebar,
.master-sidebar-nav,
.master-main-shell,
.master-content,
.table-responsive,
.shift-table-wrap {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  scrollbar-gutter: stable;
}

.master-sidebar::-webkit-scrollbar,
.master-sidebar-nav::-webkit-scrollbar,
.master-main-shell::-webkit-scrollbar,
.master-content::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
.shift-table-wrap::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

.master-sidebar::-webkit-scrollbar-track,
.master-sidebar-nav::-webkit-scrollbar-track,
.master-main-shell::-webkit-scrollbar-track,
.master-content::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
.shift-table-wrap::-webkit-scrollbar-track {
  background: transparent;
  border-radius: var(--scrollbar-radius);
}

.master-sidebar::-webkit-scrollbar-thumb,
.master-sidebar-nav::-webkit-scrollbar-thumb,
.master-main-shell::-webkit-scrollbar-thumb,
.master-content::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
.shift-table-wrap::-webkit-scrollbar-thumb {
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--scrollbar-radius);
  background-clip: padding-box;
}

.master-sidebar:hover,
.master-sidebar:focus-within,
.master-sidebar-nav:hover,
.master-sidebar-nav:focus-within,
.master-main-shell:hover,
.master-main-shell:focus-within,
.master-content:hover,
.master-content:focus-within,
.table-responsive:hover,
.table-responsive:focus-within,
.shift-table-wrap:hover,
.shift-table-wrap:focus-within {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.master-sidebar:hover::-webkit-scrollbar-track,
.master-sidebar:focus-within::-webkit-scrollbar-track,
.master-sidebar-nav:hover::-webkit-scrollbar-track,
.master-sidebar-nav:focus-within::-webkit-scrollbar-track,
.master-main-shell:hover::-webkit-scrollbar-track,
.master-main-shell:focus-within::-webkit-scrollbar-track,
.master-content:hover::-webkit-scrollbar-track,
.master-content:focus-within::-webkit-scrollbar-track,
.table-responsive:hover::-webkit-scrollbar-track,
.table-responsive:focus-within::-webkit-scrollbar-track,
.shift-table-wrap:hover::-webkit-scrollbar-track,
.shift-table-wrap:focus-within::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.master-sidebar:hover::-webkit-scrollbar-thumb,
.master-sidebar:focus-within::-webkit-scrollbar-thumb,
.master-sidebar-nav:hover::-webkit-scrollbar-thumb,
.master-sidebar-nav:focus-within::-webkit-scrollbar-thumb,
.master-main-shell:hover::-webkit-scrollbar-thumb,
.master-main-shell:focus-within::-webkit-scrollbar-thumb,
.master-content:hover::-webkit-scrollbar-thumb,
.master-content:focus-within::-webkit-scrollbar-thumb,
.table-responsive:hover::-webkit-scrollbar-thumb,
.table-responsive:focus-within::-webkit-scrollbar-thumb,
.shift-table-wrap:hover::-webkit-scrollbar-thumb,
.shift-table-wrap:focus-within::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

.master-sidebar::-webkit-scrollbar-thumb:hover,
.master-sidebar-nav::-webkit-scrollbar-thumb:hover,
.master-main-shell::-webkit-scrollbar-thumb:hover,
.master-content::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover,
.shift-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.dashboard-page.scrollbars-visible .master-sidebar,
.dashboard-page.scrollbars-visible .master-sidebar-nav,
.dashboard-page.scrollbars-visible .master-main-shell,
.dashboard-page.scrollbars-visible .master-content,
.dashboard-page.scrollbars-visible .table-responsive,
.dashboard-page.scrollbars-visible .shift-table-wrap {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.dashboard-page.scrollbars-visible .master-sidebar::-webkit-scrollbar-track,
.dashboard-page.scrollbars-visible .master-sidebar-nav::-webkit-scrollbar-track,
.dashboard-page.scrollbars-visible .master-main-shell::-webkit-scrollbar-track,
.dashboard-page.scrollbars-visible .master-content::-webkit-scrollbar-track,
.dashboard-page.scrollbars-visible .table-responsive::-webkit-scrollbar-track,
.dashboard-page.scrollbars-visible .shift-table-wrap::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

.dashboard-page.scrollbars-visible .master-sidebar::-webkit-scrollbar-thumb,
.dashboard-page.scrollbars-visible .master-sidebar-nav::-webkit-scrollbar-thumb,
.dashboard-page.scrollbars-visible .master-main-shell::-webkit-scrollbar-thumb,
.dashboard-page.scrollbars-visible .master-content::-webkit-scrollbar-thumb,
.dashboard-page.scrollbars-visible .table-responsive::-webkit-scrollbar-thumb,
.dashboard-page.scrollbars-visible .shift-table-wrap::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

.master-dashboard-page {
  display: grid;
  gap: 1.25rem;
}

.master-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.master-page-header h1 {
  margin: 0;
  color: #17365f;
  font-size: 1.3rem;
}

.master-page-header p {
  margin: 0.15rem 0 0;
  color: #7d8ea3;
  font-size: 0.78rem;
}

.master-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.master-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.5rem 0.85rem;
  border-radius: 0.6rem;
  background: #ffffff;
  color: #17365f;
  border: 1px solid #dfe8f3;
  font-size: 0.78rem;
  font-weight: 700;
}

.master-toolbar-btn.primary {
  background: #173f72;
  color: #fff;
  border-color: #173f72;
}

.master-toolbar-btn.danger-outline {
  background: #fff5f4;
  color: #c83f3f;
  border-color: #f3c6c6;
}

.master-toolbar-btn.danger-outline:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.master-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.master-stat-card,
.master-card {
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 8px 24px rgba(18, 45, 82, 0.08);
}

.master-stat-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1rem;
  border-left: 4px solid transparent;
}

.master-stat-card.navy { border-left-color: #173f72; }
.master-stat-card.gold { border-left-color: #efc14b; }
.master-stat-card.green { border-left-color: #2bb673; }
.master-stat-card.red { border-left-color: #ef5a4c; }

.master-stat-icon {
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
}

.master-stat-card.navy .master-stat-icon { background: #173f72; }
.master-stat-card.gold .master-stat-icon { background: #efc14b; color: #684d00; }
.master-stat-card.green .master-stat-icon { background: #2bb673; }
.master-stat-card.red .master-stat-icon { background: #ef5a4c; }

.master-stat-card strong {
  display: block;
  color: #17365f;
  font-size: 1.45rem;
  line-height: 1;
}

.master-stat-card span,
.master-stat-card small,
.master-card p,
.master-mini-list span,
.master-table td,
.master-table th {
  color: #7d8ea3;
}

.master-stat-card span,
.master-stat-card small {
  display: block;
  font-size: 0.78rem;
}

.master-stat-card small {
  margin-top: 0.25rem;
  color: #26a65b;
  font-size: 0.7rem;
  font-weight: 600;
}

.master-dashboard-grid,
.master-dashboard-bottom {
  display: grid !important;
  gap: 1rem;
}

.master-secondary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.master-dashboard-grid {
  grid-template-columns: minmax(0, 1.85fr) minmax(280px, 0.95fr);
}

.master-dashboard-bottom {
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
}

.master-card {
  padding: 1rem;
}

.master-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.master-card-header h2 {
  margin: 0;
  color: #17365f;
  font-size: 1rem;
}

.master-card-badge {
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: #e9f2ff;
  color: #2a5b97;
  font-size: 0.68rem;
  font-weight: 700;
}

.master-card-badge.soft {
  background: #fff2cc;
  color: #b37e00;
}

.master-table {
  width: 100%;
}

.master-table th,
.master-table td {
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  font-size: 0.78rem;
}

.master-table thead th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.master-table tbody tr:last-child td {
  border-bottom: 0;
}

.master-status {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
}

.master-status.pending {
  background: #fff3d6;
  color: #b98600;
}

.master-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.master-action-tile {
  min-height: 4.5rem;
  display: grid;
  place-items: center;
  gap: 0.25rem;
  padding: 0.75rem;
  text-align: center;
  border-radius: 0.75rem;
  border: 1px solid #e8edf5;
  background: #f8fbff;
  color: #17365f;
  font-size: 0.78rem;
  font-weight: 700;
}

.master-action-tile span {
  font-size: 1rem;
}

.master-chart-placeholder {
  padding: 1rem;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #f8fbff 0%, #eef3f9 100%);
}

.master-chart-bars {
  height: 15rem;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 0.9rem;
}

.master-chart-bars div {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.master-chart-bars span {
  width: 100%;
  border-radius: 0.8rem 0.8rem 0.25rem 0.25rem;
  background: linear-gradient(180deg, #5aa6ff, #1f63d1);
}

.master-chart-bars small {
  color: #7d8ea3;
  font-size: 0.68rem;
  font-weight: 700;
}

.master-bottom-side {
  display: grid;
  gap: 1rem;
}

.master-ward-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.master-ward-card {
  padding: 0.8rem;
  border-radius: 0.75rem;
  background: #f8fbff;
  border: 1px solid #e8edf5;
  font-size: 0.78rem;
}

.master-ward-card strong,
.master-alert-item strong {
  display: block;
  color: #17365f;
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
}

.master-ward-card span,
.master-alert-item span {
  color: #7d8ea3;
  font-size: 0.75rem;
}

.master-progress {
  height: 0.55rem;
  margin-top: 0.9rem;
  border-radius: 999px;
  overflow: hidden;
  background: #e7eef7;
}

.master-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5aa6ff, #1f63d1);
}

@media (max-width: 1199.98px) {
  .master-dashboard-grid,
  .master-dashboard-bottom,
  .master-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .master-topbar {
    flex-wrap: wrap;
  }

  .master-footer {
    flex-wrap: wrap;
  }
}

@media (max-width: 991.98px) {
  .master-shell {
    display: block;
  }

  .master-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(290px, 86vw);
    max-width: 86vw;
    transform: translateX(-105%);
    box-shadow: 24px 0 50px rgba(7, 20, 39, 0.28);
  }

  .dashboard-page.sidebar-open {
    overflow: hidden;
  }

  .dashboard-page.sidebar-open .master-sidebar {
    transform: translateX(0);
  }

  .dashboard-page.sidebar-open .master-sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .master-nav-toggle,
  .master-sidebar-close {
    display: inline-flex;
  }

  .master-main-shell {
    min-height: 100vh;
  }

  .master-topbar {
    padding: 0.95rem 1rem;
  }

  .master-topbar-page {
    max-width: 100%;
  }

  .master-topbar-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .master-topbar-clock,
  .master-topbar-shift {
    align-items: flex-start;
  }

  .master-stat-grid,
  .master-dashboard-grid,
  .master-dashboard-bottom,
  .master-secondary-grid,
  .master-ward-grid,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-menu {
    position: static;
    top: auto;
  }
}

@media (max-width: 767.98px) {
  .master-content {
    padding: 1rem;
  }

  .master-topbar {
    gap: 0.85rem;
  }

  .master-topbar-page strong {
    font-size: 1.05rem;
  }

  .master-topbar-page small {
    font-size: 0.76rem;
  }

  .master-topbar-actions {
    justify-content: stretch;
  }

  .master-scrollbar-toggle,
  .master-topbar-clock,
  .master-topbar-shift,
  .master-profile-menu,
  .master-profile-pill {
    width: 100%;
  }

  .master-scrollbar-toggle,
  .master-topbar-clock,
  .master-topbar-shift,
  .master-profile-pill {
    justify-content: flex-start;
    border-radius: 1rem;
  }

  .master-profile-dropdown {
    width: 100%;
    left: 0;
    right: auto;
  }

  .master-profile-dropdown-grid {
    grid-template-columns: 1fr;
  }

  .account-profile-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .master-page-header,
  .patient-summary-strip,
  .settings-logo-card,
  .settings-logo-actions,
  .settings-form-actions,
  .patient-form-actions,
  .master-toolbar-actions,
  .app-header-inner,
  .app-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .master-toolbar-btn,
  .settings-btn,
  .patient-form-actions .master-toolbar-btn {
    width: 100%;
    min-height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .master-card,
  .patient-form-section,
  .settings-section {
    padding: 1rem;
  }

  .master-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 1rem 1rem;
  }

  .master-stat-grid {
    grid-template-columns: 1fr;
  }

  .app-nav {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 575.98px) {
  .master-topbar-clock,
  .master-topbar-shift,
  .master-profile-pill {
    padding-inline: 0.85rem;
  }

  .master-profile-pill > span {
    min-width: 0;
  }

  .master-sidebar {
    width: min(280px, 88vw);
    max-width: 88vw;
  }
}

.master-alert-list {
  display: grid;
  gap: 0.85rem;
}

.master-alert-item {
  padding: 0.75rem;
  border-radius: 0.7rem;
  border: 1px solid #e8edf5;
  background: #f8fbff;
  font-size: 0.78rem;
}

.master-alert-item.warning {
  border-left: 4px solid #efc14b;
}

.master-alert-item.danger {
  border-left: 4px solid #ef5a4c;
}

.master-alert-item.info {
  border-left: 4px solid #2a74d6;
}

.master-mini-list {
  display: grid;
  gap: 0.9rem;
}

.master-mini-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #edf2f7;
}

.master-mini-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.master-mini-list strong {
  color: #17365f;
  font-size: 0.82rem;
}

.master-mini-list span {
  font-size: 0.75rem;
}

/* ── Settings Page ── */

.settings-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.settings-menu {
  position: sticky;
  top: 0;
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 0;
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: 0 6px 20px rgba(18, 45, 82, 0.07);
  align-self: start;
  height: fit-content;
  margin-top: 0;
}

.settings-menu-label {
  display: block;
  padding: 0 1rem 0.65rem;
  color: #143865;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  color: #4a5a72;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.settings-menu-item:hover {
  color: #143865;
  background: #f0f5fc;
}

.settings-menu-item.active {
  color: #143865;
  background: #e2edfc;
  border-left: 3px solid #143865;
  padding-left: calc(1rem - 3px);
  font-weight: 700;
}

.settings-menu-icon {
  width: 0.9rem;
  text-align: center;
  font-size: 0.82rem;
  opacity: 0.75;
}

.settings-content {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

.settings-section {
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: 0 6px 20px rgba(18, 45, 82, 0.07);
  padding: 1.25rem;
  display: none;
  margin: 0;
}

.settings-section.active {
  display: block;
}

.settings-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #edf2f7;
}

.settings-section-icon {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  background: #e2edfc;
  color: #143865;
  font-size: 0.95rem;
  font-weight: 800;
}

.settings-section-header h2 {
  margin: 0;
  color: #17365f;
  font-size: 1rem;
  font-weight: 700;
}

.settings-section-header p {
  margin: 0.15rem 0 0;
  color: #7d8ea3;
  font-size: 0.75rem;
}

.settings-logo-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.15rem;
  border: 2px dashed #d5dfe9;
  border-radius: 0.85rem;
  margin-bottom: 1.25rem;
}

.settings-logo-preview {
  flex-shrink: 0;
  width: 5.5rem;
  height: 5.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: #eef3f9;
  border: 1px solid #d5dfe9;
  overflow: hidden;
}

.settings-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-logo-placeholder {
  color: #143865;
  font-size: 1.8rem;
  font-weight: 800;
}

.settings-logo-info strong {
  display: block;
  color: #17365f;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
}

.settings-logo-info p {
  margin: 0 0 0.65rem;
  color: #7d8ea3;
  font-size: 0.75rem;
  line-height: 1.5;
}

.settings-logo-info small {
  display: block;
  margin-top: 0.55rem;
  color: #9aa7bc;
  font-size: 0.68rem;
}

.settings-logo-actions {
  display: flex;
  gap: 0.5rem;
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid #d5dfe9;
  border-radius: 0.55rem;
  background: #fff;
  color: #17365f;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.settings-btn.primary {
  background: #143865;
  color: #fff;
  border-color: #143865;
}

.settings-btn.primary:hover {
  background: #1a4c8b;
}

.settings-btn.danger-outline {
  color: #d85a46;
  border-color: #f5c6bf;
}

.settings-btn.danger-outline:hover {
  background: #fff5f4;
}

.settings-btn.btn-sm {
  padding: 0.42rem 0.8rem;
  min-height: 2.1rem;
  border-radius: 0.5rem;
  font-size: 0.76rem;
  line-height: 1;
  justify-content: center;
}

.settings-form {
  display: grid;
  gap: 1rem;
}

.settings-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.settings-field {
  display: grid;
  gap: 0.3rem;
}

.settings-field label {
  color: #4a5a72;
  font-size: 0.75rem;
  font-weight: 700;
}

.settings-field input,
.settings-field select,
.settings-field textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #dfe8f3;
  border-radius: 0.55rem;
  background: #f8fbff;
  color: #1c2c45;
  font-size: 0.82rem;
  font-family: inherit;
}

/* ── Patient Registration ── */

.patient-template-page {
  gap: 1.5rem;
}

.patient-template-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  gap: 1.25rem;
  padding: 1.4rem;
  background: linear-gradient(135deg, #173f72 0%, #224f8d 54%, #f7fbff 54%, #ffffff 100%);
  overflow: hidden;
}

.patient-template-hero-single {
  grid-template-columns: 1fr;
}

.patient-template-hero-copy {
  display: grid;
  align-content: center;
  gap: 0.55rem;
  color: #fff;
}

.patient-template-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.patient-template-hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.patient-template-hero p {
  margin: 0;
  max-width: 42rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  line-height: 1.7;
}

.patient-template-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.patient-template-hero-actions .master-toolbar-btn {
  min-height: 2.95rem;
  padding: 0.65rem 1rem;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: 0 12px 28px rgba(8, 24, 47, 0.18);
}

.patient-template-hero-actions .master-toolbar-btn.primary {
  background: #ffffff;
  color: #173f72;
  border-color: #ffffff;
}

.patient-template-hero-actions .master-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.patient-template-hero-actions .master-toolbar-btn.primary:hover {
  background: #eef6ff;
  color: #173f72;
}

.patient-template-hero-stats {
  display: grid;
  gap: 0.9rem;
}

.patient-template-stat-card {
  display: grid;
  gap: 0.18rem;
  padding: 1rem 1.05rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 24px rgba(20, 56, 101, 0.08);
}

.patient-template-stat-card span,
.patient-profile-meta span,
.patient-note-grid span {
  color: #70819a;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.patient-template-stat-card strong {
  color: #17365f;
  font-size: 1.05rem;
  font-weight: 800;
}

.patient-template-stat-card small {
  color: #7d8ea3;
  font-size: 0.78rem;
}

.patient-template-stat-card.accent {
  background: #fff8e7;
}

.patient-template-stat-card.soft {
  background: #eef6ff;
}

.patient-template-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.8fr);
  gap: 1.25rem;
  align-items: start;
}

.patient-template-form-card {
  padding: 1.25rem;
}

.patient-template-sidebar {
  display: grid;
  gap: 1.25rem;
}

.patient-profile-panel,
.patient-side-card {
  padding: 1.25rem;
}

.patient-profile-panel {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.9rem;
}

.patient-profile-avatar {
  width: 5.5rem;
  height: 5.5rem;
  display: grid;
  place-items: center;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, #173f72, #4f84d9);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 800;
  box-shadow: 0 18px 36px rgba(23, 63, 114, 0.22);
}

.patient-profile-panel h2,
.patient-side-card-header h3 {
  margin: 0;
  color: #17365f;
}

.patient-profile-panel h2 {
  font-size: 1.05rem;
}

.patient-profile-panel p {
  margin: 0;
  color: #7d8ea3;
  font-size: 0.82rem;
  line-height: 1.65;
}

.patient-profile-upload {
  width: 100%;
  min-height: 2.9rem;
  border: 1px dashed #aac1e3;
  border-radius: 0.95rem;
  background: #f7fbff;
  color: #173f72;
  font-size: 0.82rem;
  font-weight: 700;
}

.patient-profile-meta,
.patient-side-list,
.patient-note-grid {
  width: 100%;
  display: grid;
  gap: 0.8rem;
}

.patient-profile-meta div,
.patient-side-list div,
.patient-note-grid div {
  padding: 0.85rem 0.95rem;
  border-radius: 0.9rem;
  background: #f8fbff;
  border: 1px solid #e4edf7;
}

.patient-profile-meta strong,
.patient-side-list strong,
.patient-note-grid strong {
  display: block;
  margin-top: 0.22rem;
  color: #17365f;
  font-size: 0.86rem;
}

.patient-side-card {
  display: grid;
  gap: 1rem;
}

.patient-side-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.patient-side-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #edf4ff;
  color: #2a5b97;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.patient-side-list span {
  display: block;
  margin-top: 0.25rem;
  color: #7d8ea3;
  font-size: 0.78rem;
  line-height: 1.55;
}

.patient-side-card-accent {
  background: linear-gradient(180deg, #fffaf0 0%, #ffffff 100%);
}

.patient-recent-card {
  padding: 1.15rem;
}

.patient-registration-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

.patient-registration-page {
  width: 100%;
  max-width: none;
  margin: 0;
}

.patient-registration-card {
  padding: 1.1rem;
}

.patient-sidebar-stack {
  display: grid;
  gap: 1.25rem;
}

.patient-form-grid {
  display: grid;
  gap: 0.85rem;
}

.patient-hero-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.15rem;
}

.patient-hero-strip div,
.patient-form-section {
  border: 1px solid #e7edf6;
  border-radius: 1rem;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fd 100%);
}

.patient-hero-strip div {
  padding: 1rem 1.05rem;
}

.patient-hero-strip strong,
.patient-section-header h3 {
  display: block;
  color: #17365f;
}

.patient-hero-strip strong {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.patient-hero-strip span,
.patient-section-header p {
  color: #66768d;
  font-size: 0.78rem;
  line-height: 1.55;
}

.patient-form-section {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
}

.patient-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.patient-section-header h3 {
  margin: 0;
  font-size: 1rem;
}

.patient-section-header p {
  margin: 0.3rem 0 0;
}

.patient-section-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: #e9f2ff;
  color: #1f63d1;
  font-size: 0.78rem;
  font-weight: 800;
}

.patient-summary-strip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.patient-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 0.5rem 0.6rem;
  border-radius: 0.6rem;
  background: #ffffff;
  border: 1px solid #e4eaf3;
  box-shadow: 0 1px 3px rgba(18, 45, 82, 0.06);
  transition: box-shadow 0.15s;
}

.patient-summary-pill:hover {
  box-shadow: 0 3px 10px rgba(18, 45, 82, 0.1);
}

.patient-summary-pill-icon {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.45rem;
  color: #fff;
  flex-shrink: 0;
}

.patient-summary-pill.navy .patient-summary-pill-icon {
  background: #173f72;
}

.patient-summary-pill.gold .patient-summary-pill-icon {
  background: #efc14b;
  color: #684d00;
}

.patient-summary-pill-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #5a6a80;
}

.patient-summary-pill-value {
  font-size: 0.82rem;
  font-weight: 800;
  color: #17365f;
  padding-left: 0.25rem;
  border-left: 2px solid #e4eaf3;
}

.patient-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.patient-form-row-wide {
  grid-column: 1 / -1;
}

.patient-field {
  display: grid;
  gap: 0.4rem;
}

.patient-field label {
  color: #4a5a72;
  font-size: 0.74rem;
  font-weight: 700;
}

.patient-input {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid #dbe5f1;
  border-radius: 0.7rem;
  background: #f8fbff;
  color: #1c2c45;
  box-shadow: none;
  font-size: 0.88rem;
}

.patient-input:focus {
  border-color: #90b2e6;
  box-shadow: 0 0 0 0.2rem rgba(20, 56, 101, 0.08);
}

.patient-textarea {
  min-height: 5rem;
  resize: vertical;
}

.patient-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: #f5f8fd;
  color: #4a5a72;
  font-size: 0.8rem;
}

.patient-checkbox-row input {
  width: 1rem;
  height: 1rem;
}

.patient-checkbox-row-inline {
  margin-bottom: 0;
}

.patient-estimation-box {
  display: grid;
  gap: 0.85rem;
  padding: 0.9rem;
  border: 1px solid #e1e9f4;
  border-radius: 0.85rem;
  background: #fbfdff;
}

.patient-age-row {
  margin-top: 0.1rem;
}

.patient-age-row-compact {
  grid-template-columns: minmax(0, 1.25fr) minmax(180px, 0.75fr);
}

.patient-field-note {
  color: #66768d;
  font-size: 0.78rem;
  line-height: 1.5;
}

.patient-live-age-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.patient-live-age-panel div {
  padding: 0.75rem 0.85rem;
  border: 1px solid #e1e9f4;
  border-radius: 0.75rem;
  background: #f5f8fd;
}

.patient-live-age-panel strong {
  display: block;
  margin-bottom: 0.3rem;
  color: #17365f;
  font-size: 0.78rem;
}

.patient-live-age-panel span {
  color: #66768d;
  font-size: 0.8rem;
}

.patient-input:disabled {
  background: #eef3f9;
  opacity: 0.85;
}

.patient-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.patient-validation-summary ul {
  margin-bottom: 0;
  padding-left: 1.2rem;
}

.patient-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 6px 20px rgba(18, 45, 82, 0.07);
}

.patient-alert strong,
.patient-alert span,
.patient-empty-state,
.patient-table td small {
  display: block;
}

.patient-alert.success {
  border-left: 4px solid #23b26f;
}

.patient-alert.warning {
  border-left: 4px solid #efc14b;
}

.patient-alert-badge {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: #e6f7ef;
  color: #0d7a49;
  font-size: 0.8rem;
  font-weight: 800;
}

.patient-mini-list div {
  align-items: start;
}

.patient-mini-list span {
  text-align: right;
}

.patient-table td strong {
  display: block;
  color: #17365f;
}

.patient-table td small {
  margin-top: 0.2rem;
  color: #7d8ea3;
}

.patient-empty-state {
  padding: 1rem;
  border-radius: 0.85rem;
  background: #f8fbff;
  color: #7d8ea3;
  font-size: 0.82rem;
  text-align: center;
}

.patient-registration-modal .modal-content {
  border: 0;
  border-radius: 0.2rem;
  overflow: hidden;
  box-shadow: 0 32px 90px rgba(6, 16, 29, 0.38);
  background: #f7fafe;
}

.patient-registration-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #173f72 0%, #1f5fae 58%, #35c7a3 100%);
  color: #fff;
  border-bottom: 0;
  padding: 0.75rem 1rem;
}

.patient-registration-modal .modal-title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}

.patient-modal-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  line-height: 1;
  background: transparent;
}

.patient-registration-modal .modal-body {
  padding: 0.95rem 0.9rem 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.patient-precheck-modal .modal-dialog {
  max-width: 680px;
}

.patient-precheck-body {
  display: grid;
  gap: 1rem;
}

.patient-precheck-copy {
  color: #60758f;
  font-size: 0.84rem;
  line-height: 1.5;
}

.patient-precheck-grid {
  margin: 0;
}

.patient-precheck-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.patient-precheck-btn {
  min-width: 9rem;
  height: 2.4rem;
  border: 0;
  padding: 0 1rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.patient-precheck-btn.primary {
  background: linear-gradient(135deg, #173f72 0%, #1f5fae 60%, #35c7a3 100%);
  color: #fff;
}

.patient-precheck-btn.secondary {
  background: #eaf1fb;
  color: #17365f;
}

.patient-modal-form {
  display: grid;
  gap: 0.9rem;
}

.patient-modal-grid {
  display: grid;
  gap: 0.95rem;
}

.patient-modal-row {
  display: grid;
  gap: 0.75rem;
  align-items: start;
}

.patient-modal-row-single {
  grid-template-columns: minmax(0, 1fr);
}

.patient-modal-row-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.patient-modal-row-three {
  grid-template-columns: 1fr 1fr 2fr;
}

.patient-modal-row-top {
  grid-template-columns: minmax(0, 1fr) 118px;
  align-items: start;
  column-gap: 1rem;
}

.patient-modal-top-fields {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.patient-modal-row-medical {
  grid-template-columns: minmax(220px, 360px);
}

.patient-modal-row-five {
  grid-template-columns: 0.9fr 1.05fr 1.4fr 0.85fr 0.95fr;
}

.patient-modal-validation {
  margin-bottom: 0;
}

.patient-modal-validation ul {
  margin: 0;
}

.patient-modal-alert {
  margin-bottom: 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  border-color: #c8def8;
  background: #eaf4ff;
  color: #18426f;
}

.patient-registration-modal .patient-field {
  display: grid;
  gap: 0.3rem;
  align-content: start;
}

.patient-registration-modal .patient-field label {
  display: inline-block;
  color: #464646;
  font-size: 0.78rem;
  font-weight: 600;
}

.patient-field-label-row {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 1.15rem;
}

.patient-field-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  color: #1f5fae;
  font-size: 0.82rem;
  line-height: 1;
}

.patient-required-mark {
  color: #1ea986;
  font-weight: 700;
  line-height: 1;
}

.patient-modal-input {
  width: 100%;
  height: 2.1rem;
  min-height: 2.1rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid #d6e1ef;
  border-radius: 0;
  background: #fff;
  color: #243447;
  font-size: 0.78rem;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.patient-modal-input:focus {
  border-color: #67a7ff;
  background: #fcfeff;
  box-shadow: 0 0 0 0.18rem rgba(103, 167, 255, 0.14);
}

.patient-modal-input::placeholder {
  color: #9aa1ab;
}

.patient-cnic-lookup-note {
  color: #1f5fae;
  font-size: 0.72rem;
  font-weight: 600;
}

.patient-cnic-modal-body {
  display: grid;
  gap: 0.8rem;
}

.patient-cnic-table th,
.patient-cnic-table td {
  vertical-align: middle;
  text-align: left;
}

.patient-cnic-photo-cell {
  width: 4.5rem;
}

.patient-cnic-photo {
  width: 2.8rem;
  height: 3.2rem;
  display: block;
  border-radius: 0.35rem;
  object-fit: cover;
  object-position: center top;
  background: #eef4fb;
  border: 1px solid #d8e3f0;
}

.patient-cnic-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7890ad;
  font-size: 1.1rem;
}

.patient-cnic-result-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.patient-cnic-result-row:hover {
  background: #eef5ff;
}

.patient-cnic-select-btn {
  min-width: 5.25rem;
  height: 2rem;
  border: 0;
  background: linear-gradient(135deg, #173f72 0%, #1f5fae 60%, #35c7a3 100%);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0 0.75rem;
}

.patient-cnic-select-btn:hover {
  filter: brightness(1.04);
}

.patient-modern-datepicker-input {
  padding-right: 2.2rem;
  background-image: linear-gradient(135deg, rgba(31, 95, 174, 0.08), rgba(53, 199, 163, 0.08));
}

.flatpickr-calendar {
  border: 1px solid #d9e4f2;
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 24px 50px rgba(19, 58, 107, 0.18);
  padding: 0.45rem 0.4rem 0.55rem;
}

.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after,
.flatpickr-calendar.arrowBottom::before,
.flatpickr-calendar.arrowBottom::after {
  display: none;
}

.flatpickr-months {
  align-items: center;
  padding: 0.15rem 0.2rem 0.45rem;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  top: 0.35rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  color: #173f72;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  background: #eef5ff;
  color: #1f5fae;
}

.flatpickr-current-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: #173f72;
  font-size: 0.96rem;
  font-weight: 700;
  padding-top: 0.2rem;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  font-weight: 700;
  color: #173f72;
}

.flatpickr-weekdays {
  margin-bottom: 0.2rem;
}

span.flatpickr-weekday {
  color: #6d7f97;
  font-size: 0.77rem;
  font-weight: 700;
}

.flatpickr-day {
  border-radius: 0;
  color: #213449;
  font-weight: 500;
}

.flatpickr-day:hover {
  background: #eef5ff;
  border-color: #eef5ff;
}

.flatpickr-day.today {
  border-color: #67a7ff;
  color: #1f5fae;
}

.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
  background: #eef5ff;
  border-color: #67a7ff;
  color: #1f5fae;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: linear-gradient(135deg, #173f72 0%, #1f5fae 70%, #35c7a3 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(31, 95, 174, 0.24);
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: #aab6c7;
}

.flatpickr-innerContainer,
.flatpickr-rContainer,
.flatpickr-days,
.dayContainer {
  width: 100%;
}

.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.numInputWrapper:hover,
.numInputWrapper span:hover {
  background: #eef5ff;
}

.patient-search-select {
  position: relative;
}

.settings-field .patient-search-select {
  overflow: visible;
}

.settings-field .patient-search-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  z-index: 100;
}

.patient-search-select-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  cursor: pointer;
}

.patient-search-select-display,
.patient-search-select-option {
  gap: 0.45rem;
}

.patient-search-select-display {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.patient-search-select-arrow {
  color: #6f86a7;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.patient-search-select-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  border: 1px solid #cddcf0;
  background: #fff;
  box-shadow: 0 16px 34px rgba(23, 63, 114, 0.12);
}

.patient-search-select-search {
  width: 100%;
  height: 2.1rem;
  padding: 0.3rem 0.65rem;
  border: 0;
  border-bottom: 1px solid #d9e4f2;
  color: #243447;
  font-size: 0.78rem;
  outline: none;
}

.patient-search-select-options {
  max-height: 220px;
  overflow-y: auto;
}

.patient-search-select-option,
.patient-search-select-empty {
  width: 100%;
  min-height: 2rem;
  display: flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border: 0;
  background: #fff;
  color: #243447;
  font-size: 0.78rem;
  text-align: left;
}

.patient-search-select-option {
  cursor: pointer;
}

.patient-search-select-option:hover,
.patient-search-select-option.is-selected {
  background: #eef5ff;
}

.patient-search-select-option-add {
  background: #f4fbf6;
  color: #166534;
  font-weight: 700;
  border-top: 1px dashed #c7ead1;
}

.patient-search-select-option-add:hover,
.patient-search-select-option-add.is-selected {
  background: #dcfce7;
}

.patient-search-select-empty {
  color: #7f8fa6;
}

.patient-option-icon {
  flex-shrink: 0;
}

.patient-flag {
  width: 1rem;
  height: 0.72rem;
  display: inline-block;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.1rem;
  overflow: hidden;
}

.patient-flag-pakistan {
  background: linear-gradient(90deg, #ffffff 0 24%, #0b7a43 24% 100%);
  position: relative;
}

.patient-flag-pakistan::before {
  content: "";
  position: absolute;
  top: 0.12rem;
  left: 0.56rem;
  width: 0.22rem;
  height: 0.22rem;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: -0.06rem 0 0 0.05rem #0b7a43;
}

.patient-flag-afghanistan {
  background: linear-gradient(90deg, #111111 0 33.33%, #c71f2d 33.33% 66.66%, #1f8a44 66.66% 100%);
}

.patient-modal-age-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  align-items: stretch;
}

.patient-photo-input {
  display: none;
}

.patient-photo-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #c6d8ee;
  border-radius: 0.35rem;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.patient-photo-preview:hover,
.patient-photo-preview:focus-visible {
  border-color: #67a7ff;
  background: linear-gradient(180deg, #fafdff 0%, #edf6ff 100%);
  box-shadow: 0 0 0 0.18rem rgba(103, 167, 255, 0.12);
  outline: none;
}

.patient-photo-preview-placeholder {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  color: #7f8fa6;
}

.patient-photo-preview-placeholder span {
  font-size: 1.2rem;
  line-height: 1;
}

.patient-photo-preview-placeholder small {
  font-size: 0.72rem;
  font-weight: 600;
}

.patient-photo-preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #fff;
}

.patient-photo-field-top {
  align-self: start;
  justify-self: end;
  width: 112px;
}

.patient-photo-preview-top {
  min-height: 148px;
  aspect-ratio: 3 / 4;
}

.patient-modal-textarea {
  height: auto;
  min-height: 4rem;
  resize: none;
}

.patient-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 0.15rem;
}

.appointment-payment-row {
  margin-bottom: 0.35rem;
}

.appointment-modal-actions {
  margin-top: 0.45rem;
}

.patient-modal-save {
  min-width: 4.75rem;
  min-height: 2rem;
  padding: 0.2rem 0.75rem;
  border: 0;
  border-radius: 0.25rem;
  background: linear-gradient(135deg, #1ea986 0%, #35c7a3 100%);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(30, 169, 134, 0.22);
}

.patient-modal-save:hover,
.patient-modal-save:focus {
  background: linear-gradient(135deg, #169878 0%, #28b894 100%);
}

.patient-registration-modal .text-danger {
  font-size: 0.7rem;
}

.patient-modal-close {
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.patient-modal-close:hover,
.patient-modal-close:focus {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  transform: scale(1.04);
}

.patient-modal-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.patient-registration-modal .modal-dialog {
  max-width: 1080px;
}

.patient-registration-modal .modal-backdrop,
.modal-backdrop.show {
  opacity: 0.55;
}

@media (max-width: 1200px) {
  .patient-modal-row-medical,
  .patient-modal-row-five {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .patient-modal-row-top {
    grid-template-columns: minmax(0, 1fr) 118px;
  }
}

@media (max-width: 768px) {
  .patient-modal-row-top,
  .patient-modal-row-medical,
  .patient-modal-row-two,
  .patient-modal-row-three,
  .patient-modal-row-five {
    grid-template-columns: 1fr;
  }

  .patient-photo-field-top {
    width: 100%;
  }

  .patient-photo-preview-top {
    min-height: 140px;
  }
}

.patient-list-card {
  display: grid;
  gap: 0;
}

.patient-list-page {
  gap: 0.5rem;
}

.patient-list-card-full {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.patient-list-header,
.patient-list-tools,
.patient-list-tools-end,
.patient-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.patient-list-header {
  align-items: flex-start;
  padding: 0.7rem 0.9rem 0.65rem;
  border: 1px solid #d5dce7;
  border-bottom: 0;
  background: #fff;
}

.patient-list-title-block {
  display: grid;
  gap: 0.18rem;
}

.patient-list-header h2 {
  margin: 0;
  color: #17365f;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.patient-list-header p {
  margin: 0;
  color: #7d8ea3;
  font-size: 0.76rem;
  line-height: 1.55;
}

.patient-list-toolbar-danger {
  gap: 0.35rem;
}

.patient-danger-btn {
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.12rem;
  border-color: #b7151b;
  background: #c51a1f;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: none;
}

.patient-danger-btn:hover,
.patient-danger-btn:focus {
  background: #aa1318;
  color: #fff;
}

.patient-list-toolbar-theme {
  gap: 0.55rem;
  flex-wrap: wrap;
}

.patient-theme-btn {
  min-height: 2.7rem;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  background: linear-gradient(180deg, #ffffff 0%, #f1f7ff 100%);
  color: #1f4f88;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(35, 79, 140, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.patient-theme-btn.primary {
  border-color: #1f5fae;
  background: linear-gradient(135deg, #2f74d0 0%, #1c5ab2 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(29, 90, 178, 0.2);
}

.patient-theme-btn.appointment {
  border-color: #9cd4cc;
  background: linear-gradient(135deg, #ecfffb 0%, #d9f8ef 100%);
  color: #0e6b67;
  box-shadow: 0 12px 24px rgba(32, 134, 122, 0.12);
}

.patient-theme-btn.direct {
  border-color: #f3c793;
  background: linear-gradient(135deg, #fff6e8 0%, #ffe7c7 100%);
  color: #a05600;
  box-shadow: 0 12px 24px rgba(198, 123, 20, 0.12);
}

.patient-theme-btn-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.82rem;
  line-height: 1;
  flex-shrink: 0;
}

.patient-theme-btn:not(.primary) .patient-theme-btn-icon {
  background: rgba(255, 255, 255, 0.72);
}

.patient-theme-btn:hover,
.patient-theme-btn:focus {
  border-color: #a9c8eb;
  background: linear-gradient(180deg, #ffffff 0%, #e8f2ff 100%);
  color: #17497f;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(35, 79, 140, 0.12);
}

.patient-theme-btn.primary:hover,
.patient-theme-btn.primary:focus {
  background: linear-gradient(135deg, #3b82de 0%, #215db8 100%);
  color: #fff;
  border-color: #215db8;
  box-shadow: 0 16px 28px rgba(29, 90, 178, 0.24);
}

.patient-theme-btn.appointment:hover,
.patient-theme-btn.appointment:focus {
  border-color: #7ec7bb;
  background: linear-gradient(135deg, #e4fff8 0%, #cef5ea 100%);
  color: #0a5c58;
  box-shadow: 0 16px 28px rgba(32, 134, 122, 0.16);
}

.patient-theme-btn.direct:hover,
.patient-theme-btn.direct:focus {
  border-color: #ebb56a;
  background: linear-gradient(135deg, #fff2df 0%, #ffdcae 100%);
  color: #8a4c00;
  box-shadow: 0 16px 28px rgba(198, 123, 20, 0.16);
}

.patient-list-tools-plain {
  align-items: flex-start;
  padding: 0.55rem 0.9rem 0.55rem;
  border: 1px solid #d5dce7;
  border-top: 0;
  border-bottom: 0;
  background: #fff;
}

.patient-list-search-shell-medium {
  flex: 1;
  max-width: 620px;
}

.patient-list-search-box-medium {
  width: 100%;
  min-height: 3.15rem;
  display: flex;
  align-items: center;
  border: 1px solid #d9e3ef;
  border-radius: 0.45rem;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(28, 58, 97, 0.08);
}

.patient-list-search-panel-left,
.patient-list-search-panel-right {
  width: 4.1rem;
  min-height: 3.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.6rem;
  line-height: 1;
}

.patient-list-search-panel-left {
  background: #4f6280;
  color: #ffffff;
}

.patient-list-search-box-medium .patient-list-search-input-medium {
  padding-right: 1.2rem;
}

.patient-list-search-panel-right {
  background: #ffffff;
  color: #c8c8c8;
}

.patient-list-search-input-medium {
  width: 100%;
  min-width: 0;
  min-height: 3.15rem;
  padding: 0 1.2rem;
  border: 0;
  background: #ffffff;
  color: #6b7280;
  font-size: 0.95rem;
  font-weight: 500;
}

.patient-list-search-input-medium::placeholder {
  color: #c1c5cc;
}

.patient-list-search-input-medium:focus {
  outline: none;
}

.patient-list-search-box-medium:focus-within {
  border-color: #8eb2df;
  box-shadow: 0 12px 24px rgba(28, 58, 97, 0.1), 0 0 0 3px rgba(66, 133, 244, 0.08);
}

.patient-list-tools-end-plain {
  margin-left: auto;
}

.patient-list-pagination-toolbar {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.patient-page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #5f7087;
  font-size: 0.78rem;
  font-weight: 700;
}

.patient-page-size-select {
  min-width: 5rem;
  min-height: 2.35rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid #d9e3ef;
  border-radius: 0.45rem;
  background: #ffffff;
  color: #1f2f45;
  font-size: 0.78rem;
  font-weight: 600;
}

.patient-page-summary {
  color: #6a7a90;
  font-size: 0.76rem;
  font-weight: 600;
}

.patient-page-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.patient-page-nav-btn {
  min-width: 4.4rem;
  min-height: 2.35rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid #d9e3ef;
  border-radius: 0.45rem;
  background: #ffffff;
  color: #1f4f88;
  font-size: 0.76rem;
  font-weight: 700;
}

.patient-page-nav-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.patient-directory-wrap {
  border: 1px solid #d5dce7;
  border-top: 0;
  background: #fff;
}

.patient-list-toolbar,
.patient-list-tools-end {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.patient-directory-table th,
.patient-directory-table td {
  vertical-align: top;
}

.patient-directory-table-plain th,
.patient-directory-table-plain td {
  padding: 0.62rem 0.6rem;
  border-bottom: 1px solid #eceff4;
  color: #243447;
  font-size: 0.78rem;
}

.patient-directory-table-plain thead th {
  color: #1f2f45;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.patient-directory-table-plain tbody tr:hover {
  background: #fafcff;
}

.patient-directory-table th {
  white-space: nowrap;
}

.patient-name-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: #f5f8fc;
  color: #2f4b76;
  font-weight: 600;
}

.patient-row-action {
  width: 1.55rem;
  height: 1.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #edf0f5;
  border-radius: 0.15rem;
  background: #f5f6f8;
  color: #4a5668;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.patient-row-action:hover {
  background: #eceff4;
}

.patient-row-actions {
  position: relative;
  display: inline-flex;
  overflow: visible;
}

.table-responsive,
.card-body,
.table-container {
  overflow: visible !important;
}

.dropdown-menu {
  z-index: 9999 !important;
}

.dropdown-menu-end {
  right: 0;
  left: auto;
}

.patient-row-menu {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 10.5rem;
  display: grid;
  gap: 0.15rem;
  padding: 0.35rem;
  border: 1px solid #d9e3ef;
  border-radius: 0.55rem;
  background: #ffffff;
  box-shadow: 0 14px 26px rgba(28, 58, 97, 0.12);
  z-index: 3000;
}

.patient-row-menu-item {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: #1f2f45;
  font-size: 0.76rem;
  font-weight: 600;
  text-align: left;
}

.patient-row-menu-item:hover,
.patient-row-menu-item:focus {
  background: #eef5ff;
  color: #17497f;
}

@media (max-width: 1100px) {
  .patient-template-hero,
  .patient-template-layout {
    grid-template-columns: 1fr;
  }

  .patient-registration-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .patient-list-search-shell-medium {
    max-width: 100%;
    width: 100%;
  }

  .patient-list-search-panel-left,
  .patient-list-search-panel-right {
    width: 3.3rem;
    min-height: 2.9rem;
    font-size: 1.3rem;
  }

  .patient-list-search-box-medium,
  .patient-list-search-input-medium {
    min-height: 2.9rem;
  }

  .patient-template-hero {
    padding: 1.1rem;
    background: linear-gradient(180deg, #173f72 0%, #224f8d 48%, #ffffff 48%, #ffffff 100%);
  }

  .patient-template-hero-actions {
    flex-direction: column;
  }

  .patient-template-hero-actions .master-toolbar-btn {
    width: 100%;
  }

  .patient-template-hero-stats {
    grid-template-columns: 1fr;
  }

  .patient-list-header,
  .patient-list-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .patient-list-toolbar,
  .patient-list-tools-end {
    justify-content: flex-start;
  }

  .patient-side-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .patient-hero-strip,
  .patient-summary-grid,
  .patient-form-row {
    grid-template-columns: 1fr;
  }

  .patient-age-row-compact,
  .patient-live-age-panel {
    grid-template-columns: 1fr;
  }

  .patient-alert {
    flex-direction: column;
    align-items: flex-start;
  }

  .patient-mini-list span {
    text-align: left;
  }
}

.settings-field input:focus,
.settings-field select:focus,
.settings-field textarea:focus {
  outline: none;
  border-color: #a4c0e4;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 56, 101, 0.08);
}

.settings-field textarea {
  resize: vertical;
}

.settings-form-actions {
  display: flex;
  gap: 0.65rem;
  padding-top: 0.5rem;
}

.settings-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.settings-table-search {
  flex: 1 1 320px;
}

.settings-table-search-input {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid #d9e3ef;
  border-radius: 0.45rem;
  background: #ffffff;
  color: #1f2f45;
  font-size: 0.8rem;
}

.settings-table-search-input:focus {
  outline: none;
  border-color: #a4c0e4;
  box-shadow: 0 0 0 3px rgba(20, 56, 101, 0.08);
}

.settings-hours-grid {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.settings-hour-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.55rem;
  background: #f8fbff;
  border: 1px solid #edf2f7;
  font-size: 0.8rem;
}

.settings-hour-day {
  min-width: 5.5rem;
  color: #17365f;
  font-weight: 700;
}

.settings-hour-row input[type="time"] {
  padding: 0.4rem 0.55rem;
  border: 1px solid #dfe8f3;
  border-radius: 0.45rem;
  background: #fff;
  color: #1c2c45;
  font-size: 0.78rem;
  font-family: inherit;
}

.settings-hour-row > span {
  color: #7d8ea3;
  font-size: 0.75rem;
}

.settings-toggle {
  position: relative;
  display: inline-block;
  width: 2.4rem;
  height: 1.35rem;
  flex-shrink: 0;
  cursor: pointer;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.settings-toggle span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d5dfe9;
  transition: background-color 0.2s ease;
}

.settings-toggle span::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.settings-toggle input:checked + span {
  background: #2bb673;
}

.settings-toggle input:checked + span::after {
  transform: translateX(1.05rem);
}

.settings-toggle-list {
  display: grid;
  gap: 0.2rem;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.55rem;
  border: 1px solid #edf2f7;
  background: #f8fbff;
}

.settings-toggle-row strong {
  display: block;
  color: #17365f;
  font-size: 0.82rem;
}

.settings-toggle-row span {
  color: #7d8ea3;
  font-size: 0.72rem;
}

.settings-field-note {
  display: block;
  margin-top: 0.45rem;
  color: #7d8ea3;
  font-size: 0.72rem;
  line-height: 1.4;
}

.shift-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.shift-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.shift-table th,
.shift-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  white-space: nowrap;
}

.shift-table th {
  background: #f4f6fa;
  font-weight: 600;
  color: #3a4a5c;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.shift-table tbody tr:hover {
  background: #f8fafd;
}

.shift-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.shift-badge.morning {
  background: #e3f2fd;
  color: #1565c0;
}

.shift-badge.evening {
  background: #fff3e0;
  color: #e65100;
}

.shift-badge.night {
  background: #ede7f6;
  color: #4527a0;
}

.shift-badge.rotational {
  background: #e8f5e9;
  color: #2e7d32;
}

.shift-badge.oncall {
  background: #fce4ec;
  color: #c62828;
}

.shift-badge.role-admin {
  background: #e8eaf6;
  color: #283593;
}

.shift-badge.role-doctor {
  background: #e3f2fd;
  color: #1565c0;
}

.shift-badge.role-nurse {
  background: #f3e5f5;
  color: #7b1fa2;
}

.shift-badge.role-receptionist {
  background: #fff3e0;
  color: #e65100;
}

.shift-badge.role-pharmacist {
  background: #e8f5e9;
  color: #2e7d32;
}

.shift-badge.role-labtech {
  background: #fff8e1;
  color: #f57f17;
}

.shift-badge.role-accountant {
  background: #efebe9;
  color: #4e342e;
}

.shift-badge.role-staff {
  background: #eceff1;
  color: #37474f;
}

.user-table-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border: 2px solid #e0e5ed;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.user-table-avatar-initials {
  background: linear-gradient(135deg, #143558, #1e6bb8);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-color: #1e6bb8;
}

.user-image-upload-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border: 2px dashed #d0d7e2;
  border-radius: 10px;
  background: #fafbfd;
  transition: border-color 0.2s, background 0.2s;
}

.user-image-upload-row.drag-over {
  border-color: #1e6bb8;
  background: rgba(30, 107, 184, 0.06);
}

.user-image-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid #d0d7e2;
  transition: border-color 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.drag-over .user-image-preview {
  border-color: #1e6bb8;
}

.user-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-image-initials {
  font-size: 1.25rem;
  font-weight: 700;
  color: #8a9bb5;
  user-select: none;
}

.user-image-upload-info {
  font-size: 0.82rem;
  color: #3a4a5c;
}

.user-image-upload-info strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.15rem;
}

.user-image-upload-info p {
  margin: 0 0 0.5rem;
  color: #7a8a9c;
  font-size: 0.78rem;
}

.user-image-upload-info small {
  display: block;
  margin-top: 0.35rem;
  color: #a0aab5;
  font-size: 0.72rem;
}

.user-image-upload-actions {
  display: flex;
  gap: 0.5rem;
}

.user-image-file-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.45rem;
  padding: 0.35rem 0.7rem;
  background: #eef3f9;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #3a4a5c;
}

.user-image-file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.user-image-file-size {
  color: #7a8a9c;
  white-space: nowrap;
}

.shift-form-card {
  background: #f8fafd;
  border: 1px dashed #d0d7e2;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.shift-form-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1c2d41;
  margin: 0 0 1rem;
}

.shift-days-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.shift-day-check {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  transition: all 0.15s;
}

.shift-day-check:has(input:checked) {
  background: #143558;
  border-color: #143558;
  color: #fff;
}

.shift-day-check input {
  display: none;
}

@media (max-width: 991.98px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-menu {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.65rem;
  }

  .settings-menu-label {
    width: 100%;
    padding: 0 0.35rem 0.45rem;
  }

  .settings-menu-item {
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.72rem;
  }

  .settings-menu-item.active {
    border-left: 0;
    padding-left: 0.75rem;
    border-radius: 999px;
  }
}

@media (max-width: 767.98px) {
  .settings-form-row {
    grid-template-columns: 1fr;
  }

  .settings-table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-logo-card {
    flex-direction: column;
    text-align: center;
  }

  .settings-logo-actions {
    justify-content: center;
  }

  .settings-hour-row {
    flex-wrap: wrap;
  }
}

.dashboard-grid {
  display: grid;
  gap: 1.5rem;
}

.dashboard-hero,
.dashboard-card,
.dashboard-stat {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--app-shadow);
  backdrop-filter: blur(16px);
}

.dashboard-hero {
  padding: 2rem;
  overflow: hidden;
}

.dashboard-hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.dashboard-hero-copy h1 {
  margin: 0.65rem 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.dashboard-hero-copy p,
.dashboard-card p,
.dashboard-list-meta,
.dashboard-table td,
.dashboard-table th,
.dashboard-muted {
  color: var(--app-text-muted);
}

.dashboard-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(53, 199, 163, 0.14);
  color: #9ef0da;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.dashboard-btn-primary,
.dashboard-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  padding: 0.9rem 1.1rem;
  font-weight: 700;
}

.dashboard-btn-primary {
  background: linear-gradient(135deg, var(--app-primary), #8aefd7);
  color: #05111b;
}

.dashboard-btn-secondary {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--app-text);
}

.dashboard-hero-side {
  min-width: 280px;
  max-width: 320px;
  padding: 1.25rem;
  border-radius: 1.25rem;
  background: linear-gradient(160deg, rgba(103, 167, 255, 0.14), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-hero-side h3,
.dashboard-card h3,
.dashboard-card h4 {
  margin-top: 0;
}

.dashboard-kpi-list {
  display: grid;
  gap: 0.9rem;
}

.dashboard-kpi-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-kpi-item strong,
.dashboard-stat-value,
.dashboard-table strong {
  color: #fff;
}

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-stat {
  padding: 1.4rem;
}

.dashboard-stat-label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--app-text-muted);
}

.dashboard-stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.dashboard-stat-trend {
  display: inline-flex;
  margin-top: 0.85rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.dashboard-stat-trend.positive {
  color: #9ef0da;
  background: rgba(53, 199, 163, 0.12);
}

.dashboard-stat-trend.warning {
  color: #ffd89a;
  background: rgba(255, 197, 92, 0.12);
}

.dashboard-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.95fr);
  gap: 1.5rem;
}

.dashboard-card {
  padding: 1.5rem;
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dashboard-table {
  width: 100%;
}

.dashboard-table th,
.dashboard-table td {
  padding: 0.95rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.dashboard-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-status {
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.dashboard-status.success {
  background: rgba(53, 199, 163, 0.14);
  color: #9ef0da;
}

.dashboard-status.info {
  background: rgba(103, 167, 255, 0.14);
  color: #bcd5ff;
}

.dashboard-status.danger {
  background: rgba(255, 126, 138, 0.14);
  color: #ffc1c7;
}

.dashboard-list {
  display: grid;
  gap: 1rem;
}

.dashboard-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-list-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.dashboard-progress {
  height: 0.75rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.dashboard-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--app-primary), var(--app-accent));
}

.dashboard-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.dashboard-action-card {
  padding: 1rem;
  border-radius: 1.15rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-action-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.dashboard-stat-trend.info,
.dashboard-status.warning {
  color: #ffd89a;
  background: rgba(255, 197, 92, 0.12);
}

.admin-dashboard-hero {
  background:
    radial-gradient(circle at top right, rgba(53, 199, 163, 0.16), transparent 28%),
    linear-gradient(135deg, rgba(103, 167, 255, 0.09), rgba(255, 255, 255, 0.04));
}

.admin-spotlight-card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.admin-dashboard-layout {
  align-items: start;
}

.admin-stat-card {
  position: relative;
  overflow: hidden;
}

.admin-stat-card::after {
  content: "";
  position: absolute;
  inset: auto -1rem -2.5rem auto;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}

.admin-module-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-module-card {
  min-height: 10.5rem;
}

.admin-module-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.8rem;
  border-radius: 1rem;
  background: rgba(103, 167, 255, 0.12);
  font-size: 1.4rem;
}

.admin-side-card {
  background: rgba(255, 255, 255, 0.045);
}

.admin-metric-stack {
  display: grid;
  gap: 0.85rem;
}

.admin-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-metric-row strong {
  color: #fff;
}

@media (max-width: 1199.98px) {
  .master-topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .master-topbar-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .master-stat-grid,
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .master-dashboard-grid,
  .master-secondary-grid,
  .master-dashboard-bottom,
  .dashboard-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .master-shell {
    grid-template-columns: 1fr;
  }

  .master-sidebar {
    order: 2;
  }

  .master-main-shell {
    order: 1;
  }

  .dashboard-hero-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-hero-side {
    min-width: 100%;
    max-width: none;
  }
}

@media (max-width: 767.98px) {
  .master-content,
  .master-topbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .master-page-header,
  .master-toolbar-actions,
  .master-topbar-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .master-stat-grid,
  .master-action-grid,
  .master-ward-grid,
  .dashboard-stats-grid,
  .dashboard-actions-grid,
  .admin-module-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card-header,
  .dashboard-list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-table {
    display: block;
    overflow-x: auto;
  }
}

/* ─── Department Category Styles ─── */
.dept-color-swatch {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid #d1d5db;
    vertical-align: middle;
}

.dept-color-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dept-color-input {
    width: 40px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: none;
}

.dept-color-text {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: monospace;
}

.dept-category-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.dept-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #eef4ff;
    font-size: 1rem;
    line-height: 1;
}

/* ─── OPD Charges Styles ─── */
.opd-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.opd-badge.general {
    background: #e0f2fe;
    color: #0369a1;
}

.opd-badge.doctor {
    background: #fef3c7;
    color: #92400e;
}

.opd-amount {
    font-weight: 700;
    color: #059669;
    white-space: nowrap;
}

.opd-type-toggle {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-top: 6px;
}

.opd-radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.93rem;
    cursor: pointer;
    user-select: none;
}

.opd-radio-label input[type="radio"] {
    accent-color: #1e3a5f;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ── Entitle Type Badges ─────────────────────── */
.entitle-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.entitle-badge.payable {
    background: #fef3c7;
    color: #92400e;
}

.entitle-badge.free {
    background: #d1fae5;
    color: #065f46;
}

.entitle-badge.half-fee {
    background: #e0e7ff;
    color: #4338ca;
}

.entitle-badge.discount {
    background: #f3e8ff;
    color: #7c3aed;
}

.entitle-badge.discount-fixed {
    background: #fee2e2;
    color: #b91c1c;
}

.entitle-badge.discount-percentage {
    background: #dcfce7;
    color: #166534;
}

.entitle-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Responsive Layout Hardening ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe,
table {
  max-width: 100%;
}

.dashboard-page .master-main-shell,
.dashboard-page .master-content,
.dashboard-page .master-card,
.dashboard-page .master-dashboard-page {
  max-width: 100%;
  min-width: 0;
}

.dashboard-page .master-topbar-page strong,
.dashboard-page .master-card-header h2,
.dashboard-page .master-page-header h1,
.dashboard-page .settings-section-header h2 {
  font-size: clamp(1rem, 2.4vw, 1.5rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dashboard-page .master-topbar-page small,
.dashboard-page .master-profile-pill small,
.dashboard-page .master-sidebar-user small,
.dashboard-page .master-card-header p,
.dashboard-page .settings-section-header p {
  font-size: clamp(0.72rem, 1.4vw, 0.9rem);
  overflow-wrap: anywhere;
}

.dashboard-page .dashboard-income-value,
.dashboard-page .master-stat-card .master-stat-value {
  font-size: clamp(0.95rem, 2vw, 1.35rem);
  overflow-wrap: anywhere;
}

.dashboard-page .dashboard-income-title,
.dashboard-page .master-stat-card .master-stat-label {
  font-size: clamp(0.72rem, 1.5vw, 0.9rem);
  overflow-wrap: anywhere;
}

.dashboard-page table {
  width: 100%;
}

.dashboard-page .table-responsive,
.dashboard-page .shift-table-wrap,
.dashboard-page .dashboard-monthly-chart-layout,
.dashboard-page .dashboard-patient-chart-canvas {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
}

html {
  font-size: 14px;
}

body,
.master-shell,
.master-main-shell,
.master-content-shell,
.master-content,
.settings-content,
.settings-section,
.master-card,
.patient-form-section,
.patient-list-card,
.patient-list-card-full,
.table-responsive,
.shift-table-wrap {
  min-width: 0;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

.master-content,
.page-container,
.container {
  width: 100%;
}

.master-topbar,
.master-page-header,
.master-toolbar-actions,
.settings-logo-card,
.patient-list-header,
.patient-list-tools,
.patient-list-tools-end,
.patient-list-toolbar,
.patient-form-actions,
.patient-modal-actions,
.appointment-modal-actions,
.patient-precheck-actions,
.app-header-inner,
.app-footer-inner {
  flex-wrap: wrap;
}

.master-topbar-start,
.master-topbar-page,
.master-topbar-actions,
.master-profile-menu,
.settings-menu,
.settings-content,
.patient-list-title-block,
.patient-list-tools,
.patient-list-tools-end,
.patient-list-toolbar,
.master-card-header,
.master-sidebar-brand,
.master-sidebar-user {
  min-width: 0;
}

.master-topbar-page strong,
.master-topbar-page small,
.master-profile-pill strong,
.master-profile-pill small,
.master-sidebar-user strong,
.master-sidebar-user small,
.patient-list-header h2,
.patient-list-title-block,
.master-card-header h2,
.settings-section-header h2,
.settings-section-header p {
  overflow-wrap: anywhere;
}

.table-responsive,
.shift-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-responsive > table,
.shift-table,
.master-table,
.dashboard-table,
.patient-cnic-table {
  min-width: 42rem;
}

.modal-dialog {
  width: auto;
  max-width: min(100vw - 1rem, 100%);
  margin: 0.5rem auto;
}

.modal-content {
  max-height: calc(100dvh - 1rem);
}

.modal-body {
  overflow-y: auto;
}

.patient-registration-modal .modal-dialog,
.patient-precheck-modal .modal-dialog {
  max-width: min(1080px, calc(100vw - 1rem));
}

.patient-registration-modal .modal-content {
  max-height: calc(100dvh - 1rem);
}

.patient-registration-modal .modal-body {
  max-height: calc(100dvh - 5.5rem);
  overflow-y: auto;
  overflow-x: hidden;
}

.swal2-popup {
  width: min(42rem, calc(100vw - 1rem)) !important;
  max-width: calc(100vw - 1rem) !important;
}

.swal2-html-container {
  overflow-wrap: anywhere;
  max-height: min(60vh, 28rem);
  overflow-y: auto;
}

.swal2-title {
  overflow-wrap: anywhere;
}

.master-shell {
  display: block;
}

.master-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(18rem, 86vw);
  max-width: 86vw;
  height: 100dvh;
  transform: translateX(-105%);
}

.dashboard-page.sidebar-open {
  overflow: hidden;
}

.dashboard-page.sidebar-open .master-sidebar {
  transform: translateX(0);
}

.dashboard-page.sidebar-open .master-sidebar-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.master-nav-toggle,
.master-sidebar-close {
  display: inline-flex;
}

.master-main-shell {
  min-height: 100dvh;
}

.master-topbar {
  align-items: flex-start;
  padding: 0.9rem 1rem;
  gap: 0.85rem;
}

.master-topbar-start,
.master-topbar-actions {
  width: 100%;
}

.master-topbar-start {
  align-items: flex-start;
}

.master-topbar-actions {
  justify-content: stretch;
  gap: 0.75rem;
}

.master-topbar-clock,
.master-topbar-shift,
.master-profile-menu,
.master-profile-pill {
  width: 100%;
}

.master-topbar-clock,
.master-topbar-shift,
.master-profile-pill {
  min-width: 0;
  justify-content: flex-start;
  border-radius: 1rem;
}

.master-profile-dropdown {
  left: 0;
  right: auto;
  width: min(24rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
}

.master-stat-grid,
.dashboard-stats-grid,
.master-action-grid,
.dashboard-actions-grid,
.admin-module-grid,
.master-dashboard-grid,
.master-dashboard-bottom,
.master-secondary-grid,
.dashboard-content-grid,
.master-ward-grid,
.settings-layout,
.settings-form-row,
.patient-modal-row-two,
.patient-modal-row-three,
.patient-modal-row-five,
.patient-modal-row-medical,
.patient-modal-row-top,
.patient-modal-age-group {
  grid-template-columns: 1fr;
}

.master-content {
  padding: 1rem;
}

.master-card,
.settings-section,
.patient-form-section,
.auth-card {
  padding: 1rem;
}

.master-footer {
  flex-direction: column;
  align-items: flex-start;
  padding: 0 1rem 1rem;
}

.app-nav {
  width: 100%;
  flex-wrap: wrap;
}

.patient-list-header,
.patient-list-tools,
.patient-list-tools-end,
.patient-list-toolbar,
.patient-form-actions,
.master-page-header,
.master-toolbar-actions,
.settings-logo-card,
.patient-modal-actions,
.appointment-modal-actions,
.patient-precheck-actions,
.app-header-inner,
.app-footer-inner {
  flex-direction: column;
  align-items: stretch;
}

.master-toolbar-btn,
.settings-btn,
.patient-form-actions .master-toolbar-btn,
.patient-precheck-btn,
.patient-modal-save,
.master-profile-dropdown-link {
  width: 100%;
  min-height: 2.85rem;
}

.patient-modal-row-top {
  column-gap: 0.75rem;
}

.patient-photo-field-top,
.patient-photo-preview-top {
  width: 100%;
}

.patient-photo-preview-top {
  min-height: 9rem;
}

.master-profile-dropdown-grid {
  grid-template-columns: 1fr;
}

.dashboard-filter-toolbar {
  flex-direction: column;
  align-items: stretch;
  padding: 0.75rem 0.85rem;
}

.dashboard-chart-filter-form {
  width: 100%;
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.dashboard-chart-filter-form > .dashboard-chart-filter-select {
  flex: 1 1 8rem;
  min-width: 0;
  width: 100%;
}

.dashboard-chart-filter-check {
  flex: 1 1 100%;
  justify-content: center;
}

.dashboard-chart-summary-strip {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dashboard-chart-summary-pill {
  flex: 1 1 8rem;
  min-width: 0;
}

.dashboard-chart-legend {
  grid-template-columns: 1fr !important;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }

  .master-topbar {
    padding: 1rem 1.25rem;
  }

  .master-content {
    padding: 1.25rem;
  }

  .master-card,
  .settings-section,
  .patient-form-section,
  .auth-card {
    padding: 1.25rem;
  }

  .master-topbar-actions {
    flex-direction: row;
    align-items: stretch;
  }

  .dashboard-filter-toolbar {
    flex-direction: row;
    align-items: center;
    padding: 0.85rem 1rem;
  }

  .dashboard-chart-filter-form {
    width: auto;
  }

  .dashboard-chart-filter-form > .dashboard-chart-filter-select {
    flex: 0 0 auto;
    width: auto;
  }

  .dashboard-chart-filter-check {
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .dashboard-chart-summary-pill {
    flex: 0 1 auto;
  }

  .dashboard-chart-legend {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  }

  .master-topbar-clock,
  .master-topbar-shift {
    width: auto;
  }

  .master-profile-menu {
    width: auto;
    min-width: 11rem;
  }

  .master-profile-pill {
    width: 100%;
  }

  .master-stat-grid,
  .dashboard-stats-grid,
  .master-action-grid,
  .dashboard-actions-grid,
  .admin-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-form-row,
  .patient-modal-row-two,
  .patient-modal-age-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .patient-list-header,
  .patient-list-tools,
  .patient-list-tools-end,
  .patient-list-toolbar,
  .patient-form-actions,
  .master-page-header,
  .master-toolbar-actions,
  .settings-logo-card,
  .patient-modal-actions,
  .appointment-modal-actions,
  .patient-precheck-actions,
  .app-header-inner,
  .app-footer-inner {
    flex-direction: row;
    align-items: center;
  }

  .master-toolbar-btn,
  .settings-btn,
  .patient-form-actions .master-toolbar-btn,
  .patient-precheck-btn,
  .patient-modal-save,
  .master-profile-dropdown-link {
    width: auto;
  }

  .master-profile-dropdown {
    left: auto;
    right: 0;
    width: min(24rem, calc(100vw - 2rem));
  }

  .swal2-popup {
    width: min(44rem, calc(100vw - 2rem)) !important;
  }
}

@media (min-width: 1024px) {
  .dashboard-page {
    --master-topbar-height: 6.75rem;
    --master-topbar-height-expanded: 12rem;
  }

  html {
    font-size: 16px;
  }

  .master-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .master-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    max-width: calc(100vw - 2rem);
    height: 100dvh;
    transform: none;
    transition: transform 0.25s ease, width 0.25s ease;
    grid-column: 1;
    grid-row: 1;
  }

  .master-main-shell {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 100dvh;
  }

  .dashboard-page.sidebar-open {
    overflow: visible;
  }

  .master-nav-toggle {
    display: inline-flex;
  }

  .master-sidebar-close {
    display: none;
  }

  .master-sidebar-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .dashboard-page.sidebar-collapsed .master-shell {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .dashboard-page.sidebar-collapsed .master-main-shell {
    grid-column: 1 / -1;
  }

  .dashboard-page.sidebar-collapsed .master-sidebar {
    width: 0;
    min-width: 0;
    max-width: 0;
    overflow: hidden;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.25s ease, width 0.25s ease;
  }

  .master-topbar {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    align-items: center;
    flex-wrap: nowrap;
    padding: 1.2rem 1.5rem 1rem;
    gap: 1rem;
  }

  .dashboard-page.sidebar-collapsed .master-topbar {
    left: 0;
  }

  .master-content-shell {
    min-height: 100dvh;
    padding-top: var(--master-topbar-height);
  }

  .master-content-shell.has-topbar-extra {
    padding-top: var(--master-topbar-height-expanded);
  }

  .master-topbar-start,
  .master-topbar-actions {
    width: auto;
  }

  .master-topbar-actions {
    margin-left: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .master-content {
    padding: 1.5rem;
  }

  .master-card,
  .settings-section,
  .patient-form-section {
    padding: 1.25rem;
  }

  .master-topbar-clock,
  .master-topbar-shift,
  .master-profile-menu,
  .master-profile-pill {
    width: auto;
  }

  .master-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .dashboard-stats-grid,
  .master-action-grid,
  .dashboard-actions-grid,
  .admin-module-grid,
  .master-secondary-grid,
  .master-ward-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .master-dashboard-grid {
    grid-template-columns: minmax(0, 1.85fr) minmax(260px, 0.95fr);
  }

  .master-dashboard-bottom,
  .dashboard-content-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.9fr);
  }

  .settings-layout {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .settings-form-row {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .patient-modal-row-top {
    grid-template-columns: minmax(0, 1fr) 118px;
  }

  .patient-modal-row-medical {
    grid-template-columns: minmax(220px, 360px);
  }

  .patient-modal-row-three {
    grid-template-columns: 1fr 1fr 2fr;
  }

  .patient-modal-row-five {
    grid-template-columns: 0.9fr 1.05fr 1.4fr 0.85fr 0.95fr;
  }

  .patient-modal-age-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .master-footer {
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.5rem 1.25rem;
  }
}
