:root {
  --bg: #0b1c1e;
  --bg-mid: #102628;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(232, 240, 236, 0.10);
  --line-strong: rgba(232, 240, 236, 0.16);
  --ink: #e8f0ec;
  --muted: #8aa39a;
  --accent: #1f6f66;
  --accent-hover: #268a7f;
  --coral: #e07a66;
  --gold: #e2b657;
  --mint: #5dba8a;
  --hold: #9b7bb8;
  --active: #c9504d;
  --glass-blur: 18px;
  --display: "Bricolage Grotesque", Georgia, serif;
  --ui: "Public Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--ui);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, select, button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

input, textarea { user-select: text; }

.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 70% 8%, rgba(31, 111, 102, 0.18), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-mid) 100%);
}

/* —— full-bleed stage —— */
.stage {
  position: absolute;
  inset: 0;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.stage canvas:active { cursor: grabbing; }

/* —— top bar —— */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(8px + var(--safe-top)) calc(16px + var(--safe-right)) 8px calc(16px + var(--safe-left));
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.wordmark-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wordmark {
  font-family: var(--display);
  font-weight: 650;
  font-size: 22px;
  letter-spacing: -0.04em;
  text-transform: lowercase;
  color: var(--ink);
}

.points-chip {
  appearance: none;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(11, 28, 30, 0.48);
  color: var(--ink);
  font: 650 13px/1 var(--mono);
  letter-spacing: 0.01em;
  white-space: nowrap;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  cursor: pointer;
}

.points-chip:hover { background: rgba(255, 255, 255, 0.10); }
.points-chip:active { transform: scale(0.96); }
.points-chip[hidden] { display: none; }

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(11, 28, 30, 0.48);
  color: var(--ink);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  cursor: pointer;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.10); }
.icon-btn:active { transform: scale(0.96); }

