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

:root {
  /* Dark canvas with a warm green-neutral tint (gemstone-market-inverse) */
  --bg: oklch(0.13 0.008 165);
  --surface: oklch(0.17 0.010 165);
  --surface-2: oklch(0.20 0.012 165);
  --surface-3: oklch(0.25 0.014 165);

  /* Text: crisper than Material 3 defaults — needed on a tinted dark bg */
  --white: oklch(0.98 0.005 165);
  --text: oklch(0.93 0.010 165);
  --text-muted: oklch(0.72 0.014 165);
  --text-light: oklch(0.55 0.012 165);

  /* Borders: slightly warmer greens for cohesion */
  --border: oklch(0.30 0.014 165);
  --border-strong: oklch(0.40 0.016 165);

  /* Accent: emerald (gemstone-market signature, inverted for dark mode) */
  --accent: oklch(0.72 0.14 162);
  --accent-hover: oklch(0.64 0.15 162);
  --accent-ink: oklch(0.10 0.03 162);
  --accent-light: oklch(0.72 0.14 162 / 0.14);
  --accent-glow: oklch(0.72 0.14 162 / 0.22);

  /* Brand legacy names now point at emerald so existing rules inherit the new identity */
  --orange: oklch(0.72 0.14 162);
  --orange-light: oklch(0.72 0.14 162 / 0.14);

  /* Semantic status palette — still gemstone-inspired (sapphire / ruby / amber) */
  --blue: oklch(0.72 0.13 245);
  --blue-light: oklch(0.72 0.13 245 / 0.12);
  --green: oklch(0.72 0.14 162);
  --green-light: oklch(0.72 0.14 162 / 0.14);
  --red: oklch(0.66 0.17 22);
  --red-light: oklch(0.66 0.17 22 / 0.14);
  --yellow: oklch(0.80 0.12 80);
  --yellow-light: oklch(0.80 0.12 80 / 0.14);
  --gray: oklch(0.52 0.010 165);
  --gray-light: oklch(0.22 0.008 165);

  /* Spacing: 4px base, 8px layout grid */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Touch targets: Apple HIG 44pt / WCAG AAA */
  --touch-min: 2.75rem;

  /* Radii: gemstone-market-inspired — softer, more bubble-like */
  --radius: 0.85rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.6rem;
  --radius-pill: 999px;

  /* Typography: gemstone-market stack */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'SF Pro', 'Segoe UI', sans-serif;
  --font-serif: 'Instrument Serif', 'Georgia', serif;
  --font-wordmark: 'Cormorant Garamond', 'Times New Roman', serif;

  --text-caption: 0.75rem;
  --text-footnote: 0.8125rem;
  --text-subhead: 0.9375rem;
  --text-body: 1.0625rem;
  --text-title: 1.25rem;
  --ease-soft: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html { background: var(--bg); }

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 500;
  font-feature-settings: 'ss01', 'cv11';
  letter-spacing: -0.005em;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

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

/* ── HEADER ── */
header {
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 0;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
}

.logo-diamond {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-ink);
  box-shadow: 0 6px 16px var(--accent-glow);
}

.logo-diamond svg {
  width: 18px;
  height: 18px;
  display: block;
}

.logo-wordmark {
  font-family: var(--font-wordmark);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 3s ease-in-out infinite;
}

.status-dot.offline { background: var(--red); box-shadow: 0 0 8px var(--red); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 0;
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-subhead);
  font-weight: 500;
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-min);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.tab:hover { color: var(--white); }
.tab.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ── MAIN ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 22px 26px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}

.section-header {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

/* ── TASKS ── */
.task-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: var(--space-2) var(--space-4);
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-subhead);
  font-weight: 500;
  min-height: var(--touch-min);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.filter-pill:hover { border-color: var(--orange); color: var(--text); }
.filter-pill.active { background: var(--orange); color: white; border-color: var(--orange); }

