/* ══════════════════════════════════════════════
   FAZENDA HIGH-TECH — BULLET JOURNAL DIGITAL
   Moleskine Dark × Minimal × BuJo Method
   ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap');

:root {
    /* Paper & Ink */
    --bg: #0f0f0e;
    --surface: #151514;
    --surface-2: #1a1a18;
    --paper: #1e1e1b;
    --ink: #d4d0c8;
    --ink-dim: #8a8878;
    --ink-muted: #5a5a4e;
    --ink-faint: #3a3a30;

    /* Accents */
    --copper: #c87941;
    --copper-glow: #e8944a;
    --green: #5a8a5a;
    --green-light: #7aaa6a;
    --blue: #5a7a9a;
    --amber: #c8a848;
    --red: #a85a4a;
    --red-soft: #8a4a3a;

    /* BuJo Signifiers */
    --task: var(--ink);
    --done: var(--green);
    --migrated: var(--blue);
    --event: var(--amber);
    --note: var(--ink-dim);
    --priority: var(--red);

    /* Type */
    --mono: 'JetBrains Mono', 'Consolas', monospace;
    --serif: 'Crimson Pro', 'Georgia', serif;

    /* Spacing */
    --page-max: 820px;
    --gutter: 24px;
    --dot-size: 1px;
    --dot-gap: 24px;
}

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

/* Prevent iOS Safari double-tap zoom */
a,
button,
input,
textarea,
select,
[onclick] {
    touch-action: manipulation;
}

/* Fix iOS Safari auto-zoom on input focus */
@media (max-width: 430px) {

    input,
    textarea,
    select {
        font-size: 16px !important;
    }
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--ink-faint) var(--bg);
    overflow-x: hidden;
}

body {
    font-family: var(--serif);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.8;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--copper);
    text-decoration: none;
}

a:hover {
    color: var(--copper-glow);
}

::selection {
    background: var(--copper);
    color: var(--bg);
}

/* ══════════════════════════════════════════════
   PAGE — Simulates a Moleskine journal page
   ══════════════════════════════════════════════ */
.journal {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
    position: relative;
    overflow-x: hidden;
}

/* Dot grid background */
.journal::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle, var(--ink-faint) var(--dot-size), transparent var(--dot-size));
    background-size: var(--dot-gap) var(--dot-gap);
    background-position: 12px 12px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

/* Left margin line (like a Moleskine) */
.journal::after {
    content: '';
    position: fixed;
    left: calc(50% - var(--page-max) / 2 + 44px);
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--red-soft);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

/* ══════════════════════════════════════════════
   COVER — Journal front page
   ══════════════════════════════════════════════ */
.cover {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 0;
    position: relative;
    z-index: 1;
}

.cover-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 32px;
}

.cover h1 {
    font-family: var(--serif);
    font-size: clamp(42px, 7vw, 72px);
    font-weight: 300;
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.cover h1 em {
    font-style: italic;
    color: var(--copper);
}

.cover-sub {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 300;
    color: var(--ink-dim);
    font-style: italic;
    margin-bottom: 40px;
    max-width: 480px;
}

.cover-meta {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.cover-meta-item {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cover-meta-item strong {
    font-size: 20px;
    font-weight: 500;
    color: var(--ink);
}

.cover-divider {
    width: 60px;
    height: 1px;
    background: var(--copper);
    margin: 40px 0;
}

/* ══════════════════════════════════════════════
   INDEX — Table of contents
   ══════════════════════════════════════════════ */
.index {
    padding: 60px 0;
    border-bottom: 1px solid var(--ink-faint);
    position: relative;
    z-index: 1;
}

.page-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--copper);
    margin-bottom: 6px;
    display: block;
}

.page-title {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 300;
    color: var(--ink);
    margin-bottom: 28px;
    letter-spacing: -0.01em;
}

.index-list {
    list-style: none;
    counter-reset: idx;
}

.index-list li {
    counter-increment: idx;
    display: flex;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px dotted var(--ink-faint);
    font-family: var(--mono);
    font-size: 13px;
    color: var(--ink-dim);
    transition: color 0.2s;
}

.index-list li:hover {
    color: var(--ink);
}

.index-list li::before {
    content: counter(idx, decimal-leading-zero);
    font-size: 11px;
    color: var(--ink-muted);
    width: 32px;
    flex-shrink: 0;
}

.index-list li a {
    color: inherit;
    flex: 1;
}

.index-list li .idx-page {
    font-size: 11px;
    color: var(--ink-muted);
    margin-left: auto;
}

/* ══════════════════════════════════════════════
   PAGE SECTIONS (Collections)
   ══════════════════════════════════════════════ */
.page {
    padding: 60px 0;
    border-bottom: 1px solid var(--ink-faint);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.page-number {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink-muted);
    text-align: right;
    margin-bottom: 4px;
}

/* ══════════════════════════════════════════════
   RAPID LOG — BuJo symbols
   ══════════════════════════════════════════════ */
.rapid-log {
    list-style: none;
    padding-left: 0;
}

.rapid-log li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink-dim);
}

