/* ============================================================
   Clinical Prediction Engine — themed to match DNH Care
   (Dr. Nafia's Homoeopathic Medical Centre, dnhcare.co.in)
   Palette + type taken from the main site's styles.css.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500;1,600&family=Manrope:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #07120d;            /* deep forest */
  --bg-2: #0b1a13;
  --bg-3: #0e1f16;
  --panel: rgba(255, 255, 255, 0.018);
  --panel-hover: rgba(217, 164, 65, 0.05);
  --ink: #f5f1e6;           /* warm cream */
  --ink-dim: rgba(245, 241, 230, 0.66);
  --gold: #d9a441;
  --gold-soft: rgba(217, 164, 65, 0.5);
  --sage: #7fb89a;
  --emerald: #1d5c41;
  --hairline: rgba(245, 241, 230, 0.12);
  --warn: #e07a5f;
  --warn-bg: rgba(224, 122, 95, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { scrollbar-width: thin; scrollbar-color: var(--hairline) transparent; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 300;
}
::selection { background: var(--gold); color: #08140e; }
h1, h2, h3, h4, .brand, .serif { font-family: "Cormorant Garamond", serif; }

/* shared bits */
.eyebrow {
  font-size: 0.66rem; letter-spacing: 0.4em; text-transform: uppercase;
  color: var(--sage); margin-bottom: 10px;
}
.brand-mark { font-family: "Cormorant Garamond", serif; font-weight: 700; letter-spacing: 0.12em; }
.brand-mark span { color: var(--gold); }
.brand-sub {
  display: block; font-family: "Manrope", sans-serif; font-weight: 400;
  font-size: 0.52rem; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--ink-dim); margin-top: 6px;
}

label { display: block; font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-dim); margin: 16px 0 7px; }
input[type=text], input[type=password] {
  width: 100%; padding: 12px 14px; background: var(--bg-3);
  border: 1px solid var(--hairline); border-radius: 12px;
  color: var(--ink); font-size: 0.95rem; font-family: inherit;
}
input:focus { outline: none; border-color: var(--gold-soft); }

