/* ============================================================================
   flows.deals · design-token stylesheet
   Source: ~/code/steaz-next/docs/design_handoff_flows_deals/README.md
   Two themes: Lake (light, default) + Dark (moonlit lake)
   Theme switching via data-theme attribute on <body>
   ============================================================================ */

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

/* ── Design Tokens ───────────────────────────────────────────────────────── */

/* Lake (light — default; based on Lake Palo Pinto photography) */
:root,
[data-theme="lake"] {
  --bg: #edefe7;
  --surface: #fbfcf7;
  --ink: #26302a;
  --ink-soft: #586256;
  --faint: #8c958a;
  --line: #dde2d4;
  --line-2: #c6cdbb;
  --accent: #4f7d6e;
  --accent-soft: #e4ede7;
  --accent-ink: #fbfcf7;
  --link: #3c6e8f;
  --code-bg: #e9ebe1;
  --focus-glow: rgba(79,125,110,.22);
  --focus-edge: #4f7d6e;
  --glass: rgba(247,249,244,.74);
  --glass-edge: rgba(79,125,110,.32);
  --mine-bg: rgba(79,125,110,.16);
  --mine-border: rgba(79,125,110,.46);
  --mine-ink: #3a6a5c;
  --others-bg: rgba(110,131,142,.15);
  --others-border: rgba(110,131,142,.42);
  --others-ink: #536470;
  --others-edge: #6e838e;
}

/* Dark (moonlit lake: deep indigo-teal ground, calm lake-teal accent) */
[data-theme="dark"] {
  --bg: #0f1a23;
  --surface: #172530;
  --ink: #e7eeec;
  --ink-soft: #a9b6b3;
  --faint: #6f7e7d;
  --line: #243441;
  --line-2: #324654;
  --accent: #6fb09b;
  --accent-soft: rgba(111,176,155,.13);
  --accent-ink: #08130e;
  --link: #86b8d6;
  --code-bg: #13202a;
  --focus-glow: rgba(111,176,155,.26);
  --focus-edge: #6fb09b;
  --glass: rgba(20,33,43,.62);
  --glass-edge: rgba(111,176,155,.34);
  --mine-bg: rgba(111,176,155,.2);
  --mine-border: rgba(111,176,155,.55);
  --mine-ink: #8fccb8;
  --others-bg: rgba(150,166,178,.18);
  --others-border: rgba(150,166,178,.45);
  --others-ink: #b3bec7;
  --others-edge: #8ea1ad;
}

/* ── Typography ──────────────────────────────────────────────────────────── */
:root {
  --font-heading: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.62;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  line-height: 1.12;
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; line-height: 1.2; }
h3 { font-size: 1.1rem; }

p { margin-bottom: 1em; font-size: 1.02rem; }

small, .meta {
  font-size: .62rem;
  color: var(--faint);
  font-family: var(--font-mono);
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}
pre {
  background: var(--code-bg);
  padding: 1em;
  border-radius: 13px;
  overflow-x: auto;
  margin-bottom: 1em;
}
pre code { background: none; padding: 0; }

/* ── Shape & Motion ──────────────────────────────────────────────────────── */
:root {
  --radius-card: 16px;
  --radius-block: 14px;
  --radius-pill: 999px;
  --radius-sheet: 22px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sheet: 0 -12px 44px rgba(0,0,0,.24);
  --shadow-fab: 0 12px 36px rgba(0,0,0,.2);
  --ease-standard: cubic-bezier(.4,0,.2,1);
  --ease-springy: cubic-bezier(.34,1.3,.5,1);
}

/* ── Mobile-First Layout ─────────────────────────────────────────────────── */
body {
  display: flex;
  flex-direction: column;
  max-width: 400px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

/* Status bar (faux) */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Main content area */
.main-content {
  flex: 1;
  padding: 0 16px 100px;
  overflow-y: auto;
}

/* ── Bottom Bar ──────────────────────────────────────────────────────────── */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 400px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0 12px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--glass-edge);
  z-index: 40;
}

.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  border: none;
  background: none;
  color: var(--faint);
  font-size: 0.65rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: color 0.2s var(--ease-standard);
  -webkit-tap-highlight-color: transparent;
}

.bottom-tab .icon {
  font-size: 1.4rem;
  line-height: 1;
}

.bottom-tab.active {
  color: var(--accent);
}

.bottom-tab:active {
  transform: scale(0.95);
}

