/* css/styles.css
   Treadmill Tracker: dark treadmill-console theme.
   One amber accent on near-black (#101214), system font stack.
   No gradients, no purple/blue, 44px+ tap targets. */

:root {
  --bg: #101214;
  --surface: #1a1d20;
  --surface-inset: #0b0d0f;
  --text: #f2f3f4;
  --muted: #a7adb4;
  --line: #2a2e33;
  --amber: #ffb000;
  --amber-dim: #c78a00;
  --danger: #ff6b5e;
  --ok: #7fd08c;
  --radius: 10px;
  --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

/* Console-style stat readouts: tabular numbers, amber for key values.
   Reason: treadmill consoles show readouts in glowing amber digits, so key
   numbers inherit that identity instead of generic bold text. */
.stat-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--amber);
}

.app-header {
  padding: calc(16px + env(safe-area-inset-top)) 20px 12px;
  border-bottom: 1px solid var(--line);
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.app-header .sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

#view {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.screen-title {
  font-size: 18px;
  margin: 4px 0 12px;
}

/* Console readout card: dark inset panel, the identity motif of the app. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.readout {
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  margin-bottom: 12px;
}

.readout .big {
  font-size: 44px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--amber);
}

.readout .label {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.stat-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.stat .v {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.stat .k {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.formula {
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input[type="number"],
.field input[type="text"] {
  width: 100%;
  min-height: var(--tap);
  font-size: 18px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.field input:focus-visible {
  border-color: var(--amber);
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

.field .hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.field .error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 6px;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: 44px;
  padding: 12px 20px;
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font);
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--amber);
  color: #191204;
  width: 100%;
}

.btn-primary:hover { background: #ffc233; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn-ghost:hover { border-color: var(--muted); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-sm {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 15px;
}

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

.walk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.walk-row .info { flex: 1; min-width: 0; }

.walk-row .date {
  font-weight: 600;
  font-size: 15px;
}

.walk-row .nums {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.walk-row .nums b { color: var(--amber); font-weight: 700; }

.walk-row .actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  padding: 0 10px;
}

.icon-btn:hover { color: var(--text); border-color: var(--muted); }

.icon-btn.danger { color: var(--danger); border-color: var(--danger); }

.edit-form {
  background: var(--surface);
  border: 1px solid var(--amber-dim);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.edit-form .row {
  display: flex;
  gap: 10px;
}

.edit-form .row .field { flex: 1; }

.edit-form .btn-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.confirm-box {
  background: var(--surface);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.confirm-box p { margin: 0 0 10px; }

.confirm-box .btn-row { display: flex; gap: 8px; }

/* Segmented toggle: two options, one control, 44px+ targets. */
.seg {
  display: flex;
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
}

.seg button {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
}

.seg button[aria-pressed="true"] {
  background: var(--amber);
  color: #191204;
}

.notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 15px;
}

.notice.error { border-left-color: var(--danger); }

.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty p { margin: 0 0 6px; }

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

.saved-flash {
  color: var(--ok);
  font-size: 14px;
  min-height: 20px;
  margin-top: 6px;
}

/* Bottom tab bar: thumb-friendly, 4 real destinations, no dead links. */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 64px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.tabbar a svg {
  width: 24px;
  height: 24px;
}

.tabbar a[aria-current="page"] { color: var(--amber); }

.offline-banner {
  display: none;
  background: var(--surface-inset);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 6px 12px;
}

body.offline .offline-banner { display: block; }

ol.steps { margin: 8px 0 0; padding-left: 22px; }
ol.steps li { margin-bottom: 6px; }

@media (min-width: 600px) {
  #view { padding-top: 24px; }
}
