/* ============================================================
   Variables & Reset — dark terminal + warm orange accent
   ============================================================ */
:root {
  --bg:             #0A0A0A;
  --surface:        #111111;
  --surface2:       #1C1C1C;
  --surface3:       #242424;
  --border:         #2A2A2A;
  --border-subtle:  #1F1F1F;
  --text:           #EBEBEB;
  --text-secondary: #A0A0A0;
  --text-muted:     #8A8A8A;
  --text-faint:     #6B6B6B;
  --accent:         #D4770C;
  --accent-dark:    #B86408;
  --accent-dim:     rgba(212, 119, 12, 0.15);
  --accent-glow:    rgba(212, 119, 12, 0.25);
  --danger:         #E05252;
  --danger-dim:     rgba(224, 82, 82, 0.12);
  --success:        #3FB96E;
  --warn:           #D4870C;
  --warn-dim:       rgba(212, 135, 12, 0.10);
  --radius:         7px;
  --radius-sm:      5px;
  --radius-xs:      3px;
  --shadow:         0 4px 24px rgba(0,0,0,0.65);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { display: block; max-width: 100%; }
code { font-family: var(--mono); font-size: 0.875em; color: var(--accent); }
.mono { font-family: var(--mono); }
.text-muted { color: var(--text-muted); }

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
.container-narrow { max-width: 760px; margin: 0 auto; }

/* ============================================================
   Demo banner — sticky strip above nav on demo pages
   ============================================================ */
.demo-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--surface2);
  border-bottom: 1px solid rgba(212,119,12,0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 1.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.demo-pill {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(212,119,12,0.3);
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.demo-banner a { color: var(--accent); }
.demo-banner a:hover { color: var(--accent-dark); }
.demo-banner-sep { color: var(--text-faint); }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: inset 0 1px 0 rgba(212, 119, 12, 0.25);
}
.demo-banner ~ .nav { top: 35px; }

.nav-brand {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
}
.nav-brand:hover { color: var(--text); }
.nav-brand-prompt { color: var(--accent); font-size: 1.2rem; line-height: 1; font-weight: 400; }
.nav-links { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; }
.nav-links a { color: var(--text-muted); }
.nav-links a:hover { color: var(--text-secondary); }
.nav-new {
  background: var(--accent) !important;
  color: #fff !important;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface3); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; box-shadow: 0 0 0 3px var(--accent-dim); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.25rem; }
.form-row { display: flex; gap: 1rem; margin-bottom: 1.25rem; }
.form-group-sm { flex: 0 0 160px; }
.form-group-grow { flex: 1; }
.form-group-sm, .form-group-grow { margin-bottom: 0; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.75rem; }
label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--mono); }
.optional { font-weight: 400; color: var(--text-faint); font-size: 0.75rem; text-transform: none; letter-spacing: 0; font-family: var(--font); }
.input-full {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-family: var(--font);
}
.input-full::placeholder { color: var(--text-faint); }
select.input-full {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B6B6B' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}
.hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 0.3rem; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash { padding: 0.65rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 1rem; }
.flash-ok { background: rgba(63,185,110,0.08); border: 1px solid rgba(63,185,110,0.3); border-left: 3px solid var(--success); color: #7EC8A0; }
.flash-err { background: var(--danger-dim); border: 1px solid rgba(224,82,82,0.3); border-left: 3px solid var(--danger); color: #F08080; }

/* ============================================================
   Page headers
   ============================================================ */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.3rem; }
.section-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.85rem; }
.section-title { font-size: 0.78rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); }
.section-count { font-size: 0.72rem; color: var(--text-faint); font-family: var(--mono); }

/* ============================================================
   Cards
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.card-title { font-size: 0.78rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); margin-bottom: 1.25rem; }

/* ============================================================
   Badge
   ============================================================ */
.badge { display: inline-block; padding: 0.1rem 0.45rem; border-radius: var(--radius-xs); font-size: 0.65rem; font-weight: 600; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; vertical-align: middle; }
.badge-guest { background: rgba(212,119,12,0.12); color: var(--accent); border: 1px solid rgba(212,119,12,0.25); }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.empty-state h1 { font-size: 1.4rem; color: var(--text); }

/* ============================================================
   Journal — search bar & toolbar
   ============================================================ */
