/* AGX Agent Mobile — Base Stylesheet
   Mobile-first, touch-friendly. Theme tokens: AGX-THM (ui-theme.css).
   No framework dependency. */

@import url('./ui-theme.css');
@import url('./wait-busy.css');
@import url('./screen-chrome-compose.css');
@import url('./text-content.css');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --radius:       0.75rem;
  --gap:          1rem;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --min-tap:      44px;
}

/* Default to dark until JS applies user/system preference (avoids light flash on PWA). */
html:not([data-theme]) {
  color-scheme: dark;
  --color-bg-canvas: #0f172a;
  --color-surface-default: #1e293b;
  --color-surface-elevated: #334155;
  --color-border-subtle: #475569;
  --color-text-primary: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-accent-action: #3b82f6;
  --color-accent-action-hover: #2563eb;
  --color-status-success: #22c55e;
  --color-status-warn: #f59e0b;
  --color-status-error: #ef4444;
  --bg: var(--color-bg-canvas);
  --surface: var(--color-surface-default);
  --surface-2: var(--color-surface-elevated);
  --border: var(--color-border-subtle);
  --text: var(--color-text-primary);
  --text-muted: var(--color-text-muted);
  --accent: var(--color-accent-action);
  --accent-hover: var(--color-accent-action-hover);
  --success: var(--color-status-success);
  --warn: var(--color-status-warn);
  --error: var(--color-status-error);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

/* ── Layout ─────────────────────────────────────────────── */
.page {
  /* AGX-HU H8 / X16 — soft cap fills viewport; readable on ultrawide. */
  max-width: min(100%, 72rem);
  width: 100%;
  margin: 0 auto;
  padding: var(--gap);
  box-sizing: border-box;
}

/* ── Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: var(--gap);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap);
}

.theme-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.theme-controls-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.theme-controls select {
  font: inherit;
  font-size: 0.75rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.25rem 0.35rem;
  min-height: 2rem;
}

.phrases-open-btn {
  font-size: 0.75rem;
  white-space: nowrap;
}

.phrases-settings-dialog {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  max-width: min(92vw, 32rem);
  width: 100%;
  background: var(--surface);
  color: var(--text);
}
.phrases-dialog-header,
.phrases-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}
.phrases-dialog-header { border-bottom: 1px solid var(--border); }
.phrases-dialog-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}
.phrases-dialog-body {
  display: grid;
  gap: 16px;
  padding: 14px;
  max-height: min(70vh, 28rem);
  overflow: auto;
}
.phrases-slot { display: grid; gap: 8px; }
.phrases-slot-title { margin: 0; font-size: 0.95rem; }
.phrases-slot-hint,
.phrases-fields-label { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.phrases-field-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.phrases-field-chip {
  font: inherit;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 8px;
}
.phrases-field { display: grid; gap: 4px; }
.phrases-body { width: 100%; font: inherit; min-height: 4.5rem; }
.phrases-dialog-close {
  border: none;
  background: transparent;
  font-size: 1.25rem;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.workspace-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: rgba(148, 163, 184, 0.06);
}

.workspace-bar[hidden] {
  display: none !important;
}

.workspace-bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.workspace-active-label {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.workspace-bar[data-workspace-degraded="1"] .workspace-active-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  font-weight: 400;
}

.workspace-degraded-cta {
  color: var(--link, #2563eb);
  text-decoration: underline;
  font-weight: 600;
}

.workspace-degraded-title {
  display: block;
  font-weight: 600;
}

.workspace-degraded-subtitle {
  display: block;
  margin-top: 0.125rem;
  font-weight: 400;
  color: var(--text-muted);
}

.missing-config-state {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
}

.missing-config-state .missing-config-nav {
  cursor: default;
}

.missing-config-cta {
  margin: 0;
  text-align: center;
  font-size: 0.9375rem;
}

.workspace-select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  padding: 0.35rem 0.5rem;
}

.workspace-select.hidden,
.workspace-active-label.hidden {
  display: none !important;
}

.user-context-strip {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: rgba(59, 130, 246, 0.06);
}

.user-context-strip.hidden {
  display: none !important;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  background: transparent;
}

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

.cloud-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.05rem;
  padding: 0.2rem 0.38rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  text-decoration: none;
  background: rgba(148, 163, 184, 0.08);
  min-width: 0;
  max-width: 8.4rem;
}

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

.cloud-badge > span:first-child {
  max-width: 100%;
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cloud-badge > span:last-child {
  max-width: 100%;
  color: var(--text-muted);
  font-size: 0.62rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cloud-badge-ok {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.cloud-badge-warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.cloud-badge-loading {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--border);
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: var(--gap);
}

.mobile-build-version {
  grid-column: 2;
  justify-self: end;
  text-align: right;
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.ubd-badge {
  grid-column: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  user-select: none;
  cursor: default;
}

.ubd-badge--icon {
  min-width: 1.45rem;
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
}

.ubd-badge--icon svg {
  display: block;
}

.dc-badge {
  grid-column: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  height: 1.2rem;
  padding: 0 0.35rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  text-decoration: none;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.cp-badge {
  grid-column: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.6rem;
  height: 1.2rem;
  padding: 0 0.35rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cp-badge-ok {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.cp-badge-warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.cp-badge-loading {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--border);
  color: var(--text-muted);
}

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

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: var(--min-tap);
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-hover);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
}
.btn-ghost:hover { background: var(--border); }

/* ── File-pick zone ─────────────────────────────────────── */
.file-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-zone:hover,
.file-zone.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
}
.file-zone input[type="file"] {
  display: none;
}
.file-zone-label {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap);
  margin-bottom: 0.75rem;
}

