:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-elevated: #243247;
  --surface-hover: #263449;
  --border: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --nav-height: 66px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}

body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(var(--nav-height) + 24px + env(safe-area-inset-bottom));
}

body:has(dialog[open]) {
  overflow: hidden;
  overscroll-behavior: none;
}

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

button {
  touch-action: manipulation;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* Single-Row Minimal Sticky Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.app-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.app-version {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.sync-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.sync-pill.is-synced {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.35);
}

.sync-pill.is-pending {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.4);
}

.sync-pill.is-error {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.45);
}

.modifier-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  max-width: 150px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}

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

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: #5558e8;
}

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

.btn-ghost:hover {
  background: var(--surface-hover);
}

.btn-icon {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-icon:hover {
  background: var(--surface-hover);
}

.btn-block {
  width: 100%;
}

.header-settings-btn {
  font-size: 1.2rem;
}

/* Main Content & Tab Panels */
.main-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px 20px;
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.tab-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.tab-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.count-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

/* Clean Empty States */
.empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 28px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 1.65rem;
}

.empty-heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.empty-body {
  margin: 0;
  max-width: 460px;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-body strong {
  color: var(--text);
  font-weight: 600;
}

.empty-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 420px;
  margin-top: 4px;
}

.meta-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  text-align: left;
}

.meta-chip-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.meta-chip-value {
  font-size: 0.84rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-footnote {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Fixed Four-Tab Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-inner {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px 8px;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.nav-tab:hover {
  color: var(--text);
  background: rgba(30, 41, 59, 0.65);
}

.nav-tab.is-active {
  color: #c7d2fe;
  background: var(--accent-soft);
  border-color: rgba(99, 102, 241, 0.38);
}

.nav-tab-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-tab-label {
  line-height: 1.1;
  white-space: nowrap;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 28px);
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Sheet Dialogs */
.sheet-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.sheet-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}

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

.dialog-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.dialog-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.dialog-section:first-of-type {
  border-top: none;
  padding-top: 4px;
}

.section-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a5b4fc;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
}

.kv-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.7);
  font-size: 0.85rem;
}

.kv-row dt {
  color: var(--muted);
}

.kv-row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-danger-ghost {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.38);
  color: #fca5a5;
}

.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.2);
}

.file-btn {
  text-align: center;
  user-select: none;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.muted-inline {
  font-weight: 400;
  opacity: 0.85;
}

.text-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text);
  font-size: 0.9rem;
}

.text-input:focus {
  outline: 2px solid rgba(99, 102, 241, 0.55);
  outline-offset: 1px;
  border-color: var(--accent);
}

.sub-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(51, 65, 85, 0.8);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(51, 65, 85, 0.75);
  font-size: 0.84rem;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.preview-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.preview-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #c7d2fe;
}

.warning-list {
  margin: 0;
  padding: 8px 12px 8px 24px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fde68a;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.helper-text.is-error {
  color: #fca5a5;
}

.helper-text.is-success {
  color: #6ee7b7;
}

.dialog-actions-row {
  display: flex;
  gap: 8px;
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phase 3: Trackers Tab, 2-Column Grid, Stream Tiles, Folders & Reorganize Mode */
.tab-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.btn-compact {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.84rem;
}

.btn-icon.is-active {
  background: var(--accent-soft);
  border-color: rgba(99, 102, 241, 0.55);
  color: #c7d2fe;
}

.empty-cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

/* Folder Filter Bar */
.folder-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.folder-pills-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.folder-pills-scroll::-webkit-scrollbar {
  display: none;
}

.folder-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.folder-pill:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.folder-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.folder-order-btn {
  flex: 0 0 auto;
  min-width: 38px;
  min-height: 38px;
  font-size: 0.95rem;
}

/* Reorganize Banner */
.reorganize-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.45);
}

.reorganize-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
}

.reorganize-scope {
  color: #c7d2fe;
  font-size: 0.76rem;
}

/* 2-Column Trackers Tile Grid */
.trackers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.tracker-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-accent, var(--accent));
  min-width: 0;
  transition: transform 120ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.tracker-card.is-wide-scale {
  grid-column: 1 / -1;
}

