/* RetroTracker — restrained CRT-inspired inventory UI (light + dark) */

:root {
  /* Shared structural tokens */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  --text-2xl: clamp(1.85rem, 1.4rem + 1.5vw, 2.5rem);

  --motion-quick: 150ms;
  --motion-fast: 250ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Default = dark (CRT phosphor look) until theme.js resolves preference */
  --bg: #0a0b0c;
  --bg-elevated: var(--map-panel);
  --bg-subtle: #1a1d20;
  --fg: #e8eaed;
  --fg-muted: #9aa0a6;
  --fg-subtle: #6b7280;
  --border: rgba(232, 234, 237, 0.1);
  --border-strong: rgba(232, 234, 237, 0.18);
  --accent: #8fd6a8;
  --accent-dim: rgba(143, 214, 168, 0.14);
  --accent-fg: #0a0b0c;
  --danger: #e8a0a0;
  --danger-bg: rgba(232, 160, 160, 0.12);
  --warn: #d4c48a;
  --ok: #8fd6a8;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 40px rgba(0, 0, 0, 0.35);
  --glow-a: rgba(143, 214, 168, 0.06);
  --glow-b: rgba(140, 160, 180, 0.05);
  --map-surface: #101214;
  --map-panel: var(--map-panel);
  --map-panel-deep: #0c0e10;
  --map-ink: #f2f4f3;
  --bin-label: #f4f6f5;
  --table-hover: rgba(143, 214, 168, 0.06);
  --theme-color: #0a0b0c;
}

html[data-theme="dark"],
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0c;
  --bg-elevated: var(--map-panel);
  --bg-subtle: #1a1d20;
  --fg: #e8eaed;
  --fg-muted: #9aa0a6;
  --fg-subtle: #6b7280;
  --border: rgba(232, 234, 237, 0.1);
  --border-strong: rgba(232, 234, 237, 0.18);
  --accent: #8fd6a8;
  --accent-dim: rgba(143, 214, 168, 0.14);
  --accent-fg: #0a0b0c;
  --danger: #c45c5c;
  --danger-bg: rgba(196, 92, 92, 0.12);
  --warn: #d4c48a;
  --ok: #8fd6a8;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 40px rgba(0, 0, 0, 0.35);
  --glow-a: rgba(143, 214, 168, 0.06);
  --glow-b: rgba(140, 160, 180, 0.05);
  --map-surface: #101214;
  --map-panel: var(--map-panel);
  --map-panel-deep: #0c0e10;
  --map-ink: #f2f4f3;
  --bin-label: #f4f6f5;
  --table-hover: rgba(143, 214, 168, 0.06);
  --theme-color: #0a0b0c;
}

html[data-theme="light"],
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f4;
  --bg-elevated: #ffffff;
  --bg-subtle: #e8ece8;
  --fg: #1a1f1c;
  --fg-muted: #5c6560;
  --fg-subtle: #7a847e;
  --border: rgba(26, 31, 28, 0.1);
  --border-strong: rgba(26, 31, 28, 0.18);
  --accent: #2f7a4a;
  --accent-dim: rgba(47, 122, 74, 0.12);
  --accent-fg: #ffffff;
  --danger: #b33b3b;
  --danger-bg: rgba(179, 59, 59, 0.1);
  --warn: #9a7b20;
  --ok: #2f7a4a;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 10px 28px rgba(26, 31, 28, 0.08);
  --glow-a: rgba(47, 122, 74, 0.08);
  --glow-b: rgba(80, 110, 140, 0.05);
  --map-surface: #e4e9e4;
  --map-panel: #f7f9f7;
  --map-panel-deep: #dfe5df;
  --map-ink: #1a1f1c;
  --bin-label: #f7faf7;
  --table-hover: rgba(47, 122, 74, 0.06);
  --theme-color: #f4f6f4;
}

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

html {
  color-scheme: dark light;
}

body.rt-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--fg);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--glow-a), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, var(--glow-b), transparent 50%),
    var(--bg);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  transition: background-color var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}

body.rt-body main {
  flex: 1;
}

.skip-link:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

/* PWA update banner */
.rt-pwa-banner {
  background: var(--accent-dim);
  border-bottom: 1px solid color-mix(in oklab, var(--accent) 35%, var(--border));
  color: var(--fg);
  font-size: var(--text-sm);
  position: sticky;
  top: 0;
  z-index: 1040;
}

.rt-pwa-banner[hidden] {
  display: none !important;
}

/* Nav */
.rt-nav {
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: max(0.35rem, var(--safe-top));
  padding-bottom: 0.35rem;
}

.rt-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--fg) !important;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.rt-brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.rt-brand-text {
  font-size: 1.05rem;
}

