/* "My measurements" page. Colors, fonts, buttons, header and footer come from /assets/theme.css (the app's look). */

main { max-width: 980px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.7rem; margin: 0 0 .3rem; }
h2 { font-size: .95rem; margin: 0 0 .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.center { display: flex; justify-content: center; padding: 64px 0; }
.muted { color: var(--muted); margin: 0; }
.error { color: var(--run); }
.hint { color: var(--muted); font-size: .92rem; }

.account { position: relative; min-width: 0; font-size: .92rem; }
.account-btn {
  display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 320px; padding: 4px 8px 4px 4px;
  font: inherit; color: var(--text); background: none; border: 0; border-radius: 22px; cursor: pointer;
}
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--bg); }
.account-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.account-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.avatar.initial { display: inline-grid; place-items: center; background: var(--accent); color: #fff; font: 600 .95rem var(--font-ui); }
.avatar.initial:empty { display: none; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 280px; padding: 16px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg), var(--shadow);
  display: grid; gap: 10px;
}
.account-menu[hidden] { display: none; }
.account-menu h3 { margin: 4px 0 0; font: 500 .8rem var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.account-menu label { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; color: var(--text); }
.account-menu select {
  font: inherit; color: var(--text); background: var(--bg); border: 0; border-radius: 8px; padding: .4rem .5rem; width: 100%;
}
.menu-email { margin: 0; color: var(--strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { margin: 0; color: var(--muted); font-size: .82rem; }
.account-menu #sign-out { justify-self: start; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; background: var(--line); }

.signin { max-width: 460px; margin: 32px auto; text-align: center; }
/* color-scheme: light stops the browser painting Google's button frame white on the dark theme
   (a frame whose color scheme differs from the page gets an opaque background). */
.signin-buttons { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 1.25rem 0; }
.google-button { display: flex; justify-content: center; min-height: 44px; color-scheme: light; }
/* Sign in with Apple, sized like Google's large pill button: white with an outline on the light theme, black on
   the dark one (Apple's allowed styles). */
.apple-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 260px; height: 40px;
  border-radius: 20px; border: 1px solid #747775; background: #fff; color: #000; cursor: pointer;
  font: 500 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: .01em;
}
.apple-button[hidden] { display: none; }
.apple-button svg { width: 15px; height: 18px; fill: currentColor; margin-top: -2px; }
.apple-button:hover { background: #f4f4f4; }
.apple-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.apple-button.dark { background: #000; color: #fff; border-color: #8e918f; }
.apple-button.dark:hover { background: #1c1c1c; }
.google-button iframe { color-scheme: light; }

.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- list (like the app's measurement slots) */
#view-list h1 { margin-bottom: 14px; }
.search {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 0; border-radius: 8px;
  padding: .75rem 1rem; margin-bottom: 22px; box-shadow: var(--shadow);
}
.search::placeholder { color: var(--muted); font-style: italic; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
/* Store buttons under "No measurements backed up yet" (same look as on the home page). */
.stores { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: -8px 0 32px; }
.stores[hidden] { display: none; }
.store {
  display: inline-flex; align-items: center; gap: 10px; min-width: 176px;
  background: #000; color: #fff; text-decoration: none; border-radius: 10px;
  padding: 9px 18px 9px 14px; line-height: 1.15; font: 600 1.05rem var(--font-body);
  box-shadow: var(--shadow);
}
.store:hover { background: #222; }
.store svg { width: 24px; height: 24px; fill: currentColor; flex: none; }
.store small { display: block; font-weight: 400; font-size: .72rem; opacity: .85; }
:root[data-theme="dark"] .store { border: 1px solid #3a444a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .store { border: 1px solid #3a444a; } }

.car { margin-bottom: 12px; }
.car.open { margin-bottom: 22px; }
.car-title { margin: 0; font: italic 500 1.1rem var(--font-ui); color: var(--text); }
/* The car's name is a dropdown button: a card with a caret that turns when its runs are shown. */
.car-toggle {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  background: var(--surface); border: 0; border-radius: 8px; box-shadow: var(--shadow);
  padding: 12px 16px; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.car-toggle:hover .car-name { color: var(--strong); }
.car-toggle:focus-visible { outline: 2px solid var(--strong); outline-offset: 2px; }
.car-toggle .caret { width: 18px; height: 18px; transform: rotate(-90deg); }
.car-toggle[aria-expanded="true"] .caret { transform: none; }
.car-name { overflow-wrap: anywhere; }
.car-title small { margin-left: auto; color: var(--muted); font: normal .85rem var(--font-body); white-space: nowrap; }
.runs { list-style: none; margin: 10px 0 0 14px; padding: 0; display: grid; gap: 10px; }
.runs[hidden] { display: none; }
.run {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow);
  padding: 12px 16px; color: var(--text); text-decoration: none;
}
.run:hover { color: var(--strong); }
.run:active { transform: translateY(1px); }
.run .name { color: var(--strong); font-weight: 600; overflow-wrap: anywhere; }
.run .date { color: var(--muted); font-size: .85rem; font-style: italic; }
.run .peak { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.run .peak span { display: block; color: var(--muted); font-size: .85rem; font-style: italic; }

/* ---------------------------------------------------------------- one measurement */
.shared-note { color: var(--muted); font-style: italic; margin: .4rem 0 0; }
.public-tag { display: inline-block; margin-left: .5rem; padding: 1px 8px; border-radius: 10px; font: 500 .72rem var(--font-ui);
  background: var(--accent); color: #fff; vertical-align: 2px; }

/* Public link switch */
.share { margin-top: 16px; display: grid; gap: 10px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font: 500 1rem var(--font-ui); color: var(--strong); width: fit-content; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: .6; }
.share-link { display: flex; gap: 10px; flex-wrap: wrap; }
.share-link input { flex: 1 1 260px; min-width: 0; font: inherit; color: var(--text); background: var(--bg); border: 0; border-radius: 8px; padding: .5rem .75rem; }
.share .small { margin: 0; }
.back { margin-bottom: 14px; }
.eyebrow { color: var(--muted); margin: 0 0 .2rem; font-style: italic; }

/* The app's graph: white plot, dashed grid, rpm on top, one value axis, dark readout box. */
/* Run check: "Verified" / "Not verified" above the chart's top-right corner; tap for the details. */
.check-row { display: flex; justify-content: flex-end; margin-top: 14px; min-height: 30px; }
.run-check {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border: 0; border-radius: 999px;
  background: var(--bg); color: var(--strong); font: 600 .88rem var(--font-ui); cursor: pointer;
}
.run-check[hidden] { display: none; }
.run-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-icon { width: 22px; height: 22px; flex: none; }
.check-icon circle { fill: var(--check-color); }
.check-icon path { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.check-icon text { fill: #fff; font: 700 14px var(--font-ui); }
.check-icon.pass { --check-color: #22c360; }
.check-icon.fail { --check-color: #e34133; }
.check-icon.unknown { --check-color: #8c9499; }
.check-dialog {
  max-width: min(560px, calc(100vw - 32px)); border: 0; border-radius: var(--radius); padding: 22px 24px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg), var(--shadow);
}
.check-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.check-head { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font: 700 1.35rem var(--font-ui); color: var(--strong); text-transform: none; letter-spacing: 0; }
.check-head .check-icon { width: 30px; height: 30px; }
.check-dialog p { margin: 0 0 10px; }
.check-items { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.check-items li { display: flex; gap: 10px; align-items: flex-start; }
.check-items b { display: block; color: var(--strong); }
.check-items span { font-size: .92rem; }
.check-dialog form { margin: 0; text-align: right; }
.chart-wrap { position: relative; width: 100%; height: 380px; margin-top: 6px; background: var(--chart-bg); }
.chart-wrap canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--tip-bg); color: var(--tip-text);
  border-radius: 3px; padding: 5px 10px; font-size: .9rem; line-height: 1.35; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tooltip b { font-weight: 700; }
.result-line { font: 700 .95rem var(--font-result); color: var(--chart-label); text-align: center; margin: 8px 0 0; }
.result-line .swatch { display: inline-block; width: 10px; height: 10px; background: var(--run); vertical-align: middle; margin: 0 3px 2px 8px; }
.result-line .tag { white-space: nowrap; }
.note { color: var(--muted); background: var(--bg); border-radius: 8px; padding: 12px 14px; margin: 12px 0 0; }

.controls {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 16px;
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line);
}
.controls label { display: flex; flex-direction: column; gap: 5px; color: var(--text); font-size: .92rem; }
.controls select, .controls input {
  font: inherit; color: var(--text); background: var(--surface); border: 0; border-radius: 8px;
  padding: .45rem .6rem; width: 100%; box-shadow: var(--shadow);
}
.presets { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; grid-column: 1 / -1; }
.small { font-size: .88rem; font-style: italic; grid-column: 1 / -1; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 16px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; color: var(--strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  .chart-wrap { height: 290px; }
  .card { padding: 14px; }
  .account-name { display: none; }
  .account-menu { width: min(280px, calc(100vw - 32px)); }
  .result-line { font-size: .8rem; }
}
