:root {
  color-scheme: light;
  --bg: #faf7f2;
  --bg-elevated: #f3ece3;
  --panel: #ffffff;
  --surface: #f5f0ea;
  --surface-muted: #ebe4da;
  --input-bg: #ffffff;
  --text: #2d2a26;
  --muted: #7a756e;
  --accent: #5a9a7a;
  --accent-text: #ffffff;
  --accent-soft: rgba(90, 154, 122, 0.14);
  --danger: #c53030;
  --success: #5a9a7a;
  --border: #e8e0d4;
  --attention-bg: #e8f0fa;
  --attention-border: #c5d4e8;
  --attention-text: #3d4a6a;
  --attention-action: #3685bf;
  --warning-bg: #fef3e2;
  --warning-border: #e8c99a;
  --warning-text: #7a5c20;
  --overlay: rgba(45, 42, 38, 0.45);
  --person-0: #c4a882;
  --person-1: #5a9a7a;
  --person-2: #7a9eb8;
  --person-3: #b89090;
  --person-muted: #a39a90;
}

/* Display size: scale the whole UI (text + controls), not text alone. */
html[data-ui-scale="large"] .app {
  zoom: 1.12;
}
html[data-ui-scale="extra"] .app {
  zoom: 1.25;
}

@supports not (zoom: 1) {
  html[data-ui-scale="large"] {
    font-size: 112.5%;
  }
  html[data-ui-scale="extra"] {
    font-size: 125%;
  }
  html[data-ui-scale="large"] .btn,
  html[data-ui-scale="extra"] .btn {
    padding: 1em 1.1em;
  }
  html[data-ui-scale="large"] .icon-btn,
  html[data-ui-scale="extra"] .icon-btn {
    width: 2.75em;
    height: 2.75em;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 36%);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

.app {
  max-width: 420px;
  margin: 0 auto;
  padding:
    calc(24px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(40px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  flex-shrink: 1;
}

.status-text {
  margin: 0;
  min-width: 0;
  text-align: right;
  font-size: 0.9rem;
  line-height: 1.3;
}

.status-text:empty {
  display: none;
}

.header-naked-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.header-naked-label {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  line-height: 1;
}

.switch.switch-sm {
  width: 40px;
  height: 24px;
}

.switch.switch-sm .switch-track {
  width: 40px;
  height: 24px;
}

.switch.switch-sm .switch-track::after {
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
}

.switch.switch-sm input:checked + .switch-track::after {
  transform: translateX(16px);
}

.naked-attention {
  background: var(--warning-bg) !important;
  border-color: var(--warning-border) !important;
  color: var(--warning-text) !important;
}

.naked-attention .home-attention-action {
  color: var(--warning-text) !important;
}

.status-text,
.hint,
.warning {
  color: var(--muted);
  line-height: 1.5;
}

.home-top {
  margin-bottom: 4px;
}

.home-top h2 {
  margin: 0;
}

.screen-subtitle {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.screen-subtitle-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 6px;
}

.icon-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  outline: none;
}

.warning {
  color: var(--warning-text);
}

.panel {
  /* Screen shell only — no nested card chrome. Content cards live inside screens. */
  margin-top: 16px;
  padding: 0 0 24px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.hidden {
  display: none !important;
}

.field {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.field-static {
  display: grid;
  gap: 8px;
}

.field-static > span:first-child {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.field.float {
  position: relative;
  display: block;
  margin: 14px 0;
}

.field.float input,
.field.float textarea {
  width: 100%;
  margin: 0;
  padding: 22px 14px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field.float textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.field.float input:focus,
.field.float textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field.float > span {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    top 0.15s ease,
    transform 0.15s ease,
    font-size 0.15s ease,
    color 0.15s ease;
}

.field.float textarea + span {
  top: 18px;
  transform: none;
}

.field.float input:focus + span,
.field.float input:not(:placeholder-shown) + span,
.field.float input.has-value + span,
.field.float input[type="date"] + span,
.field.float input[type="time"] + span,
.field.float textarea:focus + span,
.field.float textarea:not(:placeholder-shown) + span,
.field.float textarea.has-value + span {
  top: 8px;
  transform: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.field.float input:focus + span,
.field.float textarea:focus + span {
  color: var(--accent);
}

.field-optional {
  font-weight: 400;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-text);
}

.btn.subtle {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.actions {
  display: grid;
  gap: 8px;
}

.recovery-code {
  display: block;
  margin: 16px 0;
  padding: 16px;
  border-radius: 12px;
  background: var(--input-bg);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-align: center;
}

.invite-result {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.share-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.share-field {
  margin: 0;
}

.share-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.field.float .share-input {
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
}

.field.float .share-input-code {
  letter-spacing: 0.08em;
  font-size: 1.1rem;
  text-align: center;
}

.field.float .share-input-code + span {
  text-align: left;
}

.share-value {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.share-value-code {
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 8px 0;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 12px;
}

.debug-log {
  margin-top: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
}

.home-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-version {
  margin: 10px 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.home-primary-btn {
  width: 100%;
  margin-top: 4px;
  border-radius: 999px;
  gap: 8px;
}

.home-primary-btn .home-btn-icon {
  flex-shrink: 0;
}

.home-attention-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}

.home-attention-wrap.hidden {
  display: none;
}

.home-attention {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--attention-border);
  border-radius: 14px;
  background: var(--attention-bg);
  color: var(--attention-text);
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.home-attention.hidden {
  display: none;
}

.home-attention-text {
  flex: 1;
}

.home-attention-action {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--attention-action);
}

.home-attention-wear-check {
  border-color: var(--danger);
  background: #fceeed;
  color: #7a2e28;
}

.home-attention-wear-check .home-attention-action {
  color: var(--danger);
}

.home-attention-wishlist {
  border-color: #b8d4c4;
  background: #e8f2ec;
  color: #2d5a42;
}

.home-attention-wishlist .home-attention-action {
  color: #3d7a58;
}

.earn-attention {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--attention-border);
  border-radius: 14px;
  background: var(--attention-bg);
  color: var(--attention-text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.earn-attention.hidden {
  display: none;
}

.home-section {
  margin-top: 20px;
}

.home-section-title {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.home-tile {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  min-height: 72px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.home-tile:hover,
.home-tile:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.home-tile-icon {
  grid-column: 1;
  grid-row: 1;
  display: block;
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  color: var(--accent);
}

.home-tile-label {
  grid-column: 1;
  grid-row: 2;
  font-size: 0.95rem;
  font-weight: 600;
}

.home-tile-hint {
  grid-column: 1;
  grid-row: 3;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.home-tile-chevron {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  width: 18px;
  height: 18px;
  color: var(--accent);
  opacity: 0.85;
}

.home-tile-wide {
  width: 100%;
}

.home-tile .tile-badge {
  position: absolute;
  top: 8px;
  right: 34px;
}

.home-dashboard {
  display: grid;
  gap: 12px;
}

.home-dashboard-wear-check {
  margin: 0 0 14px;
}

.home-dashboard-wear-check.hidden {
  display: none;
}

.duration-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 12px;
}

.duration-stats.hidden {
  display: none;
}

.duration-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  text-align: left;
}

button.duration-stat {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
}

.duration-stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.duration-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.duration-stats-period {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

#reports-durations {
  margin: 0;
}

.home-dashboard-wear-check-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.home-dashboard-wear-check-text {
  flex: 1;
}

.home-dashboard-wear-check-action {
  flex-shrink: 0;
  font-weight: 600;
}

.home-dashboard-wear-check-notice.is-off {
  border: 1px solid #f5b8b8;
  background: #fffafa;
  color: #9b2c2c;
}

.home-dashboard-wear-check-notice.is-off .home-dashboard-wear-check-action {
  color: var(--danger);
}

.home-dashboard-wear-check-notice.is-on {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.home-dashboard-wear-check-notice.is-on .home-dashboard-wear-check-action {
  color: var(--text);
}

.home-dashboard-panel {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  display: grid;
  gap: 0;
  overflow: hidden;
}

.home-dashboard-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.home-dashboard-avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-text);
}

.home-dashboard-avatar.person-p0 { background: var(--person-0); color: var(--text); }
.home-dashboard-avatar.person-p1 { background: var(--person-1); }
.home-dashboard-avatar.person-p2 { background: var(--person-2); }
.home-dashboard-avatar.person-p3 { background: var(--person-3); }

.home-dashboard-person {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.home-dashboard-body {
  padding: 4px 8px 0;
}

.home-dashboard-footer {
  padding: 12px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.home-dashboard-report-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.home-dashboard-report-btn:hover,
.home-dashboard-report-btn:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.home-dashboard-report-btn .home-nav-chevron {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.home-dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.home-dashboard-table th,
.home-dashboard-table td {
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  text-align: right;
  vertical-align: top;
  line-height: 1.35;
}

.home-dashboard-table thead th {
  padding-top: 4px;
  border-top: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
}

.home-dashboard-table tbody tr:nth-child(even) {
  background: var(--surface);
}

.home-dashboard-table-item-col {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.home-dashboard-table tbody th.home-dashboard-table-item-col {
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
}

.home-dashboard-table tbody td {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.approval-reward {
  font-weight: 600;
  color: var(--text);
}

.wishlist-activity {
  font-weight: 500;
  color: var(--text);
}

.wishlist-propose {
  margin-bottom: 8px;
  padding-bottom: 20px;
}

.type-dashboard-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.type-dashboard-toggle input {
  margin: 0;
}

.text-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}

.text-link:hover {
  color: var(--accent);
  opacity: 0.85;
}

.subsection {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.settings-group,
.earn-group {
  margin-top: 16px;
  padding: 16px 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.settings-group:first-of-type {
  margin-top: 12px;
}

#earn-challenges-section {
  margin-top: 12px;
}

.earn-section-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.earn-scroll-claim-btn {
  width: 100%;
  margin: 0 0 14px;
}

.earn-scroll-claim-btn.hidden {
  display: none;
}

#earn-challenges-section .earn-task-list {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.earn-task-headline {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.earn-task-details {
  display: grid;
  gap: 8px;
}

.earn-task-details.hidden {
  display: none;
}

.earn-task-accordion-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.earn-task-accordion-btn .earn-task-accordion-chevron {
  display: inline-block;
  transition: transform 0.18s ease;
}

.earn-task-accordion-btn[aria-expanded="true"] .earn-task-accordion-chevron {
  transform: rotate(180deg);
}

.earn-attention.is-action {
  cursor: pointer;
}

.earn-attention.has-claim {
  border-color: #b8d4c4;
  background: #e8f2ec;
  color: #2d5a42;
}

.earn-group + .earn-group {
  margin-top: 16px;
}

.settings-group-title {
  margin: 0 0 4px;
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.earn-group > h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.earn-group > .hint:first-of-type {
  margin-top: 0;
}

.earn-group .earn-task-list {
  margin-top: 8px;
}

.earn-group .earn-task-card,
.earn-group .approval-item {
  background: var(--surface);
}

.earn-claimed-history-link {
  margin-top: 10px;
  display: inline-block;
}

.earn-unclaimed-list.has-rewards .approval-item {
  border-color: var(--success);
}

.earn-unclaimed-list.has-rewards .approval-item strong {
  color: var(--success);
}

.settings-group-hint {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}

.settings-group > .subsection {
  margin-top: 16px;
  padding-top: 14px;
}

.settings-group > .subsection:first-of-type {
  margin-top: 10px;
  padding-top: 0;
  border-top: none;
}

.settings-group-log {
  margin-top: 16px;
}

.notifications-log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.notifications-log:empty {
  display: none;
}

.notifications-log li {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.35;
}

.notifications-log li:last-child {
  border-bottom: none;
}

.notifications-log-main {
  font-weight: 600;
  color: var(--text);
}

.notifications-log-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.notifications-log-outcome {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.72rem;
}

.notifications-log-outcome.sent { color: var(--success); }
.notifications-log-outcome.suppressed { color: var(--warning-text); }
.notifications-log-outcome.failed,
.notifications-log-outcome.pruned { color: var(--danger); }

.wear-check-settings-status {
  margin: 0 0 10px;
  font-weight: 600;
  line-height: 1.45;
}

.wear-check-settings-status.is-off {
  color: var(--danger);
}

.wear-check-settings-status.is-on {
  color: var(--success);
}

.wear-check-blurb {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}

.wear-check-blurb > .hint {
  margin: 0;
}

.wear-check-earner-refs-note {
  font-weight: 700;
  color: var(--text);
}

.subsection h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.credential-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.credential-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
}

.credential-item small {
  color: var(--muted);
}

.credential-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.btn.compact {
  margin-top: 0;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.btn.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding:
    calc(16px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(16px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  background: var(--overlay);
  z-index: 40;
}

.modal.hidden {
  display: none !important;
}

.modal-card {
  width: min(100%, 360px);
  max-height: min(90vh, 640px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

.sync-warning {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.nav-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.nav-row .btn {
  margin-top: 0;
  position: relative;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}

.back-btn {
  width: auto;
  margin-top: 0;
  margin-bottom: 8px;
}

.btn.subtle.back-btn {
  /* Make back navigation more visible than generic subtle buttons. */
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.btn.subtle.back-btn:hover,
.btn.subtle.back-btn:focus-visible {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
  outline: none;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ui-scale-segmented {
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 8px;
}

.segmented button,
.type-chip,
.reorder-btn {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.segmented button.active,
.type-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.earn-claim-task-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.earn-claim-task-list .type-chip {
  width: 100%;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.earn-claim-task-btn {
  display: grid;
  gap: 4px;
}

.earn-claim-task-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.earn-claim-task-meta {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
}

.earn-task-meta {
  margin-top: -4px;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
}

.earn-target-field {
  margin: 8px 0 12px;
}

.earn-target-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  cursor: pointer;
  appearance: auto;
}

.earn-claim-task-btn.active .earn-claim-task-meta {
  color: inherit;
  opacity: 0.85;
}

.type-chip {
  width: 100%;
}

.field.float input[readonly] {
  color: var(--muted);
  background: var(--surface);
  cursor: default;
}

#settings-names-list {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  resize: vertical;
  font: inherit;
}

.history-list,
.type-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.history-item,
.type-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  display: grid;
  gap: 6px;
}

.history-item.voided {
  opacity: 0.62;
  border-style: dashed;
}

.history-item.pending-sync {
  border-color: var(--warning-border);
}

.history-meta {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.pending { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.badge.approved { background: var(--accent-soft); color: #2f5a47; }
.badge.rejected,
.badge.auto_rejected { background: #fde8e8; color: #9b2c2c; }
.badge.voided { background: var(--surface); color: var(--muted); }
.badge.sync { background: var(--warning-bg); color: var(--warning-text); }
.badge.module { background: var(--surface); color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 600; }
.badge.wishlist-status {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.badge.wishlist-status.open { background: var(--warning-bg); color: var(--warning-text); }
.badge.wishlist-status.promoted { background: var(--accent-soft); color: #2f5a47; }
.badge.wishlist-status.dismissed { background: #fde8e8; color: #9b2c2c; }

.approvals-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.approval-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  display: grid;
  gap: 8px;
}

.approval-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.approval-header strong {
  flex: 1;
  min-width: 0;
}

.approval-check {
  display: inline-flex;
  align-items: center;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 12px;
}

.bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.rewards-section {
  margin-top: 24px;
}

.btn.danger {
  background: #fde8e8;
  color: #9b2c2c;
  border-color: #f5b8b8;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--text);
}

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 12px;
  color: var(--text);
  cursor: pointer;
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.switch-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.switch-hint {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  margin-top: 2px;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cfd6d1;
  border: 1px solid var(--border);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.quiet-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  max-width: 100%;
}

.quiet-field {
  margin-top: 0;
  margin-bottom: 0;
  width: 5.5rem;
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
}

#escalation-grace-field {
  width: 9.5rem;
}

.quiet-field input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 18px 6px 8px;
  font-size: 0.88rem;
}

.quiet-field input[type="time"],
.quiet-field input[type="number"] {
  /* Native controls are wide — keep the field box compact */
  padding-left: 6px;
  padding-right: 4px;
}

#escalation-grace-field input {
  padding-left: 10px;
  padding-right: 8px;
  font-size: inherit;
}

.quiet-field > span {
  left: 6px;
  font-size: 0.72rem;
}

#escalation-grace-field > span {
  left: 14px;
}

.quiet-field.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.install-steps {
  margin: 8px 0 12px 1.1rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.onboard-card {
  border: 1px solid var(--border);
  background: var(--panel);
}

.earn-task-list {
  display: grid;
  gap: 12px;
}

.earn-task-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  display: grid;
  gap: 8px;
}

.earn-task-card-inactive {
  opacity: 0.78;
  background: var(--surface);
}

.earn-task-paused {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.earn-task-active-row {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.earn-task-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.segment-bar {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  height: 14px;
}

.segment-bar span {
  border-radius: 3px;
  background: var(--surface-muted);
}

.segment-bar span.filled {
  background: var(--accent);
  transform-origin: left center;
}

.earn-figures {
  color: var(--muted);
  font-size: 0.9rem;
}

.earn-figures-muted {
  font-size: 0.85rem;
}

.task-notice {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.task-notice .task-notice-dismiss {
  flex-shrink: 0;
  width: auto;
  margin-top: 0;
  padding: 8px 12px;
  white-space: nowrap;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(45, 42, 38, 0.06);
}

.task-notice .task-notice-dismiss:hover,
.task-notice .task-notice-dismiss:focus-visible {
  background: var(--bg-elevated);
}

.task-notice-counter-reset {
  border-color: #f5b8b8;
  background: #fff5f5;
  color: #9b2c2c;
}

.task-notice-counter-reset .task-notice-dismiss {
  color: var(--text);
}

.earn-task-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.earn-task-actions .btn {
  margin-top: 0;
  width: 100%;
}

.earn-past-cycles {
  margin-top: 4px;
}

.earn-past-cycles-toggle {
  width: 100%;
}

.earn-past-cycles-panel {
  margin-top: 8px;
}

.earn-past-cycles-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.earn-past-cycle {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  display: grid;
  gap: 4px;
}

.earn-past-cycle strong {
  font-size: 0.9rem;
}

.earn-past-cycle-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.earn-past-cycle-reset {
  border-color: #f5b8b8;
  background: #fff5f5;
}

.earn-past-cycle-reset strong {
  color: #9b2c2c;
}

.earn-past-cycle-completed strong {
  color: var(--accent-strong, var(--accent));
}

.approval-item.highlighted {
  border-color: var(--warning-border);
  box-shadow: inset 0 0 0 1px var(--warning-border);
}

.history-actions,
.type-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.history-actions.wishlist-actions {
  grid-template-columns: 1fr;
}

.history-filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 4px;
}

.history-filter {
  margin: 0;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.history-filter.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.history-item.challenge-event {
  border-color: var(--border);
}

.history-item.challenge-reset {
  border-color: #f5b8b8;
  background: #fffafa;
}

.history-item.challenge-reset strong {
  color: #9b2c2c;
}

.badge.challenge {
  background: var(--accent-soft);
  color: var(--accent);
}

.type-section {
  margin-top: 20px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.type-section h3 {
  margin: 0 0 10px;
}

.type-item.retired {
  opacity: 0.7;
}

.type-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.type-item-row .label {
  font-weight: 600;
}

.reorder-controls {
  display: flex;
  gap: 6px;
}

.reorder-btn {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.rename-note {
  margin-bottom: 8px;
}

.add-type-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  margin-top: 10px;
}

.add-type-row .field.float {
  margin: 0;
}

.add-type-row .btn {
  margin-top: 0;
  width: auto;
  min-height: 52px;
  white-space: nowrap;
}

.period-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.period-summary:hover,
.period-summary:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.period-summary-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.period-summary-title {
  font-size: 0.95rem;
  font-weight: 650;
}

.period-summary-range {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.period-summary-chevron {
  flex-shrink: 0;
  color: var(--muted);
}

.period-options {
  display: grid;
  gap: 6px;
  margin: 12px 0 4px;
}

.period-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.period-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.period-custom {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.period-custom.hidden {
  display: none;
}

.chart-section {
  margin-top: 20px;
}

.reports-group {
  margin-top: 16px;
  padding: 16px 14px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.reports-group-title {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.reports-group-hint {
  margin: 0 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}

.reports-group-all-time {
  margin-top: 16px;
}

.reports-group .chart-section:first-of-type {
  margin-top: 12px;
}

.chart-root {
  margin-top: 10px;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-empty {
  margin: 8px 0;
}

.chart-subhead {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.heatmap-block + .heatmap-block {
  margin-top: 16px;
}

.heatmap-month {
  margin-bottom: 12px;
}

.heatmap-month-label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.heatmap-dow,
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  max-width: 280px;
}

.heatmap-dow {
  margin-bottom: 4px;
}

.heatmap-dow .heat-dow {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-muted);
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1;
  min-width: 0;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.heat-cell.heat-pad,
.heat-cell.heat-out {
  background: transparent;
  pointer-events: none;
}

.heat-cell.heat-off {
  background: var(--surface-muted);
  cursor: pointer;
}

.heat-cell.heat-on {
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}

.heat-cell.heat-on.heat-p0 {
  background: var(--person-0);
  color: var(--text);
}

.heat-cell.heat-on.heat-p1 {
  background: var(--person-1);
}

.heat-cell.heat-on.heat-p2 {
  background: var(--person-2);
}

.heat-cell.heat-on.heat-p3 {
  background: var(--person-3);
}

.heat-cell.heat-on.heat-l1 {
  opacity: 0.45;
}

.heat-cell.heat-on.heat-l2 {
  opacity: 0.72;
}

.heat-cell.heat-on.heat-l3 {
  opacity: 1;
}

.heat-cell.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  z-index: 1;
}

.heat-day-num {
  pointer-events: none;
}

.heatmap-day-detail {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
}

.heatmap-day-detail[hidden] {
  display: none;
}

.heatmap-day-detail-date {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.bar-chart {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.9fr) 1fr auto;
  gap: 8px;
  align-items: center;
}

.bar-label {
  font-size: 0.85rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  width: 0;
  background: var(--accent);
}

.bar-fill.person-p0 { background: var(--person-0); }
.bar-fill.person-p1 { background: var(--person-1); }
.bar-fill.person-p2 { background: var(--person-2); }
.bar-fill.person-p3 { background: var(--person-3); }
.bar-fill.person-muted { background: var(--person-muted); }

.bar-fill-muted {
  opacity: 0.35;
}

.bar-fill[data-w="0"] { width: 0%; }
.bar-fill[data-w="1"] { width: 1%; }
.bar-fill[data-w="2"] { width: 2%; }
.bar-fill[data-w="3"] { width: 3%; }
.bar-fill[data-w="4"] { width: 4%; }
.bar-fill[data-w="5"] { width: 5%; }
.bar-fill[data-w="6"] { width: 6%; }
.bar-fill[data-w="7"] { width: 7%; }
.bar-fill[data-w="8"] { width: 8%; }
.bar-fill[data-w="9"] { width: 9%; }
.bar-fill[data-w="10"] { width: 10%; }
.bar-fill[data-w="11"] { width: 11%; }
.bar-fill[data-w="12"] { width: 12%; }
.bar-fill[data-w="13"] { width: 13%; }
.bar-fill[data-w="14"] { width: 14%; }
.bar-fill[data-w="15"] { width: 15%; }
.bar-fill[data-w="16"] { width: 16%; }
.bar-fill[data-w="17"] { width: 17%; }
.bar-fill[data-w="18"] { width: 18%; }
.bar-fill[data-w="19"] { width: 19%; }
.bar-fill[data-w="20"] { width: 20%; }
.bar-fill[data-w="21"] { width: 21%; }
.bar-fill[data-w="22"] { width: 22%; }
.bar-fill[data-w="23"] { width: 23%; }
.bar-fill[data-w="24"] { width: 24%; }
.bar-fill[data-w="25"] { width: 25%; }
.bar-fill[data-w="26"] { width: 26%; }
.bar-fill[data-w="27"] { width: 27%; }
.bar-fill[data-w="28"] { width: 28%; }
.bar-fill[data-w="29"] { width: 29%; }
.bar-fill[data-w="30"] { width: 30%; }
.bar-fill[data-w="31"] { width: 31%; }
.bar-fill[data-w="32"] { width: 32%; }
.bar-fill[data-w="33"] { width: 33%; }
.bar-fill[data-w="34"] { width: 34%; }
.bar-fill[data-w="35"] { width: 35%; }
.bar-fill[data-w="36"] { width: 36%; }
.bar-fill[data-w="37"] { width: 37%; }
.bar-fill[data-w="38"] { width: 38%; }
.bar-fill[data-w="39"] { width: 39%; }
.bar-fill[data-w="40"] { width: 40%; }
.bar-fill[data-w="41"] { width: 41%; }
.bar-fill[data-w="42"] { width: 42%; }
.bar-fill[data-w="43"] { width: 43%; }
.bar-fill[data-w="44"] { width: 44%; }
.bar-fill[data-w="45"] { width: 45%; }
.bar-fill[data-w="46"] { width: 46%; }
.bar-fill[data-w="47"] { width: 47%; }
.bar-fill[data-w="48"] { width: 48%; }
.bar-fill[data-w="49"] { width: 49%; }
.bar-fill[data-w="50"] { width: 50%; }
.bar-fill[data-w="51"] { width: 51%; }
.bar-fill[data-w="52"] { width: 52%; }
.bar-fill[data-w="53"] { width: 53%; }
.bar-fill[data-w="54"] { width: 54%; }
.bar-fill[data-w="55"] { width: 55%; }
.bar-fill[data-w="56"] { width: 56%; }
.bar-fill[data-w="57"] { width: 57%; }
.bar-fill[data-w="58"] { width: 58%; }
.bar-fill[data-w="59"] { width: 59%; }
.bar-fill[data-w="60"] { width: 60%; }
.bar-fill[data-w="61"] { width: 61%; }
.bar-fill[data-w="62"] { width: 62%; }
.bar-fill[data-w="63"] { width: 63%; }
.bar-fill[data-w="64"] { width: 64%; }
.bar-fill[data-w="65"] { width: 65%; }
.bar-fill[data-w="66"] { width: 66%; }
.bar-fill[data-w="67"] { width: 67%; }
.bar-fill[data-w="68"] { width: 68%; }
.bar-fill[data-w="69"] { width: 69%; }
.bar-fill[data-w="70"] { width: 70%; }
.bar-fill[data-w="71"] { width: 71%; }
.bar-fill[data-w="72"] { width: 72%; }
.bar-fill[data-w="73"] { width: 73%; }
.bar-fill[data-w="74"] { width: 74%; }
.bar-fill[data-w="75"] { width: 75%; }
.bar-fill[data-w="76"] { width: 76%; }
.bar-fill[data-w="77"] { width: 77%; }
.bar-fill[data-w="78"] { width: 78%; }
.bar-fill[data-w="79"] { width: 79%; }
.bar-fill[data-w="80"] { width: 80%; }
.bar-fill[data-w="81"] { width: 81%; }
.bar-fill[data-w="82"] { width: 82%; }
.bar-fill[data-w="83"] { width: 83%; }
.bar-fill[data-w="84"] { width: 84%; }
.bar-fill[data-w="85"] { width: 85%; }
.bar-fill[data-w="86"] { width: 86%; }
.bar-fill[data-w="87"] { width: 87%; }
.bar-fill[data-w="88"] { width: 88%; }
.bar-fill[data-w="89"] { width: 89%; }
.bar-fill[data-w="90"] { width: 90%; }
.bar-fill[data-w="91"] { width: 91%; }
.bar-fill[data-w="92"] { width: 92%; }
.bar-fill[data-w="93"] { width: 93%; }
.bar-fill[data-w="94"] { width: 94%; }
.bar-fill[data-w="95"] { width: 95%; }
.bar-fill[data-w="96"] { width: 96%; }
.bar-fill[data-w="97"] { width: 97%; }
.bar-fill[data-w="98"] { width: 98%; }
.bar-fill[data-w="99"] { width: 99%; }
.bar-fill[data-w="100"] { width: 100%; }

.bar-value {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 1.5rem;
  text-align: right;
}

.compare-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 12px;
}

.compare-bar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.compare-bar-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.compare-bar-swatch.person-p0 { background: var(--person-0); }
.compare-bar-swatch.person-p1 { background: var(--person-1); }
.compare-bar-swatch.person-p2 { background: var(--person-2); }
.compare-bar-swatch.person-p3 { background: var(--person-3); }

.compare-bar-chart {
  display: grid;
  gap: 14px;
}

.compare-bar-row {
  display: grid;
  gap: 8px;
}

.compare-bar-type {
  font-size: 0.9rem;
  font-weight: 600;
}

.compare-bar-items {
  display: grid;
  gap: 6px;
}

.compare-bar-item {
  display: grid;
  grid-template-columns: minmax(4.5rem, auto) 1fr auto;
  gap: 8px;
  align-items: center;
}

.compare-bar-name {
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.compare-bar-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.by-type-block + .by-type-block {
  margin-top: 16px;
}

.reward-claim-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.reward-claim-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
}

.reward-claim-item strong {
  display: block;
  margin-bottom: 4px;
}

.entry-icon-chart {
  display: grid;
  gap: 12px;
}

.entry-icon-hint {
  margin: 0;
}

.entry-icon-legend {
  display: grid;
  gap: 6px;
}

.entry-icon-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.entry-icon-legend-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.entry-icon-days {
  display: grid;
  gap: 8px;
}

.entry-icon-day {
  display: grid;
  grid-template-columns: minmax(5.5rem, 7.5rem) 1fr;
  gap: 8px;
  align-items: start;
}

.entry-icon-date {
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 6px;
  line-height: 1.3;
}

.entry-icon-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
  padding-top: 4px;
  padding-right: 4px;
}

.entry-icon-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--person-1);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: visible;
}

.entry-icon-badge.person-p0 { background: var(--person-0); color: var(--text); }
.entry-icon-badge.person-p1 { background: var(--person-1); }
.entry-icon-badge.person-p2 { background: var(--person-2); }
.entry-icon-badge.person-p3 { background: var(--person-3); }

.entry-icon-count {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 3px;
  border-radius: 999px;
  background: #e07a3a;
  border: 2px solid var(--panel);
  color: #fff7ed;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  box-sizing: border-box;
}

/* —— Wear check —— */
.wear-check-home-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 14px 16px;
}

.wear-check-home-card.urgent {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.wear-check-home-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.wear-check-home-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.wear-check-chip {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.wear-check-chip.active { color: var(--accent); }
.wear-check-chip.setup { color: #b45309; }

.wear-check-home-meta {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.wear-check-active-urgent {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--danger);
}

.wear-check-next-automatic {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--danger);
}

.wear-check-schedule {
  margin: 12px 0 4px;
}

.wear-check-schedule-hint {
  margin: 0 0 10px;
}

.wear-check-schedule-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 8px;
}

.wear-check-schedule-row .field-static {
  margin: 0;
  min-width: 0;
}

.wear-check-schedule-row .field-static input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
}

.wear-check-schedule-row .field-static input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.wear-check-save-schedule {
  width: auto;
  margin-top: 0;
  margin-bottom: 0;
  padding: 10px 14px;
}

.wear-check-check-now {
  margin-top: 18px;
  min-height: 3.5rem;
  padding-top: 22px;
  padding-bottom: 22px;
  font-size: 1.05rem;
  font-weight: 700;
}

.wear-check-history {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.wear-check-history li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.wear-check-history-status {
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.wear-check-history-status.pass {
  color: var(--success);
}

.wear-check-history-status.fail {
  color: var(--danger);
}

.wear-check-history-status.expired {
  color: var(--muted);
}

.wear-check-report-summary {
  margin: 0 0 12px;
}

.wear-check-report-enabled {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.wear-check-report-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
}

.wear-check-report-history {
  margin-top: 4px;
}

.wear-check-report-day {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.wear-check-report-day:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.wear-check-refs-log-wrap {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.wear-check-refs-log-title {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.wear-check-refs-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.wear-check-refs-log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.wear-check-refs-log li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.4;
}

.wear-check-refs-log li:last-child {
  border-bottom: none;
}

.wear-check-refs-log-event {
  font-weight: 600;
}

.wear-check-refs-log-meta {
  color: var(--muted);
  font-size: 0.8rem;
}
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.wear-check-enroll-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

body.wear-check-open {
  overflow: hidden;
}

.wear-check-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: #0c0b0a;
  color: #f5f0ea;
  padding:
    calc(12px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(16px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
}

.wear-check-overlay.wear-check-result {
  cursor: pointer;
}

.wear-check-overlay.wear-check-result .wear-check-cancel {
  display: none;
}

.wear-check-overlay.wear-check-result .wear-check-steps {
  opacity: 1;
  font-weight: 600;
}

.wear-check-overlay-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.85;
}

.wear-check-steps {
  margin: 6px 0 10px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.75;
}

.wear-check-viewfinder {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
}

.wear-check-viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.wear-check-outline {
  position: absolute;
  inset: 10%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
}

.wear-check-hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
}

.wear-check-pose {
  margin: 0;
  font-size: clamp(2.6rem, 14vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
}

.wear-check-pose.ok {
  color: #4ade80;
}

.wear-check-pose.bad {
  color: #f87171;
}

.wear-check-count {
  margin: 4px 0 0;
  font-size: clamp(3.5rem, 22vw, 7rem);
  font-weight: 800;
  line-height: 1;
}

.wear-check-status {
  margin: 8px 12px 0;
  font-size: 1rem;
  opacity: 0.95;
  max-width: 22rem;
  line-height: 1.35;
}

.wear-check-status.ok {
  color: #4ade80;
  font-weight: 600;
}

.wear-check-status.warn {
  color: #f0d090;
}

.wear-check-status.bad {
  color: #f87171;
  font-weight: 600;
}

.wear-check-cancel {
  margin-top: 12px;
  align-self: center;
}

.hidden-canvas {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.toast-stack {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top, 0px));
  bottom: auto;
  transform: translateX(-50%);
  z-index: 80;
  width: min(100% - 24px, 400px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(45, 42, 38, 0.2);
  background: #2d2a26;
  color: #faf7f2;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-align: center;
  box-shadow:
    0 12px 32px rgba(45, 42, 38, 0.28),
    0 2px 8px rgba(45, 42, 38, 0.16);
}

.help-support-id-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
}

.help-faq {
  margin: 10px 0 0;
  display: grid;
  gap: 14px;
}

.help-accordion {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.help-accordion-item {
  border-bottom: 1px solid var(--border);
}

.help-accordion-item:last-child {
  border-bottom: none;
}

.help-accordion-item > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.help-accordion-item > summary::-webkit-details-marker {
  display: none;
}

.help-accordion-item > summary::after {
  content: '';
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.help-accordion-item[open] > summary::after {
  transform: rotate(225deg);
  margin-top: 4px;
}

.help-accordion-item[open] > summary {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 70%, var(--surface));
}

.help-accordion-item .help-faq {
  padding: 4px 14px 14px;
}

.help-faq dt {
  font-weight: 600;
  margin: 0 0 4px;
}

.help-faq dd {
  margin: 0;
  color: var(--muted, #6b6560);
  font-size: 0.92rem;
  line-height: 1.45;
}

.help-faq dd strong {
  color: var(--text, #2d2a26);
  font-weight: 600;
}

.help-faq-list {
  margin: 6px 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 4px;
}

.help-messaging-intro {
  margin: 4px 0 0;
}

.help-support-id {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.help-message-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.help-message-list:empty,
.help-message-list.hidden {
  display: none;
}

.help-message-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.help-message-item.is-support {
  background: var(--accent-soft);
  border-color: #c5dccf;
}

.help-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.help-message-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}

.help-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.help-list-head h3 {
  margin: 0;
}

.help-conversation-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.help-conversation-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.help-conversation-item:hover {
  border-color: #c5dccf;
}

.help-conversation-item.is-unread {
  border-color: #b8d4c4;
  background: #e8f2ec;
}

.help-conversation-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 4px;
}

.help-conversation-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.help-unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
  margin-top: 5px;
}