.card-name {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.card-field {
  display: flex;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  align-items: flex-start;
}

.card-field-key {
  min-width: 4.5rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.card-field-value {
  color: var(--text);
  word-break: break-word;
}

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-active  { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-inactive { background: rgba(239,68,68,0.15); color: var(--error); }
.badge-default { background: var(--surface-2);      color: var(--text-muted); }
.badge-accent { background: rgba(59,130,246,0.15); color: #1d4ed8; }

.entity-pending-draft-badge {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.entity-editor-dirty-chip {
  margin-left: 0.5rem;
  vertical-align: middle;
}

#pending-drafts-btn[hidden] {
  display: none;
}

/* ── Meta strip ─────────────────────────────────────────── */
.meta-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.625rem var(--gap);
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--gap);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.meta-strip span b {
  color: var(--text);
}

/* ── Messages ────────────────────────────────────────────── */
.msg-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: var(--radius);
  padding: var(--gap);
  font-size: 0.9375rem;
}

.msg-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: 0.9375rem;
}

/* ── Journal day/kind filters ───────────────────────────── */
.journal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: var(--gap);
  align-items: end;
}
.journal-filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 9rem;
  min-width: 8.5rem;
}
.journal-filter-label {
  font-size: 0.78rem;
  color: var(--muted, #667085);
}
.journal-day-input,
.journal-kind-select,
.journal-tag-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  padding: 0.55rem 0.75rem;
  min-height: var(--min-tap);
}
.journal-day-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: end;
  flex: 1 1 100%;
}
.journal-view-toggle,
.journal-range-toggle {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}
.journal-toggle-btn.is-active {
  border-color: var(--accent, #3b82f6);
  background: color-mix(in srgb, var(--accent, #3b82f6) 14%, var(--surface));
}
.journal-nav-btn {
  min-width: 2.5rem;
}
.journal-calendar {
  margin-bottom: var(--gap);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem;
  background: var(--surface);
}
.journal-calendar.hidden,
.journal-calendar[hidden] {
  display: none;
}
.journal-calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.55rem;
}
.journal-calendar-title {
  font-weight: 600;
  flex: 1 1 auto;
  text-align: center;
  min-width: 6rem;
}
.journal-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.3rem;
}
.journal-cal-weekday {
  font-size: 0.7rem;
  color: var(--muted, #667085);
  text-align: center;
}
.journal-cal-day {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--surface) 80%, #e2e8f0);
  color: var(--text);
  min-height: var(--min-tap);
  padding: 0.2rem;
  font: inherit;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}
.journal-cal-day.is-outside { opacity: 0.45; }
.journal-cal-day.is-today { border-color: var(--accent, #3b82f6); }
.journal-cal-day.is-selected { box-shadow: inset 0 0 0 2px var(--accent, #3b82f6); }
.journal-cal-day.has-entries { background: color-mix(in srgb, #0d9488 20%, var(--surface)); }
.journal-cal-day.has-entries-few { background: color-mix(in srgb, #0d9488 32%, var(--surface)); }
.journal-cal-day.has-entries-many { background: color-mix(in srgb, #0d9488 46%, var(--surface)); }
.journal-cal-count { font-size: 0.65rem; color: var(--muted, #667085); }
.journal-calendar-grid.is-day-agenda {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.journal-day-agenda {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.journal-day-agenda-empty {
  padding: 0.7rem 0.4rem;
  color: var(--muted, #667085);
  font-size: 0.9rem;
  text-align: center;
}
.journal-day-entry {
  appearance: none;
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  width: 100%;
  text-align: start;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.journal-day-entry-depth-1 {
  margin-inline-start: 1rem;
  width: calc(100% - 1rem);
}
.journal-day-entry-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--muted, #667085);
}
.journal-range {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--muted, #667085);
  margin-bottom: 0.15rem;
}
.journal-form-duration {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  margin: 0.2rem 0 0.7rem;
  font-size: 0.88rem;
}
.journal-form-duration-label {
  color: var(--muted, #667085);
}
.journal-form-duration-value {
  font-variant-numeric: tabular-nums;
  font-weight: 560;
}
.journal-form-timer,
.journal-card-timer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  margin: 0.2rem 0 0.45rem;
}
.btn-journal-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  padding: 4px 6px;
}

.journal-recipe-group-section {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line, #e4e7ec);
  border-radius: 8px;
  background: var(--surface-2, #f8f8f8);
}

.journal-recipe-group-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.recipe-group-members.collaboration-panel {
  margin-top: 1rem;
}

.recipe-group-members .related-collection-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.recipe-group-member-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.recipe-group-member-link-select {
  min-width: min(100%, 18rem);
  flex: 1 1 12rem;
}

.recipe-group-members-list {
  list-style: decimal;
  margin: 0;
  padding-left: 1.25rem;
}

.recipe-group-member-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.35rem 0;
}

.journal-recipe-step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.journal-recipe-step {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--line, #e4e7ec);
  background: var(--surface, #fff);
}

.journal-indicative-alert-banner {
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  background: #fff4e5;
  color: #8a4b00;
  font-size: 0.88rem;
}

.journal-indicative-alert-banner.hidden {
  display: none;
}

.journal-indicative-duration-section {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line, #e4e7ec);
  border-radius: 8px;
  background: var(--surface-2, #f8f8f8);
}

.journal-indicative-duration-hint {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  color: var(--muted, #667085);
}

.journal-indicative-alert-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  margin-top: 0.45rem;
  font-size: 0.88rem;
  align-items: center;
}

.journal-indicative-alert-threshold select {
  min-width: 7rem;
}

.journal-list-summary,
.journal-day-entry-title {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}
.journal-notes-indicator {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--muted, #667085);
  line-height: 1;
}
.journal-notes-indicator .journal-notes-icon {
  display: block;
}
.card-name .journal-notes-indicator {
  margin-left: 0.1rem;
}
.journal-overrun-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #fff4e5;
  color: #8a4b00;
}

.journal-inline-time {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.journal-inline-time input[type="datetime-local"] {
  font-size: 0.78rem;
  max-width: 11.5rem;
}

.journal-list-summary-editable {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem;
}

.journal-inline-kind {
  font: inherit;
  font-size: 0.92em;
  max-width: 12rem;
  margin: 0;
  padding: 0 0.15rem;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
}

.journal-list-summary-tail {
  display: inline;
}

.journal-card-title {
  display: grid;
  grid-template-columns: minmax(6.5rem, auto) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: baseline;
  width: 100%;
}

.journal-card-kind {
  min-width: 0;
}

.journal-card-description {
  min-width: 0;
}

.list-popover-room {
  padding-bottom: min(42vh, 22rem);
  scroll-padding-bottom: min(42vh, 22rem);
}
.journal-duration-adjust {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.journal-duration-adjust-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.journal-duration-adjust-field {
  display: grid;
  gap: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.journal-duration-adjust-field input {
  width: 6.5rem;
}
.journal-duration-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.journal-segments {
  margin-top: 0.2rem;
}
.journal-segment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}
.journal-segment-range {
  flex: 1 1 auto;
}
.journal-segment-row .btn-journal-segment-delete {
  margin-left: auto;
  flex: 0 0 auto;
}
.journal-choice-actions {
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.journal-segments-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.3rem 0 0.7rem;
}
#journal-start-btn {
  margin-left: 0.2rem;
}
#journal-recipe-btn {
  margin-left: 0.15rem;
}
.journal-recipe-picker {
  border: 1px solid #c5d4e4;
  border-radius: 10px;
  padding: 0;
  max-width: min(92vw, 28rem);
  width: 100%;
  background: #fff;
  color: inherit;
  box-shadow: 0 12px 40px rgba(16, 32, 51, 0.2);
}
.journal-recipe-picker::backdrop {
  background: rgba(16, 32, 51, 0.35);
}
.journal-recipe-picker-inner { margin: 0; padding: 0; }
.journal-recipe-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #c5d4e4;
}
.journal-recipe-picker-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.journal-recipe-picker-close {
  border: none;
  background: transparent;
  color: #5b6e82;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.journal-recipe-picker-body {
  padding: 10px 14px 14px;
  max-height: min(60vh, 22rem);
  overflow: auto;
}
.journal-recipe-picker-empty {
  margin: 0.35rem 0;
  color: #5b6e82;
}
.journal-recipe-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.journal-recipe-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border: 1px solid #c5d4e4;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  cursor: pointer;
}
.journal-recipe-picker-row-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.journal-recipe-picker-badge {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: #5b6e82;
}
.journal-recipe-picker-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
  padding: 10px 14px 14px;
  border-top: 1px solid #c5d4e4;
}
.journal-recipe-save-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.85rem;
  color: #5a6a7a;
}
.journal-save-template-source {
  margin: 0 0 12px;
}
.journal-save-template-source-label {
  color: #5a6a7a;
}
.journal-save-template-duplicate {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #c5d4e4;
  border-radius: 8px;
  background: #f4f8fc;
}
.journal-save-template-duplicate-copy {
  margin: 0 0 8px;
}
.journal-save-template-duplicate-modes {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 6px;
}
.journal-save-template-mode {
  display: flex;
  align-items: center;
  gap: 6px;
}
.journal-save-template-group {
  display: block;
  margin: 0 0 6px;
  font-weight: 600;
}
.journal-save-template-group-select {
  width: 100%;
  max-width: 100%;
}
.journal-recovery-hint {
  margin: 0;
  padding: 0 14px 8px;
  font-size: 0.82rem;
  color: #5b6e82;
}
.journal-recovery-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  width: 100%;
  text-align: left;
}
.journal-recovery-row-actions {
  margin-left: auto;
  display: flex;
  gap: 0.35rem;
}
.cloud-status .undo-link {
  margin-left: 0.4rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.journal-pattern-suggestion {
  margin: 0.3rem 0 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #c5d4e4;
  border-radius: 8px;
  background: #fff;
}
.journal-pattern-suggestion[hidden] {
  display: none;
}
.journal-pattern-suggestion-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.7rem;
}
.journal-pattern-suggestion-copy {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.92rem;
}
.journal-pattern-suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.journal-day-entry-title {
  font-weight: 560;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.journal-source-badge {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid #c5d4e4;
  border-radius: 3px;
  font-size: 0.7rem;
  line-height: 1.3;
  color: #3d556e;
  background: #f2f6fa;
  vertical-align: middle;
}
.journal-source-badge[data-source-type="care_event"] {
  border-color: #c9d9c4;
  color: #3d5a3a;
  background: #f3f8f1;
}
.journal-source-badge[data-source-type="service_event"] {
  border-color: #d9d0c4;
  color: #5a4a3a;
  background: #f8f4f1;
}
.journal-day-entry-kind {
  font-size: 0.72rem;
  color: var(--muted, #667085);
}
.journal-day-section-title {
  margin: 0.75rem 0 0.4rem;
  font-size: 0.85rem;
  color: var(--muted, #667085);
  cursor: pointer;
}
.journal-entry-child {
  margin-left: 0.9rem;
  border-left: 3px solid color-mix(in srgb, #0d9488 45%, var(--border));
}
.btn-journal-note {
  margin: 0.4rem 0.55rem 0.65rem;
  font-size: 0.85rem;
}
.journal-parent-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, #0d9488 12%, var(--surface));
  font-size: 0.9rem;
}

/* ── Pillar multi-select (time entries / shared collaboration) ─ */
.pillar-multi-select {
  margin: 0 0 0.85rem;
}
.pillar-multi-select h4 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.pillar-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}
.pillar-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--min-tap);
  font-size: 0.92rem;
}

/* ── Pillar/aspect dropdown tree ─ */
.pillar-aspect-tree {
  margin: 0 0 0.85rem;
}
.pillar-aspect-tree h4 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.pillar-aspect-dropdown {
  position: relative;
}
.pillar-aspect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: var(--min-tap);
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.pillar-aspect-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}
.pillar-aspect-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(22rem, 50vh);
  overflow: auto;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.pillar-aspect-node-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: var(--min-tap);
}
.pillar-aspect-expand {
  flex: 0 0 1.75rem;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.pillar-aspect-root,
.pillar-aspect-leaf {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
}
.pillar-aspect-children {
  margin: 0.15rem 0 0.4rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.collaboration-panel {
  margin: 0.75rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.collaboration-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.collaboration-panel h4 {
  margin: 0;
  font-size: 0.95rem;
}
.related-time-entries-hint {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--muted, #666);
}
.related-time-entries-table-wrap {
  overflow-x: auto;
}
.related-time-entries-row-actions {
  white-space: nowrap;
  text-align: right;
}

.time-entry-links-panel.collaboration-panel {
  margin: 0.75rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.time-entry-links-panel .collaboration-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.time-entry-links-panel h4 {
  margin: 0;
  font-size: 0.95rem;
}
.time-entry-link-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  min-height: 1.5rem;
}
.time-entry-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.85rem;
}
.time-entry-link-remove {
  min-width: var(--min-tap);
  min-height: var(--min-tap);
  padding: 0;
  line-height: 1;
}
.time-entry-link-add {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}
.time-entry-link-add select,
.time-entry-link-add input {
  width: 100%;
  min-height: var(--min-tap);
}

.time-entry-tags-panel.collaboration-panel {
  margin: 0.75rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.time-entry-tags-panel .collaboration-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.time-entry-tags-panel h4 {
  margin: 0;
  font-size: 0.95rem;
}
.time-entry-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  min-height: 1.5rem;
}
.time-entry-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.85rem;
}
.time-entry-tag-chip.is-inline {
  margin-left: 0.4rem;
  font-size: 0.78rem;
}
.time-entry-tags-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  vertical-align: middle;
}
.time-entry-tag-remove {
  min-width: var(--min-tap);
  min-height: var(--min-tap);
  padding: 0;
  line-height: 1;
}
.time-entry-tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}
.time-entry-tag-suggest {
  padding: 0.3rem 0.6rem;
  border: 1px dashed var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  min-height: var(--min-tap);
}
.time-entry-tag-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.time-entry-tag-add input {
  flex: 1 1 10rem;
  width: 100%;
  min-height: var(--min-tap);
}

.time-entry-technical {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
}
.time-entry-technical summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: var(--min-tap);
  display: flex;
  align-items: center;
}
.time-entry-technical-hint {
  margin: 0.5rem 0 0.65rem;
  font-size: 0.82rem;
  line-height: 1.4;
}
.time-entry-technical-block + .time-entry-technical-block { margin-top: 0.65rem; }
.time-entry-technical-label {
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}
.time-entry-technical-pre {
  margin: 0;
  padding: 0.6rem 0.7rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface-2);
  font-size: 0.78rem;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Search bar ─────────────────────────────────────────── */
.search-bar {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  padding: 0.625rem 0.875rem;
  margin-bottom: var(--gap);
  min-height: var(--min-tap);
  outline: none;
  transition: border-color 0.15s;
}
.search-bar:focus {
  border-color: var(--accent);
}

.list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: var(--gap);
  align-items: flex-end;
}

.list-filter {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.list-filter select {
  font: inherit;
  min-height: var(--min-tap);
  min-width: 10rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

/* ── Utilities ───────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.hidden { display: none !important; }

/* ── Info rows (system-status / updater-status views) ─── */
.info-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  flex-wrap: wrap;
}
.info-row:last-child { border-bottom: none; }
.info-row .label {
  color: var(--text-muted);
  min-width: 5.5rem;
  flex-shrink: 0;
}
.info-row .value {
  color: var(--text);
  word-break: break-word;
}
.info-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  background: var(--surface-2);
  border-radius: 0.25rem;
  padding: 0 0.25rem;
  word-break: break-all;
}

/* ── Status badges ───────────────────────────────────────── */
.badge-ok   { background: rgba(34,197,94,0.15);  color: var(--success); border-color: rgba(34,197,94,0.3); }
.badge-warn { background: rgba(245,158,11,0.15); color: var(--warn);    border-color: rgba(245,158,11,0.3); }
.badge-err  { background: rgba(239,68,68,0.15);  color: var(--error);   border-color: rgba(239,68,68,0.3); }

/* ── Card title ──────────────────────────────────────────── */
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.625rem;
  letter-spacing: 0.01em;
}

/* ── Nav list (index.html) ───────────────────────────────── */
.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  min-height: var(--min-tap);
  transition: background 0.15s, border-color 0.15s;
}
.nav-link:hover,
.nav-link:focus-visible {
  background: var(--surface-2);
  border-color: var(--accent);
  outline: none;
}
.nav-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}
.nav-label {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* ── Error message ───────────────────────────────────────── */
.msg-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  color: var(--error);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  margin-bottom: var(--gap);
}

/* ── Mode tabs ───────────────────────────────────────────── */
.mode-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: var(--gap);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}
.tab-btn {
  background: none;
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: color 0.15s, background 0.15s;
}
.tab-btn:hover { background: var(--surface-2); color: var(--text); }
.tab-btn.tab-active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  margin-bottom: -1px;
}

/* ── Cloud settings ──────────────────────────────────────── */
.cloud-settings {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--gap);
}
.cloud-settings-summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.625rem 0.875rem;
  user-select: none;
}
.cloud-settings-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 0.875rem 0.875rem;
}
.field-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: -0.25rem;
}
.field-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  min-height: var(--min-tap);
  padding: 0.5rem 0.75rem;
  width: 100%;
  box-sizing: border-box;
}
.field-input:focus { border-color: var(--accent); outline: none; }