.rt-nav .nav-link {
  color: var(--fg-muted) !important;
  font-weight: 500;
  padding: 0.55rem 0.85rem !important;
  border-radius: var(--radius-sm);
  transition: color var(--motion-quick) var(--ease-out), background var(--motion-quick) var(--ease-out);
}

.rt-nav .nav-link:hover,
.rt-nav .nav-link:focus-visible {
  color: var(--fg) !important;
  background: var(--bg-subtle);
}

.rt-nav .nav-link.active {
  color: var(--fg) !important;
  background: var(--accent-dim);
}

.rt-nav .navbar-toggler {
  border-color: var(--border-strong);
  padding: 0.4rem 0.55rem;
}

.rt-nav .navbar-toggler-icon {
  filter: invert(1) grayscale(1);
  opacity: 0.85;
}

.rt-pill {
  font-size: var(--text-xs);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  letter-spacing: 0.02em;
}

/* Typography */
.rt-kicker {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.rt-display {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--fg);
  margin: 0;
}

.rt-lead {
  color: var(--fg-muted);
  max-width: 52ch;
  font-size: var(--text-sm);
}

.rt-section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.rt-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.95em;
}

.rt-strong {
  font-weight: 600;
  color: var(--fg);
}

.rt-sub {
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

.rt-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
}

.rt-link:hover {
  text-decoration: underline;
}

/* Panels & stats */
.rt-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}

.rt-panel-head {
  margin-bottom: var(--space-4);
}

.rt-panel-title {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}

.rt-stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow);
}

.rt-stat-accent {
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border));
  background: linear-gradient(180deg, var(--accent-dim), var(--bg-elevated) 70%);
}

.rt-stat-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.35rem;
}

.rt-stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--fg);
}

.rt-stat-hint {
  margin-top: 0.35rem;
  font-size: var(--text-xs);
  color: var(--fg-subtle);
}

/* Bars */
.rt-bar-list > li + li {
  margin-top: var(--space-3);
}

.rt-bar {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.rt-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  min-width: 2px;
  transition: width var(--motion-fast) var(--ease-out);
}

.rt-status-list > li + li {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* Table */
.rt-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--fg);
  --bs-table-border-color: var(--border);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.02);
  margin: 0;
  font-size: var(--text-sm);
}

.rt-table thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom-color: var(--border-strong) !important;
  padding: 0.9rem 1.1rem;
  white-space: nowrap;
}

.rt-table tbody td {
  padding: 0.95rem 1.1rem;
  vertical-align: middle;
  border-color: var(--border);
}

