:root {
  --bg: #f7f8fb;
  --ink: #171717;
  --muted: #667085;
  --panel: #ffffff;
  --line: #e4e7ec;
  --green: #0f8b6f;
  --blue: #3157b7;
  --red: #c74343;
  --gold: #d5972b;
  --cyan: #0ea5b7;
  --violet: #6d5bd0;
  --shadow: 0 18px 45px rgba(16, 24, 40, .1);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background:
    radial-gradient(circle at 8% 0%, rgba(14, 165, 183, .12), transparent 28%),
    radial-gradient(circle at 96% 18%, rgba(109, 91, 208, .12), transparent 24%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.customer-page {
  display: block;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.66), transparent 320px),
    radial-gradient(circle at 18% 12%, rgba(15, 139, 111, .22), transparent 28%),
    radial-gradient(circle at 92% 10%, rgba(49, 87, 183, .18), transparent 30%),
    radial-gradient(circle at 10% 88%, rgba(213, 151, 43, .18), transparent 24%),
    var(--bg);
}
.customer-shell {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 22px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}
.customer-hero {
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 0;
  padding: 14px 0 4px;
  position: relative;
}
.customer-hero h1 {
  max-width: 780px;
  font-size: clamp(34px, 4.8vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}
.customer-hero p {
  max-width: 720px;
  color: #475467;
  font-size: 17px;
  line-height: 1.5;
}
.hero-facts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.hero-facts span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
}
.trust-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.trust-strip strong {
  padding: 9px 12px;
  border-radius: 999px;
  color: #074d43;
  background: rgba(220, 252, 241, .86);
  border: 1px solid rgba(15, 139, 111, .18);
  font-size: 13px;
}
.hero-badge {
  width: 132px;
  min-height: 132px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--green), var(--cyan) 48%, var(--blue));
  color: white;
  box-shadow: 0 24px 56px rgba(15, 139, 111, .28);
  outline: 10px solid rgba(255,255,255,.64);
}
.hero-badge strong { font-size: 32px; }
.hero-badge span { font-weight: 800; }
.customer-grid {
  display: grid;
  grid-template-columns: minmax(280px, .72fr) minmax(0, 1.5fr) minmax(280px, .7fr);
  gap: 18px;
  align-items: stretch;
  min-height: 0;
}
.customer-grid .panel {
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}
.customer-grid .chat-panel {
  min-height: 0;
  border-color: rgba(15, 139, 111, .28);
  box-shadow: 0 24px 70px rgba(15, 139, 111, .14);
}
.panel-intro {
  margin: -4px 0 16px;
  color: var(--muted);
  line-height: 1.45;
}
.doctor-block {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.doctor-block.always-visible {
  margin-top: 0;
}
.doctor-directory {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}
.doctor-pill {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid #dce8f7;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f4fbff);
}
.doctor-pill strong {
  font-size: 14px;
}
.doctor-pill span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}
.hidden { display: none; }
.locked {
  opacity: .72;
}
.judge-note {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(49, 87, 183, .18);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(239, 245, 255, .98));
  box-shadow: 0 14px 28px rgba(49, 87, 183, .1);
}
.judge-note span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.judge-note dl {
  display: grid;
  gap: 8px;
  margin: 0;
}
.judge-note dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
}
.judge-note dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.judge-note dd {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
}
.admin-note-link {
  display: inline-flex;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #172033, var(--blue));
  color: white;
  text-decoration: none;
  font-weight: 900;
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.auth-card {
  width: min(420px, 100%);
}
.auth-brand {
  margin-bottom: 22px;
  color: var(--ink);
}
.auth-brand small { color: var(--muted); }
.error-text {
  margin: 0 0 12px;
  color: var(--red);
  font-weight: 800;
}
.sidebar {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(180deg, #111827, #172033 54%, #101614),
    #111827;
  color: #fffaf0;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 8px; background: linear-gradient(145deg, var(--green), var(--cyan)); font-weight: 900;
  box-shadow: 0 12px 24px rgba(14, 165, 183, .24);
}
small, .muted { color: var(--muted); }
.brand small, .tenant-card small, .tenant-card span { color: #bdb5a4; display: block; }
nav { display: grid; gap: 8px; }
nav button {
  color: #d0d5dd; background: transparent; border: 1px solid transparent;
  padding: 12px; text-align: left; border-radius: 8px; cursor: pointer;
}
nav button.active, nav button:hover { background: rgba(255, 255, 255, .08); color: white; border-color: rgba(255, 255, 255, .12); }
.sidebar-logout {
  display: block;
  padding: 12px;
  border: 1px solid #4b2f2f;
  border-radius: 8px;
  background: #321f1f;
  color: #ffdede;
  text-decoration: none;
  font-weight: 800;
  text-align: center;
}
.sidebar-logout:hover {
  background: #452626;
  color: white;
}
.tenant-card { margin-top: auto; padding: 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(255,255,255,.06); }
main { padding: 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 24px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.78); box-shadow: 0 12px 30px rgba(16,24,40,.06); }
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 13px; font-weight: 700; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 34px; }
h2 { font-size: 18px; }
button, input, textarea, select {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
}
button { cursor: pointer; padding: 10px 14px; font-weight: 700; }
.primary { background: linear-gradient(135deg, var(--green), var(--blue)); color: white; border-color: transparent; box-shadow: 0 10px 22px rgba(49, 87, 183, .18); }
.primary:hover { filter: brightness(1.04); transform: translateY(-1px); }
.ghost { background: white; color: var(--ink); }
.top-actions a { text-decoration: none; display: inline-flex; align-items: center; padding: 10px 14px; border-radius: 8px; font-weight: 800; }
.top-actions { display: flex; gap: 10px; }
.view { display: none; }
.view.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.metric { padding: 18px; position: relative; overflow: hidden; }
.metric::after {
  content: "";
  position: absolute;
  right: -22px;
  top: -22px;
  width: 76px;
  height: 76px;
  border-radius: 999px;
  background: rgba(14, 165, 183, .14);
}
.metric strong { display: block; font-size: 30px; margin-top: 8px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1.1fr .9fr; }
.panel { padding: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.status { color: var(--green); background: #e6f5ef; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.pipeline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 18px 0; }
.pipeline span { padding: 16px 10px; text-align: center; border-radius: 8px; background: #edf0f7; color: var(--blue); font-weight: 800; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 130px 1fr 30px; gap: 10px; align-items: center; }
.bar i { display: block; height: 10px; border-radius: 999px; background: var(--green); }
input, textarea, select {
  width: 100%;
  padding: 12px;
  background: #ffffff;
  color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: rgba(14, 165, 183, .65); box-shadow: 0 0 0 4px rgba(14, 165, 183, .12); }
textarea { min-height: 92px; resize: vertical; }
label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; margin-bottom: 14px; }
.form-row, .operation-form { display: grid; gap: 10px; margin-bottom: 18px; }
.operation-form { grid-template-columns: 1fr 120px 1.2fr 1.3fr 1.5fr; }
.list { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 14px; box-shadow: 0 8px 18px rgba(16, 24, 40, .04); }
.item-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.tag { font-size: 12px; color: white; background: linear-gradient(135deg, var(--blue), var(--violet)); padding: 4px 8px; border-radius: 999px; }
.tag.write { background: var(--gold); color: #221600; }
.provider-card {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.provider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.provider-head small { display: block; margin-top: 3px; }
.full { width: 100%; margin-bottom: 14px; }
.simulator-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); gap: 16px; }
.chat-panel { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.chat-log {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(247, 250, 252, .9), rgba(255,255,255,.9));
  border: 1px solid var(--line);
  min-height: 0;
}
.bubble { max-width: 78%; padding: 14px 16px; border-radius: 8px; background: #eef2f6; line-height: 1.45; box-shadow: 0 8px 18px rgba(16, 24, 40, .05); }
.bubble.ai { align-self: flex-start; background: #e7f8f2; border: 1px solid #c7eee0; }
.bubble.customer { align-self: flex-end; background: linear-gradient(135deg, #edf4ff, #eef0ff); border: 1px solid #d7e3ff; }
.quick-prompts { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 16px; }
.quick-prompts button { background: white; color: var(--blue); box-shadow: 0 6px 16px rgba(16, 24, 40, .05); border-color: #d9e4ff; }
.quick-prompts button:hover { border-color: rgba(49, 87, 183, .35); color: var(--green); }
.composer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.composer input { border-color: transparent; background: #f8fafc; }
.trace { display: grid; gap: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.trace div { padding: 10px; border-radius: 8px; background: #1f1e1a; color: #f7eddc; }
@media (min-width: 901px) {
  .customer-grid {
    height: min(680px, calc(100vh - 220px));
    min-height: 500px;
  }
  .customer-grid > .panel {
    min-height: 0;
    overflow: auto;
  }
  .customer-grid .chat-panel {
    overflow: hidden;
  }
}
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; padding: 18px; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  nav button { text-align: center; }
  .metrics, .grid.two, .simulator-layout, .operation-form, .customer-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .customer-page { overflow: auto; }
  .customer-shell { min-height: auto; display: block; }
  .customer-hero { flex-direction: column; align-items: stretch; min-height: auto; padding-top: 12px; margin-bottom: 12px; }
  .hero-badge { width: 100%; min-height: 88px; border-radius: 8px; outline: 0; }
  .composer { grid-template-columns: 1fr; }
  .composer button { width: 100%; }
  .customer-shell { padding: 16px; }
  .customer-grid .chat-panel { min-height: 580px; }
  .bubble { max-width: 92%; }
}
@media (max-width: 720px) {
  .customer-shell {
    padding: 12px;
  }
  .customer-hero {
    gap: 16px;
    margin-bottom: 12px;
    padding: 14px 0 8px;
  }
  .customer-hero h1 {
    font-size: 38px;
    line-height: 1.06;
  }
  .customer-hero p {
    font-size: 16px;
    margin-bottom: 0;
  }
  .customer-grid {
    gap: 12px;
  }
  .customer-grid .chat-panel {
    min-height: 520px;
  }
  .chat-panel {
    grid-template-rows: auto minmax(280px, 1fr) auto auto;
  }
  .chat-log {
    min-height: 280px;
    max-height: 48vh;
    padding: 10px;
  }
  .judge-note dl div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .admin-note-link {
    width: 100%;
  }
  .doctor-directory {
    max-height: none;
  }
}
@media (max-width: 520px) {
  body.customer-page {
    min-width: 0;
  }
  .customer-hero p { font-size: 16px; }
  .customer-hero h1 { font-size: 36px; }
  .hero-facts span { width: 100%; }
  .trust-strip { display: grid; }
  .panel { padding: 16px; }
  .quick-prompts { display: grid; }
  .quick-prompts button { text-align: left; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  nav { grid-template-columns: 1fr; }
  main { padding: 16px; }
  .topbar { padding: 16px; }
  h1 { font-size: 28px; }
  .customer-grid .panel {
    border-radius: 8px;
  }
  .hero-badge {
    min-height: 74px;
    display: flex;
    justify-content: center;
    gap: 10px;
  }
  .hero-badge strong {
    font-size: 28px;
  }
  .trust-strip strong {
    text-align: center;
  }
  .status {
    white-space: normal;
  }
  input, textarea, select, button {
    min-height: 44px;
  }
  .chat-log {
    max-height: 46vh;
  }
  .bubble {
    max-width: 96%;
    padding: 12px 13px;
    font-size: 15px;
  }
  .composer {
    padding: 8px;
  }
  .trace {
    font-size: 12px;
  }
}
@media (max-width: 380px) {
  .customer-shell {
    padding: 8px;
  }
  .customer-hero h1 {
    font-size: 32px;
  }
  .panel {
    padding: 14px;
  }
  .hero-facts span,
  .trust-strip strong,
  .quick-prompts button {
    font-size: 13px;
  }
}