button {
  cursor: pointer; border: none; border-radius: 999px; padding: 12px 26px;
  background: var(--gold); color: #08140e; font-family: inherit;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  transition: transform 0.25s, background 0.25s, box-shadow 0.25s;
}
button:hover { background: #e8b95e; transform: translateY(-1px); }
button.ghost {
  background: transparent; border: 1px solid var(--gold-soft); color: var(--gold);
}
button.ghost:hover { background: var(--gold); color: #08140e; }
button.danger { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
button.danger:hover { background: var(--warn); color: var(--bg); }
.full { width: 100%; margin-top: 22px; }
.error { color: var(--warn); font-size: 0.82rem; margin-top: 14px; min-height: 16px; letter-spacing: 0.02em; }

/* ---------- Login / centered card ---------- */
.center-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(70% 80% at 50% -10%, rgba(29, 92, 65, 0.35), transparent 60%),
    radial-gradient(60% 70% at 50% 120%, rgba(217, 164, 65, 0.10), transparent 65%),
    var(--bg);
}
.card {
  background: var(--bg-2); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 40px 36px; width: 100%; max-width: 380px; text-align: center;
}
.card .brand-mark { font-size: 1.7rem; display: block; }
.card h1 { font-weight: 600; }
.card .sub { color: var(--ink-dim); font-size: 0.9rem; margin: 18px 0 8px; line-height: 1.6; }
.card form, .card #stage-backup { text-align: left; }
.card .mini { font-size: 0.74rem; color: var(--ink-dim); margin-top: 14px; line-height: 1.7; }
.card code { color: var(--gold); font-size: 0.86rem; letter-spacing: 0.12em; word-break: break-all; }
.qr-box {
  display: flex; justify-content: center; margin: 18px 0 6px; padding: 14px;
  background: var(--ink); border-radius: 14px;
}
.qr-box img { width: 190px; height: 190px; display: block; }
.backup-list {
  list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin: 18px 0 6px; padding: 16px; background: var(--bg-3);
  border: 1px solid var(--gold-soft); border-radius: 14px;
}
.backup-list li {
  font-family: ui-monospace, "Cascadia Code", monospace; font-size: 0.9rem;
  letter-spacing: 0.08em; color: var(--ink); text-align: center; padding: 4px 0;
}

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 290px 1fr; height: 100vh; }

.sidebar {
  background: var(--bg-2); border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar .top { padding: 20px 18px 16px; border-bottom: 1px solid var(--hairline); }
.brand { font-size: 1.3rem; margin-bottom: 4px; }
.brand-tag { font-size: 0.56rem; letter-spacing: 0.34em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 16px; }
.sessions { flex: 1; overflow-y: auto; padding: 10px; min-height: 0; }
.sessions-label { font-size: 0.6rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-dim); padding: 8px 10px 4px; }
.session-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 12px; border-radius: 12px; cursor: pointer; color: var(--ink-dim);
  font-size: 0.9rem; margin-bottom: 3px; border: 1px solid transparent; transition: all 0.25s;
}
.session-item:hover { background: var(--panel); color: var(--ink); }
.session-item.active { background: var(--panel-hover); border-color: var(--gold-soft); color: var(--ink); }
.session-item .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .del { opacity: 0; color: var(--ink-dim); background: none; border: none; padding: 2px 6px; font-size: 0.8rem; }
.session-item:hover .del { opacity: 1; }
.session-item .del:hover { color: var(--warn); transform: none; background: none; }
.sidebar .bottom { padding: 14px 18px; border-top: 1px solid var(--hairline); font-size: 0.8rem; color: var(--ink-dim); }
.sidebar .bottom a { color: var(--gold); text-decoration: none; cursor: pointer; letter-spacing: 0.06em; }
.sidebar .bottom a:hover { color: #e8b95e; }
.sidebar .row { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Chat pane ---------- */
.chat { display: flex; flex-direction: column; min-width: 0;
  background: radial-gradient(80% 50% at 50% -10%, rgba(29, 92, 65, 0.16), transparent 60%), var(--bg);
}
.tabs { display: flex; gap: 6px; padding: 14px 24px 0; border-bottom: 1px solid var(--hairline); }
.tab {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--ink-dim); border-radius: 0; padding: 10px 18px 14px;
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600;
}
.tab:hover { background: transparent; color: var(--ink); transform: none; }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.messages { flex: 1; overflow-y: auto; padding: 30px 24px; }
.thread { max-width: 840px; margin: 0 auto; }
.empty-hint { color: var(--ink-dim); text-align: center; margin-top: 16vh; line-height: 2; }
.empty-hint .big { font-family: "Cormorant Garamond", serif; font-size: 1.9rem; color: var(--ink); display: block; margin-bottom: 12px; }

.msg { margin-bottom: 26px; }
.msg .who { font-size: 0.6rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--sage); margin-bottom: 8px; }
.bubble-user {
  background: rgba(217, 164, 65, 0.12); border: 1px solid var(--gold-soft); color: var(--ink);
  padding: 12px 16px; border-radius: 14px 14px 14px 4px; display: inline-block; max-width: 80%; line-height: 1.55;
}

/* live step log */
.steps { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.step {
  display: flex; align-items: center; gap: 10px; font-size: 0.84rem; color: var(--ink-dim);
  letter-spacing: 0.06em; background: var(--panel); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 10px 14px;
}
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-dim); flex: none; }
.step.running .dot { background: var(--gold); animation: pulse 1s infinite; }
.step.running { color: var(--ink); border-color: var(--gold-soft); }
.step.done .dot { background: var(--sage); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* result card */
.rx-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 26px; }
.rx-card.alert { border-color: var(--warn); background: var(--warn-bg); }
.rx-title { font-size: 0.64rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); }
.rx-value { font-family: "Cormorant Garamond", serif; font-size: 2rem; font-weight: 600; margin: 8px 0 18px; color: var(--ink); }
.rx-value.alert { color: var(--warn); }
.rep-summary { margin: 8px 0 20px; padding: 14px 16px; background: var(--panel-hover);
  border: 1px solid var(--gold-soft); border-left: 3px solid var(--gold);
  border-radius: 12px; color: var(--ink); font-size: 0.95rem; line-height: 1.5; }