/* —— selected site pill —— */
.site-pill {
  position: absolute;
  top: calc(56px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: calc(100% - 32px);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(11, 28, 30, 0.58);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font: 650 13px/1.2 var(--ui);
  letter-spacing: 0.01em;
  white-space: nowrap;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.site-pill[hidden] { display: none; }

.site-timers {
  position: absolute;
  top: calc(58px + var(--safe-top));
  left: calc(10px + var(--safe-left));
  z-index: 6;
  width: min(46%, 180px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}
.site-timers[hidden] { display: none; }
.site-timers div {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(11, 28, 30, 0.62);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font: 650 11px/1.2 var(--ui);
  letter-spacing: 0.01em;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  white-space: nowrap;
}
.site-timers .timer-on {
  border-color: rgba(201, 80, 77, 0.42);
  color: #f0b2aa;
}
.site-timers .timer-rest {
  border-color: rgba(226, 182, 87, 0.50);
  color: #f0d59a;
}

/* —— compass: right rail, keeps belly sites clear —— */
.compass {
  position: absolute;
  top: 50%;
  right: calc(8px + var(--safe-right));
  transform: translateY(-42%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 72px;
  padding: 4px;
  border-radius: 22px;
  background: rgba(11, 28, 30, 0.52);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.compass button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 11px var(--ui);
  min-height: 44px;
  padding: 6px 4px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  width: 100%;
}

.compass button:hover { color: var(--ink); }
.compass button.is-active {
  background: rgba(31, 111, 102, 0.55);
  color: var(--ink);
}

.compass #resetView {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.dot-tooltip {
  position: fixed;
  z-index: 20;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(11, 28, 30, 0.88);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font: 500 11px/1.3 var(--mono);
  letter-spacing: 0.01em;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

/* —— bottom stack + dock —— */
.bottom-stack {
  position: absolute;
  left: calc(10px + var(--safe-left));
  right: calc(10px + var(--safe-right));
  bottom: calc(10px + var(--safe-bottom));
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.bottom-stack > * { pointer-events: auto; }

.dock {
  width: 100%;
  padding: 12px 12px 14px;
  border-radius: 28px;
  background: rgba(11, 28, 30, 0.62);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.36);
}

.dock-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tool {
  appearance: none;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px 10px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}

.tool:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }

.tool.is-selected {
  background: rgba(31, 111, 102, 0.42);
  border-color: rgba(93, 186, 138, 0.40);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(93, 186, 138, 0.16), 0 8px 18px rgba(31, 111, 102, 0.22);
}

.tool-name {
  font: 650 12px/1 var(--ui);
  letter-spacing: 0.02em;
}

.ico {
  position: relative;
  display: block;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.28));
}

.ico-needle {
  width: 40px;
  height: 28px;
  transform: rotate(-28deg);
}

.n-cap {
  position: absolute;
  left: 1px;
  top: 7px;
  width: 13px;
  height: 14px;
  border-radius: 4px 2px 2px 4px;
  background: linear-gradient(180deg, #f3ae6c 0%, #e07a3a 46%, #c45d22 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 1px 2px 3px rgba(0, 0, 0, 0.28);
}

.n-hub {
  position: absolute;
  left: 13px;
  top: 9px;
  width: 5px;
  height: 10px;
  border-radius: 1px;
  background: linear-gradient(180deg, #d8dde3, #8e98a3);
  box-shadow: inset 0 1px 0 #fff;
}

.n-barrel {
  position: absolute;
  left: 17px;
  top: 10px;
  width: 15px;
  height: 8px;
  border-radius: 1px 2px 2px 1px;
  background: linear-gradient(180deg, #f4f6f8 0%, #b8c0c8 48%, #8d97a2 100%);
  box-shadow: inset 0 1px 0 #fff, 1px 2px 3px rgba(0, 0, 0, 0.2);
}

.n-tip {
  position: absolute;
  left: 31px;
  top: 12px;
  width: 8px;
  height: 4px;
  background: linear-gradient(90deg, #c5ccd3, #f2f4f6);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.ico-sensor {
  width: 42px;
  height: 26px;
}

.s-body {
  position: absolute;
  inset: 0;
  border-radius: 40px;
  background: linear-gradient(180deg, #fffaf3 0%, #f0e6d4 55%, #d9cbb4 100%);
  box-shadow: inset 0 1px 0 #fff, 0 3px 6px rgba(0, 0, 0, 0.22);
}

.s-window {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b7e4da, #1f6f66 70%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.ico-pod {
  width: 26px;
  height: 34px;
}

.p-body {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f2efe8 55%, #ddd6cb 100%);
  box-shadow: inset 0 1px 0 #fff, 0 4px 8px rgba(0, 0, 0, 0.24);
}

.p-window {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 12px;
  height: 7px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(180deg, #d5e4e0, #6a9a94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.dock-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.days-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.days-label {
  font: 700 11px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 4px;
}

.stepper {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(8, 21, 22, 0.45);
  border: 1px solid var(--line);
}

.stepper button {
  width: 44px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: 600 22px/1 var(--ui);
  cursor: pointer;
}

.stepper button:hover { background: rgba(255, 255, 255, 0.11); }
.stepper button:active { transform: scale(0.96); }

#activeInterval {
  width: 48px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 650 18px/1 var(--mono);
  text-align: center;
  -moz-appearance: textfield;
}

#activeInterval::-webkit-outer-spin-button,
#activeInterval::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.record-btn {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--accent);
  color: #e8f0ec;
  font: 700 16px var(--ui);
  letter-spacing: 0.01em;
  cursor: pointer;
}

.record-btn:hover:not(:disabled) { background: var(--accent-hover); }
.record-btn:active:not(:disabled) { transform: scale(0.985); }

.record-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

/* —— settings sheet —— */
.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.sheet-root.is-open { pointer-events: auto; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.sheet-root.is-open .sheet-backdrop { opacity: 1; }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(92dvh, 920px);
  display: flex;
  flex-direction: column;
  border-radius: 22px 22px 0 0;
  background: #102628;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(110%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet-root.is-open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: rgba(232, 240, 236, 0.22);
  flex: none;
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.sheet-top h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 650;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.done-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--mint);
  font: 700 16px var(--ui);
  cursor: pointer;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 0 calc(28px + var(--safe-bottom));
}

.settings-group {
  margin: 0 16px 14px;
  padding: 14px 14px 16px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.safety-note {
  padding: 12px 14px 12px 16px;
  border-left: 2px solid rgba(224, 122, 102, 0.55);
  background: rgba(224, 122, 102, 0.06);
  color: #c9b4ad;
  font-size: 13px;
  line-height: 1.5;
}

.safety-note strong { color: var(--coral); font-weight: 650; }

.timing-heading {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 650;
}

.timing-explainer, .group-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.area-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.area-grid label { cursor: pointer; }
.area-grid input { position: absolute; opacity: 0; pointer-events: none; }

.area-grid span {
  display: block;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.area-grid input:checked + span {
  background: rgba(31, 111, 102, 0.4);
  border-color: rgba(93, 186, 138, 0.35);
  color: var(--ink);
}

.area-grid input:focus-visible + span {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.section-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.schedule-grid label,
.field {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
}

.schedule-grid label span,
.field span {
  color: var(--muted);
  font-weight: 500;
}

.schedule-grid input,
.field input,
.field textarea,
.field select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(8, 21, 22, 0.45);
  padding: 12px 11px;
  color: var(--ink);
  font: 14px var(--ui);
  min-height: 44px;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
  font: 14px var(--ui);
}

.schedule-grid input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 1px solid rgba(31, 111, 102, 0.7);
  border-color: var(--accent);
}

#interval-injection, #interval-dexcom, #interval-alt-cgm, #interval-pump, #interval-other,
#recover-injection, #recover-dexcom, #recover-alt-cgm, #recover-pump, #recover-other,
#holdUntil {
  font-family: var(--mono);
  font-size: 13px;
}

.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  border-radius: 10px;
  color: #e8f0ec;
  padding: 12px 15px;
  font: 700 14px var(--ui);
  cursor: pointer;
}

.primary:hover { background: var(--accent-hover); }
.compact { align-self: center; padding: 10px 12px; font-size: 12px; min-height: 44px; }

.quiet-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  padding: 11px 14px;
  min-height: 44px;
  font: 600 13px var(--ui);
  cursor: pointer;
}

.quiet-button:hover { background: var(--panel-strong); border-color: rgba(232, 240, 236, 0.24); }

.hold-button {
  width: 100%;
  margin-top: 12px;
  border-color: rgba(155, 123, 184, 0.4);
  color: #cbb6dd;
}

.danger {
  width: 100%;
  border-color: rgba(224, 122, 102, 0.35);
  color: #e8b4aa;
}

.schedule-message, .form-message {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom) + 168px);
  transform: translateX(-50%);
  z-index: 40;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(11, 28, 30, 0.88);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font: 600 13px var(--ui);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.toast:empty { display: none; }

.history-count {
  font-size: 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 11px;
  white-space: nowrap;
}

.history-head, .history-row {
  display: grid;
  grid-template-columns: 88px 1.2fr 1fr 1.3fr 34px;
  gap: 10px;
  align-items: center;
}

.history-head {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 8px 8px;
  border-bottom: 1px solid var(--line);
}

.history-row {
  border-top: 1px solid var(--line);
  padding: 12px 8px;
  font-size: 13px;
}

.history-row:first-child { border-top: 0; }

.history-row span:first-child {
  font-family: var(--mono);
  font-size: 12px;
  color: #b7c9c2;
}

.history-row .tag {
  color: #b8e0d4;
  background: rgba(31, 111, 102, 0.28);
  border-radius: 999px;
  padding: 3px 8px;
  width: max-content;
  max-width: 100%;
  font-size: 11px;
  font-weight: 650;
}

.history-row .note {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 20px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.delete:hover { color: var(--coral); }

.empty {
  padding: 18px 8px;
  color: var(--muted);
  font-size: 14px;
}

.status-chip {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
}

.active-chip { background: rgba(201, 80, 77, 0.18); color: #f0b2aa; }
.hold-chip { background: rgba(155, 123, 184, 0.18); color: #d2c0e4; }
.map-summary-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

.points-total {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}

.points-log {
  margin-top: 12px;
}

.points-log-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.points-log-row:first-child { border-top: 0; }

.points-delta {
  font-family: var(--mono);
  font-weight: 650;
  color: var(--mint);
  min-width: 2.2em;
}

.empty.compact {
  padding: 8px 0;
  font-size: 13px;
}

.idb-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#sendFeedback,
#resetPoints {
  width: 100%;
  margin-top: 12px;
}

.inbox-list {
  margin-top: 4px;
}

.inbox-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px 4px 14px;
}

.inbox-row:first-child { border-top: 0; }

.inbox-row.is-reviewed { opacity: 0.72; }

.inbox-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inbox-row .tag {
  color: #b8e0d4;
  background: rgba(31, 111, 102, 0.28);
  border-radius: 999px;
  padding: 3px 8px;
  width: max-content;
  font-size: 11px;
  font-weight: 650;
}

.inbox-row .tag.kind-bug {
  color: #f0c4ba;
  background: rgba(224, 122, 102, 0.22);
}

.inbox-row .tag.kind-other {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
}

.inbox-when {
  font-family: var(--mono);
  font-size: 12px;
  color: #b7c9c2;
}

.inbox-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.inbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-action {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 12px;
}

.danger-text {
  border-color: rgba(224, 122, 102, 0.28);
  color: #e8b4aa;
}

footer {
  margin: 8px 16px 0;
  padding: 8px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.keep {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 720px) {
  .bottom-stack {
    left: 50%;
    right: auto;
    width: min(430px, calc(100% - 32px));
    transform: translateX(-50%);
  }
  .compass { width: 76px; }
  .sheet {
    left: 50%;
    right: auto;
    width: min(480px, 100%);
    transform: translate(-50%, 110%);
  }
  .sheet-root.is-open .sheet { transform: translate(-50%, 0); }
}

@media (max-width: 520px) {
  .history-head { display: none; }
  .history-row {
    grid-template-columns: 82px 1fr 34px;
    gap: 8px;
  }
  .history-row .tag { grid-column: 2; }
  .history-row .note { display: none; }
  .history-row .delete { grid-column: 3; grid-row: 1 / 3; }
  .schedule-grid { grid-template-columns: 1fr; }
  .section-top { flex-direction: column; }
  .compact { align-self: flex-start; }
  .compass {
    width: 64px;
    right: calc(6px + var(--safe-right));
  }
  .compass button { padding: 6px 2px; font-size: 10px; }
}

@media (max-height: 700px) {
  .tool { min-height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

.invite-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}

.invite-code {
  font-family: var(--mono);
  font-weight: 650;
  font-size: 18px;
  letter-spacing: 0.12em;
  padding: 10px 14px;
  min-height: 44px;
  min-width: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(11, 28, 30, 0.48);
  color: var(--ink);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  user-select: all;
}

.give-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  margin: 14px 0 0;
}

#redeemCode,
#givePointsAmount {
  font-family: var(--mono);
}

#redeemCode {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#redeemInvite,
#giveReferralPoints,
#copyInvite,
#shareInvite {
  min-height: 44px;
  min-width: 44px;
}

#redeemInvite,
#giveReferralPoints {
  width: 100%;
  margin-top: 12px;
}

#shareInvite[hidden] { display: none; }

.referral-log-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.referral-log-row:first-child { border-top: 0; }

.referral-log-row .tag {
  color: #b8e0d4;
  background: rgba(31, 111, 102, 0.28);
  border-radius: 999px;
  padding: 3px 8px;
  width: max-content;
  font-size: 11px;
  font-weight: 650;
}