.search-bar { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 0.5rem 0.85rem; font-size: 0.875rem; font-family: var(--font);
}
.search-input::placeholder { color: var(--text-faint); }
.tag-select {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); padding: 0.5rem 2rem 0.5rem 0.75rem; font-size: 0.875rem;
  cursor: pointer; font-family: var(--font);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B6B6B' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
}
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.entry-count { font-size: 0.78rem; color: var(--text-faint); font-family: var(--mono); }
.view-toggle { display: flex; gap: 0.25rem; }
.toggle-btn { background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text-faint); padding: 0.35rem 0.5rem; cursor: pointer; display: flex; align-items: center; transition: color 0.12s; }
.toggle-btn:hover, .toggle-btn.active { color: var(--accent); border-color: var(--border); background: var(--surface2); }

/* ============================================================
   Journal — entry cards
   ============================================================ */
.entries-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.entry-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: var(--text); text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
}
.entry-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); opacity: 0; transition: opacity 0.15s; }
.entry-card:hover { border-color: rgba(212,119,12,0.4); box-shadow: 0 4px 20px rgba(0,0,0,0.5); transform: translateY(-2px); color: var(--text); }
.entry-card:hover::before { opacity: 1; }
.entry-card-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.entry-card-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.entry-card-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.entry-date { font-size: 0.72rem; color: var(--text-faint); font-family: var(--mono); }
.entry-date--backed-up { color: var(--accent); }
.entry-tags-inline { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.entry-card-title { font-size: 0.95rem; font-weight: 600; line-height: 1.35; margin-top: 0.15rem; }
.entry-card-preview { font-size: 0.83rem; color: var(--text-muted); line-height: 1.55; }
.tag { display: inline-block; background: rgba(212,119,12,0.1); color: var(--accent); border: 1px solid rgba(212,119,12,0.2); border-radius: var(--radius-xs); padding: 0.1rem 0.5rem; font-size: 0.72rem; font-weight: 600; font-family: var(--mono); }
a.tag:hover { background: rgba(212,119,12,0.2); color: var(--accent); }

/* ============================================================
   Journal — entry detail
   ============================================================ */
.entry-detail { padding-top: 0.5rem; }
.entry-detail-header { margin-bottom: 1.75rem; }
.entry-detail-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.entry-date-lg { font-size: 0.78rem; color: var(--accent); display: block; margin-bottom: 0.4rem; font-family: var(--mono); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.entry-detail-title { font-size: 1.7rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 0.65rem; }
.entry-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.entry-body { font-size: 1rem; line-height: 1.85; color: var(--text); margin-bottom: 2rem; white-space: pre-wrap; word-break: break-word; }
.entry-actions { display: flex; gap: 0.75rem; align-items: center; padding-top: 1.5rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.context-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.75rem; padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-left: 2px solid var(--accent); border-radius: var(--radius); }
.context-chip { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.83rem; color: var(--text-secondary); padding: 0.2rem 0.6rem; background: var(--surface2); border-radius: var(--radius-xs); min-width: 80px; }
.context-chip-news { flex: 1 1 100%; min-width: unset; }
.context-chip-label { font-size: 0.65rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; font-family: var(--mono); }
.page-header { margin-bottom: 1.75rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }

/* ============================================================
   Puff — squad summary bar
   ============================================================ */
.squad-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1.1rem; margin-bottom: 1.5rem; }
.stat-chip { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.3rem 0.7rem; border-radius: var(--radius-sm); }
.stat-chip-primary { background: var(--accent-dim); border: 1px solid rgba(212,119,12,0.2); }
.stat-chip-total { background: var(--surface2); border: 1px solid var(--border); margin-left: auto; }
.stat-label { font-size: 0.62rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); }
.stat-value { font-size: 1rem; font-weight: 600; color: var(--text); }
.stat-chip-primary .stat-label { color: var(--accent); opacity: 0.8; }
.stat-chip-primary .stat-value { color: var(--accent); }
.stat-divider { width: 1px; height: 2rem; background: var(--border); margin: 0 0.25rem; flex-shrink: 0; }

/* ============================================================
   Puff — members grid & cards
   ============================================================ */
