/* ============================================================
   Weight-loss progress tracker — shared by weight-tracker.html
   (patients) and weight-tracker-admin.html (staff). Builds on
   site.css tokens (--navy, --green, --line, --paper, …).
   ============================================================ */
.wt-wrap { max-width: 980px; margin: 0 auto; }
.wt-hero .phero-inner { padding: 14px 0 30px; max-width: 760px; }
.wt-hero .crumbs { padding-top: 18px; }
.wt-hero h1 { font-size: clamp(28px, 3.6vw, 44px); margin-top: 12px; }
.wt-hero .lede { font-size: 15.5px; margin-top: 12px; max-width: 580px; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); margin: 0 0 22px; overflow: hidden; box-shadow: var(--shadow-card); }
.card-head { padding: 16px 26px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--green-700); background: var(--paper); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-weight: 600; letter-spacing: .4px; text-transform: none; font-size: 12px; }
.card-body { padding: 22px 26px; }

.notice { padding: 14px 18px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; margin: 0 0 20px; }
.notice-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.notice-ok { background: rgba(15,160,78,.09); color: var(--green-700); border: 1px solid rgba(15,160,78,.25); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Login gate */
.gate { min-height: 46vh; display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.gate-card { width: 100%; max-width: 460px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: 44px 40px; text-align: center; }
.gate-card h2 { font-family: var(--serif); font-weight: 460; font-size: 28px; color: var(--navy); margin: 0 0 10px; }
.gate-card p { color: var(--muted); font-size: 14.5px; margin: 0 auto 24px; max-width: 360px; }
.gate-card .btn { width: 100%; }
.gate-help { margin-top: 18px; font-size: 12.5px; color: var(--muted); }

.signed-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.signed-row .who { font-size: 13.5px; color: var(--muted); }
.signed-row .who strong { color: var(--navy); }

/* Stat tiles */
.wt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.wt-stat { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow-card); }
.wt-stat .k { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.wt-stat .v { font-family: var(--serif); font-size: 34px; line-height: 1.1; color: var(--navy); margin-top: 8px; font-variant-numeric: tabular-nums; }
.wt-stat .v small { font-family: var(--sans); font-size: 14px; color: var(--muted); margin-left: 3px; }
.wt-stat .s { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.wt-stat .s .down { color: var(--green-700); font-weight: 600; }
.wt-bar { height: 6px; border-radius: 99px; background: var(--paper-2); margin-top: 10px; overflow: hidden; }
.wt-bar span { display: block; height: 100%; border-radius: 99px; background: var(--green); }

/* Chart */
.wt-controls { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 26px 0; }
.wt-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.wt-pill { border: 1px solid var(--line); background: var(--white); color: var(--navy); font: 600 12.5px var(--sans); padding: 7px 13px; border-radius: 999px; cursor: pointer; transition: .15s; }
.wt-pill:hover { border-color: var(--navy); }
.wt-pill[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.wt-chart { position: relative; padding: 8px 18px 6px 8px; }
.wt-chart svg { display: block; width: 100%; overflow: visible; }
.wt-chart .grid line { stroke: var(--line); stroke-width: 1; }
.wt-chart .axis text { fill: var(--muted); font: 500 11px var(--sans); font-variant-numeric: tabular-nums; }
.wt-chart .series { fill: none; stroke: var(--navy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.wt-chart .area { fill: rgba(10,53,94,.06); }
.wt-chart .pt { stroke: #fff; stroke-width: 2; }
.wt-chart .pt.clinic { fill: var(--navy); stroke-width: 1.5; }
.wt-chart .pt.home { fill: #fff; stroke: var(--navy); stroke-width: 2; }
.wt-chart .goal { stroke: var(--green); stroke-width: 1.5; stroke-dasharray: 5 5; }
.wt-chart .goal-label { fill: var(--green-700); font: 700 11px var(--sans); }
.wt-chart .xhair { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.wt-chart .hl { fill: var(--green); stroke: #fff; stroke-width: 2; }
.wt-tip { position: absolute; pointer-events: none; background: var(--navy-deep); color: #fff; border-radius: 10px; padding: 9px 12px; font-size: 12.5px; line-height: 1.45; box-shadow: 0 10px 30px rgba(6,35,64,.3); white-space: nowrap; transform: translate(-50%, calc(-100% - 14px)); opacity: 0; transition: opacity .1s; z-index: 2; }
.wt-tip strong { font-size: 15px; }
.wt-tip .t-sub { color: rgba(255,255,255,.7); font-size: 11.5px; }
.wt-legend { display: flex; gap: 18px; flex-wrap: wrap; padding: 4px 26px 18px; font-size: 12px; color: var(--muted); }
.wt-legend span { display: inline-flex; align-items: center; gap: 7px; }
.wt-legend i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--navy); display: inline-block; }
.wt-legend i.clinic { background: var(--navy); }
.wt-legend i.goal { width: 18px; height: 0; border-radius: 0; border: none; border-top: 2px dashed var(--green); }
.wt-empty { padding: 50px 26px; text-align: center; color: var(--muted); font-size: 14.5px; }

/* Entry form */
.wt-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 7px; }
.field label .u { color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 14.5px; font-family: var(--sans); color: var(--ink); background: var(--white); transition: .15s; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,160,78,.12); }
.field textarea { min-height: 64px; resize: vertical; }
.field-2 { grid-column: span 2; }
.field-full { grid-column: 1 / -1; }
.wt-more { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 14px; }
.wt-more summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--green-700); list-style: none; }
.wt-more summary::-webkit-details-marker { display: none; }
.wt-more summary::before { content: '+ '; }
.wt-more[open] summary::before { content: '− '; }
.wt-more .wt-form { margin-top: 14px; }
.wt-hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.wt-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.wt-actions .msg { font-size: 13px; color: var(--muted); margin-right: auto; }
.wt-actions .msg.err { color: #b42318; }

/* History */
.wt-table-wrap { overflow-x: auto; }
.wt-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wt-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.wt-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.wt-table tr:last-child td { border-bottom: none; }
.wt-table th:first-child, .wt-table td:first-child { padding-left: 26px; }
.wt-table th:last-child, .wt-table td:last-child { padding-right: 26px; text-align: right; }
.wt-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wt-table .w { font-weight: 700; color: var(--navy); }
.wt-table .chg-down { color: var(--green-700); font-weight: 600; }
.wt-table .chg-up { color: var(--muted); font-weight: 600; }
.wt-table .meas { color: var(--muted); font-size: 12.5px; }
.wt-table .note { color: var(--muted); font-size: 12.5px; font-style: italic; margin-top: 3px; max-width: 320px; white-space: normal; }
.wt-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.wt-badge.clinic { background: rgba(10,53,94,.09); color: var(--navy); }
.wt-badge.home { background: rgba(15,160,78,.1); color: var(--green-700); }
.wt-link { background: none; border: none; color: var(--navy); font: 600 12.5px var(--sans); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.wt-link:hover { background: var(--paper); }
.wt-link.danger { color: #b42318; }
.wt-table tr.editing td { background: rgba(15,160,78,.06); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 700px) {
  .wt-form { grid-template-columns: 1fr 1fr; }
  .card-body { padding: 18px; }
  .card-head, .wt-controls, .wt-legend { padding-left: 18px; padding-right: 18px; }
  .wt-table th:first-child, .wt-table td:first-child { padding-left: 18px; }
  .wt-table th:last-child, .wt-table td:last-child { padding-right: 18px; }
  .wt-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .wt-stat { padding: 14px 16px; }
  .wt-stat .v { font-size: 26px; }
  .gate-card { padding: 34px 24px; }
}