/* Bullet types */
.rapid-log li::before {
    font-family: var(--mono);
    font-size: 14px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    margin-top: 2px;
}

.rapid-log li.task::before {
    content: '•';
    color: var(--task);
}

.rapid-log li.task-done::before {
    content: '✕';
    color: var(--done);
}

.rapid-log li.task-done {
    color: var(--ink-muted);
    text-decoration: line-through;
    text-decoration-color: var(--ink-faint);
}

.rapid-log li.task-migrated::before {
    content: '>';
    color: var(--migrated);
}

.rapid-log li.task-migrated {
    color: var(--ink-muted);
}

.rapid-log li.event::before {
    content: '○';
    color: var(--event);
}

.rapid-log li.note::before {
    content: '—';
    color: var(--note);
}

.rapid-log li.priority::before {
    content: '!';
    color: var(--priority);
    font-weight: 700;
}

/* Nested items */
.rapid-log .sub {
    padding-left: 30px;
}

/* ══════════════════════════════════════════════
   KEY (Legend)
   ══════════════════════════════════════════════ */
.bujo-key {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--ink-faint);
    margin-bottom: 32px;
    font-family: var(--mono);
    font-size: 11px;
}

.bujo-key span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-dim);
}

.bujo-key .sym {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.bujo-key .sym.t {
    color: var(--task);
}

.bujo-key .sym.d {
    color: var(--done);
}

.bujo-key .sym.m {
    color: var(--migrated);
}

.bujo-key .sym.e {
    color: var(--event);
}

.bujo-key .sym.n {
    color: var(--note);
}

.bujo-key .sym.p {
    color: var(--priority);
    font-weight: 700;
}

/* ══════════════════════════════════════════════
   FUTURE LOG
   ══════════════════════════════════════════════ */
.future-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1px;
    background: var(--ink-faint);
    border: 1px solid var(--ink-faint);
}

.future-cell {
    background: var(--surface);
    padding: 20px;
    min-height: 160px;
}

.future-cell-title {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--copper);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ink-faint);
}

.future-cell .rapid-log li {
    font-size: 13px;
    padding: 3px 0;
}

/* ══════════════════════════════════════════════
   COLLECTION CARDS — for tech items
   ══════════════════════════════════════════════ */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1px;
    background: var(--ink-faint);
    border: 1px solid var(--ink-faint);
    margin-bottom: 24px;
}

.collection-card {
    background: var(--surface);
    padding: 20px;
    position: relative;
    transition: background 0.2s;
}

.collection-card:hover {
    background: var(--surface-2);
}

.collection-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.collection-card-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--ink-faint);
    background: var(--bg);
    flex-shrink: 0;
}

.collection-card-name {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.3;
}

.collection-card-desc {
    font-size: 13px;
    color: var(--ink-dim);
    line-height: 1.6;
}

.collection-card-spec {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--green-light);
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--ink-faint);
    line-height: 1.4;
}

/* ══════════════════════════════════════════════
   TRACKER — Progress bars
   ══════════════════════════════════════════════ */