.dashboard { display: block; }
.dashboard-main { width: 100%; }
.members-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.member-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; position: relative; transition: border-color 0.15s; }
.member-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); border-radius: var(--radius) var(--radius) 0 0; opacity: 0; transition: opacity 0.15s; }
.member-card:hover { border-color: rgba(212,119,12,0.35); }
.member-card:hover::before { opacity: 1; }
.member-card-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.member-name { font-size: 0.95rem; font-weight: 600; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-icon { background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs); color: var(--text-faint); font-size: 1.1rem; line-height: 1; padding: 0.15rem 0.4rem; cursor: pointer; font-family: var(--font); transition: color 0.12s; }
.btn-icon:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-dim); }
.joints-row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; padding: 0; }
.joint-btn { width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface2); color: var(--text-secondary); font-size: 1rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); transition: background 0.1s; flex-shrink: 0; }
.joint-btn-dec:hover { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); }
.joint-btn-inc:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.joint-count { font-size: 1.3rem; font-weight: 700; color: var(--text); font-family: var(--mono); min-width: 2ch; text-align: center; padding: 0 0.25rem; }
.bulk-joints { margin-left: auto; }
.bulk-toggle { font-size: 0.72rem; color: var(--text-faint); font-family: var(--mono); cursor: pointer; list-style: none; padding: 0.2rem 0.4rem; border-radius: var(--radius-xs); border: 1px solid transparent; }
.bulk-toggle::-webkit-details-marker { display: none; }
.member-balance { display: flex; align-items: baseline; gap: 0.45rem; flex-wrap: wrap; padding: 0.5rem 0.6rem; background: var(--surface2); border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); }
.balance-label { font-size: 0.68rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--mono); flex-shrink: 0; }
.balance-amount { font-size: 1rem; font-weight: 700; font-family: var(--mono); flex-shrink: 0; }
.balance-owes { color: var(--danger); }
.balance-owed { color: var(--success); }
.balance-even { color: var(--text-faint); font-size: 0.85rem; font-weight: 500; }
.balance-detail { font-size: 0.68rem; color: var(--text-faint); font-family: var(--mono); width: 100%; margin-top: 0.1rem; }
.add-member-details { margin-top: 0.5rem; }
.add-member-toggle { width: 100%; justify-content: center; }
.log-joint-details { margin-bottom: 1.25rem; }
.log-joint-toggle { width: 100%; justify-content: center; font-size: 0.95rem; background: var(--accent-dim); border-color: rgba(212,119,12,0.3); color: var(--accent); font-weight: 600; }
.log-joint-form { background: var(--surface); border: 1px solid rgba(212,119,12,0.3); border-radius: var(--radius); padding: 1rem 1.1rem; margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.85rem; }
.log-joint-hint { font-size: 0.82rem; color: var(--text-muted); }
.log-joint-members { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.log-joint-check { display: flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface2); }
.log-joint-check:has(input:checked) { background: var(--accent-dim); border-color: rgba(212,119,12,0.45); }
.log-joint-check input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }
.log-joint-name { font-size: 0.875rem; color: var(--text); }

/* ============================================================
   Puff — activity timeline
   ============================================================ */
