@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=DM+Sans:wght@300;400;500;600&display=swap');
:root {
  --navy: #0d2b4e;
  --navy-mid: #1a3f6f;
  --navy-light: #2557a0;
  --accent: #4a90d9;
  --accent-bright: #5ba8f5;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface2: #eef3fa;
  --border: #d0ddf0;
  --text: #0d1f35;
  --text-muted: #5a7a9e;
  --success: #2e9e6b;
  --danger: #c0392b;
  --shadow: 0 4px 24px rgba(13,43,78,0.10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

header {
  background: #ffffff;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: none;
  position: relative;
}
header::before { display: none; }
.header-rule {
  height: 14px;
  background: linear-gradient(to bottom, #0a1628 0%, #0a1628 64%, #1a5fa8 64%, #1a5fa8 100%);
  flex-shrink: 0;
}
.header-inner { display: flex; align-items: center; justify-content: center; width: 100%; position: relative; }
.header-logo { display: flex; flex-direction: column; align-items: center; }
.header-logo-img { height: 80px; width: auto; display: block; }
.header-subtitle { font-size: 0.88rem; color: #555; letter-spacing: 0.18em; font-weight: 400; margin-top: 6px; }
.header-actions { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 10px; }
.header-title { display: none; }
.btn-outline { background: transparent; border: 1.5px solid #1a1a1a; color: #1a1a1a; border-radius: 6px; padding: 7px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.15s; }
.btn-outline:hover { background: #f0f0f0; }
.btn-sm { font-size: 0.78rem; padding: 5px 12px; }

main { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }

.card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; margin-bottom: 28px; border: 1px solid var(--border); }
.card-title { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--surface2); }
.card-title .icon { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--navy-light), var(--accent)); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: #fff; flex-shrink: 0; }
.card-title h2 { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: var(--navy); font-weight: 600; }

.dropzone { border: 2.5px dashed var(--border); border-radius: 14px; padding: 52px 24px; text-align: center; cursor: pointer; transition: all 0.25s ease; background: var(--surface2); position: relative; }
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: #eaf3fd; box-shadow: 0 0 0 4px rgba(74,144,217,0.10); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone .dz-icon { font-size: 3rem; margin-bottom: 14px; display: block; }
.dropzone .dz-logo { width: 64px; height: auto; margin-bottom: 14px; display: block; margin-left: auto; margin-right: auto; pointer-events: none; }
.dropzone .dz-title { font-size: 1.1rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.dropzone .dz-sub { font-size: 0.85rem; color: var(--text-muted); }
.dz-types { display: inline-flex; gap: 8px; margin-top: 14px; }
.dz-tag { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 3px 12px; font-size: 0.75rem; color: var(--navy-light); font-weight: 500; }

#file-list { margin-top: 16px; }
.file-item { display: flex; align-items: center; gap: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-size: 0.88rem; }
.file-item .fi-name { flex: 1; font-weight: 500; color: var(--navy); }
.file-item .fi-size { color: var(--text-muted); font-size: 0.78rem; }
.file-item .fi-remove { cursor: pointer; color: var(--danger); font-size: 1rem; background: none; border: none; padding: 4px; border-radius: 6px; }

.btn-primary { background: linear-gradient(135deg, var(--navy-light), var(--accent)); color: #fff; border: none; border-radius: 10px; padding: 14px 32px; font-size: 1rem; font-weight: 600; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 14px rgba(37,87,160,0.3); display: inline-flex; align-items: center; gap: 8px; width: 100%; justify-content: center; margin-top: 16px; }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,87,160,0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.progress-bar-wrap { background: var(--surface2); border-radius: 99px; height: 8px; margin-top: 14px; overflow: hidden; display: none; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-bright)); border-radius: 99px; width: 0%; transition: width 0.4s ease; }
.progress-label { text-align: center; font-size: 0.82rem; color: var(--text-muted); margin-top: 8px; display: none; }

#results-section { display: none; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 8px; }
.info-field label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 5px; font-weight: 600; }
.info-field input { width: 100%; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 0.95rem; font-family: 'DM Sans', sans-serif; color: var(--text); transition: border-color 0.2s; outline: none; }
.info-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74,144,217,0.12); }

.bp-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th { background: var(--navy); color: #fff; padding: 12px 16px; text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
thead th:first-child { border-radius: 10px 0 0 0; }
thead th:last-child { border-radius: 0 10px 0 0; }
tbody tr:nth-child(even) { background: var(--surface2); }
tbody tr:hover { background: #e8f0fc; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody td input[type=number] { width: 80px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 7px; padding: 7px 10px; font-size: 0.9rem; font-family: 'DM Sans', sans-serif; color: var(--text); text-align: center; outline: none; transition: border-color 0.2s; }
tbody td input[type=number]:focus { border-color: var(--accent); }
.wpi-pill { display: inline-block; background: linear-gradient(135deg, var(--navy-light), var(--accent)); color: #fff; border-radius: 20px; padding: 4px 14px; font-size: 0.85rem; font-weight: 600; min-width: 60px; text-align: center; }
.remove-bp { background: none; border: none; cursor: pointer; color: var(--danger); font-size: 1.1rem; padding: 4px 8px; border-radius: 6px; transition: background 0.15s; }
.remove-bp:hover { background: #fdecea; }

.add-bp-row { display: flex; gap: 12px; align-items: flex-end; margin-top: 20px; flex-wrap: wrap; }
.add-bp-row .info-field { flex: 1; min-width: 160px; }
.add-bp-row .info-field input { width: 100%; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 0.95rem; font-family: 'DM Sans', sans-serif; color: var(--text); outline: none; }
.btn-add { background: var(--success); color: #fff; border: none; border-radius: 10px; padding: 11px 24px; font-size: 0.9rem; font-weight: 600; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.2s; white-space: nowrap; align-self: flex-end; display: flex; align-items: center; gap: 6px; }
.btn-add:hover { filter: brightness(1.1); transform: translateY(-1px); }

.method-selector { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.method-btn { padding: 10px 20px; border-radius: 8px; border: 2px solid var(--border); background: var(--surface); color: var(--text-muted); font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; }
.method-btn.active { border-color: var(--accent); background: #eaf3fd; color: var(--navy-light); }
.method-desc { font-size: 0.82rem; color: var(--text-muted); background: var(--surface2); border-radius: 8px; padding: 10px 14px; margin-bottom: 20px; border-left: 3px solid var(--accent); }

.pd-result-box { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%); border-radius: 16px; padding: 36px; text-align: center; color: #fff; position: relative; overflow: hidden; }
.pd-result-box .pd-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.15em; color: rgba(255,255,255,0.6); margin-bottom: 8px; }
.pd-result-box .pd-value { font-family: 'Playfair Display', serif; font-size: 4rem; font-weight: 700; color: var(--accent-bright); line-height: 1; margin-bottom: 4px; }
.pd-result-box .pd-pct { font-size: 1.5rem; color: rgba(255,255,255,0.7); }
.pd-result-box .pd-sub { font-size: 0.82rem; color: rgba(255,255,255,0.5); margin-top: 10px; }

.pd-breakdown { margin-top: 20px; background: var(--surface2); border-radius: 12px; padding: 20px; font-size: 0.88rem; }
.pd-breakdown-title { font-weight: 600; color: var(--navy); margin-bottom: 12px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; }
.breakdown-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.breakdown-item:last-child { border-bottom: none; }
.breakdown-item .bi-name { color: var(--text); font-weight: 500; }

.action-row { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.btn-secondary { background: var(--surface); color: var(--navy-light); border: 2px solid var(--border); border-radius: 10px; padding: 12px 24px; font-size: 0.9rem; font-weight: 600; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: #eaf3fd; }

.empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.92rem; }
.empty-state .es-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; }
.alert { border-radius: 10px; padding: 12px 16px; font-size: 0.88rem; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; }
.alert-info { background: #e8f3fd; border: 1px solid #b3d4f5; color: var(--navy-mid); }

@media print {
  header { background: #ffffff !important; border-bottom: 1px solid #000 !important; -webkit-print-color-adjust: exact; }
  #upload-section, .method-selector, .add-bp-row, .action-row { display: none !important; }
  #results-section { display: block !important; }
}

/* ===== TAB NAVIGATION ===== */
.tab-nav {
  background: #000000;
  display: flex;
  align-items: flex-end;
  padding: 0 48px;
  gap: 4px;
  border-bottom: 3px solid #1a8fd1;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.tab-btn {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.6);
  border: none;
  border-radius: 10px 10px 0 0;
  padding: 12px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  top: 3px;
  border-bottom: 3px solid transparent;
}
.tab-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.tab-btn.active {
  background: var(--bg);
  color: var(--navy);
  border-bottom-color: var(--bg);
  box-shadow: 0 -2px 12px rgba(13,43,78,0.15);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== MEDICAL RECORD SCRAPER ===== */
#scraper-results { display: none; }
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.provider-card {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  transition: box-shadow 0.2s;
}
.provider-card:hover { box-shadow: 0 4px 20px rgba(13,43,78,0.12); }
.provider-card .pc-type {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.provider-card .pc-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
  line-height: 1.3;
}
.provider-card .pc-address {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.5;
}
.provider-card .pc-address svg { flex-shrink: 0; margin-top: 2px; }
.provider-card .pc-specialty {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.provider-type-pill {
  display: inline-block;
  background: var(--navy-light);
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.provider-type-pill.facility { background: #2e9e6b; }

/* Case info fields */
.case-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.case-info-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.case-info-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface2);
  transition: border-color 0.2s;
  outline: none;
}
.case-info-field input:focus { border-color: var(--accent); background: #fff; }
.case-info-full { grid-column: 1 / -1; }
/* Physician facility tag on card */
.pc-facility {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--navy-light);
  font-weight: 500;
  margin-top: 4px;
  background: #eaf3fd;
  border: 1px solid #c6dbf4;
  border-radius: 6px;
  padding: 3px 8px;
}

.scraper-summary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: #fff;
  border-radius: 14px;
  padding: 20px 28px;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.scraper-summary .stat { text-align: center; padding: 12px 20px; border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; }
.scraper-summary .stat .num { font-size: 2rem; font-weight: 700; font-family: 'Playfair Display', serif; }
.scraper-summary .stat .lbl { font-size: 0.72rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.4; }
.scraper-summary .stat.highlight { background: rgba(0,0,0,0.25); border-color: rgba(255,255,255,0.25); }
.scraper-summary .stat.highlight .num { color: #fbbf24; }
.scraper-summary .stat.highlight .lbl { opacity: 0.9; }
.copy-btn-sm {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--navy);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}
.copy-btn-sm:hover { background: var(--surface2); border-color: var(--accent); }

/* ===== RECORDS CHAT ===== */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
@media (max-width: 720px) { .chat-layout { grid-template-columns: 1fr; } }

.chat-file-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 5px; font-size: 0.8rem;
}
.chat-file-row .cfr-icon { font-size: 0.85rem; flex-shrink: 0; }
.chat-file-row .cfr-name { flex: 1; font-weight: 500; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-file-row .cfr-meta { color: var(--text-muted); font-size: 0.72rem; white-space: nowrap; }
.chat-file-row .cfr-rm { cursor: pointer; color: var(--danger); background: none; border: none; padding: 2px 5px; border-radius: 4px; font-size: 0.85rem; }

.chat-stats-bar {
  display: flex; gap: 0; margin-bottom: 14px; margin-top: 12px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  border-radius: 10px; overflow: hidden;
}
.cs-item { flex: 1; text-align: center; padding: 10px 4px; color: #fff; border-right: 1px solid rgba(255,255,255,0.1); }
.cs-item:last-child { border-right: none; }
.cs-num { font-size: 1.4rem; font-weight: 700; font-family: 'Playfair Display', serif; line-height: 1; }
.cs-lbl { font-size: 0.65rem; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }

.cf-label { font-size: 0.73rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 7px; margin-top: 14px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.fp {
  padding: 4px 11px; border-radius: 99px; font-size: 0.73rem; font-weight: 500;
  border: 1.5px solid var(--border); background: var(--surface2); color: var(--navy);
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.fp:hover { border-color: var(--accent); color: var(--accent); }
.fp.active { background: var(--navy-light); border-color: var(--navy-light); color: #fff; }

/* Chat main panel */
.chat-main-card { display: flex; flex-direction: column; padding: 0 !important; overflow: hidden; border-radius: 16px; min-height: 560px; max-height: 78vh; }
.chat-messages { flex: 1; overflow-y: auto; padding: 22px 22px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.chat-empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px 16px; }
.chat-empty-state .ce-icon { font-size: 2.8rem; margin-bottom: 12px; }
.chat-empty-state h3 { font-family: 'Playfair Display', serif; color: var(--navy); margin-bottom: 6px; font-size: 1.1rem; }
.chat-empty-state p { color: var(--text-muted); font-size: 0.84rem; margin-bottom: 18px; max-width: 340px; }
.sug-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; width: 100%; max-width: 520px; }
.sug-btn {
  background: var(--surface2); border: 1.5px solid var(--border); border-radius: 9px;
  padding: 9px 12px; text-align: left; font-size: 0.78rem; color: var(--navy);
  cursor: pointer; transition: all 0.15s; font-family: 'DM Sans', sans-serif; line-height: 1.3;
}
.sug-btn:hover { border-color: var(--accent); background: #eaf3fd; color: var(--navy-light); }

/* Messages */
.cmsg { display: flex; flex-direction: column; max-width: 90%; }
.cmsg.user { align-self: flex-end; }
.cmsg.assistant { align-self: flex-start; max-width: 97%; }
.cmsg-bubble { border-radius: 13px; padding: 11px 15px; font-size: 0.87rem; line-height: 1.65; }
.cmsg.user .cmsg-bubble { background: linear-gradient(135deg, var(--navy-light), var(--accent)); color: #fff; border-bottom-right-radius: 3px; }
.cmsg.assistant .cmsg-bubble { background: var(--surface); border: 1.5px solid var(--border); color: var(--text); border-bottom-left-radius: 3px; }
.cmsg-text { white-space: pre-wrap; word-break: break-word; }
.cmsg-text strong { color: var(--navy); font-weight: 600; }
.cmsg-text em { color: var(--text-muted); }
.cmsg-time { font-size: 0.69rem; color: var(--text-muted); margin-top: 4px; padding: 0 3px; }
.cmsg.user .cmsg-time { text-align: right; }

.cite-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.cite-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #eaf3fd; border: 1px solid #c6dbf4; border-radius: 6px;
  padding: 2px 8px; font-size: 0.7rem; color: var(--navy-light); font-weight: 500;
}
.thinking-msg .cmsg-bubble { background: var(--surface2); border: 1.5px solid var(--border); }
.thinking-dots { display: inline-flex; gap: 3px; align-items: center; }
.thinking-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; animation: tdot 1.1s infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 0.18s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes tdot { 0%,60%,100% { transform: translateY(0); opacity:.6; } 30% { transform: translateY(-5px); opacity:1; } }

/* Input area */
.chat-input-wrap { border-top: 1.5px solid var(--border); padding: 14px 18px; background: var(--surface2); flex-shrink: 0; }
.chat-convo-meta { display: flex; justify-content: flex-end; margin-bottom: 7px; }
.chat-convo-meta button { font-size: 0.72rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0; }
.chat-convo-meta button:hover { color: var(--danger); }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-ta {
  flex: 1; resize: none; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 9px 13px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem;
  background: var(--surface); color: var(--text); outline: none;
  min-height: 42px; max-height: 110px; line-height: 1.5; transition: border-color 0.18s;
}
.chat-ta:focus { border-color: var(--accent); background: #fff; }
.chat-ta:disabled { opacity: 0.45; }
.chat-go {
  background: linear-gradient(135deg, var(--navy-light), var(--accent));
  color: #fff; border: none; border-radius: 10px; width: 42px; height: 42px;
  font-size: 1.1rem; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all 0.18s; box-shadow: 0 3px 10px rgba(37,87,160,0.25);
}
.chat-go:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(37,87,160,0.35); }
.chat-go:disabled { opacity: 0.38; cursor: not-allowed; transform: none; box-shadow: none; }
.chat-hint { font-size: 0.69rem; color: var(--text-muted); margin-top: 6px; }

/* Mode toggle bar */
.chat-mode-bar {
  display: flex; gap: 6px; padding: 10px 18px 0; flex-wrap: wrap;
  border-top: 1.5px solid var(--border); background: var(--surface2);
}
.chat-mode-lbl { font-size: 0.69rem; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; align-self: center; margin-right: 2px; }
.chat-mode-btn {
  font-size: 0.74rem; font-family: 'DM Sans', sans-serif;
  padding: 5px 11px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
  transition: all 0.15s; font-weight: 500; white-space: nowrap;
}
.chat-mode-btn:hover { border-color: var(--accent); color: var(--navy-light); background: #eaf3fd; }
.chat-mode-btn.active {
  background: linear-gradient(135deg, var(--navy-light), var(--accent));
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(37,87,160,0.28);
}
.chat-mode-actions { display: flex; gap: 6px; margin-left: auto; align-self: center; }
.chat-mode-action-btn {
  font-size: 0.73rem; font-family: 'DM Sans', sans-serif;
  padding: 5px 11px; border-radius: 20px;
  border: 1.5px solid var(--accent); color: var(--accent);
  background: transparent; cursor: pointer; transition: all 0.15s; font-weight: 500;
}
.chat-mode-action-btn:hover { background: var(--accent); color: #fff; }
.chat-mode-action-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Structured answer sections */
.ans-direct {
  background: linear-gradient(135deg, #f0f6ff, #e8f0fb);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0; padding: 9px 13px; margin-bottom: 10px;
  font-weight: 500; color: var(--navy);
}
.ans-section-title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent); margin: 10px 0 4px;
}
.ans-ambiguity {
  background: #fff8e1; border: 1px solid #ffe082; border-radius: 7px;
  padding: 7px 11px; margin-top: 9px; font-size: 0.82rem;
  color: #7a5c00; display: flex; gap: 7px; align-items: flex-start;
}
.ans-ambiguity::before { content: '⚠️'; flex-shrink: 0; }

/* MTC Tab styles */
.mtc-timeline-entry {
  display: grid;
  grid-template-columns: 120px 130px 140px 1fr 160px 28px;
  gap: 6px;
  align-items: start;
  margin-bottom: 6px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.mtc-timeline-entry input, .mtc-timeline-entry select {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.78rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  background: white;
}
.mtc-timeline-header {
  display: grid;
  grid-template-columns: 120px 130px 140px 1fr 160px 28px;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #555;
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mtc-remove-btn {
  background: #e53e3e;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 6px;
  line-height: 1;
}
.mtc-remove-btn:hover { background: #c53030; }
.mtc-doc-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 0.8rem;
}
.mtc-doc-check-item.present { background: #f0fff4; color: #276749; }
.mtc-doc-check-item.missing { background: #fff5f5; color: #c53030; }
.mtc-warn-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #856404;
  margin-top: 6px;
}
.mtc-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f0f4f8;
  border-radius: 5px;
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: #2d3748;
}
.mtc-file-item .mtc-file-type {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mtc-file-item .mtc-file-type.pdf { background:#fee2e2;color:#991b1b; }
.mtc-file-item .mtc-file-type.docx { background:#dbeafe;color:#1e40af; }
.mtc-file-item .mtc-file-type.txt { background:#dcfce7;color:#166534; }
.mtc-file-item .mtc-file-remove { margin-left:auto;cursor:pointer;color:#e53e3e;font-size:1rem;line-height:1; }
.dropzone.drag-over { border-color: #2b6cb0; background: #ebf8ff; }

/* ===== MEDICAL CHRONOLOGY + QME SHARED STYLES ===== */
.chrono-section-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #4a6fa5; margin-bottom: 6px;
}
.chrono-mode-btn {
  padding: 5px 11px; font-size: 0.75rem; font-weight: 600;
  border: 1.5px solid #cbd5e0; border-radius: 20px; background: white;
  color: #4a6fa5; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.chrono-mode-btn.active, .chrono-mode-btn:hover {
  background: #0d2b4e; color: white; border-color: #0d2b4e;
}
.chrono-view-btn {
  padding: 5px 14px; font-size: 0.78rem; font-weight: 600;
  border: 1.5px solid #cbd5e0; border-radius: 6px; background: white;
  color: #555; cursor: pointer; transition: all 0.15s;
}
.chrono-view-btn.active { background: #0d2b4e; color: white; border-color: #0d2b4e; }
.chrono-table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
  min-width: 700px;
}
.chrono-table th {
  background: #0d2b4e; color: white; padding: 8px 10px;
  text-align: left; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.chrono-table td {
  padding: 7px 10px; border-bottom: 1px solid #e8edf4;
  vertical-align: top; line-height: 1.4;
}
.chrono-table tr:hover td { background: #f0f5ff; }
.chrono-table tr.important-row td { background: #fffbf0; }
.chrono-table tr.uncertain-row td { background: #fff8f8; }
.chrono-table tr.filtered-out { display: none; }
.chrono-cite {
  display: inline-block; font-size: 0.68rem; background: #e8f0fe;
  color: #1a56db; border-radius: 3px; padding: 1px 5px;
  font-weight: 600; cursor: default; white-space: nowrap;
}
.chrono-badge {
  display: inline-block; font-size: 0.65rem; font-weight: 700;
  padding: 2px 6px; border-radius: 10px; margin-right: 3px; white-space: nowrap;
}
.badge-ps    { background:#dcfce7; color:#166534; }
.badge-surgery { background:#fee2e2; color:#991b1b; }
.badge-imaging { background:#e0f2fe; color:#075985; }
.badge-med   { background:#fef3c7; color:#92400e; }
.badge-restrict { background:#fce7f3; color:#9d174d; }
.badge-uncert { background:#f3f4f6; color:#6b7280; }
.chrono-edit-btn, .chrono-pin-btn, .chrono-del-btn {
  background: none; border: none; cursor: pointer; font-size: 0.8rem;
  opacity: 0.5; transition: opacity 0.15s; padding: 2px;
}
.chrono-edit-btn:hover, .chrono-pin-btn:hover, .chrono-del-btn:hover { opacity: 1; }
.chrono-row-actions { display: flex; gap: 2px; }

/* QME Sections */
.qme-section-tab {
  padding: 6px 14px; font-size: 0.78rem; font-weight: 600;
  border: 1.5px solid #e2e8f0; border-bottom: none; border-radius: 6px 6px 0 0;
  background: #f8f9fa; color: #555; cursor: pointer; transition: all 0.15s;
  position: relative; top: 2px;
}
.qme-section-tab.active { background: white; color: #0d2b4e; border-color: #0d2b4e; z-index: 1; }
.qme-section-panel { display: none; }
.qme-section-panel.active { display: block; }
.qme-field-row {
  display: grid; grid-template-columns: 160px 1fr; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid #f0f4f8; font-size: 0.83rem;
  align-items: start;
}
.qme-field-label {
  font-weight: 700; color: #4a6fa5; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px;
}
.qme-field-value { color: #1a1a2e; line-height: 1.5; }
.qme-field-value.missing { color: #999; font-style: italic; }
.qme-issue-item {
  padding: 8px 12px; margin-bottom: 6px; border-radius: 6px;
  font-size: 0.82rem; line-height: 1.5; border-left: 3px solid;
}
.qme-issue-warn  { background: #fffbeb; border-color: #f59e0b; color: #78350f; }
.qme-issue-alert { background: #fef2f2; border-color: #ef4444; color: #7f1d1d; }
.qme-issue-info  { background: #eff6ff; border-color: #3b82f6; color: #1e3a5f; }
.qme-issue-sibtf { background: #f5f3ff; border-color: #7c3aed; color: #3b0764; }
.qme-wpi-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: #f8fafc; border-radius: 6px;
  margin-bottom: 6px; border: 1px solid #e2e8f0; font-size: 0.82rem;
}
.qme-wpi-pct { font-size: 1.3rem; font-weight: 700; color: #0d2b4e; }
.qme-exec-summary {
  background: #f0f5ff; border-left: 4px solid #2557a0;
  padding: 14px 18px; border-radius: 0 8px 8px 0;
  font-size: 0.87rem; line-height: 1.65; color: #1a2a4a;
  margin-bottom: 16px; white-space: pre-wrap; font-family: 'DM Sans', sans-serif;
}
.qme-atty-summary {
  background: #fff8f0; border-left: 4px solid #d97706;
  padding: 14px 18px; border-radius: 0 8px 8px 0;
  font-size: 0.87rem; line-height: 1.65; color: #3d2000;
  margin-top: 14px; white-space: pre-wrap; font-family: 'DM Sans', sans-serif;
}
.qme-compare-table table {
  width: 100%; border-collapse: collapse; font-size: 0.8rem;
}
.qme-compare-table th {
  background: #0d2b4e; color: white; padding: 8px 10px; text-align: left;
}
.qme-compare-table td { padding: 7px 10px; border-bottom: 1px solid #e8edf4; vertical-align: top; }
.qme-compare-table tr:hover td { background: #f5f8ff; }
.qme-diff-changed { background: #fffbf0 !important; }
.quick-action-btn {
  padding: 6px 14px; font-size: 0.78rem; font-weight: 600;
  background: white; border: 1.5px solid #2557a0; color: #2557a0;
  border-radius: 20px; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.quick-action-btn:hover { background: #2557a0; color: white; }

/* === GAP FINDER === */
.gap-category { border:1px solid #dde3ec; border-radius:10px; margin-bottom:14px; overflow:hidden; }
.gap-category-header { background:#f0f4fa; padding:12px 18px; font-weight:700; font-size:0.9rem; cursor:pointer; display:flex; justify-content:space-between; align-items:center; }
.gap-category-header:hover { background:#e4eaf5; }
.gap-category-body { padding:14px 18px; }
.gap-item { padding:10px 14px; border-left:3px solid #1a8fd1; background:#f8fafc; border-radius:0 6px 6px 0; margin-bottom:8px; font-size:0.84rem; }
.gap-item.priority-high { border-left-color:#e74c3c; }
.gap-item.priority-medium { border-left-color:#e67e22; }
.gap-item.priority-low { border-left-color:#27ae60; }
.gap-citation { font-size:0.74rem; color:#888; margin-top:4px; }
.gap-actions { display:flex; gap:6px; margin-top:6px; }
.gap-pill { display:inline-block; padding:2px 10px; border-radius:12px; font-size:0.72rem; font-weight:600; cursor:pointer; border:1px solid #ccc; background:#fff; }
.gap-pill:hover { background:#f0f4fa; }
.gap-filter-bar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.gap-filter-pill { padding:5px 14px; border-radius:20px; font-size:0.78rem; cursor:pointer; border:1px solid #ccc; background:#fff; font-weight:500; }
.gap-filter-pill.active { background:#1a8fd1; color:#fff; border-color:#1a8fd1; }
.gap-summary-bar { display:flex; gap:20px; flex-wrap:wrap; padding:10px 0 14px; border-bottom:1px solid #eee; margin-bottom:14px; font-size:0.85rem; }
.gap-count-badge { background:#e8f0fe; color:#1a5276; border-radius:6px; padding:2px 8px; font-weight:700; font-size:0.82rem; margin-left:4px; }

/* === PD AUDIT TRAIL === */
.pd-audit-trail { background:#f8fafc; border:1px solid #dde3ec; border-radius:8px; padding:14px 18px; margin-top:14px; font-size:0.83rem; }
.pd-audit-step { display:flex; justify-content:space-between; align-items:baseline; padding:4px 0; border-bottom:1px solid #eef1f6; }
.pd-audit-step:last-child { border-bottom:none; }
.pd-audit-label { color:#556; font-weight:500; }
.pd-audit-value { font-weight:700; color:#1a3a5c; }
.pd-audit-basis { color:#888; font-size:0.75rem; margin-left:8px; }
.pd-audit-title { font-weight:700; color:#1a3a5c; margin-bottom:8px; font-size:0.9rem; border-bottom:2px solid #1a8fd1; padding-bottom:6px; }
.pd-rebuttal-note { background:#fff3cd; border:1px solid #ffc107; border-radius:6px; padding:8px 12px; margin-top:10px; font-size:0.8rem; color:#856404; }

/* === RECORDS CHAT PRESETS === */
.chat-presets-rail { display:flex; gap:6px; flex-wrap:wrap; padding:8px 0 4px; border-bottom:1px solid #eee; margin-bottom:8px; }
.chat-preset-pill { padding:4px 12px; border-radius:16px; font-size:0.76rem; cursor:pointer; border:1px solid #1a8fd1; color:#1a8fd1; background:#f0f8ff; font-weight:500; white-space:nowrap; }
.chat-preset-pill:hover { background:#1a8fd1; color:#fff; }

/* === CITATION BADGE === */
.cite-badge { display:inline-block; background:#eaf2ff; color:#1a5276; border:1px solid #b8d4f0; border-radius:4px; font-size:0.72rem; padding:0 6px; margin:0 2px; font-weight:500; }

/* === MTC CLASSIFICATION BADGE === */
.mtc-doc-class { display:inline-block; padding:1px 8px; border-radius:4px; font-size:0.71rem; font-weight:700; margin-left:6px; text-transform:uppercase; }
.mtc-doc-class.subpoena { background:#d4edda; color:#155724; }
.mtc-doc-class.declaration { background:#cce5ff; color:#004085; }
.mtc-doc-class.hipaa-auth { background:#d1ecf1; color:#0c5460; }
.mtc-doc-class.due-diligence { background:#fff3cd; color:#856404; }
.mtc-doc-class.proof-of-service { background:#e2d9f3; color:#432874; }
.mtc-doc-class.follow-up { background:#fde8d8; color:#7d3c00; }
.mtc-doc-class.non-compliance { background:#f8d7da; color:#721c24; }
.mtc-doc-class.unknown { background:#e9ecef; color:#495057; }
.mtc-missing-warning { background:#fff3cd; border:1px solid #ffc107; border-radius:6px; padding:10px 14px; font-size:0.82rem; margin-bottom:8px; }
.mtc-missing-warning .miss-label { font-weight:700; color:#856404; }
.mtc-packet-preview { border:1px solid #dde3ec; border-radius:8px; overflow:hidden; margin-top:12px; }
.mtc-packet-preview summary { padding:10px 16px; font-weight:700; font-size:0.88rem; cursor:pointer; background:#f0f4fa; }
.mtc-packet-preview-body { padding:14px 18px; font-size:0.83rem; white-space:pre-wrap; line-height:1.7; font-family:'DM Sans',sans-serif; }

/* === MTC PACKET CREATOR === */
.mtc-upload-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.mtc-upload-card { border:1.5px solid var(--border); border-radius:12px; padding:20px; background:var(--surface); }
.mtc-upload-card-title { font-size:0.95rem; font-weight:700; color:var(--navy); margin-bottom:4px; }
.mtc-upload-card-desc { font-size:0.78rem; color:var(--text-muted); margin-bottom:14px; }
.mtc-dropzone { padding:32px 20px !important; }
.mtc-dd-toggle { display:flex; gap:6px; margin-bottom:14px; }
.mtc-dd-toggle .method-btn {
  padding:6px 16px; font-size:0.8rem; font-weight:600;
  border:1.5px solid var(--border); border-radius:20px; background:var(--surface);
  color:var(--text-muted); cursor:pointer; transition:all 0.15s;
}
.mtc-dd-toggle .method-btn.active { background:var(--navy); color:#fff; border-color:var(--navy); }
.mtc-dd-toggle .method-btn:hover:not(.active) { background:var(--surface2); }
#mtc-dd-text {
  width:100%; padding:12px 16px; border:1.5px solid var(--border); border-radius:10px;
  font-family:'DM Sans',sans-serif; font-size:0.88rem; color:var(--text);
  background:var(--surface2); resize:vertical; outline:none; box-sizing:border-box;
  line-height:1.6;
}
#mtc-dd-text:focus { border-color:var(--accent); background:#fff; }
.mtc-progress-item {
  display:flex; align-items:center; gap:12px; padding:10px 14px;
  border-bottom:1px solid var(--surface2); transition:background 0.2s;
}
.mtc-progress-item:last-child { border-bottom:none; }
.mtc-progress-icon {
  width:28px; height:28px; border-radius:50%; display:flex; align-items:center;
  justify-content:center; font-size:0.75rem; font-weight:700; flex-shrink:0;
  transition:all 0.3s;
}
.mtc-progress-icon.waiting { background:#e5e7eb; color:#9ca3af; }
.mtc-progress-icon.working { background:var(--accent); color:#fff; animation:mtc-pulse 1.2s ease-in-out infinite; }
.mtc-progress-icon.complete { background:#10b981; color:#fff; }
.mtc-progress-icon.error { background:#ef4444; color:#fff; }
.mtc-progress-label { flex:1; font-size:0.88rem; font-weight:600; color:var(--navy); }
.mtc-progress-status { font-size:0.78rem; color:var(--text-muted); font-weight:500; min-width:100px; text-align:right; }
.mtc-progress-status.complete { color:#10b981; }
.mtc-progress-status.error { color:#ef4444; }
@keyframes mtc-pulse { 0%,100%{opacity:1;} 50%{opacity:0.6;} }
.mtc-preview-exhibit { background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:14px 18px; font-size:0.83rem; color:var(--text-muted); text-align:center; }
@media (max-width:700px) { .mtc-upload-grid { grid-template-columns:1fr; } }

/* === TAB HEADER BAR === */
.tab-header-bar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; margin-bottom:18px; }
.tab-header-left { display:flex; flex-direction:column; gap:2px; }
.tab-header-title { font-size:1.12rem; font-weight:800; color:#1a3a5c; display:flex; align-items:center; gap:8px; }
.tab-header-desc { font-size:0.8rem; color:#667; }

/* === ADVANCED OPTIONS TOGGLE === */
details.adv-options summary { cursor:pointer; font-size:0.78rem; color:#1a8fd1; font-weight:600; padding:4px 0; user-select:none; }
details.adv-options summary:hover { color:#155a8a; }
details.adv-options > div { margin-top:8px; padding:12px; background:#f8fafc; border-radius:6px; border:1px solid #e0e7f0; }

/* ── Tab Header / Description ───────────────────────────────── */
.tab-header { margin-bottom: 20px; }
.tab-header h2 { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: var(--navy); font-weight: 600; margin-bottom: 6px; }
.tab-desc { font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; }

/* ── Primary / Secondary Buttons (alias) ────────────────────── */
.primary-btn { background: linear-gradient(135deg, var(--navy-light), var(--accent)); color: #fff; border: none; border-radius: 10px; padding: 10px 24px; font-size: 0.9rem; font-weight: 600; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 14px rgba(37,87,160,0.3); display: inline-flex; align-items: center; gap: 8px; }
.primary-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,87,160,0.4); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.secondary-btn { background: var(--surface); color: var(--navy-light); border: 2px solid var(--border); border-radius: 10px; padding: 8px 18px; font-size: 0.85rem; font-weight: 600; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.secondary-btn:hover { border-color: var(--accent); color: var(--accent); background: #eaf3fd; }

/* ── Drop Zone (generic) ────────────────────────────────────── */
.drop-zone { border: 2.5px dashed var(--border); border-radius: 14px; padding: 40px 24px; text-align: center; cursor: pointer; transition: all 0.25s ease; background: var(--surface2); position: relative; }
.drop-zone:hover { border-color: var(--accent); background: #eaf3fd; }
.drop-icon { font-size: 2.5rem; margin-bottom: 10px; display: block; }
.drop-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ── Dashboard ──────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px;
}
.dash-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
}
.dash-card h3 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #37474f;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 8px;
}
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.dash-table td { padding: 4px 6px; border-bottom: 1px solid #f5f5f5; }
.dash-table td:first-child { color: #666; width: 40%; }
.dash-table td:last-child { font-weight: 500; }

/* ── Score Meters ───────────────────────────── */
.score-meters { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0; }
.score-meter { flex: 1; min-width: 160px; }
.score-label { font-size: 0.75rem; color: #555; margin-bottom: 4px; font-weight: 600; }
.score-bar-wrap { background: #e0e0e0; border-radius: 4px; height: 10px; overflow: hidden; }
.score-bar { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.score-value { font-size: 0.85rem; font-weight: 700; margin-top: 4px; }

/* ── Doc Type Badge ─────────────────────────── */
.doc-type-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 4px;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ── View Toggle ────────────────────────────── */
.view-toggle { display: flex; gap: 6px; margin-bottom: 16px; }
.view-toggle-btn {
  padding: 6px 14px;
  border: 1px solid #b0bec5;
  background: #f5f7f8;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #546e7a;
  transition: all 0.15s;
}
.view-toggle-btn.active {
  background: #1565c0;
  color: #fff;
  border-color: #1565c0;
  font-weight: 600;
}

/* ── Preset Pills ───────────────────────────── */
.preset-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.preset-pill {
  padding: 4px 10px;
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.75rem;
  white-space: nowrap;
  transition: background 0.15s;
}
.preset-pill:hover { background: #bbdefb; }

/* ── Future Medical Table ───────────────────── */
.fm-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin-top: 12px; }
.fm-table th { background: #eceff1; padding: 8px 10px; text-align: left; border-bottom: 2px solid #cfd8dc; font-size: 0.75rem; }
.fm-table td { padding: 7px 10px; border-bottom: 1px solid #f0f0f0; }
.fm-table tr:hover td { background: #fafafa; }
.fm-total-row td { font-weight: 700; background: #e8f5e9; padding: 10px; }
.fm-low { color: #388e3c; }
.fm-mid { color: #f57c00; font-weight: 600; }
.fm-high { color: #c62828; }

/* ── Document Generator ─────────────────────── */
.dg-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.dg-template-card {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fafafa;
}
.dg-template-card:hover { border-color: #1565c0; background: #e3f2fd; }
.dg-template-card.selected { border-color: #1565c0; background: #e3f2fd; box-shadow: 0 0 0 2px #1565c066; }
.dg-template-name { font-weight: 600; font-size: 0.82rem; margin-bottom: 4px; }
.dg-template-desc { font-size: 0.72rem; color: #666; }

.dg-letter-paper {
  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 40px 50px;
  min-height: 500px;
  font-family: 'Times New Roman', serif;
  font-size: 12pt;
  line-height: 1.6;
  margin: 16px 0;
  white-space: pre-wrap;
  max-width: 750px;
}

.firm-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.firm-settings-grid .full-width { grid-column: 1 / -1; }

/* ── Issue Cards ────────────────────────────── */
.issue-card {
  border-left: 4px solid #ccc;
  background: #fafafa;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 6px 0;
}
.issue-card.high { border-left-color: #c62828; background: #fff5f5; }
.issue-card.medium { border-left-color: #f57f17; background: #fff8e1; }
.issue-card.low { border-left-color: #1565c0; background: #e3f2fd; }
.issue-title { font-weight: 600; font-size: 0.82rem; margin-bottom: 4px; }
.issue-desc { font-size: 0.76rem; color: #555; }
.issue-suggestion { font-size: 0.74rem; color: #2e7d32; font-style: italic; margin-top: 4px; }

/* ── Progress Bar ───────────────────────────── */
.progress-wrap { margin: 8px 0; }
.progress-bar-outer { background: #e0e0e0; border-radius: 4px; height: 8px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: #1565c0; border-radius: 4px; transition: width 0.3s; }
.progress-label-text { font-size: 0.76rem; color: #546e7a; margin-top: 4px; }

