/* Peptrack web — same tokens as the iPhone app's Theme.swift */
:root {
  --bg: #0F1012;
  --card: #1B1C1F;
  --tile: #26272B;
  --raised: #303136;
  --hairline: #2E2F33;
  --text: #F2F2F4;
  --secondary: #8E8E93;
  --tertiary: #5C5D62;
  --blue: #5B8FF0;
  --blue-light: #7EA8F7;
  --green: #3DD68C;
  --amber: #F2A33A;
  --red: #E5484D;
  --teal: #6CB6C6;
  --purple: #9B87F5;
  --radius: 20px;
  --tile-radius: 14px;
  --gap: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--blue-light); text-decoration: none; }
.num { font-family: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.muted { color: var(--secondary); }
.faint { color: var(--tertiary); }
.small { font-size: 12px; }
.error { color: var(--red); min-height: 1.2em; margin: 0; font-size: 13px; }

/* Buttons */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  border-radius: 999px; padding: 10px 18px; color: var(--text); background: var(--tile);
  transition: background .15s, transform .1s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-light); }
.btn.ghost { background: transparent; color: var(--secondary); }
.btn.ghost:hover { background: var(--tile); color: var(--text); }
.btn.small { padding: 7px 12px; font-size: 13px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(360px, 100%); background: var(--card); border-radius: var(--radius); padding: 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-card p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--secondary); font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
.field input {
  font: inherit; font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text); background: var(--tile);
  border: 1px solid transparent; border-radius: 12px; padding: 12px 14px; outline: none;
}
.field input:focus { border-color: var(--blue); }

/* Layout */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.2px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px rgba(91,143,240,.18); }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px max(16px, calc((100vw - 1200px) / 2)); background: rgba(15,16,18,.85); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--hairline);
}
.topbar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; display: flex; flex-direction: column; gap: 28px; }

.section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .9px; text-transform: uppercase; color: var(--secondary);
  margin: 0 0 10px 4px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.section-title .aside { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--tertiary); font-size: 12px; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; min-width: 0; }
.grid { display: grid; gap: var(--gap); }
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.tile { background: var(--card); border-radius: var(--tile-radius); padding: 14px 16px; min-width: 0; }
.tile-label { font-size: 10px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--secondary); }
.tile-value { font-size: 28px; font-weight: 600; margin-top: 4px; letter-spacing: -.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-value .unit { font-size: 14px; color: var(--secondary); font-weight: 500; margin-left: 3px; letter-spacing: 0; }
.tile-caption { font-size: 12px; color: var(--secondary); margin-top: 2px; }

/* Compound card */
.compound-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.compound-name { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.compound-sub { color: var(--secondary); font-size: 13px; margin-top: 3px; }
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--tile); color: var(--secondary); }
.badge.green { color: var(--green); background: rgba(61,214,140,.12); }
.badge.amber { color: var(--amber); background: rgba(242,163,58,.12); }
.badge.red { color: var(--red); background: rgba(229,72,77,.12); }
.compound-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.compound-stats .tile { background: var(--tile); }

.pills { display: inline-flex; background: var(--tile); border-radius: 999px; padding: 3px; gap: 2px; }
.pill { appearance: none; border: 0; background: transparent; color: var(--secondary); font: inherit; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.pill.on { background: var(--raised); color: var(--text); }
.chart-wrap { position: relative; margin-top: 14px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: -apple-system, system-ui, sans-serif; }
.tip {
  position: absolute; pointer-events: none; background: var(--raised); color: var(--text); border-radius: 10px; padding: 7px 10px;
  font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: 0 6px 20px rgba(0,0,0,.4); z-index: 2;
}
.tip b { font-weight: 600; }

/* Stages */
.stages { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.stage { flex: 1 1 90px; background: var(--tile); border-radius: 12px; padding: 8px 10px; font-size: 12px; color: var(--secondary); border: 1px solid transparent; }
.stage b { display: block; color: var(--text); font-size: 15px; }
.stage.now { border-color: var(--blue); }
.stage.done { opacity: .55; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 10px; letter-spacing: .8px; text-transform: uppercase; color: var(--secondary); font-weight: 600; padding: 0 10px 10px 0; white-space: nowrap; }
td { padding: 11px 10px 11px 0; border-top: 1px solid var(--hairline); vertical-align: middle; }
td.r, th.r { text-align: right; }
tr.skipped td { color: var(--tertiary); }
.cell-compound { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

/* Vials */
.vial { display: flex; gap: 14px; align-items: center; background: var(--tile); border-radius: var(--tile-radius); padding: 14px; }
.vial-gauge { width: 26px; height: 64px; border-radius: 7px; background: var(--raised); position: relative; overflow: hidden; flex: none; }
.vial-fill { position: absolute; left: 0; right: 0; bottom: 0; opacity: .9; }
.vial-body { min-width: 0; flex: 1; }
.vial-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vial-meta { color: var(--secondary); font-size: 12px; margin-top: 3px; }

/* Upcoming */
.day-row { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hairline); align-items: baseline; }
.day-row:first-child { border-top: 0; padding-top: 0; }
.day-name { width: 92px; flex: none; color: var(--secondary); font-size: 13px; font-weight: 600; }
.day-items { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--tile); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.chip.taken { color: var(--green); }
.chip.missed { color: var(--red); }
.chip.skipped { color: var(--tertiary); text-decoration: line-through; }

/* Health */
.metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.metric-title { font-size: 13px; font-weight: 600; color: var(--secondary); }
.metric-value { font-size: 24px; font-weight: 600; letter-spacing: -.4px; margin-top: 2px; }
.metric-value .unit { font-size: 13px; color: var(--secondary); margin-left: 3px; font-weight: 500; }
.delta { font-size: 12px; font-weight: 600; }
.delta.good { color: var(--green); }
.delta.bad { color: var(--red); }
.delta.neutral { color: var(--secondary); }

.journal-item { padding: 12px 0; border-top: 1px solid var(--hairline); }
.journal-item:first-child { border-top: 0; padding-top: 0; }
.empty { color: var(--tertiary); font-size: 14px; padding: 6px 0; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
select {
  font: inherit; font-size: 13px; color: var(--text); background: var(--tile); border: 0; border-radius: 999px; padding: 7px 12px;
}

@media (max-width: 560px) {
  .tile-value { font-size: 24px; }
  .two, .three { grid-template-columns: 1fr; }
  .topbar #synced { display: none; }
  .day-name { width: 70px; }
}