.tracker {
    margin-bottom: 32px;
}

.tracker-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dotted var(--ink-faint);
    font-family: var(--mono);
    font-size: 12px;
}

.tracker-label {
    color: var(--ink-dim);
}

.tracker-value {
    color: var(--ink);
    text-align: right;
    font-weight: 500;
}

.tracker-total {
    color: var(--copper);
    font-weight: 700;
    font-size: 14px;
}

.tracker-total .tracker-label {
    color: var(--copper);
    font-weight: 700;
}

.tracker-note {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink-muted);
    font-style: italic;
    margin-top: 8px;
}

/* ══════════════════════════════════════════════
   SECTION HEADING
   ══════════════════════════════════════════════ */
.section-heading {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--copper);
    margin: 32px 0 16px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--copper);
    display: inline-block;
}

/* ══════════════════════════════════════════════
   PROSE — Body text in collections
   ══════════════════════════════════════════════ */
.prose {
    font-size: 16px;
    color: var(--ink-dim);
    line-height: 1.8;
    max-width: 600px;
    margin-bottom: 24px;
}

.prose strong {
    color: var(--ink);
}

/* ══════════════════════════════════════════════
   INFO CARDS — Stats / quick facts
   ══════════════════════════════════════════════ */
.stats-row {
    display: flex;
    gap: 1px;
    background: var(--ink-faint);
    border: 1px solid var(--ink-faint);
    margin-bottom: 32px;
}

.stat-item {
    background: var(--surface);
    padding: 16px 20px;
    flex: 1;
    text-align: center;
}

.stat-value {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 500;
    color: var(--copper);
    display: block;
}

.stat-label {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-top: 4px;
}

/* ══════════════════════════════════════════════
   PLANTA (preserved from original)
   ══════════════════════════════════════════════ */
.planta-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    background: var(--surface);
    border: 1px solid var(--ink-faint);
    overflow: hidden;
    margin-bottom: 24px;
}

.planta-container svg {
    width: 100%;
    height: 100%;
}

.planta-zone {
    cursor: pointer;
    transition: filter 0.3s, opacity 0.3s;
}

.planta-zone:hover {
    filter: brightness(1.3);
}

.planta3d-container {
    position: relative;
    width: 100%;
    height: 450px;
    background: var(--bg);
    border: 1px solid var(--ink-faint);
    overflow: hidden;
}

.planta3d-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ══════════════════════════════════════════════
   NOTES — Post-it wall (preserved)
   ══════════════════════════════════════════════ */
.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.notes-add-btn {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    padding: 8px 20px;
    border: 1px solid var(--copper);
    background: transparent;
    color: var(--copper);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s;
}

.notes-add-btn:hover {
    background: var(--copper);
    color: var(--bg);
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    min-height: 100px;
}

.note-card {
    background: var(--surface-2);
    border: 1px solid var(--ink-faint);
    border-left: 3px solid var(--amber);
    padding: 16px;
    position: relative;
    min-height: 80px;
}

.note-card-text {
    font-size: 13px;
    color: var(--ink-dim);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-card-date {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink-muted);
    margin-top: 10px;
    display: block;
}

.note-card-delete {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: var(--ink-muted);
    cursor: pointer;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.note-card:hover .note-card-delete {
    opacity: 1;
}

.notes-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--ink-muted);
    font-family: var(--mono);
    font-size: 12px;
    border: 1px dashed var(--ink-faint);
}

/* Note modal */
.note-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    place-items: center;
}

.note-modal-backdrop.open {
    display: grid;
}

.note-modal {
    background: var(--surface);
    border: 1px solid var(--copper);
    padding: 24px;
    width: min(420px, calc(100vw - 32px));
    max-width: 100%;
}