.activity-timeline { display: flex; flex-direction: column; gap: 0; max-width: 680px; }
.timeline-item { display: flex; gap: 1rem; position: relative; padding-bottom: 1.25rem; }
.timeline-item:not(:last-child) .timeline-dot::after { content: ''; position: absolute; left: 7px; top: 16px; width: 1px; bottom: 0; background: var(--border); }
.timeline-dot { position: relative; flex-shrink: 0; width: 15px; height: 15px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface2); z-index: 1; }
.timeline-joints  .timeline-dot { border-color: var(--accent); background: var(--accent-dim); }
.timeline-expense .timeline-dot { border-color: #4ec880; background: rgba(63,185,110,0.12); }
.timeline-member  .timeline-dot { border-color: #a07fe0; background: rgba(130,100,212,0.1); }
.timeline-session .timeline-dot { border-color: var(--text-faint); background: var(--surface3); }
.timeline-content { flex: 1; min-width: 0; padding-bottom: 0.1rem; }
.timeline-headline { font-size: 0.9rem; color: var(--text); font-weight: 500; line-height: 1.4; margin-bottom: 0.2rem; }
.timeline-detail { font-size: 0.8rem; color: var(--text-muted); font-family: var(--mono); margin-bottom: 0.3rem; }
.timeline-time { display: block; font-size: 0.7rem; color: var(--text-faint); font-family: var(--mono); }

/* ============================================================
   Puff — expenses
   ============================================================ */
.expense-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.expense-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border-subtle); font-size: 0.875rem; flex-wrap: wrap; }
.expense-row:last-child { border-bottom: none; }
.expense-who { font-weight: 600; color: var(--text); min-width: 80px; }
.expense-cat { padding: 0.1rem 0.5rem; border-radius: var(--radius-xs); font-size: 0.72rem; font-weight: 600; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.cat-ganja  { background: rgba(63,185,110,0.1);  color: #4ec880; border: 1px solid rgba(63,185,110,0.25); }
.cat-weed   { background: rgba(63,185,110,0.1);  color: #4ec880; border: 1px solid rgba(63,185,110,0.25); }
.cat-snacks { background: rgba(212,170,12,0.1);  color: #c9a820; border: 1px solid rgba(212,170,12,0.25); }
.cat-drinks { background: rgba(130,100,212,0.1); color: #a07fe0; border: 1px solid rgba(130,100,212,0.25); }
.cat-misc   { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.expense-amount { font-weight: 700; color: var(--text); flex-shrink: 0; font-family: var(--mono); }
.expense-memo { color: var(--text-muted); font-size: 0.82rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expense-time { color: var(--text-faint); font-family: var(--mono); font-size: 0.72rem; flex-shrink: 0; margin-left: auto; }
.cat-manager-details { margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cat-manager-toggle { display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1.1rem; cursor: pointer; list-style: none; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--mono); }
.cat-manager-toggle::-webkit-details-marker { display: none; }
.cat-manager-count { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0.05rem 0.4rem; font-size: 0.72rem; color: var(--text-faint); }
.cat-manager-body { padding: 0.75rem 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.cat-manager-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border-subtle); }
.cat-manager-row:last-of-type { border-bottom: none; }
.cat-rename-form { display: flex; gap: 0.4rem; flex: 1; align-items: center; }
.cat-rename-input { flex: 1; padding: 0.3rem 0.6rem; font-size: 0.85rem; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-xs); color: var(--text); font-family: var(--mono); }
.cat-add-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border); align-items: center; }

/* ============================================================
   Puff — session history
   ============================================================ */
.history-list { display: flex; flex-direction: column; gap: 0.75rem; }
.history-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.history-card[open] { border-color: rgba(212,119,12,0.3); }
.history-summary { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 1rem 1.25rem; cursor: pointer; list-style: none; flex-wrap: wrap; }
.history-summary::-webkit-details-marker { display: none; }
.history-summary:hover { background: var(--surface2); }
.history-summary-left { flex: 1; }
.history-dates { font-size: 0.9rem; font-weight: 600; color: var(--text); font-family: var(--mono); }
.history-summary-stats { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.history-stat { display: flex; flex-direction: column; gap: 0.05rem; text-align: right; }
.history-stat-label { font-size: 0.62rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); }
.history-stat .mono { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); }
.history-body { border-top: 1px solid var(--border); padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; }
.history-section-title { font-size: 0.72rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); margin-bottom: 0.65rem; }
.history-breakdown { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.breakdown-chip { display: flex; flex-direction: column; gap: 0.1rem; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.4rem 0.75rem; }
.breakdown-label { font-size: 0.62rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--mono); }
.breakdown-val { font-size: 0.9rem; font-weight: 600; color: var(--text); font-family: var(--mono); }
.history-table-wrap { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.history-table th { text-align: left; font-size: 0.68rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); }
.history-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.history-table tr:last-child td { border-bottom: none; }
.history-table td.mono { color: var(--text); font-weight: 600; }
.balance-owes-cell { color: var(--danger); font-weight: 600; font-family: var(--mono); }
.balance-owed-cell { color: var(--success); font-weight: 600; font-family: var(--mono); }
.balance-even-cell { color: var(--text-faint); font-family: var(--mono); }
.members-history-table { max-width: 680px; }
.member-history-name { font-weight: 600; color: var(--text); margin-right: 0.4rem; }

/* ============================================================
   Portfolio landing page
   ============================================================ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(212,119,12,0.2);
}
.site-brand {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.site-brand:hover { color: var(--text); }
.site-brand-prompt { color: var(--accent); font-size: 1.1rem; }
.site-nav-links { display: flex; align-items: center; gap: 1.25rem; font-size: 0.875rem; }
.site-nav-links a { color: var(--text-muted); }
.site-nav-links a:hover { color: var(--text-secondary); }

/* Hero */
.hero {
  padding: 5rem 2rem 4rem;
  max-width: 860px;
  margin: 0 auto;
}
.hero-kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(212,119,12,0.3);
  background: var(--accent-dim);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-xs);
}
.hero-name {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.hero-name span { color: var(--accent); }
.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 2rem;
}
.hero-ctas { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Projects section */
.projects-section {
  padding: 0 2rem 5rem;
  max-width: 860px;
  margin: 0 auto;
}
.section-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.project-grid { display: grid; gap: 1.25rem; }

/* Project card */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 340px;
  transition: border-color 0.2s;
}
.project-card:hover { border-color: rgba(212,119,12,0.35); }

