/* =========================================================================
   Meenakshi Diagnostics — Doctor Portal
   Design tokens (swap the :root block to re-theme — e.g. navy+gold).
   ========================================================================= */
:root {
  --brand: #006090;
  --brand-600: #00507a;
  --brand-050: #e6f1f7;
  --accent: #00b0a0;

  --canvas: #f4f7f9;
  --surface: #ffffff;
  --surface-muted: #eef2f6;

  --ink: #0e2a2b;
  --text: #1f2a37;
  --muted: #6b7787;
  --border: #e4e9ef;

  --success: #16a34a;
  --success-050: #e8f6ed;
  --danger: #e0453a;
  --danger-050: #fdecea;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 42, 43, .05);
  --shadow-md: 0 6px 24px -8px rgba(15, 42, 43, .12);
  --shadow-lg: 0 18px 48px -16px rgba(15, 42, 43, .18);

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --maxw: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--canvas);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -0.01em; line-height: 1.2; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--pill);
  padding: .62rem 1.3rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .18s ease, box-shadow .18s ease, border-color .18s ease, color .18s ease;
}
.btn--sm { padding: .42rem .95rem; font-size: .88rem; }
.btn--block { width: 100%; padding: .8rem 1rem; font-size: 1rem; }
.btn--primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-600); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-050); }

/* =========================================================================
   Form fields
   ========================================================================= */
.field { display: block; margin-bottom: 1rem; }
.field--inline { display: flex; align-items: center; gap: .6rem; margin: 0; }
.field__label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .35rem;
}
.field--inline .field__label { margin: 0; }
.field__input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .62rem .8rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field__input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-050);
}

.alert {
  background: var(--danger-050);
  color: #a3271e;
  border: 1px solid #f4c4bf;
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  font-size: .9rem;
  margin-bottom: 1rem;
}

/* =========================================================================
   Auth / login
   ========================================================================= */
body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(60rem 60rem at 15% -10%, var(--brand-050), transparent 60%),
    radial-gradient(50rem 50rem at 110% 120%, #dff4f1, transparent 55%),
    var(--canvas);
}
.auth__card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.8rem 1.6rem;
}
.auth__brand { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.6rem; }
.auth__logo { border-radius: 50%; box-shadow: var(--shadow-md); }
.auth__name { font-size: 1.2rem; font-weight: 800; }
.auth__tag { margin: .1rem 0 0; color: var(--muted); font-size: .88rem; }
.auth__foot { text-align: center; color: var(--muted); font-size: .78rem; margin: 1.2rem 0 0; }

/* =========================================================================
   Top bar
   ========================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar__brand { display: flex; align-items: center; gap: .7rem; }
.topbar__brand img { border-radius: 50%; }
.topbar__name { display: block; font-weight: 800; color: var(--ink); line-height: 1.1; }
.topbar__tag { display: block; font-size: .76rem; color: var(--muted); }
.topbar__right { display: flex; align-items: center; gap: .9rem; }
.topbar__doctor { font-weight: 600; color: var(--ink); font-size: .92rem; }

/* =========================================================================
   Page layout
   ========================================================================= */
.page { max-width: var(--maxw); margin: 0 auto; padding: 1.6rem 1.25rem 3rem; }

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.3rem;
}
.toolbar__title { font-size: 1.6rem; font-weight: 800; }
.toolbar__sub { margin: .15rem 0 0; color: var(--muted); font-weight: 600; }
.datepick { display: flex; align-items: center; gap: .6rem; }

/* =========================================================================
   Summary stats
   ========================================================================= */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--brand);
}
.stat--pending::before { background: var(--danger); }
.stat--done::before { background: var(--success); }
.stat__value { display: block; font-size: 1.9rem; font-weight: 800; color: var(--ink); line-height: 1; }
.stat__label { display: block; margin-top: .35rem; color: var(--muted); font-size: .84rem; font-weight: 600; }

/* =========================================================================
   Patient cards
   ========================================================================= */
.cards { display: grid; gap: 1.1rem; }
.pcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.35rem;
  transition: box-shadow .2s ease, transform .2s ease;
}
.pcard:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pcard__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .95rem;
  border-bottom: 1px dashed var(--border);
}
.pcard__name { font-size: 1.22rem; font-weight: 800; }
.pcard__meta { display: flex; align-items: center; gap: .55rem; margin-top: .4rem; flex-wrap: wrap; }
.pcard__rel { color: var(--muted); font-size: .9rem; }
.pcard__date {
  color: var(--brand);
  font-weight: 700;
  font-size: .86rem;
  background: var(--brand-050);
  padding: .3rem .7rem;
  border-radius: var(--pill);
  white-space: nowrap;
}
.chip {
  display: inline-block;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  padding: .22rem .65rem;
}