.filter-pill .count {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

.filter-pill.active .count { background: rgba(255,255,255,0.25); color: white; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

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

.task-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  margin-top: 1px;
}

.task-checkbox:hover { border-color: var(--orange); }

.task-checkbox.checked {
  background: var(--green);
  border-color: var(--green);
}

.task-checkbox.checked::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.task-body { flex: 1; min-width: 0; }

.task-title {
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--white);
  margin-bottom: var(--space-1);
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-section-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.task-section-header.completed-header {
  cursor: pointer;
  user-select: none;
}

.task-section-header .task-section-count {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
}

.task-section-header .toggle-arrow {
  font-size: 9px;
  margin-left: auto;
  transition: transform 0.2s;
}

#completedTasks.collapsed { display: none; }

.followup-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.followup-item:last-child { border-bottom: none; }
.followup-item.done { opacity: 0.5; }
.followup-item .followup-check {
  width: 18px; height: 18px; min-width: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  margin-top: 2px;
}
.followup-item .followup-check.checked {
  background: var(--green);
  border-color: var(--green);
}
.followup-person {
  font-weight: 700;
  font-size: var(--text-body);
  color: var(--orange);
}
.followup-topic {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  margin-top: 2px;
}
.followup-due {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}
.followup-due.overdue { color: var(--red); font-weight: 600; }
.followup-delete {
  margin-left: auto;
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.followup-item:hover .followup-delete { opacity: 1; }
.followup-empty {
  color: var(--text-muted);
  font-size: var(--text-caption);
  padding: 16px 12px;
  text-align: center;
}

.task-completed-date {
  font-size: 11px;
  color: var(--text-light);
  margin-left: auto;
}

.timestamp-label {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 6px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  flex: 0 0 auto;
  width: auto;
  max-width: max-content;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1.4;
}

.badge-critical { background: var(--red-light); color: var(--red); }
.badge-high { background: var(--orange-light); color: var(--orange); }
.badge-medium { background: var(--blue-light); color: var(--blue); }
.badge-low { background: var(--gray-light); color: var(--text-muted); }
.badge-blocked { background: var(--yellow-light); color: var(--yellow); }
.badge-cat { background: var(--surface-2); color: var(--text-muted); font-weight: 500; }

.comment-count {
  font-size: 11px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── TASK EXPANDED ── */
.task-expanded {
  display: none;
  padding: 12px 0 4px 36px;
}

.task-expanded.open { display: block; }

.task-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.comment-list { margin-bottom: 12px; }

.comment {
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.comment-author {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.comment-author.topaz { color: var(--orange); }
.comment-author.sloth { color: var(--blue); }

.comment-time {
  font-size: 11px;
  color: var(--text-light);
}

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

.comment-form { display: flex; gap: 8px; }

.comment-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: var(--surface-2);
  color: var(--white);
  transition: border-color 0.15s;
}

.comment-input:focus { border-color: var(--blue); }
.comment-input::placeholder { color: var(--text-light); }

.comment-submit {
  padding: 8px 16px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ── ADD TASK (in note bar) ── */
.note-bar-add {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: white;
  border: none;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 500px;
}

.modal h2 {
  font-family: var(--font-serif);
  font-size: 1.95rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.05;
  color: var(--white);
  margin-bottom: 22px;
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.3;
  outline: none;
  background: var(--surface-2);
  color: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { appearance: none; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface-2); color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: var(--red); color: white; }

/* ── VENTURES ── */
.venture-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.venture-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gray);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.venture-card.health-green { border-left-color: var(--green); }
.venture-card.health-yellow { border-left-color: var(--orange); }
.venture-card.health-red { border-left-color: var(--red); }
.venture-card.health-gray { border-left-color: var(--gray); }

.venture-card.dragging {
  opacity: 0.5;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.venture-card.drag-over {
  border-top: 2px solid var(--orange);
}

.venture-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
}

.venture-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  touch-action: none;
}

.venture-drag-handle:active { cursor: grabbing; }

.venture-header-info { flex: 1; min-width: 0; }

.venture-name {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--white);
  margin-bottom: 2px;
}

.venture-type {
  font-size: var(--text-footnote);
  color: var(--text-muted);
}

.venture-health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.venture-health-dot.green { background: var(--green); }
.venture-health-dot.yellow { background: var(--orange); }
.venture-health-dot.red { background: var(--red); }
.venture-health-dot.gray { background: var(--gray); }

.venture-chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.venture-card.open .venture-chevron { transform: rotate(90deg); }

.venture-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-hover);
  color: var(--text-light);
  flex-shrink: 0;
}

