:root {
  --bg: #111318;
  --card: #1a1d24;
  --card-hi: #232733;
  --line: #2c313c;
  --fg: #e9ecf1;
  --muted: #8b94a7;
  --accent: #4c9aff;
  --ok: #2fbf71;
  --danger: #ef5b5b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.pad { padding: 16px 16px 24px; max-width: 720px; margin: 0 auto; }
h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 24px 0 8px; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 20px; }
.screen { display: none; }
.screen.active { display: block; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

button, .btn {
  min-height: 48px; width: 100%; border: 0; border-radius: 12px;
  background: var(--card-hi); color: var(--fg); font-size: 16px; font-weight: 500;
  padding: 12px 16px; cursor: pointer; text-align: left;
}
button.primary { background: var(--accent); color: #fff; text-align: center; margin-top: 16px; }
button.ghost { background: transparent; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
button.danger-ghost { background: transparent; border: 1px solid var(--line); color: var(--danger); text-align: center; margin-top: 8px; }
button.small { min-height: 36px; width: auto; padding: 6px 12px; font-size: 14px; border-radius: 8px; }

input, select {
  min-height: 48px; width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--fg); font-size: 16px; padding: 8px 12px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
form { display: flex; flex-direction: column; gap: 8px; }
.inline-form { flex-direction: row; align-items: center; margin-top: 8px; }
.inline-form button { width: auto; min-width: 56px; text-align: center; }

.card { background: var(--card); border-radius: 14px; padding: 12px 14px; }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.banner {
  background: var(--card-hi); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
}
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.pill { background: var(--card-hi); border-radius: 999px; padding: 6px 12px; font-size: 14px; }

.set-row { display: grid; grid-template-columns: 1fr 1fr 56px; gap: 8px; align-items: center; margin-bottom: 8px; }
.set-row input { text-align: center; }
.set-row .check { min-height: 48px; width: 100%; text-align: center; background: var(--card-hi); }
.set-row.done .check { background: var(--ok); color: #fff; }
.set-row.done input { opacity: .55; }

.chart { width: 100%; overflow-x: auto; margin: 8px 0 16px; }
.chart svg { display: block; }

.details { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.detail-row { margin-bottom: 8px; }
.detail-row:last-child { margin-bottom: 0; }
.danger-text { color: var(--danger); }

.ex-meta { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; margin-top: 8px; }
.te-row { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.te-row:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.te-head { display: flex; gap: 8px; align-items: center; }
.te-move { display: flex; gap: 4px; }
.te-move button { min-width: 40px; text-align: center; padding: 6px 8px; }
.te-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.te-nums input { text-align: center; }

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs a {
  flex: 1; text-align: center; padding: 14px 4px; min-height: 48px;
  color: var(--muted); text-decoration: none; font-size: 13px;
}
#tabs a.active { color: var(--accent); }
body.no-tabs #tabs { display: none; }

#toast {
  position: fixed; left: 16px; right: 16px; bottom: 88px; z-index: 10;
  background: var(--card-hi); border-radius: 12px; padding: 12px 14px;
  display: none; text-align: center;
}
#toast.show { display: block; }
