/* Tansiyon Takip — mobile-first, no CSS framework. */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0d9488;
  --sys: #e11d48;
  --dia: #0d9488;
  --pulse: #6366f1;
  --ok-bg: #dcfce7;
  --ok-ink: #14532d;
  --err-bg: #fee2e2;
  --err-ink: #7f1d1d;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: -.01em; }
.tabs { display: flex; gap: 6px; }
.tabs a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: 15px;
}
.tabs a.is-active { background: var(--brand); color: #fff; }

.wrap {
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 14px 14px 96px;
  display: flex; flex-direction: column; gap: 14px;
}
.footnote {
  max-width: 680px; margin: 0 auto; padding: 0 18px 28px;
  color: var(--muted); font-size: 12.5px; text-align: center;
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card h2 { margin: 0 0 10px; font-size: 15px; color: var(--muted); font-weight: 650; }
.link { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 14px; }

.banner { margin: 0; padding: 10px 12px; border-radius: 12px; font-weight: 600; font-size: 14px; }
.banner-ok { background: var(--ok-bg); color: var(--ok-ink); }
.banner-err { background: var(--err-bg); color: var(--err-ink); }
.errors { margin: 0 0 12px; padding-left: 18px; color: var(--err-ink); font-size: 14px; }
.errors li { margin: 3px 0; }

/* ---------- latest reading ---------- */
.reading { display: flex; flex-direction: column; gap: 2px; }
.reading-value { font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.reading-value .slash { color: var(--muted); font-weight: 500; margin: 0 2px; }
.reading-value .sys { color: var(--sys); }
.reading-value .dia { color: var(--dia); }
.reading-meta { color: var(--muted); font-size: 14px; }
.note {
  margin: 10px 0 0; padding: 9px 11px; background: #f8fafc;
  border-left: 3px solid var(--line); border-radius: 8px; font-size: 14.5px;
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 12px; box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat-value { font-size: 21px; font-weight: 750; margin-top: 2px; }
.stat-sub { color: var(--muted); font-size: 12px; }

/* ---------- chart ---------- */
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart-svg { display: block; width: 100%; min-width: 560px; height: auto; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 13px; }
.chart-axis-y { text-anchor: end; }
.chart-axis-x { text-anchor: middle; }
.chart-dot { stroke: #fff; stroke-width: 1.4; }
.chart-empty {
  display: flex; align-items: center; justify-content: center; min-height: 150px;
  color: var(--muted); font-size: 14.5px; text-align: center; padding: 10px;
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { font-size: 13.5px; font-weight: 650; color: #334155; }
input, select, textarea {
  font: inherit; width: 100%; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea { min-height: 72px; resize: vertical; }
.hint { color: var(--muted); font-size: 12.5px; }
.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 13px 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--brand); color: #fff; width: 100%;
}
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); width: auto; }
.btn-danger {
  background: transparent; color: #b91c1c; border: none; width: auto;
  padding: 6px 8px; font-size: 13px; font-weight: 650;
}
details.add summary {
  cursor: pointer; font-weight: 700; font-size: 16px; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
details.add summary::-webkit-details-marker { display: none; }
details.add summary::after { content: "+"; font-size: 22px; color: var(--brand); }
details.add[open] summary::after { content: "\2212"; }
details.add[open] summary { margin-bottom: 14px; }

/* ---------- lists ---------- */
.m-list { list-style: none; margin: 0; padding: 0; }
.m-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-top: 1px solid var(--line);
}
.m-item:first-child { border-top: none; }
.m-values { font-weight: 750; font-size: 17px; min-width: 88px; }
.m-values small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.m-when { flex: 1; color: var(--muted); font-size: 13px; }
.m-when b { display: block; color: var(--ink); font-size: 13.5px; font-weight: 650; }
.m-note { color: var(--muted); font-size: 13px; max-width: 34%; word-break: break-word; }
.empty { color: var(--muted); font-size: 14.5px; margin: 0; }

/* ---------- filters / pagination ---------- */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters select { width: auto; padding: 9px 12px; font-size: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 8px 13px; border-radius: 999px; text-decoration: none;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  font-size: 14px; font-weight: 600;
}
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.pager .btn-secondary.disabled { opacity: .45; pointer-events: none; }
.pager-info { color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- floating add button ---------- */
.card-head h2 { margin: 0; }
.hint-block { margin: 12px 0 0; }
.legend i.swatch { font-style: normal; }
.fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: #fff; border: none;
  font-size: 30px; line-height: 54px; text-align: center; text-decoration: none;
  box-shadow: 0 6px 20px rgba(13, 148, 136, .38);
}