.rt-row-link {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.rt-row-link:hover {
  color: var(--accent);
}

.rt-empty,
.rt-empty-inline {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.rt-empty {
  padding: 2rem 1.1rem !important;
  text-align: center;
}

.rt-empty a,
.rt-empty-inline a {
  color: var(--accent);
}

.rt-result-count {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

/* Badges */
.badge {
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  padding: 0.4em 0.65em;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-status-working {
  background: rgba(143, 214, 168, 0.14);
  color: #b6ebc7;
  border-color: rgba(143, 214, 168, 0.28);
}

.badge-status-partial {
  background: rgba(212, 196, 138, 0.14);
  color: #e6d7a4;
  border-color: rgba(212, 196, 138, 0.28);
}

.badge-status-dead {
  background: rgba(232, 160, 160, 0.12);
  color: #f0b8b8;
  border-color: rgba(232, 160, 160, 0.28);
}

.badge-status-untested {
  background: rgba(154, 160, 166, 0.12);
  color: #c4c8cc;
  border-color: rgba(154, 160, 166, 0.25);
}

.badge-condition-good {
  background: rgba(143, 214, 168, 0.1);
  color: #b6ebc7;
  border-color: rgba(143, 214, 168, 0.22);
}

.badge-condition-ok {
  background: rgba(140, 170, 200, 0.12);
  color: #c5d5e5;
  border-color: rgba(140, 170, 200, 0.25);
}

.badge-condition-warn {
  background: rgba(212, 196, 138, 0.12);
  color: #e6d7a4;
  border-color: rgba(212, 196, 138, 0.25);
}

.badge-condition-bad {
  background: rgba(232, 160, 160, 0.1);
  color: #f0b8b8;
  border-color: rgba(232, 160, 160, 0.22);
}

.badge-condition-muted {
  background: rgba(154, 160, 166, 0.1);
  color: #c4c8cc;
  border-color: rgba(154, 160, 166, 0.22);
}

/* Forms */
.rt-filters {
  padding: var(--space-4) var(--space-5);
}

.rt-form-wrap {
  max-width: 860px;
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.rt-req {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--fg-subtle);
  margin-left: 0.35rem;
}

.rt-input,
.form-control.rt-input,
.form-select.rt-input {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 0.55rem 0.85rem;
  box-shadow: none;
  transition: border-color var(--motion-quick) var(--ease-out), box-shadow var(--motion-quick) var(--ease-out);
}

.form-select.rt-input {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%9aa0a6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.rt-input:focus,
.form-control.rt-input:focus,
.form-select.rt-input:focus {
  background: var(--bg);
  border-color: color-mix(in oklab, var(--accent) 55%, var(--border-strong));
  color: var(--fg);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.rt-input::placeholder {
  color: var(--fg-subtle);
}

textarea.rt-input {
  min-height: 120px;
  resize: vertical;
}

.rt-file {
  padding: 0.45rem 0.65rem;
}

.rt-file::file-selector-button {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  border-radius: var(--radius-xs);
  margin-right: 0.75rem;
  padding: 0.35rem 0.75rem;
  font-weight: 500;
}

.rt-form-actions {
  border-top: 1px solid var(--border);
}

.rt-alert {
  background: var(--danger-bg);
  border: 1px solid rgba(232, 160, 160, 0.3);
  color: #f0b8b8;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

/* Buttons */
.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.1rem;
  transition: transform var(--motion-quick) var(--ease-out), background var(--motion-quick) var(--ease-out), border-color var(--motion-quick) var(--ease-out), opacity var(--motion-quick) var(--ease-out);
}

.btn-sm {
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  font-size: var(--text-xs);
}

.btn:active {
  transform: scale(0.98);
}

.btn-rt-primary {
  background: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 80%, white);
  color: var(--accent-fg);
}

.btn-rt-primary:hover,
.btn-rt-primary:focus-visible {
  background: color-mix(in oklab, var(--accent) 88%, white);
  border-color: color-mix(in oklab, var(--accent) 70%, white);
  color: var(--accent-fg);
}

.btn-rt-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--fg);
}

.btn-rt-ghost:hover,
.btn-rt-ghost:focus-visible {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--fg);
}

.btn-rt-danger {
  background: transparent;
  border: 1px solid rgba(232, 160, 160, 0.35);
  color: #f0b8b8;
}

.btn-rt-danger:hover,
.btn-rt-danger:focus-visible {
  background: var(--danger-bg);
  border-color: rgba(232, 160, 160, 0.5);
  color: #f5c8c8;
}

/* Detail */
.rt-breadcrumb {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rt-breadcrumb a {
  color: var(--fg-muted);
  text-decoration: none;
}

.rt-breadcrumb a:hover {
  color: var(--accent);
}

.rt-dl dt {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin-bottom: 0.25rem;
}

.rt-dl dd {
  margin: 0 0 1rem;
  color: var(--fg);
}

.rt-dl .col-sm-6:last-child dd,
.rt-dl dd:last-child {
  margin-bottom: 0;
}

.rt-notes {
  white-space: pre-wrap;
  color: var(--fg);
  line-height: 1.6;
}

.rt-value-block .rt-stat-value {
  color: var(--accent);
}

/* Worklogs */
.rt-worklog-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.rt-worklog-card {
  scroll-margin-top: 5rem;
}

.rt-worklog-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.rt-worklog-author {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
}

.rt-worklog-meta {
  color: var(--fg-muted);
  font-size: var(--text-xs);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
}

.rt-meta-sep {
  color: var(--fg-subtle);
}

.rt-worklog-notes {
  margin: 0 0 var(--space-4);
}

.rt-empty-worklogs {
  text-align: center;
  padding: var(--space-6) var(--space-5);
}

.rt-empty-worklogs .rt-empty {
  padding: 0 !important;
}

/* Photo grid */
.rt-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--space-3);
}

.rt-photo-thumb {
  display: block;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color var(--motion-quick) var(--ease-out), transform var(--motion-quick) var(--ease-out);
}

.rt-photo-thumb:hover {
  border-color: var(--border-strong);
  transform: scale(1.02);
}

.rt-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rt-photo-grid-edit {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.rt-photo-edit {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.rt-photo-edit .rt-photo-thumb {
  aspect-ratio: 1;
}

.rt-photo-name {
  font-size: var(--text-xs);
  color: var(--fg-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt-photo-remove {
  margin: 0;
}

/* Mobile cards */
.rt-machine-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-decoration: none;
  color: inherit;
  margin-bottom: var(--space-2);
  transition: border-color var(--motion-quick) var(--ease-out);
}

.rt-machine-card:hover {
  border-color: var(--border-strong);
  color: inherit;
}

/* Footer */
.rt-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-5) 0;
  margin-top: var(--space-6);
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

.rt-footer-muted {
  color: var(--fg-subtle);
}

/* HTMX busy */
.htmx-request .rt-table tbody {
  opacity: 0.55;
  transition: opacity var(--motion-quick) var(--ease-out);
}

/* Standalone display mode (installed PWA) */
@media (display-mode: standalone) {
  .rt-nav {
    padding-top: max(0.5rem, var(--safe-top));
  }
}

@media (max-width: 767.98px) {
  .rt-table thead {
    display: none;
  }

  .rt-panel.p-0 .table-responsive {
    display: none;
  }

  .rt-worklog-head {
    flex-direction: column;
  }
}

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

/* Photo picker — camera + library (iOS-friendly) */
.rt-visually-hidden-file {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.rt-photo-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rt-photo-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

@media (min-width: 576px) {
  .rt-photo-actions {
    grid-template-columns: 1fr 1fr;
  }
  .rt-photo-action-secondary {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) {
  .rt-photo-actions {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .rt-photo-action-secondary {
    grid-column: auto;
  }
}

.rt-photo-action {
  justify-content: flex-start !important;
  gap: 0.75rem;
  min-height: 56px;
  text-align: left;
  padding: 0.75rem 1rem;
}

.rt-photo-action .bi {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.95;
}

.rt-photo-action-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  line-height: 1.25;
}

.rt-photo-action-label strong {
  font-weight: 600;
  font-size: var(--text-sm);
}

.rt-photo-action-label small {
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--fg-muted);
  opacity: 0.95;
}

.btn-rt-primary.rt-photo-action .rt-photo-action-label small {
  color: color-mix(in oklab, var(--accent-fg) 70%, transparent);
}

.rt-photo-ios-hint {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--border));
  background: var(--accent-dim);
  color: var(--fg);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.rt-photo-status {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.rt-photo-status-error {
  color: #f0b8b8;
}

.rt-photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.rt-pending-photo {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
}

.rt-pending-photo-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
  background: var(--bg-subtle);
}

.rt-pending-photo-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.rt-pending-photo-name {
  font-size: var(--text-xs);
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt-pending-photo-size {
  font-size: 0.7rem;
  color: var(--fg-subtle);
}

.rt-pending-photo-remove {
  width: 100%;
}

/* Larger touch targets on iOS photo picker */
.rt-photo-picker-ios .rt-photo-action {
  min-height: 64px;
}

@supports (-webkit-touch-callout: none) {
  .rt-photo-action {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Machine gallery */
.rt-machine-gallery {
  scroll-margin-top: 5rem;
}

.rt-gallery-hero {
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .rt-gallery-hero {
    grid-template-columns: 1fr minmax(100px, 160px);
    align-items: stretch;
  }
}

.rt-gallery-main {
  display: block;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  aspect-ratio: 16 / 10;
}

.rt-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rt-gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: var(--space-2);
}

@media (min-width: 768px) {
  .rt-gallery-thumbs {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(72px, 1fr);
    max-height: 100%;
    overflow-y: auto;
  }
}

.rt-gallery-thumb {
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 1;
  background: var(--bg-elevated);
}

.rt-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rt-empty-photos {
  text-align: center;
  padding: var(--space-6) var(--space-5);
}

.rt-empty-photos .rt-empty {
  padding: 0 !important;
}

/* List thumbnails */
.rt-col-thumb {
  width: 56px;
  padding-right: 0 !important;
}

.rt-list-thumb {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.rt-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rt-list-thumb-empty {
  display: block;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, var(--bg-subtle) 0%, var(--bg-elevated) 100%);
}

.rt-list-thumb-card {
  width: 56px;
  height: 56px;
}

.min-w-0 {
  min-width: 0;
}

/* Parts */
.rt-location-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rt-location-bin {
  background: rgba(140, 170, 200, 0.1);
  color: #c5d5e5;
  border-color: rgba(140, 170, 200, 0.25);
}

.rt-location-installed {
  background: var(--accent-dim);
  color: #b6ebc7;
  border-color: rgba(143, 214, 168, 0.28);
}

a.rt-location-installed:hover {
  color: var(--accent);
}

.rt-placement {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

@media (min-width: 576px) {
  .rt-placement {
    grid-template-columns: 1fr 1fr;
  }
}

.rt-placement-option {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  min-height: 64px;
}

.rt-placement-option:has(input:checked) {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--border-strong));
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 30%, transparent);
}

.rt-placement-option input {
  margin-top: 0.25rem;
  accent-color: var(--accent);
}

.rt-placement-option strong {
  display: block;
  font-size: var(--text-sm);
  color: var(--fg);
}

.rt-placement-option small {
  display: block;
  color: var(--fg-muted);
  font-size: var(--text-xs);
  margin-top: 0.15rem;
}

.rt-part-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.rt-part-list-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.rt-part-list-item:last-child {
  border-bottom: 0;
}

.rt-install-from-bin {
  padding: var(--space-4) var(--space-5);
}

.rt-install-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  list-style: none;
}

.rt-install-summary::-webkit-details-marker {
  display: none;
}

.rt-install-summary::before {
  content: "▸ ";
  color: var(--accent);
}

details[open] > .rt-install-summary::before {
  content: "▾ ";
}

#parts {
  scroll-margin-top: 5rem;
}

/* Storage locations — list tiles (v3) */
.rt-loc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.rt-loc-list-item {
  margin: 0;
  padding: 0;
}
.rt-loc-tile {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none !important;
  color: var(--fg) !important;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.rt-loc-tile:hover,
.rt-loc-tile:focus-visible {
  border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
  color: var(--fg) !important;
  text-decoration: none !important;
}
.rt-loc-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}
.rt-loc-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Fixed-size thumbnail — never expands the page */
.rt-loc-tile-thumb {
  flex: 0 0 7.5rem;
  width: 7.5rem;
  max-width: 7.5rem;
  min-height: 5.75rem;
  position: relative;
  background: var(--map-surface);
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.rt-loc-tile-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 0;
  max-width: none;
}
.rt-loc-tile-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  font-size: 1.35rem;
  background:
    radial-gradient(ellipse at 40% 30%, rgba(143, 214, 168, 0.1), transparent 60%),
    var(--map-panel);
}