.venture-body {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
}

.venture-card.open .venture-body { display: block; }

.venture-status {
  font-size: var(--text-subhead);
  color: var(--text);
  margin: 14px 0 8px;
  line-height: 1.5;
}

.venture-next {
  font-size: var(--text-footnote);
  color: var(--text-muted);
  margin-bottom: 14px;
}

.venture-next strong { color: var(--text); }

.venture-link {
  display: inline-block;
  margin-bottom: 14px;
  font-size: var(--text-footnote);
  color: var(--blue);
  text-decoration: none;
}

.venture-sub-section {
  margin-top: 12px;
}

.venture-sub-label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.venture-sub-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 4px;
  font-size: var(--text-subhead);
  color: var(--text);
  line-height: 1.4;
}

.venture-sub-item .sub-status {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.sub-status.pending { background: rgba(255,180,50,0.15); color: var(--orange); }
.sub-status.done { background: rgba(80,200,120,0.15); color: var(--green); }
.sub-status.blocked { background: rgba(255,80,80,0.15); color: var(--red); }
.sub-status.in_progress, .sub-status.active, .sub-status.building { background: rgba(80,160,255,0.15); color: var(--blue); }

.venture-task-title { flex: 1; min-width: 0; }
.venture-task-title.task-done { text-decoration: line-through; color: var(--text-muted); }

/* Sub-section count pill */
.venture-sub-count {
  margin-left: 6px;
  padding: 1px 7px;
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
}

/* Clickable artifact row inside venture cards */
.venture-artifact { cursor: pointer; transition: background 120ms ease; }
.venture-artifact:hover { background: var(--surface-2, rgba(255,255,255,0.04)); }
.venture-artifact-body { flex: 1; min-width: 0; }
.venture-artifact-title { font-weight: 600; color: var(--text); }
.venture-artifact-desc {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-caption);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.venture-artifact-meta {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.venture-artifact-view {
  flex-shrink: 0;
  align-self: center;
  font-size: 11px;
  padding: 5px 12px;
}

.venture-empty {
  font-size: var(--text-footnote);
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

/* ── DEBRIEFS (TIMELINE) ── */
.timeline { padding-left: 16px; }

.tl-item {
  position: relative;
  padding: 0 0 20px 24px;
  border-left: 2px solid var(--border);
  cursor: pointer;
}

.tl-item:last-child { border-left-color: transparent; }

.tl-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid var(--bg);
}

.tl-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.tl-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--white);
}

.tl-meta {
  font-size: var(--text-footnote);
  color: var(--text-light);
  white-space: nowrap;
}

.tl-summary {
  font-size: var(--text-subhead);
  color: var(--text-muted);
  line-height: 1.6;
}

.tl-body {
  display: none;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.tl-body.open { display: block; }

.debrief-show-more {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-light);
  font-size: var(--text-body);
  cursor: pointer;
  text-align: center;
}

.debrief-show-more:hover {
  background: var(--surface-hover);
  color: var(--white);
}

.tl-body-summary {
  font-size: var(--text-subhead);
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 10px;
}

.tl-highlights {
  list-style: none;
  padding: 0;
}

.tl-highlights li {
  font-size: 12px;
  color: var(--text);
  padding: 3px 0 3px 14px;
  position: relative;
}

.tl-highlights li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
}

/* ── PROJECTS (RINGS) ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.project-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.project-name { font-size: var(--text-body); font-weight: 600; color: var(--white); }

.project-owner {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.project-owner.topaz { background: var(--orange-light); color: var(--orange); }
.project-owner.sloth { background: var(--blue-light); color: var(--blue); }
.project-owner.both { background: var(--gray-light); color: var(--text-muted); }

.project-status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.project-status-badge.complete { background: var(--green-light); color: var(--green); }
.project-status-badge.in_progress { background: var(--blue-light); color: var(--blue); }
.project-status-badge.blocked { background: var(--yellow-light); color: var(--yellow); }
.project-status-badge.not_started { background: var(--gray-light); color: var(--text-muted); }
.project-status-badge.active { background: var(--green-light); color: var(--green); }

.project-desc { font-size: var(--text-footnote); color: var(--text-muted); margin-bottom: var(--space-4); line-height: 1.6; }

.project-ring-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.ring-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.ring-wrap svg {
  transform: rotate(-90deg);
  width: 52px;
  height: 52px;
}

.ring-track {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 4;
}

.ring-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
}

.project-next { font-size: 12px; color: var(--text-muted); padding-top: 10px; border-top: 1px solid var(--border); }
.project-next strong { color: var(--text); }

/* ── DISTRIBUTION ── */
.dist-progress {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.dist-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.progress-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.dist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
}