.project-preview {
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.project-info {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.project-name {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.project-name-prompt { color: var(--accent); font-weight: 400; }
.project-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.65; margin-bottom: 1.25rem; flex: 1; }
.project-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.project-tag { font-family: var(--mono); font-size: 0.68rem; color: var(--text-faint); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0.15rem 0.5rem; }
.project-actions { display: flex; gap: 0.6rem; }

/* Mini app mockup inside project preview */
.mockup {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  transform-origin: top left;
  transform: scale(0.72);
  width: calc(100% / 0.72);
  height: calc(100% / 0.72);
}
.mockup-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
  height: 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(212,119,12,0.2);
  flex-shrink: 0;
}
.mockup-brand { font-family: var(--mono); font-size: 0.85rem; font-weight: 600; color: var(--text); }
.mockup-brand-prompt { color: var(--accent); }
.mockup-nav-links { display: flex; gap: 0.75rem; font-size: 0.72rem; color: var(--text-muted); }
.mockup-new { background: var(--accent); color: #fff; padding: 0.2rem 0.55rem; border-radius: 3px; font-size: 0.7rem; font-weight: 600; }
.mockup-body { flex: 1; overflow: hidden; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.5rem; }
.mockup-search { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0.35rem 0.6rem; font-size: 0.72rem; color: var(--text-faint); margin-bottom: 0.35rem; }
.mockup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.mockup-entry-card { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 0.65rem 0.75rem; }
.mockup-entry-date { font-family: var(--mono); font-size: 0.62rem; color: var(--text-faint); margin-bottom: 0.2rem; }
.mockup-entry-title { font-size: 0.78rem; font-weight: 600; color: var(--text); margin-bottom: 0.2rem; }
.mockup-entry-preview { font-size: 0.68rem; color: var(--text-muted); line-height: 1.4; }
.mockup-tag-pill { display: inline-block; background: rgba(212,119,12,0.12); color: var(--accent); border-radius: 2px; padding: 0.05rem 0.3rem; font-size: 0.6rem; font-family: var(--mono); margin-bottom: 0.3rem; }

/* Puff mockup */
.mockup-bar { display: flex; align-items: center; gap: 0.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 0.5rem 0.75rem; margin-bottom: 0.5rem; flex-shrink: 0; }
.mockup-stat { display: flex; flex-direction: column; gap: 0.05rem; padding: 0.15rem 0.45rem; border-radius: 3px; background: var(--accent-dim); border: 1px solid rgba(212,119,12,0.2); }
.mockup-stat-label { font-size: 0.55rem; color: var(--accent); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; }
.mockup-stat-value { font-size: 0.82rem; font-weight: 700; color: var(--accent); font-family: var(--mono); }
.mockup-stat-total { background: var(--surface2); border-color: var(--border); margin-left: auto; }
.mockup-stat-total .mockup-stat-label { color: var(--text-faint); }
.mockup-stat-total .mockup-stat-value { color: var(--text); }
.mockup-members-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.mockup-member-card { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 0.55rem 0.65rem; display: flex; flex-direction: column; gap: 0.35rem; }
.mockup-member-name { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.mockup-member-joints { font-size: 1.1rem; font-weight: 700; color: var(--text); font-family: var(--mono); text-align: center; }
.mockup-balance { font-size: 0.68rem; font-family: var(--mono); padding: 0.2rem 0.4rem; border-radius: 3px; background: var(--surface2); }
.mockup-owes { color: var(--danger); }
.mockup-owed { color: var(--success); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  max-width: 860px;
  margin: 0 auto;
}
.site-footer a { color: var(--text-faint); }
.site-footer a:hover { color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .members-grid { grid-template-columns: repeat(2, 1fr); }
  .project-card { grid-template-columns: 1fr; min-height: auto; }
  .project-preview { height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .container { padding: 1rem 0.75rem; }
  .nav { padding: 0 0.85rem; height: 48px; }
  .nav-links { gap: 0.5rem; font-size: 0.8rem; }
  .members-grid { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1.25rem 2.5rem; }
  .projects-section { padding: 0 1.25rem 3rem; }
  .site-header { padding: 0.9rem 1.25rem; }
  .history-summary { flex-direction: column; align-items: flex-start; }
  .entries-grid { grid-template-columns: 1fr; }
}