.rt-loc-tile-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}
.rt-loc-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.rt-loc-tile-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--fg);
  text-transform: none;
  text-decoration: none !important;
}
.rt-loc-tile-photos {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.rt-loc-tile-address {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none !important;
}
.rt-loc-tile-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.rt-loc-tile-stats strong {
  color: var(--fg);
  font-weight: 650;
}
.rt-loc-tile-dot {
  opacity: 0.5;
}
.rt-loc-tile-go {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 0.9rem 0 0.25rem;
  color: var(--fg-subtle);
  font-size: 1rem;
}

@media (min-width: 576px) {
  .rt-loc-tile-thumb {
    flex-basis: 9.5rem;
    width: 9.5rem;
    max-width: 9.5rem;
    min-height: 6.5rem;
  }
}
@media (min-width: 768px) {
  .rt-loc-tile-thumb {
    flex-basis: 11rem;
    width: 11rem;
    max-width: 11rem;
    min-height: 7rem;
  }
  .rt-loc-tile-body {
    padding: 1rem 1.15rem;
  }
  .rt-loc-tile-name {
    font-size: 1.2rem;
  }
}

/* keep legacy class harmless if referenced */
.rt-location-card { display: block; }

.rt-room-card {
  transition: border-color var(--motion-quick) var(--ease-out), transform var(--motion-quick) var(--ease-out);
  color: inherit;
}
.rt-room-card:hover {
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
  transform: translateY(-1px);
  color: inherit;
}

.rt-unit-badge {
  font-size: var(--text-xs);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  white-space: nowrap;
}

.rt-mini-map {
  position: relative;
  height: 72px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 12px 12px,
    var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.rt-mini-bin {
  position: absolute;
  border-radius: 2px;
  opacity: 0.85;
  min-width: 4px;
  min-height: 4px;
}

/* Room map canvas */
.rt-map-shell {
  position: relative;
}

.rt-room-map {
  position: relative;
  width: 100%;
  aspect-ratio: var(--map-aspect, 1.428);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(143, 214, 168, 0.06), transparent 50%),
    linear-gradient(180deg, var(--map-panel) 0%, var(--map-panel-deep) 100%);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.rt-map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 5% 5%;
  pointer-events: none;
}

.rt-map-bin {
  position: absolute;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  color: var(--map-ink);
  padding: 0.35rem 0.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  cursor: pointer;
  min-width: 28px;
  min-height: 24px;
  transition: box-shadow var(--motion-quick) var(--ease-out), outline-color var(--motion-quick);
}

.rt-map-design .rt-map-bin {
  cursor: grab;
}

.rt-map-design .rt-map-bin.rt-bin-dragging {
  cursor: grabbing;
  z-index: 5;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  outline: 2px solid var(--accent);
}

.rt-map-bin.rt-bin-selected {
  outline: 2px solid var(--accent);
  z-index: 4;
}

.rt-map-bin-label {
  font-size: 0.7rem;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  overflow: hidden;
}

.rt-map-bin-label strong {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.rt-map-bin-label span {
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rt-map-bin-counts {
  display: flex;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  opacity: 0.9;
}

.rt-map-bin-handle {
  display: none;
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(0,0,0,0.25);
  cursor: nwse-resize;
}

.rt-map-design .rt-map-bin-handle {
  display: block;
}

.rt-map-status {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}
.rt-map-status-error { color: #f0b8b8; }

.rt-bin-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.form-control-color {
  min-height: 44px;
  max-width: 5rem;
  padding: 0.25rem;
}



/* ── Storage polish (v2) ─────────────────────────────────────────── */
.rt-storage-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
@media (min-width: 768px) {
  .rt-storage-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}
.rt-storage-header-main {
  min-width: 0;
  flex: 1;
}
.rt-storage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.rt-storage-actions form {
  display: inline;
  margin: 0;
}

/* Location photo strip (not giant 16:10 hero) */
.rt-loc-photos-strip {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-2);
}
@media (max-width: 575.98px) {
  .rt-loc-photos-strip {
    grid-template-columns: 1fr 1fr;
  }
  .rt-loc-photo-primary {
    grid-column: 1 / -1;
  }
}
.rt-loc-photo {
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  aspect-ratio: 4 / 3;
}
.rt-loc-photo-primary {
  aspect-ratio: 16 / 10;
}
.rt-loc-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Room cards */
.rt-room-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none !important;
  color: var(--fg) !important;
  transition: border-color var(--motion-quick) var(--ease-out),
              transform var(--motion-quick) var(--ease-out);
}
.rt-room-card:hover {
  border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
  transform: translateY(-2px);
  color: var(--fg) !important;
}
.rt-room-card-map {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.rt-room-card-body {
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.rt-room-card-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-transform: none;
  line-height: 1.25;
}
.rt-mini-map-lg {
  height: 120px;
  border: 0;
  border-radius: 0;
}
.rt-mini-bin {
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}

.rt-unit-badge {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono, ui-monospace, monospace);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* Map layout */
.rt-map-layout {
  display: grid;
  gap: var(--space-4);
}
@media (min-width: 992px) {
  .rt-map-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }
}
.rt-map-main {
  min-width: 0;
}
.rt-map-shell {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  background: var(--map-surface);
  box-shadow: var(--shadow);
}
.rt-room-map {
  position: relative;
  width: 100%;
  aspect-ratio: var(--map-aspect, 1.428);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(143, 214, 168, 0.05), transparent 55%),
    #111416;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.rt-map-floor {
  position: absolute;
  inset: 3%;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 4px;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 6.25% 6.25%;
  pointer-events: none;
}
.rt-map-compass {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}
.rt-map-hint {
  margin: 0.65rem 0 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}
.rt-map-status {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-muted);
  min-height: 1.25em;
}
.rt-map-status-error { color: #f0b8b8; }

.rt-map-bin {
  position: absolute;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.22);
  background: var(--bin-color, #3d5a4c);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.12);
  color: var(--bin-label);
  padding: 0.35rem 0.45rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  cursor: pointer;
  min-width: 36px;
  min-height: 28px;
  z-index: 1;
}
.rt-map-design .rt-map-bin { cursor: grab; }
.rt-map-design .rt-map-bin.rt-bin-dragging {
  cursor: grabbing;
  z-index: 10;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
  outline: 2px solid var(--accent);
}
.rt-map-bin.rt-bin-selected {
  outline: 2px solid var(--accent);
  z-index: 8;
}
.rt-map-bin-label {
  font-size: 0.68rem;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.rt-map-bin-label strong {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}
.rt-map-bin-label span {
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rt-map-bin-counts {
  display: flex;
  gap: 0.3rem;
  font-size: 0.62rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  opacity: 0.9;
}
.rt-map-bin-handle {
  display: none;
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0,0,0,0.3);
  cursor: nwse-resize;
}
.rt-map-design .rt-map-bin-handle { display: block; }

/* Sidebar bin list */
.rt-bin-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rt-bin-list > li + li {
  border-top: 1px solid var(--border);
}
.rt-bin-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  text-decoration: none !important;
  color: inherit !important;
}
.rt-bin-list-item:first-child { padding-top: 0; }
.rt-bin-list > li:last-child .rt-bin-list-item { padding-bottom: 0; }
.rt-bin-list-item:hover .rt-bin-list-name { color: var(--accent); }
.rt-bin-list-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}
.rt-bin-list-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--fg);
  text-transform: none;
}
.rt-bin-list-chevron {
  color: var(--fg-subtle);
  font-size: 0.85rem;
}
.rt-bin-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}
.rt-bin-swatch-lg {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 5px;
}