/* ── FAB (Floating Action Button) ────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 80px;
  right: calc(50% - 180px);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  z-index: 45;
  box-shadow: var(--shadow-fab);
  transition: transform 0.3s var(--ease-springy), box-shadow 0.3s var(--ease-standard);
  animation: breathe 5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.fab:hover {
  transform: scale(1.05);
}

.fab:active {
  transform: scale(0.95);
}

@keyframes breathe {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(2px, -2px) scale(1.02); }
  50% { transform: translate(-1px, 1px) scale(0.98); }
  75% { transform: translate(1px, -1px) scale(1.01); }
}

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

/* ── Pills ───────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.25em 0.75em;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  cursor: pointer;
  transition: all 0.2s var(--ease-standard);
  -webkit-tap-highlight-color: transparent;
}

.pill:active {
  transform: scale(0.97);
}

.pill.mine {
  background: var(--mine-bg);
  border-color: var(--mine-border);
  color: var(--mine-ink);
}

.pill.others {
  background: var(--others-bg);
  border-color: var(--others-border);
  color: var(--others-ink);
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Auth Picker (Sign-in) ──────────────────────────────────────────────── */
.auth-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 2rem 1rem;
    text-align: center;
}

.auth-wordmark h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.25rem;
    letter-spacing: -.02em;
}

.auth-tagline {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ink-soft);
    margin-bottom: 2.5rem;
}

.auth-label {
    font-size: 0.85rem;
    color: var(--faint);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.handle-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    max-width: 400px;
    margin-bottom: 2.5rem;
}

.handle-form {
    margin: 0;
}

.handle-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-pill);
    background: var(--surface);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.2s var(--ease-standard);
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    -webkit-tap-highlight-color: transparent;
}

.handle-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.handle-pill:active {
    transform: scale(0.97);
}