.conf-bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.conf-fill { height: 100%; background: linear-gradient(90deg, var(--sage), var(--gold)); }
.conf-label { font-size: 0.78rem; color: var(--ink-dim); letter-spacing: 0.08em; }

details { margin-top: 16px; border-top: 1px solid var(--hairline); padding-top: 14px; }
summary { cursor: pointer; list-style: none; font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); display: flex; justify-content: space-between; }
summary::after { content: "+"; color: var(--gold); font-size: 1.1rem; line-height: 1; transition: transform 0.3s; }
details[open] summary::after { transform: rotate(45deg); }
details .body { font-size: 0.95rem; color: var(--ink-dim); margin-top: 12px; line-height: 1.75; }
.kv { font-size: 0.9rem; margin: 4px 0; color: var(--ink-dim); }
.kv b { color: var(--sage); font-weight: 600; }
.case { border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: 0.88rem; line-height: 1.6; }
.case .rx { color: var(--gold); }

/* composer */
.composer { border-top: 1px solid var(--hairline); padding: 18px 24px; background: var(--bg-2); }
.composer .inner { max-width: 840px; margin: 0 auto; display: flex; gap: 12px; align-items: flex-end; }
.ta-wrap { position: relative; flex: 1; }
.composer textarea {
  width: 100%; resize: none; min-height: 50px; max-height: 180px; padding: 14px 16px;
  background: var(--bg-3); border: 1px solid var(--hairline); border-radius: 14px;
  color: var(--ink); font-size: 0.95rem; font-family: inherit; line-height: 1.5;
}
.composer textarea:focus { outline: none; border-color: var(--gold-soft); }
.composer button { align-self: stretch; }

/* type-ahead dropdown */
.ac {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  background: var(--bg-2); border: 1px solid var(--gold-soft); border-radius: 14px;
  overflow: hidden; z-index: 30; box-shadow: 0 -10px 40px rgba(2, 8, 5, 0.6);
}
.ac-item {
  padding: 11px 16px; font-size: 0.9rem; color: var(--ink-dim); cursor: pointer;
  display: flex; justify-content: space-between; gap: 12px; letter-spacing: 0.02em;
}
.ac-item:hover, .ac-item.active { background: var(--panel-hover); color: var(--ink); }
.ac-item .tag { font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--sage); align-self: center; }

/* recognised-abbreviations note inside the result card */
.expansions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.exp-chip {
  font-size: 0.74rem; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--panel); color: var(--ink-dim);
}
.exp-chip b { color: var(--gold); font-weight: 600; }
.step.normalize .dot { background: var(--sage); }
.hint { max-width: 840px; margin: 8px auto 0; font-size: 0.68rem; color: var(--ink-dim); letter-spacing: 0.04em; text-align: center; }

/* ---------- Admin ---------- */
.admin-wrap { max-width: 820px; margin: 0 auto; padding: 64px 28px; }
.admin-wrap .eyebrow { color: var(--gold); }
.admin-wrap h1 { font-size: 2.4rem; font-weight: 600; }
.admin-wrap .sub { color: var(--ink-dim); margin-top: 8px; font-size: 0.95rem; }
.admin-wrap a.back { color: var(--sage); text-decoration: none; font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; }
.admin-wrap a.back:hover { color: var(--gold); }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--hairline); font-size: 0.92rem; }
th { color: var(--ink-dim); font-weight: 600; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.2em; }
.badge { background: var(--panel); border: 1px solid var(--hairline); border-radius: 999px; padding: 4px 12px; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.badge.admin { color: var(--gold); border-color: var(--gold-soft); }
.create-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 14px; align-items: end; margin-top: 28px; padding: 24px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--ink-dim); }
.checkbox-row label { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .create-row { grid-template-columns: 1fr; }
}