/* Content lists on bin page */
.rt-content-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rt-content-list-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.rt-content-list-item:last-child { border-bottom: 0; }

.form-control-color {
  min-height: 44px;
  max-width: 100%;
  padding: 0.35rem;
  width: 5rem;
}


/* ── Auth ─────────────────────────────────────────────────────────── */
.rt-auth-wrap {
  max-width: 28rem;
  margin: 0 auto;
}
.rt-auth-wrap-wide {
  max-width: 36rem;
}
.rt-auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--fg-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rt-auth-divider::before,
.rt-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.rt-oauth-stack {
  display: grid;
  gap: 0.55rem;
}
.btn-rt-oauth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg) !important;
  font-weight: 600;
  text-decoration: none !important;
}
.btn-rt-oauth:hover {
  border-color: color-mix(in oklab, var(--accent) 40%, var(--border));
  background: var(--bg-elevated);
  color: var(--fg) !important;
}
.btn-rt-oauth.disabled,
.rt-oauth-disabled .btn-rt-oauth {
  opacity: 0.45;
  pointer-events: none;
}
.rt-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.55rem 0.2rem 0.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg) !important;
  text-decoration: none !important;
  font-size: 0.85rem;
  font-weight: 600;
}
.rt-user-avatar {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--accent) 25%, var(--bg));
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.rt-user-name {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ── QR shortlinks ──────────────────────────────────────────────── */
.rt-shortlink-card {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.rt-shortlink-qr {
  flex: 0 0 auto;
  padding: 0.5rem;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  line-height: 0;
}
.rt-shortlink-qr img {
  display: block;
  width: 140px;
  height: 140px;
  image-rendering: pixelated;
}
.rt-shortlink-body {
  flex: 1 1 14rem;
  min-width: 0;
}
.rt-shortlink-url {
  margin: 0 0 0.35rem;
  word-break: break-all;
}
.rt-shortlink-href {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--accent) !important;
  text-decoration: none !important;
}
.rt-shortlink-href:hover {
  text-decoration: underline !important;
}
.rt-shortlink-copied {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}
@media (max-width: 575.98px) {
  .rt-shortlink-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

.rt-forgot {
  font-size: 0.85rem;
  white-space: nowrap;
}


/* ── Public landing hero ─────────────────────────────────────────── */
body.rt-body-landing main {
  padding: 0;
}

.rt-landing-hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3.5rem);
}