/* Profile-colored handles (from design spec) */
.handle-pill[data-handle="Dan"] {
    color: #3c6e8f;
    -webkit-text-stroke: 1.3px var(--surface);
    paint-order: stroke fill;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.handle-pill[data-handle="Anney"] {
    color: #5a7150;
    -webkit-text-stroke: 1.3px var(--surface);
    paint-order: stroke fill;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.handle-pill[data-handle="Chance"] {
    color: #2f6f78;
    -webkit-text-stroke: 1.3px var(--surface);
    paint-order: stroke fill;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.handle-pill[data-handle="Amber"] {
    color: #b9954f;
    -webkit-text-stroke: 1.3px var(--surface);
    paint-order: stroke fill;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.handle-pill[data-handle="Caroline"] {
    color: #6d82ab;
    -webkit-text-stroke: 1.3px var(--surface);
    paint-order: stroke fill;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.handle-pill[data-handle="Lance"] {
    color: #7a8a52;
    -webkit-text-stroke: 1.3px var(--surface);
    paint-order: stroke fill;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.auth-footer {
    font-size: 0.75rem;
    color: var(--faint);
    font-style: italic;
}

/* ── Library (Home) ─────────────────────────────────────────────────────── */
.library {
    padding: 1.5rem 0;
}

.library-header {
    margin-bottom: 2rem;
}

.library-header h1 {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    margin-bottom: 0.25rem;
}

.library-subline {
    font-size: 0.85rem;
    color: var(--ink-soft);
    font-style: italic;
}

.library-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 0.75rem;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-left: 0.25rem;
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    padding: 1rem;
    text-decoration: none;
    color: var(--ink);
    transition: all 0.2s var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.project-card:hover {
    border-color: var(--line-2);
    transform: translateY(-1px);
}

.project-card:active {
    transform: scale(0.99);
}

.project-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.project-name {
    font-family: var(--font-heading);
    font-size: 1.22rem;
    font-weight: 600;
}

.project-chevron {
    color: var(--faint);
    font-size: 1.2rem;
}

.owner-chip {
    display: inline-flex;
    padding: 0.15em 0.5em;
    border: 1px solid var(--others-border);
    border-radius: var(--radius-pill);
    background: var(--others-bg);
    color: var(--others-ink);
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.project-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.project-files {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--faint);
}

.nudge-chip {
    display: inline-flex;
    padding: 0.15em 0.5em;
    border: 1px solid var(--mine-border);
    border-radius: var(--radius-pill);
    background: var(--mine-bg);
    color: var(--mine-ink);
    font-size: 0.75rem;
}

/* ── Project (File List) ────────────────────────────────────────────────── */
.project {
    padding: 1.5rem 0;
}

.project-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.back-chevron {
    font-size: 1.5rem;
    color: var(--link);
    text-decoration: none;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.back-chevron:hover {
    text-decoration: none;
}

.project-name {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    flex: 1;
}

.flow-key {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--faint);
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-block);
    text-decoration: none;
    color: var(--ink);
    transition: all 0.2s var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.file-row:hover {
    border-color: var(--line-2);
    transform: translateX(2px);
}

.file-row:active {
    transform: scale(0.99);
}

.file-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-icon {
    font-size: 1.1rem;
}

.file-name {
    font-size: 1rem;
    font-weight: 500;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-updated {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--faint);
}

.file-chevron {
    color: var(--faint);
    font-size: 1.1rem;
}

/* ── File Reader (The Crux) ─────────────────────────────────────────────── */
.file-reader {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.file-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 16px;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 30;
}

.file-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.time-machine-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
    -webkit-tap-highlight-color: transparent;
}

.reading-column {
    flex: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px 120px;
    width: 100%;
}

.markdown-content {
    font-size: 1.02rem;
    line-height: 1.62;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -.01em;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.markdown-content h1 { font-size: 1.7rem; }
.markdown-content h2 { font-size: 1.3rem; line-height: 1.2; }
.markdown-content h3 { font-size: 1.1rem; }

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.markdown-content li {
    margin-bottom: 0.25em;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background: var(--accent-soft);
    border-radius: 0 var(--radius-block) var(--radius-block) 0;
}

.markdown-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.markdown-content pre {
    background: var(--code-bg);
    padding: 1em;
    border-radius: var(--radius-block);
    overflow-x: auto;
    margin-bottom: 1em;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

/* ── DOM Box (Scroll-to-Focus) ──────────────────────────────────────────── */
.dom-box {
    transition: all 0.26s var(--ease-standard);
    position: relative;
    padding: 0.5rem 0;
    border-left: 3px solid transparent;
}

.dom-box.focused {
    opacity: 1;
    transform: translateY(-3px);
    box-shadow: 0 14px 40px var(--focus-glow);
    border-left-color: var(--focus-edge);
    background: var(--accent-soft);
    border-radius: 0 var(--radius-block) var(--radius-block) 0;
}

.dom-box:not(.focused) {
    opacity: 0.74;
}

/* ── Feedback Indicator ─────────────────────────────────────────────────── */
.feedback-indicator {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.feedback-indicator:hover {
    opacity: 1;
}

.feedback-indicator .emoji {
    font-size: 1.2rem;
}

/* ── Presence Pills ─────────────────────────────────────────────────────── */
.presence-pills {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.presence-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
    padding: 0.15em 0.5em;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    -webkit-text-stroke: 1.3px var(--surface);
    paint-order: stroke fill;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.presence-pill.mine {
    background: var(--mine-bg);
    border-color: var(--mine-border);
    color: var(--mine-ink);
}

.presence-pill.others {
    background: var(--others-bg);
    border-color: var(--others-border);
    color: var(--others-ink);
}

/* ── Reader Layout ─────────────────────────────────────────────────────── */
.reader {
    position: relative;
    min-height: 100vh;
}

.reader-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.reader-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.time-machine-btn {
    background: none;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-pill);
    padding: 0.3em 0.6em;
    font-size: 1.1rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.reader-column {
    max-width: 680px;
    margin: 0 auto;
    padding: 1.5rem 1rem 6rem;
    scroll-behavior: smooth;
}

/* ── DOM Boxes ─────────────────────────────────────────────────────────── */
.dom-box {
    position: relative;
    padding: 0.5rem 0.75rem;
    margin: 0.125rem 0;
    border-radius: var(--radius-block);
    border-left: 3px solid transparent;
    transition: opacity 0.26s cubic-bezier(.4,0,.2,1),
                transform 0.26s cubic-bezier(.4,0,.2,1),
                box-shadow 0.26s cubic-bezier(.4,0,.2,1),
                background 0.26s cubic-bezier(.4,0,.2,1),
                border-color 0.26s cubic-bezier(.4,0,.2,1);
    opacity: 0.74;
}

.dom-box.focused {
    opacity: 1;
    transform: translateY(-3px);
    box-shadow: 0 14px 40px var(--focus-glow);
    border-left-color: var(--focus-edge);
    background: var(--accent-soft);
}

.dom-box.has-feedback {
    border-left-color: var(--mine-border);
    background: var(--mine-bg);
}

/* ── Presence Pills (reader) ───────────────────────────────────────────── */
.presence-pills {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    padding: 0.2em 0.55em;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s;
}

.pill:active {
    transform: scale(0.96);
}

.pill strong {
    -webkit-text-stroke: 1.3px var(--surface);
    paint-order: stroke fill;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}

.pill.mine {
    background: var(--mine-bg);
    border-color: var(--mine-border);
    color: var(--mine-ink);
}

.pill.others {
    background: var(--others-bg);
    border-color: var(--others-border);
    color: var(--others-ink);
}

.pill.overflow {
    background: var(--surface);
    border-color: var(--line-2);
    color: var(--faint);
    font-weight: 500;
}

/* ── FAB ↔ Dock Morph ─────────────────────────────────────────────────── */
.fab-container {
    position: fixed;
    bottom: calc(var(--bottom-bar-h, 56px) + 1rem);
    right: 1rem;
    z-index: 100;
}

.fab {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-edge);
    box-shadow: 0 12px 36px rgba(0,0,0,.2);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: fab-breathe 3s ease-in-out infinite;
    transition: all 0.42s cubic-bezier(.34,1.3,.5,1);
}

@keyframes fab-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.fab-container.engaged .fab {
    display: none;
}

.dock {
    display: none;
    position: fixed;
    bottom: calc(var(--bottom-bar-h, 56px) + 1rem);
    left: 1rem;
    right: 1rem;
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--glass-edge);
    border-radius: 22px 22px 16px 16px;
    box-shadow: 0 -12px 44px rgba(0,0,0,.24);
    padding: 0.75rem;
    animation: dock-enter 0.42s cubic-bezier(.34,1.3,.5,1);
}

.fab-container.engaged .dock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@keyframes dock-enter {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dock-verbs {
    display: flex;
    gap: 0.35rem;
    flex: 1;
}

.verb {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-pill);
    padding: 0.4em 0.75em;
    font-size: 0.9rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.1));
}

.verb:active {
    transform: scale(0.94);
    background: var(--accent-soft);
}

.dock-note {
    width: 100%;
    padding-top: 0.5rem;
    border-top: 1px solid var(--line);
    margin-top: 0.35rem;
}

.note-textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-block);
    padding: 0.5rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--ink);
    resize: vertical;
    min-height: 60px;
}

.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.note-save, .note-delete {
    flex: 1;
    padding: 0.4em;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line-2);
    font-size: 0.85rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.note-save {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
}

.note-delete {
    background: var(--surface);
    color: var(--ink-soft);
}

.watcher {
    font-size: 1.3rem;
    min-width: 2rem;
    text-align: center;
    animation: watcher-idle 2.6s ease-in-out infinite;
}

@keyframes watcher-idle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Accordion Headings ────────────────────────────────────────────────── */
.dom-box[data-accordion] {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.dom-box[data-accordion]::before {
    content: '›';
    display: inline-block;
    margin-right: 0.4em;
    font-size: 0.9em;
    color: var(--faint);
    transition: transform 0.2s;
    transform: rotate(0deg);
}

.dom-box[data-accordion].open::before {
    transform: rotate(90deg);
}

.dom-box.accordion-collapsed {
    display: none;
}

/* ── Coachmark ─────────────────────────────────────────────────────────── */
.coachmark {
    position: fixed;
    bottom: calc(var(--bottom-bar-h, 56px) + 5rem);
    right: 1rem;
    z-index: 200;
}

.coachmark-content {
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: var(--radius-block);
    padding: 0.75rem 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    max-width: 240px;
    font-size: 0.82rem;
    color: var(--ink);
    line-height: 1.5;
}

.coachmark-dismiss {
    display: block;
    margin-top: 0.4rem;
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.3em 0.8em;
    font-size: 0.8rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.coachmark-arrow {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--accent);
    margin-left: auto;
    margin-right: 2.5rem;
}

/* ── Feedback Popover ──────────────────────────────────────────────────── */
.feedback-popover {
    position: fixed;
    z-index: 150;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-block);
    padding: 0.75rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    max-width: 280px;
    font-size: 0.82rem;
}

.popover-item {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--line);
}

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

.popover-item .popover-by {
    font-weight: 600;
    color: var(--ink);
}

.popover-item .popover-ts {
    color: var(--faint);
    font-size: 0.72rem;
    margin-left: 0.3em;
}

.popover-item .popover-note {
    color: var(--ink-soft);
    margin-top: 0.2em;
    font-style: italic;
}

/* ── Files Drawer (Bottom Sheet) ────────────────────────────────────────── */
.files-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    pointer-events: none;
}

