* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: #1d3340; background: #e8eef2; font-size: 14px; }
button { border: 0; border-radius: 6px; padding: 8px 12px; font-weight: 700; cursor: pointer; }
.brand-mark { font-variant-caps: all-small-caps; letter-spacing: .035em; }
.topbar { height: 44px; display: flex; align-items: center; gap: 16px; padding: 0 14px; color: #fff; background: #0072a6; box-shadow: 0 2px 8px #0003; }
.logo { width: 50px; height: 28px; border-radius: 14px; display: grid; place-items: center; background: #75b82a; font-weight: 800; font-size: 19px; font-style: italic; }
nav { display: flex; flex: 1; gap: 18px; align-items: center; font-size: 13px; }
nav span { opacity: .9; } nav .active { background: #005c84; padding: 12px 14px; margin: 0 -6px; }
.search { background: #fff; color: #6b7a86; padding: 7px 14px; border-radius: 3px; min-width: 210px; }
.topbar a { font-size: 12px; }
.patient-strip { min-height: 116px; display: grid; grid-template-columns: 74px 1.25fr 1fr 1fr 1.15fr 1fr; gap: 16px; padding: 14px 18px; background: #f8fbfd; border-bottom: 1px solid #c8d5dd; }
.photo { width: 60px; height: 74px; border: 1px solid #cbd6dd; border-radius: 4px; background: linear-gradient(#dbe8ee, #fff); display: grid; place-items: center; font-size: 24px; font-weight: 800; color: #578; }
h1 { margin: 0 0 8px; color: #0873a8; font-size: 20px; } p { margin: 3px 0; line-height: 1.35; }
.allergy { color: #b01d1d; } .provider { text-align: right; font-size: 13px; color: #395767; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 160px); }
aside { background: #f4f7f9; border-right: 1px solid #cad7df; padding: 14px; color: #46606e; }
aside h2 { margin: 4px 0 14px; font-size: 18px; color: #0b6d9d; } aside p { padding: 8px 10px; margin: 2px 0; border-radius: 4px; } aside .selected { background: #d9eef8; color: #005f8c; font-weight: 700; } aside footer { margin-top: 30px; font-size: 11px; color: #7e8d95; }
.page { padding: 18px; background: #eef4f7; }
.page-head, .tabs, .card, .prescribing-card, .pending, .chart-doc-card, .reminders { background: #fff; border: 1px solid #ccd9e0; border-radius: 8px; margin-bottom: 14px; padding: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: center; } .page-head h2 { margin: 0; color: #145f83; }
.tabs { display: flex; gap: 28px; padding: 11px 14px; } .tabs b { color: #006da1; }
.card h3, .prescribing-card h3, .pending h3, .chart-doc-card h3, .reminders h3 { margin: 0 0 10px; color: #304f60; } .med { padding: 11px; border-top: 1px solid #e4edf2; } .pending { border-left: 5px solid #f6b21a; } .overdue { color: #b11226; }
.prescribing-card { border-left: 5px solid #0a719f; }
.prescribing-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.prescribing-head span { border-radius: 999px; padding: 5px 9px; color: #07527b; background: #e1f2fa; font-size: 12px; font-weight: 800; }
.med-search { display: grid; gap: 7px; color: #244b5c; font-weight: 800; }
.med-search input { width: min(520px, 100%); border: 1px solid #bdd3dd; border-radius: 8px; padding: 11px 12px; color: #1d3340; background: #fff; font: inherit; font-weight: 600; }
.med-results { width: min(520px, 100%); margin-top: 10px; border: 1px solid #d8e6ed; border-radius: 8px; overflow: hidden; }
.med-result { width: 100%; display: flex; justify-content: space-between; gap: 12px; align-items: center; border-radius: 0; padding: 12px; color: #244b5c; background: #fff; text-align: left; }
.med-result + .med-result { border-top: 1px solid #edf3f6; }
.med-result.selected { color: #074f76; background: #eef8fc; }
.med-result span { color: #607a87; font-size: 12px; font-weight: 700; }
.trigger-help { margin-top: 10px; color: #456575; font-weight: 700; }
.pending-med { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.rerun-btn { color: #fff; background: #0a719f; white-space: nowrap; }
.chart-doc-card { border-left: 5px solid #2d8b57; background: #fbfffd; }
.chart-doc-card.active { border-color: #16814a; box-shadow: 0 0 0 2px rgba(45, 139, 87, .12); }
.chart-doc-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.chart-doc-head span { border-radius: 999px; padding: 5px 9px; color: #246044; background: #e7f6ee; font-size: 12px; font-weight: 800; }
.inserted-note { margin-top: 8px; padding: 12px; border: 1px solid #c8e6d6; border-radius: 8px; color: #254b37; background: #f3fbf6; font-weight: 700; }
.consult-overlay, .overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(10, 31, 43, .54); overflow-y: auto; }
.hidden { display: none !important; }
.consult-panel { width: min(1060px, 95vw); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; background: #f8fbfd; border-radius: 16px; border: 1px solid #b7d1df; box-shadow: 0 26px 80px #001b2fcc; overflow-y: auto; }
.consult-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; color: #fff; background: linear-gradient(90deg, #0c5270, #167fac); } .consult-head b { font-size: 22px; }
.intake-form { padding: 22px 24px 24px; }
.intake-copy { margin-bottom: 18px; } .intake-copy small { display: block; text-transform: uppercase; color: #6c8795; font-weight: 800; letter-spacing: .05em; } .intake-copy h2 { margin: 8px 0 6px; color: #074f76; font-size: 26px; } .intake-copy p { max-width: 720px; color: #456575; font-size: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-field { display: grid; gap: 7px; color: #244b5c; font-weight: 800; }
.form-field input { width: 100%; border: 1px solid #bdd3dd; border-radius: 10px; padding: 13px 12px; color: #1d3340; background: #fff; font: inherit; font-weight: 500; }
.agent-status { margin: 0 20px 12px; padding: 10px 12px; border-radius: 8px; color: #07527b; background: #e1f2fa; font-weight: 700; }
.analyze-btn { margin: 0 20px 20px; width: calc(100% - 40px); background: #0a719f; color: #fff; padding: 15px; font-size: 17px; }
.rx-modal { width: min(1180px, 96vw); max-height: 94vh; overflow: hidden; border-radius: 10px; background: #fff; border: 1px solid #cfdde4; box-shadow: 0 22px 80px #001b2fcc; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; color: #fff; background: #1f6d93; } .modal-head h2 { margin: 0; font-size: 21px; }
.modal-body { display: grid; grid-template-columns: 1.5fr .9fr; gap: 18px; padding: 16px; max-height: calc(94vh - 125px); overflow-y: auto; }
.summary { display: grid; grid-template-columns: 72px 1fr 1.15fr; gap: 14px; margin-bottom: 14px; } .avatar { width: 64px; height: 64px; display: grid; place-items: center; font-size: 35px; border-radius: 50%; background: #e6f3fa; }
.warn, .rec, .compliance, .adapter-card { padding: 12px; border-radius: 8px; border: 1px solid #f2c2c2; background: #fff5f3; color: #7b1820; }
h3 { margin: 15px 0 8px; color: #254b5e; font-size: 14px; letter-spacing: .02em; }
.pdmp-table { width: 100%; border-collapse: collapse; font-size: 13px; } th { background: #eef6fa; color: #2e5870; text-align: left; } th, td { padding: 8px 9px; border: 1px solid #dbe7ed; } tbody tr:nth-child(even) { background: #fafcfd; }
.report { display: inline-block; margin-top: 9px; color: #0b72a4; font-weight: 800; }
.insights, .flags { padding-left: 20px; margin: 8px 0; } .insights li, .flags li { margin-bottom: 7px; line-height: 1.35; }
.adapter-card { border-color: #b9d7e6; background: #eef8fc; color: #244b5c; } .adapter-card b { display: block; margin: 6px 0; } .adapter-card code { display: inline-block; color: #07527b; }
.risk-box { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .risk-box > div { padding: 14px; border-radius: 10px; background: #fff0f0; border: 1px solid #efb1b1; } small { color: #607a87; } .risk-score { color: #c4212c; font-size: 46px; } .risk-level { color: #c4212c; font-size: 30px; }
#noteBox { width: 100%; min-height: 130px; border: 1px solid #c7d7df; border-radius: 8px; padding: 11px; line-height: 1.45; resize: none; }
.status { margin-top: 8px; padding: 10px; border-radius: 8px; background: #eef6fa; color: #275567; font-weight: 700; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid #dbe7ed; background: #f4f8fa; } .modal-foot button { margin-left: 8px; color: #fff; background: #63869a; }
.btn-success { background: #2d8b57 !important; } .btn-warning { background: #d79b00 !important; } .btn-danger { background: #c53d36 !important; }
@media (max-width: 980px) { .patient-strip { grid-template-columns: 70px 1fr 1fr; } .modal-body { grid-template-columns: 1fr; } .handoff-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  body { font-size: 13px; }
  .topbar { gap: 8px; overflow-x: auto; white-space: nowrap; }
  nav { min-width: max-content; gap: 12px; }
  .search, .topbar a, aside { display: none; }
  .patient-strip { grid-template-columns: 48px 1fr; gap: 10px; padding: 10px; }
  .patient-strip > div:nth-child(n+4) { display: none; }
  .photo { width: 44px; height: 54px; font-size: 17px; }
  h1 { font-size: 16px; }
  .layout { display: block; min-height: auto; }
  .page { padding: 10px; }
  .page-head, .tabs, .prescribing-head, .pending-med, .chart-doc-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .consult-overlay, .overlay { display: block; padding: 0; background: rgba(10, 31, 43, .62); }
  .consult-panel, .rx-modal { width: 100%; min-height: 100dvh; max-height: none; border-radius: 0; border: 0; box-shadow: none; }
  .consult-panel { padding-bottom: 64px; }
  .rx-modal { padding-bottom: 190px; }
  .consult-head, .modal-head { align-items: flex-start; flex-direction: column; gap: 4px; padding: 12px 14px; }
  .consult-head b, .modal-head h2 { font-size: 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .intake-form { padding: 16px 14px 96px; }
  .intake-copy { margin-bottom: 14px; }
  .intake-copy h2 { font-size: 22px; }
  .agent-status { margin: 14px 0; }
  .analyze-btn { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; width: 100%; margin: 0; border-radius: 0; padding: 16px; box-shadow: 0 -8px 18px rgba(0, 27, 47, .16); }
  .modal-body { display: block; max-height: none; overflow: visible; padding: 12px; }
  .summary { grid-template-columns: 1fr; }
  .avatar { display: none; }
  .pdmp-table, .pdmp-table thead, .pdmp-table tbody, .pdmp-table tr, .pdmp-table th, .pdmp-table td { display: block; }
  .pdmp-table { border-collapse: separate; border-spacing: 0; }
  .pdmp-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pdmp-table tr { margin-bottom: 10px; border: 1px solid #dbe7ed; border-radius: 8px; overflow: hidden; background: #fff; }
  .pdmp-table td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; border: 0; border-bottom: 1px solid #edf3f6; white-space: normal; overflow-wrap: anywhere; }
  .pdmp-table td:last-child { border-bottom: 0; }
  .pdmp-table td::before { content: attr(data-label); color: #496b7d; font-weight: 800; }
  .risk-box { grid-template-columns: 1fr; }
  .risk-score { font-size: 38px; }
  .risk-level { font-size: 24px; }
  .modal-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: block; padding: 10px; }
  .modal-foot button { width: 100%; margin: 5px 0; }
}