.dist-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px;
}

.dist-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.dist-card-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dist-card.active .dist-card-num { background: var(--green-light); color: var(--green); }
.dist-card.in_progress .dist-card-num { background: var(--blue-light); color: var(--blue); }

.dist-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dist-status-badge.not_started { background: var(--gray-light); color: var(--text-muted); }
.dist-status-badge.in_progress { background: var(--blue-light); color: var(--blue); }
.dist-status-badge.active { background: var(--green-light); color: var(--green); }

.dist-card-name { font-size: 13px; font-weight: 600; color: var(--white); margin-bottom: 10px; }

.dist-roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
}

.dist-role-label { font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; font-size: 10px; margin-bottom: 2px; }
.dist-role-label.you { color: var(--blue); }
.dist-role-label.topaz { color: var(--orange); }
.dist-role-text { color: var(--text-muted); }

/* ── ARTIFACTS ── */
.artifact-category { margin-bottom: 24px; }

.artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}

.artifact-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.artifact-info { flex: 1; min-width: 0; }
.artifact-name { font-size: 13px; font-weight: 600; color: var(--white); margin-bottom: 2px; }
.artifact-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.artifact-ext {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.artifact-ext.md { background: var(--blue-light); color: var(--blue); }
.artifact-ext.html { background: var(--orange-light); color: var(--orange); }
.artifact-ext.pdf { background: var(--red-light); color: var(--red); }
.artifact-ext.sh { background: var(--green-light); color: var(--green); }
.artifact-ext.py { background: var(--yellow-light); color: var(--yellow); }
.artifact-ext.json { background: var(--gray-light); color: var(--text-muted); }

.artifact-view {
  padding: 6px 14px;
  background: var(--surface-3);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* ── NOTES (persistent bar + list) ── */
.note-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 9999px;
  padding: var(--space-2) var(--space-4);
  color: var(--white);
  font-family: inherit;
  font-size: 1rem;
  min-height: var(--touch-min);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.note-input::placeholder { color: var(--text-muted); opacity: 1; }
.note-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.note-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orange);
  color: white;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.note-item {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.note-text { font-size: var(--text-subhead); flex: 1; color: var(--text); }
.note-time { font-size: 11px; color: var(--text-light); white-space: nowrap; }
.note-unread { border-left: 2px solid var(--orange); }

.note-delete {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

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

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-light); }
.empty-state-icon { font-size: 36px; margin-bottom: 8px; }
.empty-state-text { font-size: 14px; }

/* ── UTILITIES ── */
.mt-24 { margin-top: 24px; }

/* ── ERROR BANNER ── */
.error-banner {
  display: none;
  background: var(--red-light);
  color: var(--red);
  padding: 10px 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}

.error-banner.visible { display: block; }

/* ── ARTIFACT VIEWER OVERLAY ── */
.artifact-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  flex-direction: column;
}

.artifact-overlay.open { display: flex; }

.artifact-overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: calc(12px + env(safe-area-inset-top));
}

.artifact-back {
  background: none;
  border: none;
  color: var(--orange);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 4px;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
}

.artifact-overlay-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.artifact-overlay iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--surface);
}

/* ── PULL TO REFRESH ── */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  z-index: 9999;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.ptr-indicator svg {
  width: 18px;
  height: 18px;
  stroke: var(--orange);
  stroke-width: 2.5;
  fill: none;
  transition: transform 0.2s ease;
}

.ptr-indicator.refreshing svg {
  animation: ptr-spin 0.6s linear infinite;
}