.files-drawer.open {
    pointer-events: auto;
}

.drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s var(--ease-standard);
}

.files-drawer.open .drawer-backdrop {
    opacity: 1;
}

.drawer-sheet {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(110%);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    background: var(--surface);
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
    box-shadow: var(--shadow-sheet);
    transition: transform 0.3s var(--ease-springy);
    display: flex;
    flex-direction: column;
}

.files-drawer.open .drawer-sheet {
    transform: translateX(-50%) translateY(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.drawer-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--faint);
    cursor: pointer;
    padding: 0.25rem;
    -webkit-tap-highlight-color: transparent;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.drawer-project {
    border-bottom: 1px solid var(--line);
}

.drawer-project:last-child {
    border-bottom: none;
}

.drawer-project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.drawer-project-header:hover {
    background: var(--accent-soft);
}

.drawer-project-chevron {
    color: var(--faint);
    font-size: 1.1rem;
    transition: transform 0.2s var(--ease-standard);
}

.drawer-project.expanded .drawer-project-chevron {
    transform: rotate(90deg);
}

.drawer-files {
    display: none;
    padding: 0 1.25rem 0.5rem;
}

.drawer-project.expanded .drawer-files {
    display: block;
}

.drawer-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--ink);
    border-radius: var(--radius-block);
    transition: background 0.2s var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.drawer-file:hover {
    background: var(--accent-soft);
}