.rt-landing-title {
  font-size: clamp(2.25rem, 1.6rem + 2.8vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0;
  color: var(--fg);
}

.rt-landing-title-accent {
  color: var(--accent);
}

.rt-landing-lead {
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.2rem);
  color: var(--fg-muted);
  max-width: 36rem;
  line-height: 1.55;
  margin: 0;
}

.rt-landing-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rt-landing-panel-chrome {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.rt-landing-panel-chrome span {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--border-strong);
}

.rt-landing-panel-chrome span:nth-child(1) { background: #e8a0a0; }
.rt-landing-panel-chrome span:nth-child(2) { background: #d4c48a; }
.rt-landing-panel-chrome span:nth-child(3) { background: var(--accent); }

.rt-landing-panel-chrome em {
  margin-left: auto;
  font-style: normal;
  font-size: 0.75rem;
  color: var(--fg-subtle);
  letter-spacing: 0.06em;
}

.rt-landing-panel-body {
  padding: 1.25rem 1.25rem 1.35rem;
}

.rt-landing-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.rt-landing-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  margin-bottom: 0.2rem;
}

.rt-landing-stat-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 650;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.rt-landing-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rt-landing-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  min-width: 0;
}

.rt-landing-list li .rt-mono {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt-landing-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex: 0 0 auto;
}
.rt-dot-ok { background: var(--ok); }
.rt-dot-warn { background: var(--warn); }
.rt-dot-muted { background: var(--fg-subtle); }

