:root {
  --teal: #0e7c7b; --teal-dark: #0a5c5b; --ink: #12333a; --muted: #6b8a90;
  --bg: #f2f7f7; --card: #fff; --line: #d9e6e6; --warn: #b45309; --error: #c0392b; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh; -webkit-font-smoothing: antialiased; }

.view { min-height: 100vh; }
.view.auth { display: flex; align-items: center; justify-content: center; padding: 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 440px; box-shadow: 0 6px 24px rgba(14,124,123,.08); }

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.brand.small { margin: 0; gap: 10px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark)); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 18px; }
.brand h1 { font-size: 20px; margin: 0; } .brand p { margin: 2px 0 0; }

h2 { font-size: 18px; margin: 0 0 6px; } h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin-top: 14px; font-weight: 600; }
input { width: 100%; margin-top: 6px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 16px; color: var(--ink); background: #fbfefe; }
input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,124,123,.12); }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 16px;
  border: none; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--teal); color: #fff; } .btn.primary:hover { background: var(--teal-dark); }
.btn.primary:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--teal); border: 1px solid var(--line); }
.btn.sm { padding: 8px 12px; font-size: 13px; }
#auth-btn { width: 100%; margin-top: 18px; }

.error { color: var(--error); font-size: 14px; margin: 12px 0 0; }
.warn { color: var(--warn); font-size: 13px; background: #fff7ed; border: 1px solid #fed7aa;
  padding: 10px 12px; border-radius: 10px; margin: 12px 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.tabs { display: flex; gap: 6px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 53px; z-index: 4; overflow-x: auto; }
.tabs.small { position: static; border: none; padding: 6px 0 0; background: none; }
.tab { border: none; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tab.active { background: #e4f5f4; color: var(--teal-dark); }
.badge { background: var(--error); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }

.main { max-width: 720px; margin: 0 auto; padding: 18px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.item.col { flex-direction: column; align-items: stretch; gap: 4px; }
.pill { background: #e4f5f4; color: var(--teal-dark); border-radius: 10px; font-size: 12px; padding: 3px 10px; font-weight: 700; }
.meds { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.meds li { margin: 2px 0; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(12,51,58,.45); display: flex; align-items: flex-start;
  justify-content: center; padding: 24px 16px; overflow-y: auto; z-index: 20; }
.modal-card { background: var(--card); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 560px;
  box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.modal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.cred { margin: 12px 0; }
.big-mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 24px; font-weight: 800;
  color: var(--teal-dark); background: #f0faf9; border: 1px dashed var(--teal); border-radius: 10px;
  padding: 12px; text-align: center; margin-top: 4px; }

.med-head, .med-row { display: grid; grid-template-columns: 2fr .8fr 1fr .8fr .8fr 28px; gap: 6px; align-items: center; }
.med-head { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 14px; padding: 0 2px; }
.med-row { margin-top: 6px; }
.med-row input { margin-top: 0; padding: 9px 8px; font-size: 14px; }
.rm { border: none; background: #fbeceb; color: var(--error); border-radius: 8px; font-size: 18px; cursor: pointer; height: 36px; }

@media (max-width: 560px) {
  .med-head { display: none; }
  .med-row { grid-template-columns: 1fr 1fr; }
  .med-row .m-name { grid-column: 1 / -1; }
}
