:root {
  --md-primary: #E85D04;
  --md-primary-dark: #D00000;
  --md-secondary: #1B4965;
  --md-accent: #2EC4B6;
  --md-surface: #ffffff;
  --md-bg: #f5f7fa;
  --md-on-primary: #fff;
  --md-error: #b3261e;
  --md-outline: #79747e;
  --md-elev-1: 0 1px 3px rgba(27,73,101,.12), 0 1px 2px rgba(27,73,101,.08);
  --md-elev-2: 0 4px 12px rgba(27,73,101,.15);
  --md-elev-3: 0 8px 28px rgba(27,73,101,.18);
  --md-radius: 16px;
  --md-radius-sm: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Roboto', system-ui, sans-serif;
  background: var(--md-bg);
  color: #1c1b1f;
  -webkit-font-smoothing: antialiased;
}

/* ─── Landing ─── */
.landing { min-height: 100vh; }
.landing-header {
  background: linear-gradient(135deg, var(--md-secondary) 0%, #16324f 50%, var(--md-secondary) 100%);
  color: #fff;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--md-elev-2);
}
.brand-lockup { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.brand-lockup img { width: 48px; height: 48px; border-radius: 12px; }
.brand-lockup h1 { margin: 0; font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.brand-lockup span { font-size: 0.75rem; opacity: 0.85; display: block; }
.landing-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.hero {
  background: linear-gradient(160deg, var(--md-secondary) 0%, #234e70 40%, var(--md-primary) 100%);
  color: #fff;
  padding: 3rem 1.5rem 4rem;
  text-align: center;
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: 0 0 0.75rem; font-weight: 700; }
.hero p { font-size: 1.1rem; opacity: 0.92; margin: 0 0 1.5rem; line-height: 1.6; }
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.section { max-width: 1200px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.section-title { font-size: 1.5rem; margin: 0 0 1.5rem; color: var(--md-secondary); font-weight: 700; }

/* ─── Material buttons ─── */
.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: 999px;
  font: 500 0.875rem/1.25rem 'Roboto', sans-serif;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.15s, background 0.2s;
  min-height: 40px;
}
.md-btn:active { transform: scale(0.98); }
.md-btn-filled { background: var(--md-primary); color: var(--md-on-primary); box-shadow: var(--md-elev-1); }
.md-btn-filled:hover { filter: brightness(1.05); box-shadow: var(--md-elev-2); }
.md-btn-tonal { background: rgba(46,196,182,0.2); color: var(--md-secondary); }
.md-btn-outlined { background: transparent; border: 1px solid rgba(255,255,255,0.6); color: #fff; }
.md-btn-outlined-dark { border-color: var(--md-outline); color: var(--md-secondary); }
.md-btn-text { background: transparent; color: var(--md-primary); }
.md-btn-block { width: 100%; }
.md-btn-lg { padding: 0.875rem 2rem; font-size: 1rem; min-height: 48px; }
.md-btn .material-icons-round { font-size: 1.25rem; }

/* ─── Cards ─── */
.md-card {
  background: var(--md-surface);
  border-radius: var(--md-radius);
  box-shadow: var(--md-elev-1);
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}
.md-card:hover { box-shadow: var(--md-elev-2); }
.md-card-pad { padding: 1.25rem; }
.doctor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.doctor-card .spec { color: var(--md-primary); font-weight: 500; font-size: 0.9rem; margin: 0.25rem 0; }
.doctor-card .qual { font-size: 0.8rem; color: #5c5c5c; margin-bottom: 0.75rem; }
.service-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.25rem 0.65rem; border-radius: 8px;
  background: #fff3e8; color: #9a3412; font-size: 0.75rem; font-weight: 500;
}
.branch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.branch-card { border-left: 4px solid var(--md-primary); }
.branch-card h3 { margin: 0 0 0.5rem; color: var(--md-secondary); }
.branch-card .meta { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: #444; }
.branch-card .meta a { color: var(--md-primary); text-decoration: none; }

/* ─── Login split layout ─── */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .auth-split { grid-template-columns: 1fr; } .auth-banner { display: none; } }
.auth-banner {
  background: linear-gradient(165deg, var(--md-secondary), #0d2137 60%, var(--md-primary));
  color: #fff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-banner--photo {
  background-image: linear-gradient(165deg, rgba(27, 73, 101, 0.92) 0%, rgba(13, 33, 55, 0.88) 50%, rgba(232, 93, 4, 0.45) 100%),
    url('../img/banners/slide-1.jpg');
  background-size: cover;
  background-position: center;
}
.auth-banner img { width: 80px; margin-bottom: 1.5rem; }
.auth-banner h1 { font-size: 2rem; margin: 0 0 0.5rem; }
.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  background: var(--md-bg);
}
.auth-form-card {
  width: 100%; max-width: 420px;
  background: var(--md-surface);
  border-radius: var(--md-radius);
  box-shadow: var(--md-elev-3);
  padding: 2rem;
}
.auth-form-card h2 { margin: 0 0 0.25rem; color: var(--md-secondary); font-size: 1.5rem; }
.auth-form-card .subtitle { color: #666; margin: 0 0 1.5rem; font-size: 0.9rem; }
.role-badge {
  display: inline-block; padding: 0.25rem 0.75rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 1rem;
}
.role-badge-patient { background: #e0f2f1; color: #00695c; }
.role-badge-doctor { background: #e3f2fd; color: #1565c0; }
.role-badge-admin { background: #fff3e0; color: #e65100; }

/* ─── Text fields (Material filled) ─── */
.md-field { margin-bottom: 1.25rem; position: relative; }
.md-field label {
  display: block; font-size: 0.75rem; font-weight: 500;
  color: var(--md-secondary); margin-bottom: 0.35rem;
}
.md-input {
  width: 100%; padding: 0.875rem 1rem;
  border: 1px solid #cac4d0; border-radius: var(--md-radius-sm);
  font: 400 1rem 'Roboto', sans-serif;
  background: #fafafa;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.md-input:focus {
  outline: none;
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(232,93,4,0.15);
  background: #fff;
}
.md-input.is-invalid { border-color: var(--md-error); }
.md-field-error { color: var(--md-error); font-size: 0.75rem; margin-top: 0.35rem; display: none; }
.md-field.has-error .md-field-error { display: block; }
.md-field.has-error .md-input { border-color: var(--md-error); }

/* ─── App shell (dashboard) ─── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--md-secondary); color: #e2e8f0;
  padding: 1rem; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-lockup { margin-bottom: 1.5rem; }
.sidebar .brand-lockup h1 { font-size: 1rem; color: #fff; }
.side-nav { flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 0.5rem;
  color: #cbd5e1; text-decoration: none; padding: 0.65rem 0.85rem;
  border-radius: var(--md-radius-sm); font-size: 0.9rem; margin-bottom: 0.15rem;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.12); color: #fff; }
.main-content { flex: 1; padding: 1.5rem 2rem; overflow-x: auto; }
.page-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-toolbar h1 { margin: 0; font-size: 1.5rem; color: var(--md-secondary); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--md-surface); border-radius: var(--md-radius);
  padding: 1.25rem; box-shadow: var(--md-elev-1);
  border-top: 3px solid var(--md-primary);
}
.stat-card .label { font-size: 0.8rem; color: #666; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--md-secondary); }

/* ─── Snackbar & loader ─── */
.md-snackbar {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(120%);
  background: #323232; color: #fff; padding: 0.875rem 1.5rem;
  border-radius: 8px; box-shadow: var(--md-elev-3); z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  max-width: 90vw;
}
.md-snackbar.show { transform: translateX(-50%) translateY(0); }
.md-snackbar.error { background: var(--md-error); }

.clinic-dev-otp-banner {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  max-width: min(92vw, 420px);
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: center;
}
.clinic-dev-otp-banner__code {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 8px;
  background: #fef3c7;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.md-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: none; align-items: center; justify-content: center; z-index: 9998;
}
.md-overlay.show { display: flex; }
.md-spinner {
  width: 48px; height: 48px; border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 0.75rem 1rem; border-radius: var(--md-radius-sm); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-ok { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid #e5e7eb; }
.login-portals { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.portal-card {
  text-align: center; padding: 2rem 1.5rem; text-decoration: none; color: inherit;
  border: 2px solid transparent;
}
.portal-card:hover { border-color: var(--md-primary); transform: translateY(-4px); }
.portal-card .material-icons-round { font-size: 3rem; color: var(--md-primary); margin-bottom: 0.75rem; }
.footer-landing {
  background: var(--md-secondary); color: #94a3b8; padding: 2rem 1.5rem; text-align: center;
  font-size: 0.875rem;
}
.footer-landing a { color: var(--md-accent); }

/* Auth tabs */
.auth-form-wide { max-width: 480px; }
.auth-tabs { display: flex; gap: 0.35rem; margin-bottom: 1.25rem; background: #f0f0f0; padding: 0.35rem; border-radius: 999px; }
.auth-tab { flex: 1; border: none; background: transparent; padding: 0.5rem 0.75rem; border-radius: 999px; font: 500 0.8rem Roboto,sans-serif; cursor: pointer; color: #666; }
.auth-tab.active { background: #fff; color: var(--md-primary); box-shadow: var(--md-elev-1); }
.auth-tab:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-panel-tab { display: none; }
.auth-panel-tab.active { display: block; }
.auth-links { font-size: 0.875rem; margin-top: 1rem; }
.auth-links.center { text-align: center; }
.hero-banner-side { position: relative; overflow: hidden; }
.hero-banner-side::before { content: ''; position: absolute; inset: 0; background: var(--brand-logo-url, none) center 80% / 200px no-repeat; opacity: 0.06; }
.banner-features { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 2rem; font-size: 0.9rem; }
.banner-features span { display: flex; align-items: center; gap: 0.5rem; }
.back-link { color: var(--md-accent); margin-top: 2rem; display: inline-block; }
.doctor-banner { background: linear-gradient(165deg, #1565c0, #0d47a1, var(--md-secondary)) !important; }

/* Landing hero banner */
.hero-banner-wrap {
  background: linear-gradient(135deg, var(--md-secondary) 0%, #234e70 40%, var(--md-primary) 100%);
  padding: 4rem 1.5rem; text-align: center; color: #fff; position: relative; overflow: hidden;
}
.hero-banner-wrap::after {
  content: ''; position: absolute; right: -10%; top: -20%; width: 50%; height: 140%;
  background: radial-gradient(circle, rgba(46,196,182,0.25) 0%, transparent 70%);
}
.hero-banner-logo { width: 100px; height: 100px; margin-bottom: 1rem; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.2)); }
.contact-section .contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; max-width: 1100px; margin: 0 auto; }
@media (max-width: 768px) { .contact-section .contact-grid { grid-template-columns: 1fr; } }

/* Dashboards */
.dash-hero {
  background: linear-gradient(120deg, var(--md-secondary), #2a6f97);
  color: #fff; border-radius: var(--md-radius); padding: 1.75rem 2rem; margin-bottom: 1.5rem;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
}
.dash-hero h2 { margin: 0; font-size: 1.5rem; }
.dash-hero p { margin: 0.35rem 0 0; opacity: 0.9; }
.dash-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.dash-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.dash-action-card {
  background: var(--md-surface); border-radius: var(--md-radius); padding: 1.25rem;
  text-decoration: none; color: inherit; border: 1px solid #eee; transition: transform 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.dash-action-card:hover { transform: translateY(-3px); box-shadow: var(--md-elev-2); border-color: var(--md-primary); }
.dash-action-card .material-icons-round { font-size: 2rem; color: var(--md-primary); }
.patient-theme .dash-hero { background: linear-gradient(120deg, #00695c, var(--md-accent)); }
.doctor-theme .dash-hero { background: linear-gradient(120deg, #1565c0, var(--md-secondary)); }
.cred-box code { background: #fff; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 1rem; }
