/* ============================================================================
   Stage 3: kanban, inbox, composer, templates.
   ============================================================================ */

/* ── Kanban ───────────────────────────────────────────────────────────── */
.kanban {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: flex-start;
    min-height: 500px;
}
.kan-col {
    min-width: 280px;
    width: 280px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 260px);
}
.kan-col-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: sticky;
    top: 0;
    background: var(--bg-alt);
    z-index: 1;
}
.kan-col-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.kan-col-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--stage-color, var(--accent));
}
.kan-col-meta { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.kan-col-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 120px;
}
.kan-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: grab;
    transition: border-color 0.12s, transform 0.06s;
}
.kan-card:active { cursor: grabbing; }
.kan-card:hover { border-color: var(--border-strong); }
.kan-card.is-stale { border-color: rgba(239,68,68,0.4); }
.kan-card-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.kan-card-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.kan-card-quote {
    font-size: 12px;
    color: var(--text-dim);
    font-style: italic;
    border-left: 2px solid var(--border-strong);
    padding-left: 8px;
    margin-bottom: 8px;
    line-height: 1.4;
}
.kan-card-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
}
.kan-card-value { font-weight: 700; color: var(--accent); font-family: ui-monospace, monospace; }
.kan-card-tech { color: var(--text-dim); }
.kan-card-age { margin-left: auto; font-family: ui-monospace, monospace; }
.kan-card-action {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
}
.kan-empty {
    text-align: center;
    padding: 24px 8px;
    color: var(--muted-dim);
    font-size: 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
}
.kan-card-ghost { opacity: 0.5; background: var(--bg-alt); }
.kpi-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-direction: row;
    padding: 8px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.kpi-inline .kpi-label { margin: 0; }
.kpi-inline .kpi-value { font-size: 18px; }

/* ── Messaging inbox ──────────────────────────────────────────────────── */
.messages-page { padding-bottom: 0; }
.inbox {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    height: calc(100vh - 200px);
    min-height: 480px;
}
.inbox-list {
    border-right: 1px solid var(--border);
    background: var(--bg-alt);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.inbox-filter {
    display: flex;
    gap: 4px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-alt);
    z-index: 1;
}
.inbox-filter a {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    border-radius: 999px;
    border: 1px solid var(--border);
}
.inbox-filter a:hover { color: var(--text); }
.inbox-filter a.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.inbox-row {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.inbox-row:hover { background: var(--card-hover); }
.inbox-row.is-selected { background: rgba(255,107,0,0.08); box-shadow: inset 2px 0 0 var(--accent); }
.inbox-row-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.inbox-row-name { font-weight: 600; font-size: 14px; }
.inbox-row-ts { font-size: 11px; }
.inbox-row-meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.inbox-row-channel { background: rgba(255,255,255,0.05); padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.inbox-unread {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 999px;
    font-weight: 700;
    margin-left: auto;
}
.inbox-row-preview {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inbox-empty { padding: 24px 14px; color: var(--muted); font-size: 13px; text-align: center; }

/* Right pane */
.inbox-thread { display: flex; flex-direction: column; min-width: 0; }
.inbox-empty-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}
.thread-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.thread-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.thread-contacts { font-size: 12px; display: flex; gap: 6px; align-items: center; }
.thread-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg);
}

/* Composer */
.composer {
    border-top: 1px solid var(--border);
    padding: 12px 20px 16px;
    background: var(--card);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.composer-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-toolbar select, .composer-toolbar input { padding: 6px 10px; font-size: 13px; min-width: 140px; }
.composer textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
}
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.small { font-size: 12px; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
    background: rgba(255,255,255,0.04);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--text-dim);
}
