/* İnfüzyon Hesaplayıcı — mobil öncelikli, sistem fontları (harici font yok) */

:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #eef2f3;
  --text: #13201f;
  --muted: #56666a;
  --border: #d5dde0;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --load-bg: #e8f3ff;
  --radius: 12px;
  --tap: 48px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1416;
    --surface: #131f22;
    --surface-2: #1b2a2e;
    --text: #e6eeee;
    --muted: #9aaeb1;
    --border: #2a3b3f;
    --accent: #2dd4bf;
    --accent-text: #06201d;
    --danger: #ff8a80;
    --danger-bg: #3a1714;
    --warn: #ffd27a;
    --warn-bg: #3a2e10;
    --load-bg: #12283d;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1416;
  --surface: #131f22;
  --surface-2: #1b2a2e;
  --text: #e6eeee;
  --muted: #9aaeb1;
  --border: #2a3b3f;
  --accent: #2dd4bf;
  --accent-text: #06201d;
  --danger: #ff8a80;
  --danger-bg: #3a1714;
  --warn: #ffd27a;
  --warn-bg: #3a2e10;
  --load-bg: #12283d;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

[hidden] { display: none !important; }

/* ---------- Üst bölüm ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.top h1 { font-size: 1.1rem; margin: 0; }

.top-actions { display: flex; gap: 6px; }

.inputs { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 8px; }

.vol-field { margin-top: 10px; }

.vol-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 6px; }

.vol-btn {
  min-height: 52px;
  padding: 4px 2px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vol-btn small { display: block; font-size: .7rem; font-weight: 400; color: var(--muted); }

.vol-btn[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.vol-btn[aria-checked="true"] small { color: var(--accent-text); }

.vol-custom { margin-top: 6px; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }

.input-wrap { position: relative; display: block; }

.input-wrap input {
  width: 100%;
  min-height: 56px;
  font-size: 1.6rem;
  font-weight: 600;
  padding: 6px 44px 6px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.input-wrap input:focus { border-color: var(--accent); outline: none; }

.input-wrap .unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
}

.input-msg:empty { display: none; }

.input-msg {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: .9rem;
  font-weight: 600;
}

.input-msg.info { background: var(--surface-2); color: var(--muted); font-weight: 400; }

/* ---------- Butonlar ---------- */

.btn-ghost {
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.icon-btn {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 1.1rem;
  line-height: 1;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  padding: 8px;
  min-height: 40px;
}

/* ---------- Ana içerik ---------- */

main { padding: 12px 12px 4px; max-width: 820px; margin: 0 auto; }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  background: var(--load-bg);
}

.share-ico { width: 18px; height: 18px; vertical-align: -3px; }

.tools { display: flex; gap: 8px; margin-bottom: 10px; }

.tools input {
  flex: 1;
  min-height: var(--tap);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 1rem;
}

.group-title {
  margin: 18px 4px 8px;
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.drug {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.drug > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 60px;
  padding: 10px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.drug > summary::-webkit-details-marker { display: none; }

.drug > summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin-left: 2px;
  transition: transform .15s;
}

.drug[open] > summary::after { transform: rotate(-135deg); }

.drug[open] > summary { border-bottom: 1px solid var(--border); }

.d-name { font-weight: 600; }

.d-rate { margin-left: auto; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.d-rate b { font-size: 1.25rem; }

.d-rate small { display: block; color: var(--muted); font-size: .75rem; }

.d-rate.flag b { color: var(--danger); }

.drug-body { padding: 4px 14px 14px; }

.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* ---------- Sekme içeriği (render.js) ---------- */

.drug-body .blk { padding: 10px 0; border-bottom: 1px dashed var(--border); }

.drug-body h4 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.drug-body p { margin: 4px 0; }

.drug-body ul { margin: 4px 0; padding-left: 20px; }

.drug-body .big { font-size: 1.15rem; }

.drug-body .muted, .muted { color: var(--muted); font-size: .9rem; }

.drug-body .src { color: var(--muted); font-size: .8rem; margin-top: 10px; }

.need-input { padding: 10px 0; color: var(--muted); font-style: italic; }

.alert {
  margin: 10px 0 4px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.alert ul { margin: 0; padding-left: 18px; }

.note-warn { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 4px 8px; margin-bottom: 6px; }

.warn-text { color: var(--danger); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; }

.kv dt { color: var(--muted); }

.kv dd { margin: 0; }

.amp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.amp-btn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 1.5rem;
  line-height: 1;
}

.amp-input {
  width: 72px;
  height: var(--tap);
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.amp-label { font-weight: 600; }

.prep {
  margin: 12px 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
}

.prep-main { font-size: 1.15rem; margin: 0 !important; }

.prep-main .amp-count { font-size: 1.3rem; }

.prep-sub { margin: 4px 0 0 !important; color: var(--muted); font-size: .9rem; }

.load-line { padding: 8px 12px; border-radius: 10px; background: var(--load-bg); }

.titr .lbl { font-size: .72rem; font-weight: 600; color: var(--muted); margin-left: 4px; }

.more-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.more { margin-top: 6px; }

.tbl-wrap { overflow-x: auto; }

.titr { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

.titr th, .titr td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--border); }

.titr th:first-child, .titr td:first-child { text-align: left; color: var(--muted); }

.titr th { font-size: .8rem; color: var(--muted); font-weight: 600; }

.titr tr.start td { font-weight: 700; }

.titr tr.max td { font-weight: 700; }

.rows-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 600;
}

.tag { font-size: .7rem; padding: 1px 6px; border-radius: 6px; background: var(--danger); color: var(--surface); }

.formula { margin-top: 10px; }

.formula summary { cursor: pointer; color: var(--accent); min-height: 40px; display: flex; align-items: center; }

.formula ol { padding-left: 20px; font-size: .9rem; word-break: break-word; }

.formula li { margin-bottom: 6px; }

/* ---------- Alt bilgi, bildirim ---------- */

.foot { text-align: center; padding: 18px 14px 28px; color: var(--muted); font-size: .85rem; }

.disclaimer { font-weight: 700; color: var(--text); margin: 0 0 4px; }

.foot .meta { margin: 0; }

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  z-index: 50;
}

.toast span { flex: 1; }

.toast .link-btn { color: var(--bg); font-weight: 700; }

.toast .icon-btn { background: transparent; color: var(--bg); border-color: transparent; }

@media (min-width: 700px) {
  .top { padding-left: max(14px, calc(50% - 400px)); padding-right: max(14px, calc(50% - 400px)); }
}