.tracker-card.is-reorganizing {
  user-select: none;
  touch-action: none;
  cursor: grab;
  border-style: dashed;
  border-color: rgba(165, 180, 252, 0.55);
}

.tracker-card.is-dragging {
  opacity: 0.65;
  transform: scale(0.97);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  z-index: 5;
}

.tracker-card.is-focus-pulse {
  box-shadow: 0 0 0 2px var(--accent), 0 0 20px rgba(99, 102, 241, 0.45);
}

.tracker-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.tracker-card-identity {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1 1 auto;
  padding: 2px 0;
  border: none;
  background: transparent;
  text-align: left;
  color: inherit;
}

.tracker-card-icon {
  font-size: 1.2rem;
  line-height: 1;
  flex: 0 0 auto;
}

.tracker-card-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tracker-card-name {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.period-chip,
.parent-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(51, 65, 85, 0.85);
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parent-chip {
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.32);
}

.tracker-detail-trigger {
  flex: 0 0 auto;
  min-width: 32px;
  min-height: 32px;
  padding: 0 6px;
  border-radius: 9px;
  border: 1px solid rgba(51, 65, 85, 0.8);
  background: rgba(15, 23, 42, 0.55);
  color: var(--muted);
  font-size: 0.8rem;
}

.tracker-detail-trigger:hover {
  color: var(--text);
  background: var(--surface-hover);
}

/* Numeric Stream */
.tracker-metric-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-height: 32px;
}

.tracker-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tracker-unit {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-numeric-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 6px;
}

.tracker-step-btn {
  min-height: 44px;
  padding: 0 10px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--card-accent, var(--accent));
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
}

.tracker-step-btn:active {
  transform: scale(0.97);
}

.tracker-custom-btn {
  min-height: 44px;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
}

/* Boolean Stream */
.boolean-sub-meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.boolean-toggle-btn {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

.boolean-toggle-btn.is-done {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.55);
  color: #6ee7b7;
}

/* Scale Stream */
.scale-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--muted);
}

.scale-readout strong {
  color: var(--text);
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 5px;
}

.scale-btn {
  min-height: 40px;
  padding: 0 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.scale-btn.is-selected {
  background: var(--card-accent, var(--accent));
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Text Stream */
.text-snippet {
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.65);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.text-snippet.has-value {
  color: var(--text);
}

.text-log-btn {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.38);
  color: #c7d2fe;
  font-size: 0.84rem;
  font-weight: 700;
}

/* Parent-Child Rollup Sublist on Card */
.child-rollup-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(51, 65, 85, 0.7);
}

.child-rollup-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 28px;
  padding: 2px 6px;
  border-radius: 8px;
  border: none;
  background: rgba(15, 23, 42, 0.45);
  color: #a5b4fc;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: left;
}

.child-sublist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.child-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  font-size: 0.76rem;
}

.child-row-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.child-quick-btn {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
}

/* Reorganize Card Controls */
.reorganize-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 4px;
}

.reorg-move-btn {
  flex: 1 1 0;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  font-weight: 700;
}

.reorg-drag-hint {
  font-size: 0.72rem;
  color: #a5b4fc;
  font-weight: 600;
}

/* Forms, Color Swatches & Detail Modal */
.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.color-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.color-picker {
  width: 44px;
  height: 44px;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.75);
  cursor: pointer;
}

.swatch-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  padding: 0;
}

.icon-preset-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.preset-chip {
  flex: 0 0 auto;
  min-width: 38px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
  font-size: 1.05rem;
}

.text-area-input {
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}

.detail-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.detail-icon {
  font-size: 1.65rem;
  line-height: 1;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.detail-stats-grid {
  margin-bottom: 8px;
}

.time-now-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

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

.entries-list,
.detail-sub-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.52);
  border: 1px solid rgba(51, 65, 85, 0.78);
}

.entry-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.entry-value-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

.entry-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.entry-note {
  font-size: 0.8rem;
  color: #cbd5e1;
  word-break: break-word;
}

.rollup-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  font-size: 0.68rem;
  font-weight: 600;
}

.entry-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.entry-action-btn {
  min-width: 34px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 600;
}

.entry-action-btn.is-danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.12);
}

.toast-undo-btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 360px) {
  .trackers-grid {
    grid-template-columns: 1fr;
  }
}