.rt-landing-tag {
  flex: 0 0 auto;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-xs);
  font-weight: 600;
}

.rt-landing-qr-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.rt-landing-features {
  padding: 0 0 clamp(2.5rem, 5vw, 4rem);
  scroll-margin-top: 5rem;
}

.rt-landing-card {
  padding: 1.25rem 1.3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}

@media (hover: hover) {
  .rt-landing-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
  }
}

.rt-landing-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 1.2rem;
  margin-bottom: 0.85rem;
}

.rt-landing-card-title {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.rt-landing-cta {
  padding: 0 0 clamp(3rem, 6vw, 5rem);
}

.rt-landing-cta-panel {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(143, 214, 168, 0.08), transparent 55%),
    var(--bg-elevated);
  box-shadow: var(--shadow);
}

.rt-landing-cta-title {
  font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

@media (max-width: 575.98px) {
  .rt-landing-stat-value {
    font-size: 1.1rem;
  }
  .rt-landing-list li {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rt-landing-card {
    transition: none;
  }
  .rt-landing-card:hover {
    transform: none;
  }
}


/* ── MFA / passkeys ──────────────────────────────────────────────── */
.rt-totp-setup {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: flex-start;
}
.rt-totp-qr {
  flex: 0 0 auto;
  padding: 0.75rem;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  line-height: 0;
}
.rt-totp-qr img {
  display: block;
  width: 200px;
  height: 200px;
}
.rt-totp-secret {
  font-size: 1rem;
  letter-spacing: 0.08em;
  word-break: break-all;
  color: var(--accent);
  margin: 0;
}
.rt-recovery-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5rem 1rem;
}
.rt-recovery-list li {
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
}
.rt-flash-ok {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(143, 214, 168, 0.25);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}


/* ── Profile avatars ─────────────────────────────────────────────── */
.rt-user-avatar {
  overflow: hidden;
  position: relative;
}
.rt-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 999px;
}
.rt-profile-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}
.rt-profile-avatar-lg {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 999px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--accent) 22%, var(--bg));
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.rt-profile-avatar-title {
  width: 4.5rem;
  height: 4.5rem;
  font-size: 1.15rem;
}
.rt-profile-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rt-profile-head-meta {
  flex: 1 1 12rem;
  min-width: 0;
}
.rt-divider {
  border: 0;
  border-top: 1px solid var(--border);
  opacity: 1;
}
.rt-avatar-picker .rt-photo-actions {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 575.98px) {
  .rt-avatar-picker .rt-photo-actions {
    grid-template-columns: 1fr;
  }
}


