/* ============ MediConsult AI — application styles ============ */
:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-light: #ccfbf1;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --danger: #b91c1c;
  --amber: #b45309;
  --violet: #7c3aed;
  --sky: #0369a1;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Noto Sans Bengali", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.topbar {
  background: linear-gradient(135deg, #134e4a, #0f766e);
  color: #fff;
  padding: 0.7rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 2px 10px rgba(15,118,110,.35);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.12rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; background: #fff; color: var(--teal);
  display: grid; place-items: center; font-size: 1.15rem;
}
.topbar nav { display: flex; align-items: center; gap: .9rem; font-size: .93rem; }
.topbar nav a { color: #d1fae5; }
.topbar .pill {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  padding: .3rem .7rem; border-radius: 999px; color: #fff;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 1.4rem 1rem 4rem; }

/* ---------- stepper ---------- */
.stepper { display: flex; gap: .35rem; flex-wrap: wrap; margin: 1rem 0 1.4rem; }
.stepchip {
  display: flex; align-items: center; gap: .45rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: .38rem .85rem .38rem .5rem; font-size: .85rem; color: var(--muted);
}
.stepchip .n {
  width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center;
  background: var(--line); color: var(--ink); font-weight: 700; font-size: .78rem;
}
.stepchip.done { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.stepchip.done .n { background: #10b981; color: #fff; }
.stepchip.active { border-color: var(--teal); background: var(--teal-light); color: var(--teal-dark); font-weight: 700; }
.stepchip.active .n { background: var(--teal); color: #fff; }
.stepchip.locked { opacity: .55; }
.stepchip.islink:hover { text-decoration: none; box-shadow: 0 2px 8px rgba(15,118,110,.15); }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.4rem; margin-bottom: 1.1rem;
  box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.card h2 { margin: 0 0 .3rem; font-size: 1.22rem; }
.card h3 { margin: 0 0 .7rem; font-size: 1.03rem; }
.card .sub { color: var(--muted); font-size: .92rem; margin: 0 0 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.sectioncard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.sectioncard .req { color: var(--danger); font-size: .75rem; font-weight: 700; }

/* ---------- option checkboxes ---------- */
.opts { display: flex; flex-wrap: wrap; gap: .45rem; }
.opt { position: relative; display: inline-block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt .optbox {
  display: inline-block; padding: .42rem .8rem; border-radius: 10px;
  border: 1.5px solid var(--line); background: #f8fafc; font-size: .88rem;
  transition: all .12s ease; user-select: none;
}
.opt:hover .optbox { border-color: #94a3b8; }
.opt input:checked + .optbox {
  background: var(--teal-light); border-color: var(--teal); color: var(--teal-dark); font-weight: 600;
}
.opt input:focus-visible + .optbox { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- forms ---------- */
label.field { display: block; font-size: .86rem; font-weight: 600; color: var(--muted); margin: .8rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: .6rem .75rem; border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(15,118,110,.35); border-color: var(--teal); }
textarea { min-height: 140px; resize: vertical; }
select { width: auto; min-width: 190px; padding: .45rem .6rem; }
.btn {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  background: var(--teal); color: #fff; border: 0; border-radius: 10px;
  padding: .62rem 1.25rem; font: inherit; font-weight: 700; font-size: .95rem;
  transition: background .12s ease;
}
.btn:hover { background: var(--teal-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--teal-dark); border: 1.5px solid var(--teal); }
.btn.ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.small { padding: .4rem .8rem; font-size: .85rem; }

/* ---------- flash & errors ---------- */
.flash {
  border-radius: 10px; padding: .7rem 1rem; margin: .8rem 0; font-size: .92rem;
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
}
.errbox {
  border-radius: 10px; padding: .7rem 1rem; margin: .8rem 0; font-size: .92rem;
  background: #fef2f2; border: 1px solid #fecaca; color: var(--danger);
}
.errbox ul { margin: .2rem 0 .2rem 1.1rem; padding: 0; }

/* ---------- voice recorder ---------- */
.voicebox {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: #f0fdfa; border: 1px dashed #5eead4; border-radius: 12px; padding: .8rem 1rem; margin-bottom: .9rem;
}
.mic {
  width: 46px; height: 46px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--teal); color: #fff; font-size: 1.25rem; display: grid; place-items: center;
  transition: all .15s ease;
}
.mic:hover { background: var(--teal-dark); }
.mic.rec { background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(185,28,28,.45);} 70% { box-shadow: 0 0 0 14px rgba(185,28,28,0);} 100% { box-shadow: 0 0 0 0 rgba(185,28,28,0);} }
.voicehint { font-size: .82rem; color: var(--muted); }
.listening { color: var(--danger); font-weight: 700; font-size: .88rem; display: none; }

/* ---------- topic cards (step 2) ---------- */
.topic { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; background: #fff; }
.topic .thead {
  display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; background: #f8fafc;
  border-bottom: 1px solid var(--line); font-weight: 700;
}
.topic .thead .detected {
  margin-left: auto; font-size: .72rem; font-weight: 700; color: #065f46;
  background: #d1fae5; padding: .18rem .6rem; border-radius: 999px;
}
.topic .tbody { padding: .9rem 1.1rem 1.1rem; }
.topic details { margin-top: .7rem; }
.topic summary { cursor: pointer; font-size: .9rem; color: var(--teal-dark); font-weight: 600; }
.topicrow { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-top: .8rem; }

/* ---------- report ---------- */
.markergrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin: 1rem 0; }
.marker {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; background: #fff;
}
.marker .sym { font-size: 1.5rem; font-weight: 800; }
.marker .bar { height: 10px; border-radius: 999px; background: var(--line); margin: .55rem 0 .3rem; overflow: hidden; }
.marker .bar > span { display: block; height: 100%; border-radius: 999px; }
.badge { display: inline-block; padding: .16rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.badge.prominent { background: #fee2e2; color: #991b1b; }
.badge.evident { background: #fef3c7; color: #92400e; }
.badge.slight { background: #e0f2fe; color: #075985; }
.badge.none { background: #f1f5f9; color: var(--muted); }
.redflag {
  background: #fef2f2; border: 1.5px solid #fca5a5; color: var(--danger); border-radius: 12px;
  padding: .9rem 1.1rem; margin: 1rem 0; font-weight: 600;
}
.depths { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1rem 0; }
.depth { border-radius: var(--radius); padding: 1rem 1.1rem; border: 1px solid var(--line); background: #fff; }
.depth .idx { font-size: 1.7rem; font-weight: 800; color: var(--teal-dark); }
.narrative {
  background: #f8fafc; border-left: 4px solid var(--teal); border-radius: 8px;
  padding: 1rem 1.2rem; white-space: pre-line; font-size: .95rem;
}
.findings li { margin: .25rem 0; }
.replynote { font-size: .8rem; color: var(--muted); margin-top: 1rem; }

/* ---------- table / list ---------- */
.caselist { width: 100%; border-collapse: collapse; font-size: .93rem; }
.caselist th, .caselist td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); }
.caselist th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.status { font-size: .78rem; font-weight: 700; padding: .18rem .6rem; border-radius: 999px; }
.status.open { background: #fef3c7; color: #92400e; }
.status.done { background: #d1fae5; color: #065f46; }

/* ---------- auth ---------- */
.authwrap { max-width: 430px; margin: 3rem auto; padding: 0 1rem; }
.authwrap .card { padding: 1.8rem; }

footer.site { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 0 2.5rem; }

@media (max-width: 640px) {
  .wrap { padding: 1rem .7rem 3rem; }
  .card { padding: 1rem; }
  select { width: 100%; }
}
@media print {
  .topbar, .stepper, .noprint, footer.site { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