@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── iPHONE ── */
@media (max-width: 440px) {
  body { padding-top: env(safe-area-inset-top); }
  .header-inner { padding: 10px 16px 0; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }
  main { padding: var(--space-4); }
  .card { padding: var(--space-4); }

  /* Touch: 44px min on all interactives */
  .task-checkbox { width: 2rem; height: 2rem; border-radius: var(--radius); min-height: var(--touch-min); min-width: var(--touch-min); }
  .task-checkbox.checked::after { width: 8px; height: 13px; border-width: 0 2.5px 2.5px 0; }
  .task-item { padding: var(--space-3) 0; gap: var(--space-3); min-height: var(--touch-min); }
  .task-completed-date { margin-left: 0; display: block; margin-top: var(--space-1); }
  .task-section-header { min-height: var(--touch-min); align-items: center; }

  /* Single column */
  .venture-grid, .project-grid, .artifact-grid, .dist-grid { grid-template-columns: 1fr; }
  .dist-roles { grid-template-columns: 1fr; }
  .tl-header { flex-direction: column; gap: 2px; }

  /* Forms: 1rem min to prevent iOS zoom */
  .modal { padding: var(--space-5); width: 95%; max-height: 85vh; overflow-y: auto; }
  .form-row { flex-direction: column; gap: 0; }
  .form-group input, .form-group textarea, .form-group select { font-size: 1rem; padding: var(--space-3); }
  .btn { min-height: var(--touch-min); }
  .comment-form { flex-direction: column; }
  .comment-input { font-size: 1rem; padding: var(--space-3); }
  .comment-submit { width: 100%; min-height: var(--touch-min); }
  .btn-danger { min-height: var(--touch-min); }
  .note-delete { min-width: var(--touch-min); min-height: var(--touch-min); font-size: 1.25rem; display: flex; align-items: center; justify-content: center; }
  .artifact-card { flex-wrap: wrap; gap: var(--space-2); }
  .artifact-view { min-height: var(--touch-min); min-width: var(--touch-min); }
}

/* ── GLANCE BAR ── */
.glance-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
}
.glance-bar::-webkit-scrollbar { display: none; }
.glance-bar:empty { display: none; }

.glance-weather {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  max-width: 400px;
}
.glance-clothing {
  font-size: var(--text-caption);
  color: var(--text-muted);
  white-space: normal;
  line-height: 1.3;
}

.glance-temp {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1;
}

.glance-condition {
  font-size: var(--text-caption);
  color: var(--text-muted);
}

.glance-hilo {
  font-size: var(--text-caption);
  color: var(--text-muted);
}

.glance-hilo .hi { color: var(--orange); }
.glance-hilo .lo { color: var(--blue); }

.glance-divider {
  width: 1px;
  background: var(--border);
  align-self: stretch;
  flex-shrink: 0;
}

.glance-cal {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  overflow-x: auto;
  flex: 0 0 auto;
  min-width: 0;
  width: max-content;
}

.glance-event {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: max-content;
}

.glance-event-title {
  font-size: var(--text-footnote);
  font-weight: 500;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glance-event-time {
  font-size: var(--text-caption);
  color: var(--text-muted);
}

.glance-empty {
  font-size: var(--text-caption);
  color: var(--text-light);
  font-style: italic;
}

/* ── GOLD WIDGET ── */
.glance-gold {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex-shrink: 0;
  min-width: 220px;
}
.gold-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.gold-label {
  font-size: var(--text-caption);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.gold-price {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--yellow);
  line-height: 1;
}
.gold-change {
  font-size: var(--text-caption);
  font-weight: 500;
}
.gold-change.up { color: var(--green); }
.gold-change.down { color: var(--red); }
.gold-chart {
  position: relative;
  width: 100%;
  height: 56px;
  touch-action: none;
  cursor: crosshair;
}
.gold-chart svg { display: block; }
.gold-tooltip {
  position: absolute;
  top: -2px;
  pointer-events: none;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.625rem;
  color: var(--white);
  white-space: nowrap;
  transform: translateX(-50%);
  z-index: 10;
  line-height: 1.4;
}
.gold-crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--text-muted);
  pointer-events: none;
  opacity: 0.5;
}
.gold-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px var(--yellow);
}
.gold-ranges {
  display: flex;
  gap: 2px;
}
.gold-range-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.625rem;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.gold-range-btn:hover { color: var(--white); }
.gold-range-btn.active {
  color: var(--yellow);
  border-color: var(--yellow);
}