/* ── Theme toggle ────────────────────────────────────────────────── */
.rt-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 999px;
  flex: 0 0 auto;
}
.rt-theme-toggle .rt-theme-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.rt-theme-toggle .rt-theme-icon-sun { display: none; }
.rt-theme-toggle .rt-theme-icon-moon { display: none; }
.rt-theme-toggle .rt-theme-icon-auto { display: none; }
html[data-theme-pref="light"] .rt-theme-toggle .rt-theme-icon-sun { display: inline; }
html[data-theme-pref="dark"] .rt-theme-toggle .rt-theme-icon-moon { display: inline; }
html[data-theme-pref="system"] .rt-theme-toggle .rt-theme-icon-auto { display: inline; }

html[data-theme="light"] .rt-nav .navbar-toggler-icon {
  filter: invert(0.2);
}
html[data-theme="dark"] .rt-nav .navbar-toggler-icon {
  filter: invert(1);
}

html[data-theme="light"] .rt-landing-title-accent {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  body.rt-body {
    transition: none;
  }
}

/* ── Admin / users ───────────────────────────────────────────────── */
.rt-crumb {
  color: inherit;
  text-decoration: none;
}
.rt-crumb:hover,
.rt-crumb:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.rt-badge-admin {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 38%, transparent);
}
.rt-badge-member {
  background: var(--bg-subtle);
  color: var(--fg-muted);
  border-color: var(--border-strong);
}

.rt-user-list-thumb {
  border-radius: 999px;
}
.rt-user-initials {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 18%, var(--bg-subtle));
}

.rt-stat-list {
  display: grid;
  gap: 0;
  margin: 0;
}
.rt-stat-list > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.rt-stat-list > div:first-child {
  padding-top: 0;
}
.rt-stat-list > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.rt-stat-list dt {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  font-weight: 500;
}
.rt-stat-list dd {
  margin: 0;
  color: var(--fg);
  font-weight: 600;
}

.rt-meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rt-meta-list li {
  padding: 0.4rem 0;
  color: var(--fg);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border);
}
.rt-meta-list li:first-child {
  padding-top: 0;
}
.rt-meta-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.rt-panel-danger {
  border-color: color-mix(in oklab, var(--danger) 42%, var(--border));
  background: color-mix(in oklab, var(--danger-bg) 80%, var(--bg-elevated));
}

.rt-admin-form {
  max-width: 32rem;
}

html[data-theme="light"] .btn-rt-danger {
  color: var(--danger);
  border-color: color-mix(in oklab, var(--danger) 38%, var(--border));
}
html[data-theme="light"] .btn-rt-danger:hover,
html[data-theme="light"] .btn-rt-danger:focus-visible {
  color: var(--danger);
}

/* ── Invites / admin tabs ────────────────────────────────────────── */
.rt-admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 1.35rem;
  padding: 0.25rem;
  width: fit-content;
  max-width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.rt-admin-tab {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  color: var(--fg-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}
.rt-admin-tab:hover,
.rt-admin-tab:focus-visible {
  color: var(--fg);
  background: color-mix(in oklab, var(--bg-elevated) 70%, transparent);
}
.rt-admin-tab.is-active {
  color: var(--fg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.rt-invite-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.rt-invite-url {
  word-break: break-all;
  margin: 0;
}

.rt-expiry-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.rt-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.4rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}
.rt-choice input {
  margin: 0;
  accent-color: var(--accent);
}
.rt-choice:has(input:checked) {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--border));
  background: var(--accent-dim);
  color: var(--accent);
}


