:root {
  --accent-color: #1678f2;
  --accent-deep: #0957de;
  --accent-violet: #6f3afa;
  --heading-color: #031432;
  --default-color: #1b3c74;
  --muted-color: #6c87ae;
  --nav-hover-color: #1678f2;
  --nav-dropdown-hover-color: #1678f2;
  --clinic-gradient: linear-gradient(112deg, #3a8ef6 10%, #6f3afa 197%);
  --clinic-pale: #edf1fe;
  --dark-green: #031432;
}

.dark-background { --background-color: var(--dark-green); }
.light-background { --background-color: #f9fbfc; }
.accent-background { --background-color: #1678f2; }

body { color: var(--default-color); background: #fff; }
h1, h2, h3, h4, h5, h6 { color: var(--heading-color); }
a { transition: color .2s ease, transform .2s ease, box-shadow .2s ease; }
.text-muted, .text-secondary { color: var(--muted-color) !important; }

.brand-mark {
  color: var(--accent-color);
  font-size: 1.65rem;
  margin-right: .55rem;
}

.header .topbar { background: var(--accent-deep); }
.header .branding { min-height: 78px; background: rgba(255,255,255,.96); box-shadow: 0 8px 30px rgba(22,82,240,.07); }
.header .topbar > .container > span { color: rgba(255, 255, 255, .82); font-size: .85rem; }

.hero .hero-content h1 { max-width: 660px; }
.hero .hero-content .hero-actions .btn-primary,
.btn-primary {
  background: var(--clinic-gradient);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(65,132,247,.24);
}
.btn-primary:hover { background: linear-gradient(112deg, #247eea, #5730db); border-color: transparent; transform: translateY(-1px); box-shadow: 0 12px 24px rgba(65,132,247,.32); }
.btn-outline-primary { color: var(--accent-deep); border-color: rgba(22,120,242,.45); }
.btn-outline-primary:hover { color: #fff; background: var(--accent-deep); border-color: var(--accent-deep); }
.bg-primary { background: var(--clinic-gradient) !important; }
.bg-primary-subtle { background: var(--clinic-pale) !important; }
.text-primary { color: var(--accent-deep) !important; }
.card { border-color: rgba(22,82,240,.1) !important; box-shadow: 0 10px 30px rgba(22,82,240,.07) !important; }
.rounded-4 { border-radius: 20px !important; }
.form-control, .form-select { min-height: 50px; border-color: rgba(108,135,174,.32); border-radius: 12px !important; }
.form-control:focus, .form-select:focus { border-color: #3a8ef6; box-shadow: 0 0 0 .22rem rgba(58,142,246,.14); }
.table-light { --bs-table-bg: #f5f8ff; --bs-table-color: #1b3c74; }

.skip-link { position: fixed; z-index: 99999; top: .75rem; left: .75rem; padding: .7rem 1rem; color: #fff; background: #031432; border-radius: .5rem; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.mobile-nav-toggle { color: var(--heading-color); background: transparent; border: 0; font-size: 1.75rem; }

.hero { position: relative; overflow: hidden; background: linear-gradient(145deg, #eef4ff 0%, #fff 72%); }
.hero::before { content: ""; position: absolute; width: 560px; height: 560px; inset: -240px auto auto -180px; border-radius: 50%; background: rgba(255,255,255,.82); }
.hero-visual-shell { position: relative; display: grid; place-items: center; min-height: 470px; border-radius: 50% 50% 42% 58% / 48% 42% 58% 52%; background: linear-gradient(145deg, #fff 0%, #e8f1ff 100%); }
.hero-visual-shell::before, .hero-visual-shell::after { content: ""; position: absolute; border: 1px dashed rgba(22,120,242,.35); border-radius: 50%; }
.hero-visual-shell::before { inset: 8%; }
.hero-visual-shell::after { inset: 18%; }
.hero-doctor-illustration { position: relative; z-index: 1; width: min(100%, 430px); filter: drop-shadow(0 24px 32px rgba(22,82,240,.16)); }
.icon-orb { display: inline-grid; place-items: center; width: 76px; height: 76px; color: #fff; background: var(--clinic-gradient); border-radius: 50%; font-size: 2rem; box-shadow: 0 12px 26px rgba(65,132,247,.25); }
.contact-action-card { background: linear-gradient(135deg, #fff, #f3f7ff); }

.feature-tile {
  display: block;
  height: 100%;
  padding: 2rem;
  color: var(--default-color);
  background: var(--surface-color);
  border: 1px solid #deebe7;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(8, 64, 53, .06);
}
.feature-tile:hover { transform: translateY(-5px); box-shadow: 0 18px 38px rgba(8, 64, 53, .12); }
.feature-tile > i { display: inline-grid; place-items: center; width: 54px; height: 54px; margin-bottom: 1.5rem; color: var(--accent-color); background: #e7f5f1; border-radius: 14px; font-size: 1.6rem; }
.feature-tile h3 { font-size: 1.25rem; }
.feature-tile p { min-height: 52px; color: #63736f; line-height: 1.6; }
.feature-tile span { color: var(--accent-color); font-weight: 700; }

.page-title { margin-top: 118px; }
.page-title .heading { background: #edf7f4; }
.page-title .breadcrumbs { background: #e3f1ed; }

.workspace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}
.workspace-toolbar h2 { margin-bottom: .35rem; }
.workspace-toolbar p { margin: 0; color: #687873; }

.empty-state {
  padding: 4.5rem 1.5rem;
  text-align: center;
  background: #f5faf8;
  border: 1px dashed #b9d6ce;
  border-radius: 18px;
}
.empty-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 1.25rem; color: var(--accent-color); background: #deefe9; border-radius: 50%; font-size: 2rem; }
.empty-state p { max-width: 540px; margin: .75rem auto 1.5rem; color: #687873; }
.status-pill { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .85rem; color: #7b5d13; background: #fff3cd; border-radius: 99px; font-weight: 600; }

.booking-card { max-width: 850px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem); background: #fff; border: 1px solid #deebe7; border-radius: 18px; box-shadow: 0 15px 45px rgba(8, 64, 53, .09); }
.booking-card .form-control, .booking-card .form-select { min-height: 52px; border-color: #cfdfda; }
.booking-card textarea.form-control { min-height: 120px; }
.booking-card .form-control:focus, .booking-card .form-select:focus { border-color: var(--accent-color); box-shadow: 0 0 0 .2rem rgba(8, 127, 106, .13); }

.alert-success { color: #075b4c; background: #e5f5f0; border-color: #b8dfd5; }
.patient-table-card, .record-card { background: #fff; border: 1px solid #deebe7; border-radius: 18px; box-shadow: 0 12px 34px rgba(8, 64, 53, .07); overflow: hidden; }
.patient-table thead th { padding: 1rem 1.25rem; color: #63736f; background: #f4f9f7; border-bottom-color: #deebe7; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.patient-table td { padding: 1rem 1.25rem; border-bottom-color: #edf3f1; }
.patient-name { display: inline-flex; align-items: center; gap: .75rem; color: var(--heading-color); font-weight: 700; }
.patient-avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; color: #fff; background: var(--accent-color); border-radius: 50%; font-weight: 800; text-transform: uppercase; }
.patient-avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }
.record-card { max-width: 860px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem); }
.record-card-header { display: flex; align-items: center; gap: 1rem; padding-bottom: 1.5rem; border-bottom: 1px solid #deebe7; }
.record-card-header h2 { margin: .15rem 0 0; }
.record-label { color: #63736f; font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.record-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.record-grid div { padding: 1rem; background: #f4f9f7; border-radius: 12px; }
.record-grid dt { color: #63736f; font-size: .82rem; }
.record-grid dd { margin: .35rem 0 0; color: var(--heading-color); font-weight: 600; }
.record-actions, .form-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.delete-card { text-align: center; }
.delete-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 1.25rem; color: #b42318; background: #fee4e2; border-radius: 50%; font-size: 2rem; }
.delete-card .record-grid { max-width: 420px; margin-inline: auto; }
.footer { margin-top: 0; color: rgba(255,255,255,.82); background: var(--accent-deep) !important; }
.footer h4, .footer .sitename, .footer strong { color: #fff; }
.footer a { color: rgba(255,255,255,.82) !important; }
.footer a:hover { color: #fff !important; }
.footer .border-top { border-color: rgba(255,255,255,.18) !important; }
.footer .text-muted { color: rgba(255,255,255,.62) !important; }

html[dir="rtl"] body { font-family: "Roboto", "Arial", sans-serif; }
html[dir="rtl"] .me-1, html[dir="rtl"] .me-2, html[dir="rtl"] .me-3 { margin-right: 0 !important; }
html[dir="rtl"] .me-1 { margin-left: .25rem !important; }
html[dir="rtl"] .me-2 { margin-left: .5rem !important; }
html[dir="rtl"] .me-3 { margin-left: 1rem !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  [data-aos] { opacity: 1 !important; transform: none !important; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --heading-color: #f2f6ff;
  --default-color: #d6e1f5;
  --muted-color: #a9bad7;
  --clinic-pale: #172547;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .main { background: #071226; color: var(--default-color); }
html[data-theme="dark"] .header .branding,
html[data-theme="dark"] .card,
html[data-theme="dark"] .booking-card,
html[data-theme="dark"] .record-card,
html[data-theme="dark"] .patient-table-card { background: #0e1c36 !important; color: var(--default-color); border-color: rgba(108,135,174,.22) !important; }
html[data-theme="dark"] .hero { background: linear-gradient(145deg, #0c1c3a, #071226 72%); }
html[data-theme="dark"] .hero-visual-shell { background: linear-gradient(145deg, #17284c, #0b1932); }
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .table-light,
html[data-theme="dark"] .record-grid div { background: #142443 !important; color: var(--default-color) !important; }
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select { color: #f2f6ff; background-color: #0a1730; border-color: #38527c; }
html[data-theme="dark"] .table { --bs-table-bg: #0e1c36; --bs-table-color: #d6e1f5; --bs-table-hover-bg: #142443; --bs-table-hover-color: #fff; }
html[data-theme="dark"] .text-dark { color: #f2f6ff !important; }
.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border:1px solid rgba(108,135,174,.25);border-radius:18px;overflow:hidden;background:#fff}.calendar-weekday{padding:.75rem;text-align:center;font-weight:700;background:var(--clinic-pale)}.calendar-day{min-height:130px;padding:.65rem;border-top:1px solid rgba(108,135,174,.2);border-inline-end:1px solid rgba(108,135,174,.2)}.calendar-empty{background:#f8faff}.calendar-event{display:block;margin-top:.4rem;padding:.35rem .45rem;color:#1b3c74;background:#edf1fe;border-inline-start:3px solid #1678f2;border-radius:6px;font-size:.75rem;text-decoration:none;overflow:hidden}.calendar-event time{font-weight:700}.status-cancelled,.status-rejected{opacity:.6;text-decoration:line-through;border-color:#dc3545}@media(max-width:767px){.calendar-grid{display:flex;flex-direction:column}.calendar-weekday,.calendar-empty{display:none}.calendar-day{min-height:auto}.calendar-day:not(:has(.calendar-event)){display:none}}
html[data-theme="dark"] .calendar-grid,html[data-theme="dark"] .calendar-day{background:#0e1c36}html[data-theme="dark"] .calendar-event{color:#d6e1f5;background:#172547}

@media (max-width: 991px) {
  .page-title { margin-top: 118px; }
  .hero { padding-top: 190px; }
}
@media (max-width: 575px) {
  .page-title { margin-top: 108px; }
  .workspace-toolbar { align-items: stretch; flex-direction: column; }
  .workspace-toolbar .btn { width: 100%; }
}