.drawer-file-icon {
    font-size: 1rem;
}

.drawer-file-name {
    font-size: 0.9rem;
}

/* ── Profile Sheet ──────────────────────────────────────────────────────── */
.profile-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    pointer-events: none;
}

.profile-sheet.open {
    pointer-events: auto;
}

.profile-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s var(--ease-standard);
}

.profile-sheet.open .profile-backdrop {
    opacity: 1;
}

.profile-content {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(110%);
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
    box-shadow: var(--shadow-sheet);
    transition: transform 0.3s var(--ease-springy);
    padding: 1.5rem 1.25rem;
}

.profile-sheet.open .profile-content {
    transform: translateX(-50%) translateY(0);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-handle {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
}

.profile-subtitle {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.profile-section {
    margin-bottom: 1.5rem;
}

.profile-section-title {
    font-size: 0.75rem;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.theme-control {
    display: flex;
    gap: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius-pill);
    padding: 0.25rem;
}

.theme-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-pill);
    background: none;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.2s var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.theme-btn.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-card);
}

.theme-btn:hover:not(.active) {
    color: var(--ink);
}

.profile-explainer {
    font-size: 0.75rem;
    color: var(--faint);
    margin-top: 0.5rem;
    font-style: italic;
}

.profile-logout {
    display: block;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--ink);
    text-align: center;
    text-decoration: none;
    transition: all 0.2s var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.profile-logout:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

/* ── Time Machine ───────────────────────────────────────────────────────── */
.time-machine {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: var(--bg);
    display: none;
    flex-direction: column;
}

.time-machine.open {
    display: flex;
}

.time-machine-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.time-machine-icon {
    font-size: 1.3rem;
}

.time-machine-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.time-machine-path {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--faint);
    flex: 1;
}

.time-machine-close {
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 0.4rem 1rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.2s var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.time-machine-close:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.time-machine-deck {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    perspective: 1000px;
}

.version-card {
    position: absolute;
    width: 280px;
    height: 180px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: all 0.3s var(--ease-springy);
    transform: skewX(-11deg) skewY(2deg);
    cursor: pointer;
}

.version-card.active {
    transform: skewX(-11deg) skewY(2deg) translateY(-20px) scale(1.06);
    border-color: var(--accent);
    box-shadow: 0 14px 40px var(--focus-glow);
}

.version-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.5rem;
}

.version-label {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
}

.version-date {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--faint);
}

.time-machine-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
    border-top: 1px solid var(--line);
}

.time-machine-nav {
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 0.4rem 1rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.2s var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.time-machine-nav:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.time-machine-current {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.time-machine-capstone {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--line);
    background: var(--accent-soft);
}

.capstone-content {
    max-width: 680px;
    margin: 0 auto;
}

.capstone-label {
    font-size: 0.75rem;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.capstone-text {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.capstone-notes {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.capstone-notes li {
    margin-bottom: 0.25rem;
}