/* ── Cloud status ────────────────────────────────────────── */
.cloud-status {
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: var(--gap);
  padding: 0.5rem 0.75rem;
}
.cloud-status-loading { background: var(--surface-2); color: var(--text-muted); }
.cloud-status-ok      { background: rgba(34,197,94,0.1); color: var(--success); }
.cloud-status-error   { background: rgba(239,68,68,0.1); color: var(--error); }
.cloud-status-warn    { background: rgba(245,158,11,0.12); color: var(--warn); }
.cloud-status-info    { background: var(--surface-2); color: var(--text-muted); }

/* ── Split list/item screens ───────────────────────────── */
.screen-panel {
  display: grid;
  gap: 0.65rem;
}

.screen-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.runtime-badge {
  min-width: 0;
  max-width: 100%;
}

.runtime-badge-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.runtime-badge-summary::-webkit-details-marker {
  display: none;
}

.runtime-badge[open] .runtime-badge-summary {
  border-color: var(--accent);
  background: var(--surface-2);
}

.runtime-badge-details {
  margin-top: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.runtime-badge-details b {
  color: var(--text);
}

.runtime-badge-status {
  flex-basis: 100%;
  padding-top: 0.2rem;
  border-top: 1px dashed var(--border);
}

.screen-heading {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
}

.screen-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.screen-subtitle {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Customers editor sections ─────────────────────────── */
.customers-entity-form {
  display: grid;
  gap: 0.75rem;
}

.customers-entity-form .entity-section,
.customers-entity-form .entity-form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.customers-entity-form .entity-section-header,
.customers-entity-form .entity-form-section-header {
  margin-bottom: 0.55rem;
}

.customers-entity-form .entity-section-title,
.customers-entity-form .entity-form-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.customers-entity-form .entity-section-subtitle,
.customers-entity-form .entity-form-section-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.customers-entity-form .entity-section-body,
.customers-entity-form .entity-form-section-body {
  display: grid;
  gap: 0.55rem;
}

.customers-entity-form .form-field {
  display: grid;
  gap: 0.28rem;
}

.customers-entity-form .form-field label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.customers-entity-form .form-field input,
.customers-entity-form .form-field select,
.customers-entity-form .form-field textarea {
  width: 100%;
  min-height: var(--min-tap);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.55rem 0.65rem;
}

.customers-entity-form .form-field textarea {
  min-height: 84px;
  resize: vertical;
}

.customers-entity-form .form-field input[type='checkbox'] {
  min-height: auto;
  width: auto;
  margin-right: 0.4rem;
  transform: scale(1.06);
}

.customers-entity-form .form-field label:has(input[type='checkbox']) {
  display: inline-flex;
  align-items: center;
  color: var(--text);
}

.customers-entity-form .form-field-width-narrow input,
.customers-entity-form .form-field-width-narrow select {
  max-width: 9rem;
}

.customers-entity-form .form-field-width-medium input,
.customers-entity-form .form-field-width-medium select {
  max-width: 18rem;
}

.customers-entity-form .form-field-width-wide input,
.customers-entity-form .form-field-width-wide select {
  max-width: 100%;
}

.customers-entity-form .form-field-readonly input,
.customers-entity-form .form-field-readonly select,
.customers-entity-form .form-field-readonly textarea {
  background: var(--surface-2);
  color: var(--text-muted);
}

.customers-entity-form .form-field-value-mono input,
.customers-entity-form .form-field-value-mono textarea,
.customers-entity-form .form-field-value-mono select {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
}

.customers-entity-form .form-field-label-inline label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.enum-tags-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.enum-tags-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line, #c9cdd4);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.88rem;
}

.screen-action-band {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.entity-form .form-field-related-links .related-links-list,
.entity-form .form-field-attribute-pairs .attribute-pairs-list {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.entity-form .form-field-related-links .related-links-row,
.entity-form .form-field-attribute-pairs .attribute-pairs-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.entity-form .form-field-related-links .related-links-cell,
.entity-form .form-field-attribute-pairs .attribute-pairs-cell {
  display: grid;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.entity-form .form-field-enum-tags .enum-tags-checkbox-group,
.customers-entity-form .form-field-enum-tags .enum-tags-checkbox-group {
  margin-top: 0.15rem;
}

.entity-form .form-field-enum-tags .enum-tags-checkbox-item,
.customers-entity-form .form-field-enum-tags .enum-tags-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0;
  color: var(--text, #1a1a1a);
  cursor: pointer;
}

.entity-form .form-field-enum-tags .enum-tags-checkbox-item input[type="checkbox"],
.customers-entity-form .form-field-enum-tags .enum-tags-checkbox-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line, #c9cdd4);
  border-radius: 3px;
  background: #fff;
  flex: 0 0 auto;
  accent-color: var(--accent, #3d6ea8);
}

.entity-form .form-field-enum-tags > label {
  display: block;
  margin-bottom: 0.35rem;
}

.journal-nourishment-overrides {
  border: none;
  margin: 0;
  padding: 0;
}

.journal-nourishment-overrides legend {
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.journal-nourishment-items {
  border: none;
  margin: 0;
  padding: 0;
  grid-column: 1 / -1;
}

.journal-nourishment-items legend {
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.nourishment-items-picker {
  margin-top: 0.15rem;
}

.nourishment-item-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  min-height: 1.5rem;
}

.nourishment-item-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line, #c9cdd4);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2, #eef1f5) 55%, transparent);
  font-size: 0.82rem;
}

.nourishment-item-chip-badge {
  font-size: 0.72rem;
  color: var(--muted, #64748b);
}

.nourishment-item-remove {
  padding: 0 0.25rem;
  min-width: 1.4rem;
  line-height: 1;
}

.nourishment-item-add {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.nourishment-item-add select,
.nourishment-item-add input {
  width: 100%;
}

@media (max-width: 24rem) {
  .enum-tags-checkbox-group {
    flex-direction: column;
    align-items: stretch;
  }

  .enum-tags-checkbox-item {
    white-space: normal;
  }
}

.customers-entity-form .form-field-label-strong label,
.customers-entity-form label.form-field-label-strong {
  font-weight: 600;
  color: var(--text);
}

.card-field-value-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
}

.customers-entity-form .form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.customers-entity-form .form-actions button {
  min-height: var(--min-tap);
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}

.customers-entity-form .form-actions button.primary {
  background: var(--accent);
  border-color: var(--accent-hover);
  color: #fff;
}

/* ── Debug toggle button (header top-right) ─────────────────────────────── */
.debug-toggle {
  flex-shrink: 0;
  padding: 0.3rem 0.55rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1;
}
.debug-toggle-on {
  background: rgba(234, 179, 8, 0.12);
  border-color: #d97706;
  color: #d97706;
}

/* ── View profile button (header top-right, before cloud badge) ─────────── */
.view-profile-btn {
  flex-shrink: 0;
  padding: 0.3rem 0.55rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1;
}
.view-profile-btn:hover,
.view-profile-btn:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

.view-profile-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: min(92vw, 28rem);
  width: 100%;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
}
.view-profile-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.view-profile-dialog-inner {
  margin: 0;
  padding: 0;
}
.view-profile-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.view-profile-dialog-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.view-profile-dialog-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}
.view-profile-dialog-body {
  padding: 0.75rem 1rem;
  max-height: min(60vh, 24rem);
  overflow-y: auto;
}
.view-profile-section + .view-profile-section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.view-profile-section-title {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.view-profile-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  padding: 0.2rem 0;
}
.view-profile-row-label {
  color: var(--text-muted);
  flex-shrink: 0;
}
.view-profile-row-value {
  text-align: right;
  word-break: break-word;
}
.view-profile-section-link {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
}
.view-profile-section-link a {
  color: var(--accent);
}
.view-profile-dialog-footer {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}
.view-profile-dialog-dismiss {
  min-height: var(--min-tap);
}
.view-profile-transport-editor {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
}
.view-profile-transport-label {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.view-profile-transport-select {
  width: 100%;
  min-height: var(--min-tap);
  margin-bottom: 0.45rem;
}
.view-profile-transport-override-status {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.view-profile-transport-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.view-profile-transport-feedback {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
}
.view-profile-transport-feedback.is-error { color: var(--danger, #b42318); }
.view-profile-transport-feedback.is-ok { color: var(--ok, #067647); }
.view-profile-transport-feedback.hidden { display: none; }

.view-profile-list-inline-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.view-profile-list-inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}
.view-profile-list-inline-hint,
.view-profile-list-inline-feedback {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.view-profile-list-inline-feedback.is-ok { color: var(--ok, #067647); }
.view-profile-list-inline-feedback.is-error { color: var(--danger, #b42318); }

.view-profile-workspace-editor {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.view-profile-workspace-editor-label {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 6px;
}
.view-profile-workspace-editor-select {
  width: 100%;
}
.view-profile-workspace-editor-override-status {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.view-profile-workspace-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.view-profile-workspace-editor-feedback {
  margin: 8px 0 0;
  font-size: 0.82rem;
}
.view-profile-workspace-editor-feedback.is-error { color: var(--danger, #b42318); }
.view-profile-workspace-editor-feedback.is-ok { color: var(--ok, #067647); }
.view-profile-workspace-editor-feedback.hidden { display: none; }

.view-profile-data-sources-editor {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.view-profile-data-sources-idle {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}
.view-profile-data-sources-results {
  display: grid;
  gap: 6px;
  font-size: 0.84rem;
}
.view-profile-data-sources-results.hidden { display: none; }
.view-profile-data-sources-summary { margin: 0; }
.view-profile-data-sources-summary.is-ok { color: #067647; }
.view-profile-data-sources-summary.is-warn { color: #b54708; }
.view-profile-data-sources-summary.is-error { color: #b42318; }
.view-profile-data-sources-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.view-profile-data-sources-row-label { color: var(--muted); }
.view-profile-data-sources-row-value { text-align: right; word-break: break-word; }
.view-profile-data-sources-row.is-warn .view-profile-data-sources-row-value { color: #b54708; }
.view-profile-data-sources-row.is-ok .view-profile-data-sources-row-value { color: #067647; }

/* ── Debug panel (only visible when debug mode is active) ───────────────── */
.dbg-toggle-btn {
  position: fixed;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  right: calc(1rem + env(safe-area-inset-right, 0px));
  z-index: 10001;
  padding: 0.35rem 0.75rem;
  background: #1f2937;
  color: #f9fafb;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.dbg-panel {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 10, 10, 0.95);
  padding: 1rem;
  overflow-y: auto;
}
.dbg-panel.is-hidden {
  display: none;
}
.screen-debug-dock {
  margin: 0.5rem 0 0.75rem;
  border: 1px solid #d97706;
  border-radius: var(--radius);
  background: rgba(234, 179, 8, 0.08);
}
.screen-debug-dock-details {
  padding: 0.5rem 0.65rem;
}
.screen-debug-dock-summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fbbf24;
  list-style: none;
}
.screen-debug-dock-summary::-webkit-details-marker {
  display: none;
}
.screen-debug-dock-alerts,
.screen-debug-panel-alerts {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.35rem 0 0.5rem;
}
.screen-debug-alert {
  display: block;
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 0.35rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
}
.screen-debug-alert-warn {
  color: #fef3c7;
  background: rgba(217, 119, 6, 0.22);
  border-color: #d97706;
}
.screen-debug-alert-info {
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.18);
  border-color: #3b82f6;
}
.screen-debug-dock-meta {
  font-size: 0.72rem;
  line-height: 1.5;
  color: #fde68a;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.35rem 0 0.5rem;
  font-family: monospace;
}
.screen-debug-dock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}
.screen-debug-dock-pre {
  font-size: 0.68rem;
  line-height: 1.45;
  color: #bfdbfe;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 32vh;
  overflow-y: auto;
  font-family: monospace;
}
.dbg-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.dbg-btn {
  padding: 0.35rem 0.7rem;
  background: #374151;
  color: #f9fafb;
  border: none;
  border-radius: 0.4rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.dbg-btn-danger { background: #dc2626; }
.dbg-panel-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f9fafb;
  margin-bottom: 0.5rem;
}
.dbg-detail-pre,
.dbg-log-pre {
  font-size: 0.7rem;
  line-height: 1.5;
  color: #d1fae5;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0 0 0.75rem;
  font-family: monospace;
}
.dbg-detail-pre {
  color: #bfdbfe;
  max-height: 45vh;
  overflow-y: auto;
}

/* ── Commitments outline mode (AC.2) ───────────────────────────────────── */
.outline-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0;
}
.outline-root-filter {
  flex: 1 1 8rem;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}
.commitment-outline-card {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.commitment-outline-toggle {
  flex-shrink: 0;
  width: 1.5rem;
  padding: 0.35rem 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.commitment-outline-card .card {
  flex: 1 1 auto;
  min-width: 0;
}
.commitment-rollup-preview {
  margin: 0.5rem 0 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.45rem;
  border: 1px dashed var(--border);
  background: rgba(59, 130, 246, 0.06);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.commitment-breadcrumb {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* AGX-INS tip host — mobile dark adaptations (INS.10.4) */
.inspiration-tip-host,
.inspiration-tip-bar {
  --ink: var(--text);
  --muted: var(--text-muted);
  --line: var(--border);
  --ins-tip-surface: rgba(30, 41, 59, 0.95);
  color: var(--text);
  box-shadow: none;
}
.inspiration-tip-menu,
.inspiration-manage-dialog,
.inspiration-presentation-dialog,
.inspiration-text-dialog {
  background: #0f172a;
  color: var(--text);
  border-color: var(--border);
}
.inspiration-tip-menu-item:hover,
.inspiration-tip-menu-item:focus-visible {
  background: rgba(148, 163, 184, 0.15);
}
.inspiration-manage-row {
  background: rgba(15, 23, 42, 0.85);
}