.note-modal h3 {
    font-family: var(--mono);
    color: var(--copper);
    margin-bottom: 16px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.note-modal textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    background: var(--bg);
    border: 1px solid var(--ink-faint);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    padding: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.note-modal textarea:focus {
    border-color: var(--copper);
}

.note-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

.note-modal-actions button {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    padding: 8px 20px;
    border: 1px solid var(--ink-faint);
    background: transparent;
    color: var(--ink-dim);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s;
}

.note-modal-actions .save-btn {
    border-color: var(--copper);
    color: var(--copper);
}

.note-modal-actions .save-btn:hover {
    background: var(--copper);
    color: var(--bg);
}

/* ══════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════ */
.journal-footer {
    padding: 40px 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink-muted);
    letter-spacing: 0.12em;
    position: relative;
    z-index: 1;
}

/* ══════════════════════════════════════════════
   REVEAL ANIMATION
   ══════════════════════════════════════════════ */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ══════════════════════════════════════════════
   PAGE VIEWS (Router)
   ══════════════════════════════════════════════ */
.page-view {
    animation: pageIn 0.25s ease-out;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ══════════════════════════════════════════════
   BOTTOM TAB BAR
   ══════════════════════════════════════════════ */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--ink-faint);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(21, 21, 20, 0.92);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 0 6px;
    min-height: 50px;
    text-decoration: none;
    color: var(--ink-muted);
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.tab-item:hover {
    color: var(--ink-dim);
}

.tab-item.active {
    color: var(--copper);
}

.tab-icon {
    font-size: 20px;
    line-height: 1;
}

