/* Health OS — Light Theme B (iPhone-first) */
:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #1d4ed8;
  --danger: #dc2626;
  --warn: #f59e0b;
  --ok: #16a34a;
  --sidebar-w: 220px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 24px 0; position: fixed; height: 100vh; z-index: 100; }
.sidebar-logo { font-size: 18px; font-weight: 700; padding: 0 20px 24px; color: var(--text); }
.nav-links { list-style: none; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--text-muted); text-decoration: none; font-size: 14px; transition: background 0.15s; }
.nav-link:hover, .nav-link.active { background: var(--bg); color: var(--text); }
.nav-icon { font-size: 16px; }
.logout-form { padding: 16px 20px; }
.logout-btn { background: none; border: 1px solid var(--border); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-muted); width: 100%; }
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 32px; max-width: 1100px; }
/* Login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 40px; width: 100%; max-width: 360px; text-align: center; }
.login-logo { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.login-error { color: var(--danger); font-size: 13px; margin-bottom: 16px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-input { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 15px; }
.login-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 10px; font-size: 15px; cursor: pointer; }
/* Mobile */
.mobile-menu-btn { display: none; }
@media (max-width: 640px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: block; position: fixed; top: 12px; left: 12px; z-index: 200; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 16px; }
  .main-content { margin-left: 0; padding: 16px; }
}
/* Dashboard */
.inventory-banner { background: #fef9c3; border: 1px solid #fde047; border-radius: 8px; padding: 12px 16px; margin-bottom: 24px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.missing-badge { background: #fde047; border-radius: 4px; padding: 2px 8px; font-size: 12px; }
.hero { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; gap: 24px; }
.hero-name { font-size: 32px; font-weight: 700; margin-bottom: 6px; }
.hero-meta { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
.safety-badge { display: inline-block; border: 1px solid var(--border); border-radius: 20px; padding: 4px 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; }
.safety-pass { border-color: var(--ok); color: var(--ok); }
.safety-pass-with-cautions { border-color: var(--warn); color: var(--warn); }
.safety-red, .safety-fail { border-color: var(--danger); color: var(--danger); }
.section { margin-bottom: 36px; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; }
.risk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.risk-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.risk-system { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.risk-label { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.risk-desc { font-size: 12px; color: var(--text-muted); }
.week-plan { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.week-plan li { line-height: 1.5; }
.lab-panel { overflow-x: auto; }
.summary-box { background: var(--surface); border-left: 3px solid var(--border); padding: 16px 20px; border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.7; color: var(--text-muted); }
/* Labs + shared page */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 24px; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.empty-state { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 40px; text-align: center; color: var(--text-muted); font-size: 14px; }
.empty-state code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.missing-note { color: var(--text-muted); font-size: 12px; margin-top: 8px; font-style: italic; }
/* Reports */
.report-date-group { margin-bottom: 28px; }
.report-date-header { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.report-list { display: flex; flex-direction: column; gap: 6px; }
.report-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; text-decoration: none; color: var(--text); transition: border-color 0.15s; }
.report-card:hover { border-color: var(--accent); }
.report-category { font-size: 11px; color: var(--text-muted); background: var(--bg); border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.report-title { font-size: 14px; }
.report-detail-header { margin-bottom: 28px; }
.back-link { font-size: 13px; color: var(--text-muted); text-decoration: none; display: block; margin-bottom: 12px; }
.back-link:hover { color: var(--text); }
.report-detail-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.report-date { font-size: 12px; color: var(--text-muted); }
.report-detail-title { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.export-btn { display: inline-block; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; text-decoration: none; color: var(--text-muted); }
.export-btn:hover { border-color: var(--accent); color: var(--accent); }
.report-body { max-width: 720px; }
.report-body h1, .report-body h2 { margin: 24px 0 8px; }
.report-body h1 { font-size: 22px; }
.report-body h2 { font-size: 16px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.report-body h3 { font-size: 15px; margin: 16px 0 6px; }
.report-body p { font-size: 14px; line-height: 1.7; margin-bottom: 12px; }
.report-body ul, .report-body ol { padding-left: 20px; font-size: 14px; line-height: 1.7; margin-bottom: 12px; }
.report-body table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
.report-body th { background: var(--bg); border: 1px solid var(--border); padding: 8px 10px; text-align: left; font-weight: 600; }
.report-body td { border: 1px solid var(--border); padding: 8px 10px; }
.report-body code { background: var(--bg); padding: 2px 5px; border-radius: 3px; font-size: 12px; }
.report-body blockquote { border-left: 3px solid var(--border); padding-left: 16px; color: var(--text-muted); margin-bottom: 12px; }

/* Chat */
.chat-layout { display: flex; flex-direction: column; height: calc(100vh - 100px); max-width: 760px; }
.chat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.chat-clear-btn { font-size: 12px; border: 1px solid var(--border); background: none; border-radius: 6px; padding: 4px 10px; cursor: pointer; color: var(--text-muted); }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 0 16px; }
.chat-empty { color: var(--text-muted); font-size: 14px; text-align: center; margin-top: 40px; }
.chat-msg { display: flex; }
.chat-msg--user { justify-content: flex-end; }
.chat-msg--assistant { justify-content: flex-start; }
.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6; }
.chat-bubble--user { background: var(--accent); color: #fff; border-bottom-right-radius: 2px; }
.chat-bubble--assistant { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 2px; }
.chat-bubble p { margin-bottom: 6px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble code { background: rgba(0,0,0,0.08); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.chat-bubble pre { background: rgba(0,0,0,0.06); padding: 8px; border-radius: 6px; overflow-x: auto; font-size: 12px; }
.chat-bubble ul, .chat-bubble ol { padding-left: 16px; margin: 4px 0; }
.chat-form { display: flex; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.chat-send-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chat-spinner { display: none; font-size: 18px; animation: spin 1s linear infinite; }
.htmx-request .chat-spinner { display: inline; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Upload */
.upload-success { background: #dcfce7; border: 1px solid #86efac; border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; color: #166534; font-size: 14px; }
.upload-error { background: #fee2e2; border: 1px solid #fca5a5; border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; color: #991b1b; font-size: 14px; }
.upload-form { margin-bottom: 32px; }
.upload-drop-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 40px; text-align: center; cursor: pointer; margin-bottom: 16px; transition: border-color 0.15s; }
.upload-drop-zone:hover { border-color: var(--accent); }
.upload-file-input { display: none; }
.upload-label { cursor: pointer; display: block; }
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-hint { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.upload-types { font-size: 12px; color: var(--text-muted); }
.upload-btn { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 12px 28px; font-size: 15px; cursor: pointer; }
.upload-info { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px 24px; font-size: 14px; }
.upload-info h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.upload-info ul { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.upload-info p { color: var(--text-muted); }
.upload-info a { color: var(--accent); }

/* Review status */
.review-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; font-size: 13px; border: 1px solid var(--border); background: var(--surface); }
.review-status--running { border-color: var(--warn); background: #fffbeb; }
.review-status--done { border-color: var(--ok); background: #f0fdf4; }
.review-status--error { border-color: var(--danger); background: #fef2f2; }
.review-dot { font-size: 14px; }
.review-dot--running { display: inline-block; animation: spin 1s linear infinite; }
.review-link { color: var(--accent); text-decoration: underline; }
.review-note { color: var(--text-muted); font-size: 12px; margin-left: 4px; }

/* Review status + sidebar widget */
.sidebar-review { padding: 12px 20px 0; border-top: 1px solid var(--border); margin-top: 8px; }
.review-status--idle { color: var(--text-muted); }
.review-run-btn { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 7px; font-size: 12px; cursor: pointer; color: var(--text); margin-bottom: 12px; }
.review-run-btn:hover { border-color: var(--accent); color: var(--accent); }