/* ── PORTFOLIO WIDGET ── */
.glance-portfolio {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex-shrink: 0;
  min-width: 220px;
}
.port-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.port-label {
  font-size: var(--text-caption);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.port-price {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1;
}
.port-change {
  font-size: var(--text-caption);
  font-weight: 500;
}
.port-change.up { color: var(--green); }
.port-change.down { color: var(--red); }
.port-chart {
  position: relative;
  width: 100%;
  height: 56px;
  touch-action: none;
  cursor: crosshair;
}
.port-chart svg { display: block; }
.port-tooltip {
  position: absolute;
  top: -2px;
  pointer-events: none;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.625rem;
  color: var(--white);
  white-space: nowrap;
  transform: translateX(-50%);
  z-index: 10;
  line-height: 1.4;
}
.port-crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--text-muted);
  pointer-events: none;
  opacity: 0.5;
}
.port-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px var(--blue);
}
.port-ranges {
  display: flex;
  gap: 2px;
}
.port-range-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.625rem;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.port-range-btn:hover { color: var(--white); }
.port-range-btn.active {
  color: var(--blue);
  border-color: var(--blue);
}
.port-setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-width: 220px;
  padding: var(--space-2) 0;
}
.port-setup-label {
  font-size: var(--text-caption);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.port-setup-btn {
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: var(--text-caption);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.03em;
}
.port-setup-btn:hover { opacity: 0.85; }
.port-setup-msg {
  font-size: 0.625rem;
  color: var(--text-light);
}

@keyframes pulse { from { opacity: 0.3; } to { opacity: 0.6; } }

/* ── GOLD CHART (Bloomberg/TradingView style) ── */
.gi-chart-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}
.gi-chart-symbol {
  font-size: var(--text-title);
  font-weight: 700;
  color: var(--yellow);
}
.gi-chart-name {
  font-size: var(--text-footnote);
  color: var(--text-muted);
}
.gi-chart-ohlc {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.gi-chart-ohlc .up { color: var(--green); }
.gi-chart-ohlc .dn { color: var(--red); }
.gi-chart-wrap {
  position: relative;
  width: 100%;
  height: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  margin-bottom: var(--space-3);
}
.gi-chart-wrap canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}
@media (max-width: 600px) {
  .gi-chart-wrap { height: 280px; }
}

/* ── GOLD INTELLIGENCE DASHBOARD ── */
.gi-signal-banner {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: var(--text-footnote);
  font-weight: 600;
  text-align: center;
}
.gi-signal-banner.strong_buy { background: oklch(0.25 0.06 155); color: var(--green); }
.gi-signal-banner.buy { background: oklch(0.20 0.04 155); color: var(--green); }
.gi-signal-banner.neutral { background: var(--surface-2); color: var(--text-muted); }
.gi-signal-banner.sell { background: oklch(0.20 0.04 25); color: var(--red); }
.gi-signal-banner.strong_sell { background: oklch(0.25 0.06 25); color: var(--red); }

.gi-ticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: var(--space-2);
}
.gi-ticker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  cursor: pointer;
  transition: border-color 0.15s;
}
.gi-ticker:hover, .gi-ticker.active { border-color: var(--yellow); }
.gi-ticker-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}
.gi-ticker-sym {
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--white);
}
.gi-ticker-name {
  font-size: 0.625rem;
  color: var(--text-muted);
}
.gi-ticker-price {
  font-size: var(--text-subhead);
  font-weight: 600;
  color: var(--white);
}
.gi-ticker-chg {
  font-size: var(--text-caption);
  font-weight: 500;
}
.gi-ticker-chg.up { color: var(--green); }
.gi-ticker-chg.down { color: var(--red); }
.gi-ticker-spark {
  position: relative;
  height: 44px;
  margin-top: 4px;
  touch-action: none;
  cursor: crosshair;
}
.gi-ticker-spark svg { display: block; width: 100%; height: 100%; }
.gi-spark-cross {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--text-muted); opacity: 0.4; pointer-events: none; display: none;
}
.gi-spark-dot {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: var(--yellow); pointer-events: none; transform: translate(-50%,-50%);
  box-shadow: 0 0 3px var(--yellow); display: none;
}
.gi-spark-tip {
  position: absolute; top: -4px; pointer-events: none; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 3px;
  padding: 1px 5px; font-size: 0.575rem; color: var(--white);
  white-space: nowrap; z-index: 10; line-height: 1.3; display: none;
}