.tab-label {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Add bottom padding to journal to prevent content hidden behind tab bar */
.journal {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
}

/* ══════════════════════════════════════════════
   RESPONSIVE — Tablet (768px)
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --gutter: 20px;
    }

    .journal::after {
        display: none;
    }

    .cover h1 {
        font-size: 36px;
    }

    .cover-meta {
        gap: 20px;
    }

    .stats-row {
        flex-direction: column;
    }

    .future-grid {
        grid-template-columns: 1fr;
    }

    .collection-grid {
        grid-template-columns: 1fr;
    }

    .bujo-key {
        flex-direction: column;
        gap: 8px;
    }
}

/* ══════════════════════════════════════════════
   RESPONSIVE — iPhone 14 (390px)
   ══════════════════════════════════════════════ */
@media (max-width: 430px) {
    :root {
        --gutter: 14px;
        --dot-gap: 20px;
    }

    body {
        line-height: 1.65;
        -webkit-text-size-adjust: 100%;
    }

    /* Safe area for notch/dynamic island */
    .journal {
        padding-left: max(var(--gutter), env(safe-area-inset-left));
        padding-right: max(var(--gutter), env(safe-area-inset-right));
    }

    /* ── Cover ── */
    .cover {
        min-height: 100svh;
        padding: 40px 0 32px;
    }

    .cover-label {
        font-size: 8px;
        letter-spacing: 0.3em;
        margin-bottom: 20px;
    }

    .cover h1 {
        font-size: 28px;
        margin-bottom: 6px;
    }

    .cover-sub {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .cover-divider {
        margin: 24px 0;
    }

    .cover-meta {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .cover-meta-item strong {
        font-size: 16px;
    }

    .cover-meta-item {
        font-size: 9px;
    }

    /* ── Index ── */
    .index {
        padding: 36px 0;
    }

    .index-list li {
        padding: 12px 0;
        font-size: 12px;
        min-height: 44px;
        align-items: center;
    }

    .index-list li::before {
        font-size: 10px;
        width: 26px;
    }

    /* ── Page sections ── */
    .page {
        padding: 36px 0;
    }

    .page-label {
        font-size: 9px;
        letter-spacing: 0.3em;
    }

    .page-title {
        font-size: 20px;
        margin-bottom: 18px;
    }

    .page-title span {
        display: block;
        margin-top: 4px;
        font-size: 10px;
    }

    /* ── Rapid Log ── */
    .rapid-log li {
        font-size: 13px;
        padding: 8px 0;
        gap: 8px;
        line-height: 1.5;
    }

    .rapid-log li::before {
        font-size: 12px;
        width: 16px;
    }

    /* ── Future Log ── */
    .future-grid {
        grid-template-columns: 1fr;
    }

    .future-cell {
        padding: 14px;
        min-height: auto;
    }

    .future-cell-title {
        font-size: 10px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .future-cell .rapid-log li {
        font-size: 12px;
        padding: 4px 0;
    }

    /* ── Collection Cards ── */
    .collection-grid {
        grid-template-columns: 1fr;
        gap: 1px;
    }

    .collection-card {
        padding: 14px;
    }

    .collection-card-icon {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .collection-card-name {
        font-size: 11px;
    }

    .collection-card-desc {
        font-size: 12px;
        line-height: 1.5;
    }

    .collection-card-spec {
        font-size: 9px;
    }

    /* ── Stats row ── */
    .stats-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1px;
        flex-direction: unset;
    }

    .stat-item {
        padding: 12px 10px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-label {
        font-size: 8px;
    }

    /* ── Prose ── */
    .prose {
        font-size: 14px;
        line-height: 1.7;
        margin-bottom: 16px;
    }

    /* ── Section heading ── */
    .section-heading {
        font-size: 10px;
        margin: 20px 0 12px;
    }

    /* ── Tracker ── */
    .tracker-row {
        font-size: 11px;
        gap: 8px;
        padding: 6px 0;
    }

    .tracker-total {
        font-size: 12px;
    }

    .tracker-phase-title {
        font-size: 10px;
        padding: 10px 0 3px;
    }

    /* ── Planta (horizontal scroll) ── */
    .planta-container {
        aspect-ratio: auto;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .planta-container svg {
        width: 700px;
        height: auto;
        min-height: 500px;
    }

    .planta3d-container {
        height: 280px;
    }

    /* ── Notes ── */
    .notes-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .notes-add-btn {
        text-align: center;
        padding: 12px;
        font-size: 12px;
    }

    .notes-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .note-card {
        padding: 12px;
    }

    .note-card-text {
        font-size: 12px;
    }

    /* ── Key ── */
    .bujo-key {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 12px 14px;
        font-size: 10px;
    }

    .bujo-key .sym {
        font-size: 12px;
        width: 14px;
    }

    /* ── Modals ── */
    .note-modal-backdrop {
        padding: 16px;
        align-items: flex-start;
        padding-top: 30vh;
    }

    .note-modal {
        width: 100%;
        max-width: 100%;
        padding: 20px 18px;
    }

    .note-modal h3 {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .note-modal p {
        font-size: 13px !important;
    }

    .note-modal textarea {
        font-size: 14px;
        min-height: 100px;
        padding: 14px;
    }

    .note-modal-actions {
        margin-top: 14px;
    }

    .note-modal-actions button {
        padding: 12px 24px;
        font-size: 13px;
        min-height: 44px;
    }

    /* Auth modal input specifically */
    #authInput {
        font-size: 16px !important;
        padding: 14px 12px !important;
        min-height: 48px !important;
        border-radius: 0;
    }

    /* ── Task input (touch-friendly) ── */
    .task-input-row {
        flex-direction: column;
        gap: 6px;
        max-width: 100%;
    }

    .task-input {
        padding: 10px 12px;
        font-size: 16px;
        min-height: 44px;
        width: 100%;
        max-width: 100%;
    }

    .task-type-select {
        width: 100%;
        max-width: 100%;
        padding: 8px 32px 8px 10px;
        font-size: 13px;
        min-height: 44px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8878' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 10px center;
    }

    /* Delete always visible on touch (no hover) */
    .task-delete {
        display: inline;
        opacity: 0.3;
    }

    .note-card-delete {
        opacity: 0.5;
    }

    /* ── Links ── */
    .links-grid {
        flex-direction: column;
    }

    .link-item {
        padding: 12px 14px;
        font-size: 13px;
        display: flex;
        align-items: center;
        min-height: 44px;
    }

    /* ── Footer ── */
    .journal-footer {
        padding: 28px 0;
        font-size: 9px;
        padding-bottom: max(28px, env(safe-area-inset-bottom));
    }

    /* ── Cover coordinates text ── */
    .cover>div[style*="letter-spacing"] {
        word-break: break-all;
        font-size: 8px !important;
        letter-spacing: 0.1em !important;
        line-height: 1.4;
    }

    /* ── Collapsible section headers (44px touch target) ── */
    .page-title[data-collapsible] {
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .page-title[data-collapsible]::after {
        content: '▼';
        font-size: 10px;
        color: var(--ink-muted);
        transition: transform 0.2s;
        margin-left: auto;
        flex-shrink: 0;
    }

    .page-title[data-collapsible].collapsed::after {
        transform: rotate(-90deg);
    }
}

/* ══════════════════════════════════════════════
   INTERACTIVE BuJo (per .doutores + .arquiteto)
   ══════════════════════════════════════════════ */

/* Collapsible sections (Krug: Progressive Disclosure) */
.page-body.collapsed {
    display: none;
}

.page-title[data-collapsible] {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 30px;
}

.page-title[data-collapsible]::after {
    content: '▾';
    position: absolute;
    right: 0;
    font-size: 16px;
    color: var(--ink-muted);
    transition: transform 0.2s;
}

.page-title[data-collapsible].collapsed::after {
    transform: rotate(-90deg);
}

/* Clickable tasks */
.rapid-log li.task,
.rapid-log li.task-done,
.rapid-log li.task-migrated {
    transition: background 0.15s;
    padding: 6px 8px;
    margin: 0 -8px;
    border-radius: 2px;
}

.rapid-log li.task:hover,
.rapid-log li.task-done:hover,
.rapid-log li.task-migrated:hover {
    background: var(--surface-2);
}

/* Section progress badges */
.section-progress {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-muted);
    margin-left: 8px;
}

/* Active index item */
.index-list li.active {
    color: var(--copper);
}

.index-list li.active::before {
    color: var(--copper);
}

/* Task inline input */
.task-input-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
    max-width: 100%;
    width: 100%;
}

.task-input {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    background: transparent;
    border: 1px solid var(--ink-faint);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 12px;
    padding: 6px 10px;
    outline: none;
    transition: border-color 0.2s;
}

.task-input:focus {
    border-color: var(--copper);
}

.task-input::placeholder {
    color: var(--ink-muted);
}

.task-type-select {
    background: var(--surface);
    border: 1px solid var(--ink-faint);
    color: var(--ink-dim);
    font-family: var(--mono);
    font-size: 11px;
    padding: 5px;
    cursor: pointer;
    max-width: 100%;
    flex-shrink: 0;
}

/* Task submit button */
.task-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: 2px solid var(--copper);
    border-radius: 50%;
    background: transparent;
    color: var(--copper);
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.task-submit-btn:hover {
    background: var(--copper);
    color: var(--bg);
}

.task-submit-btn:active {
    transform: scale(0.9);
    background: var(--copper);
    color: var(--bg);
}

.task-submit-btn:disabled {
    opacity: 0.3;
    cursor: wait;
    pointer-events: none;
}

/* Task delete button */
.task-delete {
    display: none;
    background: none;
    border: none;
    color: var(--ink-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 0.15s, color 0.15s;
    float: right;
}

.rapid-log li:hover .task-delete {
    display: inline;
}

.task-delete:hover {
    opacity: 1;
    color: #e74c3c;
}

/* Links grid */
.links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.link-item {
    display: inline-block;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--copper);
    padding: 8px 14px;
    border: 1px solid var(--rule);
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s;
}

.link-item:hover {
    border-color: var(--copper);
    background: rgba(200, 121, 65, 0.06);
}

/* Loading state */
.loading {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-muted);
    font-style: italic;
}

/* Tracker P0-P4 phase titles */
.tracker-phase-title {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--copper);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 0 4px;
    border-top: 1px solid var(--rule);
    margin-top: 8px;
}

.tracker-phase-title:first-child {
    border-top: none;
    margin-top: 0;
}

.tracker-subtotal .tracker-label {
    font-style: italic;
    color: var(--ink-muted);
}

.tracker-subtotal .tracker-value {
    color: var(--ink-dim);
}