/* ===================================
   Step bar, Brief and Write
   Loaded after css/styles.css; reuses its tokens.
   =================================== */

/* ----- Step bar (top nav) ----- */
.step-bar { display: flex; align-items: center; gap: 4px; }
.step {
    display: flex; align-items: center; gap: 8px;
    font: 500 14px var(--font-sans); padding: 7px 14px;
    border: none; border-radius: var(--radius-sm);
    background: none; color: var(--color-text-secondary); cursor: pointer;
}
.step:hover:not(:disabled) { background: var(--color-bg); color: var(--color-text); }
.step.active { background: var(--color-primary-light); color: var(--color-primary); }
.step:disabled { opacity: 0.4; cursor: not-allowed; }
.step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    font-size: 11px; font-weight: 700;
    background: var(--color-border); color: var(--color-text-secondary);
}
.step.active .step-num { background: var(--color-primary); color: #fff; }
.step-arrow { color: var(--color-text-muted); font-size: 12px; }

/* ----- Brief ----- */
.ask-box { display: flex; gap: 10px; margin-bottom: 12px; }
.ask-box input {
    flex: 1; font: 15px var(--font-sans); padding: 10px 14px;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface);
}
.ask-box input:focus { outline: 2px solid var(--color-primary-light); border-color: var(--color-primary); }
.ask-message, .ask-banner {
    margin-bottom: 20px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px;
    background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text-secondary);
    display: flex; flex-direction: column; gap: 4px;
}
.ask-banner { margin: 14px 0 0; background: var(--color-primary-light); border-color: #c7d2fe; color: var(--color-text); }
.ask-title { font-weight: 600; color: var(--color-text); }
.ask-sub { font-size: 12.5px; color: var(--color-text-secondary); }

.move-card .problem-header { align-items: flex-start; }
.move-method { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-primary); }
.move-card .problem-title { font-size: 19px; }
.move-sub { font-size: 13px; color: var(--color-text-secondary); margin: 6px 0 10px; }
.brief-quiet { font-size: 12px; color: var(--color-text-muted); margin-top: 14px; }

