/* ============================================================
   Roni's Health Tracker — View Styles
   Today (hero, plan, feed), Calendar, Trends, Medications,
   Reports, Settings.
   ============================================================ */

/* ==================== TODAY ==================== */
.hero { position: relative; overflow: hidden; }
.hero .glucosenum {
  font-family: var(--serif);
  font-size: 76px;
  line-height: 1;
  color: var(--rose);
  font-weight: 500;
  letter-spacing: 1px;
  margin: 2px 0;
}
.hero .unit { font-size: 15px; color: var(--text-soft); margin-bottom: 4px; }
.hero .meta { font-size: 13px; color: var(--text-soft); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.hero .meta .dotsep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-soft); display: inline-block; }
.hero .actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.hero .prompt { font-family: var(--serif); font-size: 30px; color: var(--heading); line-height: 1.25; margin: 10px 0 4px; }
.hero .prompt small { display: block; font-family: var(--sans); font-size: 14px; color: var(--text-soft); margin-top: 8px; }
.noteglyph { color: var(--note); }

.checkfoot { font-size: 12.5px; color: var(--text-soft); margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Note card */
.notecard { border-left: 4px solid var(--lavender); }
.notecard textarea {
  width: 100%;
  min-height: 64px;
  border: none;
  background: transparent;
  resize: vertical;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--text);
  line-height: 1.5;
}
.notecard textarea:focus { outline: none; }
.notefoot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* Plan (right column) */
.planrow { display: flex; align-items: center; gap: 12px; padding: 9px 6px; font-size: 15px; }
.planrow .st {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--border);
  font-size: 13px;
  color: var(--text-soft);
}
.planrow.done .st { background: var(--success); border-color: var(--success); color: #fff; }
:root[data-theme="dark"] .planrow.done .st { color: #241D2B; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .planrow.done .st { color: #241D2B; } }
.planrow.now .st {
  border-color: var(--lavender);
  background: var(--lavender);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--lavender) 25%, transparent);
}
:root[data-theme="dark"] .planrow.now .st { color: #241D2B; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .planrow.now .st { color: #241D2B; } }
.planrow .pn { font-weight: 600; flex: 1; }
.planrow .ps { font-size: 12.5px; color: var(--text-soft); }
.planrow.now .pn { color: var(--accent); }
.plancount { font-size: 12.5px; color: var(--text-soft); margin-top: 8px; }

/* Banner (next up) */
.banner {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 14px;
}
.banner .ic { color: var(--lavender); flex: none; }
.banner b { color: var(--heading); }

/* Feed (Earlier Today) */
.feed { display: flex; flex-direction: column; }
.feedrow {
  display: flex; gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  align-items: baseline;
}
.feedrow:last-child { border-bottom: none; }
.feedrow .when { font-family: var(--mono); font-size: 12px; color: var(--text-soft); flex: none; width: 70px; }
.feedrow .what b { font-weight: 600; }
.feedrow .what .g { color: var(--rose); font-weight: 700; }
.feedrow .what .n { color: var(--note); font-style: italic; font-family: var(--serif); }

/* ==================== CALENDAR ==================== */
.calhead { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.calhead h2 { font-family: var(--serif); font-size: 26px; font-weight: 500; flex: 1; }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calgrid .dow { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-soft); text-align: center; padding: 6px 0; }
.calday {
  min-height: 74px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  text-align: left;
}
.calday:hover { border-color: var(--accent-soft); box-shadow: var(--shadow); }
.calday .dnum { font-size: 14px; font-weight: 600; color: var(--text); }
.calday .dots { display: flex; gap: 4px; flex-wrap: wrap; }
.calday .dots i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.calday.today { border: 2px solid var(--rose); }
.calday.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.calday .lbl { font-size: 9.5px; color: var(--text-soft); letter-spacing: .3px; line-height: 1.25; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; font-size: 12px; color: var(--text-soft); align-items: center; }
.cal-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: -1px; }

/* Day record sheet is wider */
.sheet.wide { width: min(680px, 100%); }