/* Range bar */
.gi-range-bar {
  display: flex;
  gap: 3px;
  margin-bottom: var(--space-3);
}
.gi-range-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.6875rem;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.12s;
}
.gi-range-btn:hover { color: var(--white); border-color: var(--text-muted); }
.gi-range-btn.active {
  color: var(--yellow);
  border-color: var(--yellow);
  background: oklch(0.18 0.02 85);
}

/* Ticker highlights */
.gi-ticker-highlights {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
  font-size: 0.575rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.gi-ticker-highlights .hi-tag {
  display: inline-block;
  padding: 0 3px;
  border-radius: 2px;
  font-weight: 600;
  margin-right: 2px;
}
.hi-tag.bull { background: oklch(0.22 0.04 155); color: var(--green); }
.hi-tag.bear { background: oklch(0.22 0.04 25); color: var(--red); }
.hi-tag.warn { background: oklch(0.22 0.04 60); color: var(--yellow); }
.gi-ticker-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.6rem;
  color: var(--text-muted);
}
.gi-ticker-badge {
  font-size: 0.55rem;
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 600;
  text-transform: uppercase;
}
.gi-ticker-badge.bullish, .gi-ticker-badge.lean_bull { background: oklch(0.25 0.04 155); color: var(--green); }
.gi-ticker-badge.bearish, .gi-ticker-badge.lean_bear { background: oklch(0.25 0.04 25); color: var(--red); }
.gi-ticker-badge.neutral { background: var(--surface-3); color: var(--text-muted); }

/* Technicals Panel */
.gi-technicals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.gi-tech-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.gi-tech-label {
  font-size: var(--text-caption);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}
.gi-tech-value {
  font-size: var(--text-title);
  font-weight: 700;
  color: var(--white);
}
.gi-tech-sub {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-top: 2px;
}
.gi-tech-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  margin-top: var(--space-2);
  overflow: hidden;
}
.gi-tech-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.gi-tech-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: var(--text-caption);
  border-bottom: 1px solid var(--border);
}
.gi-tech-row:last-child { border-bottom: none; }
.gi-tech-row .label { color: var(--text-muted); }
.gi-tech-row .val { color: var(--white); font-weight: 500; }
.gi-tech-row .val.above { color: var(--green); }
.gi-tech-row .val.below { color: var(--red); }
.gi-tech-symbol {
  font-size: var(--text-caption);
  color: var(--yellow);
  margin-left: var(--space-2);
}
.gi-macd-bars {
  display: flex;
  gap: 1px;
  height: 40px;
  margin-top: var(--space-2);
  position: relative;
}
.gi-macd-bars::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--border);
  opacity: 0.8;
}
.gi-macd-col {
  flex: 1;
  min-width: 0;
  position: relative;
}
.gi-macd-bar {
  position: absolute;
  left: 0;
  right: 0;
  min-height: 1px;
}
.gi-macd-bar.pos { background: var(--green); bottom: 50%; border-radius: 1px 1px 0 0; }
.gi-macd-bar.neg { background: var(--red); top: 50%; border-radius: 0 0 1px 1px; }

/* Macro */
.gi-macro {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-2);
}
.gi-macro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.gi-macro-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.gi-macro-name {
  font-size: var(--text-caption);
  color: var(--text-muted);
  font-weight: 600;
}
.gi-macro-val {
  font-size: var(--text-subhead);
  font-weight: 600;
  color: var(--white);
}
.gi-macro-chg {
  font-size: var(--text-caption);
  font-weight: 500;
  margin-top: 2px;
}
.gi-macro-chg.up { color: var(--green); }
.gi-macro-chg.down { color: var(--red); }
.gi-macro-corr {
  font-size: 0.6rem;
  color: var(--text-light);
  margin-top: 4px;
  font-style: italic;
}