.pcard__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .85rem 1.4rem;
  margin: 1rem 0 1.1rem;
}
.pcard__grid div { margin: 0; }
.pcard__grid dt { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pcard__grid dd { margin: .15rem 0 0; font-weight: 600; color: var(--ink); }

/* =========================================================================
   Tests table
   ========================================================================= */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.tests { width: 100%; border-collapse: collapse; min-width: 520px; }
.tests thead th {
  text-align: left;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
  padding: .7rem .9rem;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}
.tests td { padding: .72rem .9rem; border-bottom: 1px solid var(--border); }
.tests tbody tr:last-child td { border-bottom: none; }
.tests__name { font-weight: 600; color: var(--ink); }
.tests .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tests .ctr { text-align: center; width: 112px; }

.status { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 700; }
.status--done { color: var(--success); }
.status--pending { color: var(--danger); }

.tel { color: var(--brand); text-decoration: none; font-weight: 600; }
.tel:hover { text-decoration: underline; }

/* Status dots */
.dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  vertical-align: middle;
}
.dot--done { background: var(--success); box-shadow: 0 0 0 3px var(--success-050); }
.dot--pending { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-050); }

.tick {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  color: var(--danger);
  background: var(--danger-050);
  border: 1px solid #f4c4bf;
  border-radius: var(--pill);
  padding: .2rem .6rem .2rem .5rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tick:hover { background: var(--brand-050); border-color: var(--brand); color: var(--brand); }
.tick:disabled { opacity: .55; cursor: default; }
.tick__label { line-height: 1; }

/* =========================================================================
   Empty state
   ========================================================================= */
.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty__icon { opacity: .55; margin-bottom: .6rem; }
.empty__title { font-weight: 800; color: var(--ink); margin: 0 0 .25rem; }
.empty__sub { color: var(--muted); margin: 0; }

/* =========================================================================
   Toast
   ========================================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translate(-50%, 2rem);
  background: var(--ink);
  color: #fff;
  padding: .7rem 1.15rem;
  border-radius: var(--pill);
  font-weight: 600;
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 50;
}
.toast--show { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--danger); }

/* =========================================================================
   Auth extras + notices
   ========================================================================= */
.auth__links { text-align: center; margin: 1rem 0 0; font-size: .9rem; }
.auth__links a { color: var(--brand); text-decoration: none; font-weight: 600; }
.auth__links a:hover { text-decoration: underline; }
.auth__intro { color: var(--muted); font-size: .92rem; margin: 0 0 1.1rem; }
.auth__hint { color: var(--muted); font-size: .8rem; margin: -.3rem 0 1rem; }

.notice {
  background: var(--brand-050);
  color: #0b4a6f;
  border: 1px solid #bfe0ef;
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  font-size: .9rem;
  margin-bottom: 1rem;
}

/* =========================================================================
   Admin
   ========================================================================= */
.adm-h { font-size: 1.05rem; font-weight: 800; color: var(--ink); margin: 0 0 1rem; }
.adm-create { margin-bottom: 1.1rem; }
.adm-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .2rem 1.2rem;
  align-items: end;
}
.adm-form .field { margin-bottom: .8rem; }
.adm-check { grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; margin: .2rem 0 1rem; font-weight: 600; color: var(--ink); }
.pw-show { font-size: .78rem; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; margin-top: .4rem; }
.account-card { max-width: 440px; margin: 1.5rem auto; }
.adm-form .btn--primary { grid-column: 1 / -1; justify-self: start; }
.adm-table th, .adm-table td { font-size: .9rem; white-space: nowrap; }
.adm-actions { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; }
.adm-actions form { margin: 0; }

.pill {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: var(--pill);
  background: var(--surface-muted);
  color: var(--ink);
  border: 1px solid var(--border);
}
.pill--admin { background: var(--brand-050); color: var(--brand); border-color: #bfe0ef; }
.pill--on { background: var(--success-050); color: var(--success); border-color: #bfe6cd; }
.pill--off { background: var(--danger-050); color: var(--danger); border-color: #f4c4bf; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .pcard__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .toolbar { align-items: stretch; }
  .datepick { width: 100%; }
  .datepick .field--inline { width: 100%; justify-content: space-between; }
  .pcard__grid { grid-template-columns: 1fr 1fr; }
  .topbar__doctor { display: none; }
  .adm-form { grid-template-columns: 1fr; }
}