/* ==================== TRENDS ==================== */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.statcard { text-align: left; }
.statcard .num { font-family: var(--serif); font-size: 44px; color: var(--rose); line-height: 1.1; }
.statcard .lbl { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-soft); font-weight: 600; margin-top: 4px; }
.statcard .delta { font-size: 13px; color: var(--text-soft); margin-top: 8px; }
.weeknav { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.weeknav .wk { font-weight: 600; }
.periodstats .prow { display: flex; align-items: baseline; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.periodstats .prow:last-child { border-bottom: none; }
.periodstats .pname { flex: 1; font-weight: 600; }
.periodstats .pavg { font-family: var(--serif); font-size: 26px; color: var(--heading); }
.periodstats .pcnt { font-size: 12.5px; color: var(--text-soft); min-width: 90px; text-align: right; }

/* ==================== MEDICATIONS ==================== */
.medcard .medhead { display: flex; align-items: center; gap: 12px; }
.medcard .medname { font-size: 18px; font-weight: 600; flex: 1; }
.medcard .medmeta { font-size: 13px; color: var(--text-soft); margin-top: 3px; }
.medcard .medactions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.medlist > .medcard + .medcard { margin-top: 14px; }
.statuschip { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; padding: 3px 10px; border-radius: var(--r-chip); }
.statuschip.active { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.statuschip.paused { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.statuschip.discontinued { background: var(--surface-soft); color: var(--text-soft); }

/* History timeline */
.timeline { display: flex; flex-direction: column; }
.tlrow { display: flex; gap: 14px; padding: 11px 4px; border-bottom: 1px solid var(--border); font-size: 14px; align-items: baseline; }
.tlrow:last-child { border-bottom: none; }
.tlrow .tldate { font-family: var(--mono); font-size: 12px; color: var(--text-soft); flex: none; width: 96px; }
.tlrow .tlwhat b { font-weight: 600; }
.tlrow .tlwhat .n { color: var(--note); font-style: italic; font-family: var(--serif); }

/* ==================== REPORTS ==================== */
.reportopts { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--gap); }
.reportopts .field { margin-bottom: 0; min-width: 170px; }

/* Print-only professional report (docs/REPORTS.md §4) */
.report-doc { display: none; }
@media print {
  body * { visibility: hidden; }
  .report-doc, .report-doc * { visibility: visible; }
  .report-doc {
    display: block !important;
    position: absolute;
    inset: 0;
    background: #fff;
    color: #1c1a1e;
    font-family: Georgia, serif;
    padding: 24px 8px;
  }
  .report-doc h1 { color: #1c1a1e; font-size: 22px; }
  .report-doc h2 { color: #1c1a1e; font-size: 15px; margin: 18px 0 8px; border-bottom: 1.5px solid #999; padding-bottom: 4px; }
  .report-doc table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .report-doc th, .report-doc td { border: 1px solid #bbb; padding: 5px 8px; text-align: left; }
  .report-doc th { background: #f0f0f0; }
  .report-doc .rmeta { font-size: 11px; color: #555; margin-bottom: 4px; }
}
@media screen {
  .report-doc { display: none; }
}

/* ==================== SETTINGS ==================== */
.setgroup + .setgroup { margin-top: var(--gap); }
.setrow { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.setrow:last-child { border-bottom: none; }
.setrow .slabel { flex: 1; min-width: 200px; }
.setrow .slabel .t { font-weight: 600; font-size: 15px; }
.setrow .slabel .d { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.seg.small button { min-width: 72px; min-height: 40px; padding: 7px 12px; font-size: 13.5px; }

/* ==================== Boot failure state (runtime diagnostic) ==================== */
.bootfail {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.bootfail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lift);
  max-width: 520px;
  padding: 30px 32px;
}
.bootfail-card h1 { font-family: var(--serif); font-size: 26px; margin-bottom: 10px; }
.bootfail-card p { font-size: 14.5px; line-height: 1.6; color: var(--text); margin-bottom: 10px; }
.bootfail-card .bf-important {
  background: var(--pink-soft);
  border-radius: 12px;
  padding: 12px 14px;
}
.bootfail-card details { margin: 12px 0; font-size: 13px; }
.bootfail-card pre {
  background: var(--surface-soft);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  overflow: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
}
.bootfail-card .bf-actions { display: flex; gap: 10px; margin: 14px 0 8px; }
.bootfail-card .bf-foot { color: var(--text-soft); font-size: 12.5px; }

/* ==================== iPhone tabbar spacing for views ==================== */
@media (max-width: 700px) {
  .hero .glucosenum { font-size: 64px; }
  .seg button { min-width: 62px; padding: 8px 8px; }
  .periodbar .arrowbtn { width: 36px; height: 36px; }
  .periodbar { gap: 8px; }
}