/* News */
.gi-news {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 400px;
  overflow-y: auto;
}
.gi-news-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.gi-news-title {
  font-size: var(--text-footnote);
  color: var(--white);
  font-weight: 500;
  line-height: 1.3;
}
.gi-news-title a { color: var(--white); text-decoration: none; }
.gi-news-title a:hover { color: var(--yellow); }
.gi-news-meta {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-top: 4px;
}

/* Analysis */
.gi-analysis {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}
.gi-analysis-date {
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.gi-analysis-text {
  font-size: var(--text-footnote);
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}
.gi-an-h1, .gi-an-h2, .gi-an-h3 {
  font-weight: 700;
  color: var(--yellow);
  margin-top: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gi-an-h1 { font-size: var(--text-subhead); }
.gi-an-h2 { font-size: var(--text-footnote); }
.gi-an-h3 { font-size: var(--text-footnote); }
.gi-an-li {
  padding-left: 12px;
  position: relative;
  margin: 2px 0;
}
.gi-an-li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}
.gi-gen-btn {
  background: var(--surface-2);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  font-size: var(--text-footnote);
  font-family: inherit;
  cursor: pointer;
  margin-bottom: var(--space-3);
  transition: background 0.15s;
  width: 100%;
  text-align: center;
}
.gi-gen-btn:hover { background: oklch(0.22 0.03 85); }
.gi-gen-btn:disabled { cursor: wait; }

/* ── PACKAGE TRACKER ── */
.pkg-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: stretch;
}
.pkg-input {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
  min-width: 0;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.pkg-input::placeholder {
  color: var(--text-muted);
  opacity: 1;
  font-size: 14px;
}
.pkg-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}
.pkg-input-tracking { flex: 1; min-width: 120px; }
.pkg-input-origin { width: 150px; }
.pkg-btn {
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: filter 120ms var(--ease-soft), border-color 120ms var(--ease-soft), transform 120ms var(--ease-soft);
}
.pkg-btn-add { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 6px 18px var(--accent-glow); }
.pkg-btn-add:hover { background: var(--accent-hover); transform: translateY(-1px); }
.pkg-btn-refresh { background: transparent; color: var(--text); border-color: var(--border-strong); }
.pkg-btn-refresh:hover { border-color: var(--accent); color: var(--accent); }
.pkg-list { display: flex; flex-direction: column; gap: 8px; }
.pkg-status { font-size: var(--text-caption); color: var(--text-muted); margin-top: 8px; }

/* Daily Brief */
.daily-brief { margin-bottom: 16px; padding: 14px 16px; background: linear-gradient(180deg, var(--accent-light), rgba(255,255,255,0.02)); border: 1px solid var(--accent); border-radius: var(--radius); }
.db-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.db-today { font-weight: 600; color: var(--text); font-size: 13px; letter-spacing: 0.3px; }
.db-stats { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.db-stat { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.db-num { color: var(--text); font-weight: 700; }
.db-up { color: var(--green); }
.db-down { color: var(--red); }
.db-warn { color: var(--yellow); }
.db-delta { color: var(--text-muted); font-size: 11px; margin-left: 2px; }
.db-top { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.db-top-item { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.db-pill { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.4px; }
.db-pill.db-critical { background: var(--red); color: var(--white); }
.db-pill.db-high { background: var(--yellow); color: oklch(0.18 0.04 80); }
.db-pill.db-medium { background: var(--blue); color: oklch(0.12 0.02 245); }
.db-pill.db-low { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.db-dates { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.db-date { font-size: 12px; color: var(--accent); }

/* Household status chips */
.hh-chip.hh-ok { background: var(--green-light); color: var(--green); }
.hh-chip.hh-low { background: var(--yellow-light); color: var(--yellow); }
.hh-chip.hh-out { background: var(--red-light); color: var(--red); }

@media (max-width: 600px) {
  .gi-technicals { grid-template-columns: 1fr; }
  .gi-ticker-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .pkg-controls { flex-wrap: wrap; }
  .pkg-input-origin { width: 100%; }
  .db-stats { gap: 8px; }
}
