
:root {
  --bg: #111418;
  --bg-elev: #1a1e24;
  --bg-input: #232830;
  --line: #2d333c;
  --text: #f3eee6;
  --muted: #9aa3ae;
  --accent: #e87830;
  --accent-dim: #c45f1f;
  --ok: #7dbe6a;
  --warn: #d4b45a;
  --danger: #d0665a;
  --radius: 14px;
  --tap: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-top)) 16px calc(28px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 650;
}
.brand .tag {
  color: var(--muted);
  font-size: 13px;
}

.icon-btn, .text-btn, .primary, .ghost, .danger {
  border: 0;
  border-radius: 12px;
  min-height: var(--tap);
}
.icon-btn {
  width: var(--tap);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}
.text-btn {
  background: transparent;
  color: var(--accent);
  padding: 0 8px;
  font-weight: 600;
}
.primary {
  width: 100%;
  background: var(--accent);
  color: #1a1008;
  font-weight: 700;
  padding: 0 16px;
}
.primary:disabled { opacity: 0.45; }
.ghost {
  width: 100%;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
}
.danger {
  width: 100%;
  background: transparent;
  color: var(--danger);
  border: 1px solid #5a2e2a;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
}
.card.clickable { width: 100%; text-align: left; display: block; }
.card h2, .section-title {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 650;
}

.practice-name {
  font-size: 18px;
  font-weight: 650;
  margin: 0 0 6px;
}
.meta { color: var(--muted); font-size: 14px; }
.big {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.big span { font-size: 16px; font-weight: 550; color: var(--muted); }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 600;
}
input[type="text"], input[type="number"], input[type="date"], textarea, select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: var(--tap);
  padding: 10px 12px;
  outline: none;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--text);
}
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.seg {
  display: flex;
  background: var(--bg-input);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  border-radius: 10px;
  font-weight: 650;
}
.seg button.on {
  background: var(--bg-elev);
  color: var(--text);
}

.quick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.quick button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  font-weight: 650;
}

.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  font-size: 15px;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 650; text-align: right; }

.note {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 0;
}
.flash {
  background: #24301f;
  color: #c8e6bc;
  border: 1px solid #35502c;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}
.warnbox {
  background: #2a2618;
  color: #e6d9a8;
  border: 1px solid #4a4328;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
}

.hidden { display: none !important; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  color: var(--accent);
  min-height: 40px;
  padding: 0;
  font-weight: 650;
}

.footer-actions { margin-top: 8px; }

.log-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.log-item:first-child { border-top: 0; }
.log-item .when { font-weight: 650; }
.log-item .amt { color: var(--muted); }

.empty {
  color: var(--muted);
  padding: 8px 0 4px;
}

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