/* ----- Write: note left, evidence right ----- */
.main-content:has(#page-write.active) { max-width: 1200px; }
.write-split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.write-split .inv-section { margin-bottom: 0; }
.write-note { position: sticky; top: 76px; }
.write-note-head { display: flex; align-items: center; justify-content: space-between; }
/* The note: bold headline, then short labelled sections of bullets */
.write-note-text { max-width: 62ch; font-size: 15px; line-height: 1.55; color: var(--color-text); margin-bottom: 12px; }
.note-item { cursor: pointer; border-radius: 6px; }
.note-item:hover { background: var(--color-bg); }
.note-item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.note-item.active { background: #fef9c3; box-shadow: 0 0 0 1px #fde047; }
.note-headline { font-size: 17px; font-weight: 700; line-height: 1.4; margin: 0 0 6px; padding: 4px 8px; margin-left: -8px; }
.note-section { margin-top: 16px; }
.note-section-label {
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--color-primary); margin: 0 0 4px;
}
.note-bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.note-bullet { position: relative; padding: 3px 8px 3px 22px; margin-left: -8px; }
.note-bullet::before {
    content: ''; position: absolute; left: 9px; top: 0.85em;
    width: 5px; height: 5px; border-radius: 50%; background: var(--color-text-muted);
}
.write-source { font-weight: 600; padding: 2px 8px; border-radius: 999px; font-style: normal; }
.write-source.ai { background: #dcfce7; color: #166534; }
.write-source.template { background: #e0e7ff; color: #3730a3; }
.write-source-line { font-size: 13px; margin-bottom: 14px; }
.write-copied { font-size: 12px; color: #166534; min-height: 1em; }

.write-evidence .inv-section-body { display: flex; flex-direction: column; gap: 8px; }
.write-fact {
    padding: 8px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border); font-size: 12.5px; transition: background-color 0.15s ease;
}
.write-fact.lit { background: #fef9c3; border-color: #fde047; }
.write-fact-head { font-weight: 600; color: var(--color-text); }
.write-fact-id {
    display: inline-block; min-width: 26px; font-size: 11px; font-weight: 700;
    color: var(--color-primary); font-variant-numeric: tabular-nums;
}
.write-fact-text { color: var(--color-text-secondary); margin-top: 2px; }
.write-fact-ref { color: var(--color-text-muted); font-size: 11px; margin-top: 2px; }

/* ----- App brand: name with a small subtitle beneath ----- */
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.nav-brand .brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.nav-brand .brand-sub { font-size: 11px; font-weight: 500; color: var(--color-text-muted); white-space: nowrap; }

/* ----- Product Pulse tab ----- */
.step-divider { width: 1px; height: 22px; background: var(--color-border); margin: 0 6px; }
.pulse-tab { font-weight: 600; }

/* ----- Product Pulse (home) ----- */
.pulse-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.pulse-tile {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 16px;
}
.pulse-value { font-size: 24px; font-weight: 700; color: var(--color-text); line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.pulse-sub { font-size: 11.5px; color: var(--color-text-muted); margin-top: 4px; line-height: 1.4; }
.pulse-table-wrap { overflow-x: auto; }
.pulse-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pulse-table th, .pulse-table td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.pulse-table th { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }
.pulse-table tr:last-child td { border-bottom: none; }
.pulse-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pulse-table td.up { color: #b91c1c; font-weight: 600; }
.pulse-cta { display: flex; justify-content: center; margin-top: 24px; }
.pulse-explain { font-size: 16px; padding: 12px 28px; }

/* ----- Last week's decision (one plain line at the bottom of the Pulse) ----- */
.last-decision {
    display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 4px 8px;
    margin-top: 28px; font-size: 12px; color: var(--color-text-muted); text-align: center;
}
.last-decision strong { font-weight: 600; }
.last-decision .link-btn { font-size: 12px; }
.sample-tag {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 1px 7px; border-radius: 999px; background: #f1f5f9; color: #475569; border: 1px dashed #94a3b8;
}
.link-btn {
    font: 500 13px var(--font-sans); color: var(--color-primary); background: none; border: none;
    padding: 0; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.ask-toggle { display: block; margin: -8px 0 12px; }

/* ----- Move label badge and the z tooltip ----- */
.move-badge {
    display: inline-block; vertical-align: middle; margin-left: 6px;
    font-size: 10.5px; font-weight: 700; text-transform: none; letter-spacing: 0;
    padding: 2px 8px; border-radius: 999px;
}
.move-badge.real { background: #fee2e2; color: #991b1b; }
.move-badge.watch { background: #fef9c3; color: #854d0e; }
.move-badge.noise { background: #f1f5f9; color: #64748b; }
.inv-meta .move-badge { margin-left: 0; }
.z-chip {
    position: relative; display: inline-block; cursor: help;
    border-bottom: 1px dotted var(--color-text-muted); color: var(--color-text);
}
.z-chip::after {
    content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 20;
    width: 300px; padding: 8px 10px; border-radius: var(--radius-sm);
    background: #1e293b; color: #fff; font-size: 12px; font-weight: 400; line-height: 1.45;
    opacity: 0; pointer-events: none; transition: opacity 0.12s ease;
}
.z-chip:hover::after, .z-chip:focus::after { opacity: 1; }
.inv-meta { flex-wrap: wrap; font-size: 13px; }

/* ----- AI model line (causes, Write) ----- */
.ai-model-line { font-size: 11.5px; color: var(--color-text-muted); font-weight: 400; }
.inv-ai-line { margin-left: auto; }
.write-note-label { display: flex; flex-direction: column; }
.write-prev { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--color-text-secondary); margin-top: 10px; }
.write-prev input { margin-top: 3px; }

/* ----- Follow up ----- */
.fu-entry { padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.fu-entry:last-of-type { border-bottom: none; }
.fu-entry-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.fu-entry-title { font-weight: 600; font-size: 14px; display: inline-flex; gap: 8px; align-items: center; }
.fu-entry-week { font-size: 12px; color: var(--color-text-muted); }
.fu-move { font-size: 14px; color: var(--color-text); margin: 4px 0 2px; }
.fu-result { margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.fu-result.met { background: #dcfce7; color: #166534; }
.fu-result.not-met { background: #fee2e2; color: #991b1b; }
.fu-result.awaiting { background: #f1f5f9; color: #475569; }

@media (max-width: 860px) {
    .write-split { grid-template-columns: 1fr; }
    .write-note { position: static; }
    .step-arrow { display: none; }
    .step { padding: 6px 8px; }
    .top-nav { padding: 0 16px; }
    .nav-brand .brand-text { display: none; }
    .pulse-tiles { grid-template-columns: repeat(2, 1fr); }
    .step-divider { display: none; }
}

/* ----- Debited but failed (js/debited.js) ----- */
.dbf-callout { margin: 16px 0 20px; font-size: 14px; }
.dbf-tiles { grid-template-columns: repeat(3, 1fr); }
.dbf-note { font-size: 13px; color: var(--color-text-secondary); margin: 10px 0 0; line-height: 1.5; }
.dbf-splits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dbf-row { padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.dbf-row:last-child { border-bottom: none; }
.dbf-row.zero { opacity: 0.65; }
.dbf-row-head { display: flex; align-items: center; gap: 10px; }
.dbf-row-head .inv-breakdown-label { min-width: 90px; }
.dbf-row-head .inv-breakdown-bar-bg { flex: 1; }
.dbf-row-line { font-size: 12px; color: var(--color-text-secondary); margin-top: 3px; line-height: 1.45; }
.dbf-base { display: block; color: var(--color-text-muted); font-size: 11.5px; }
.dbf-table .record-id { font-size: 12.5px; }
.dbf-total td { font-weight: 600; }
.dbf-related { display: flex; flex-direction: column; gap: 10px; }
.dbf-why { margin-top: 8px; }
@media (max-width: 860px) {
    .dbf-splits, .dbf-tiles { grid-template-columns: 1fr; }
}
