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

/* ─── Design tokens ─────────────────────────────────────────── */
:root {
    --bg: #f5f2ee;
    --surface: #faf8f5;
    --border: #d4cec5;
    --sage: #7d9e8a;
    --text: #1c1a17;
    --text-mid: #6b6459;
    --term-bg: #1a1a17;
    --term-green: #4ade80;
    --term-dim: #2a6640;
    --urgent-bg: #fef2f2;
    --urgent-fg: #dc2626;
    --routine-bg: #fffbeb;
    --routine-fg: #d97706;
    --low-bg: #f0fdf4;
    --low-fg: #16a34a;
}

/* ─── Base ───────────────────────────────────────────────────── */
html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

main {
    min-height: 100vh;
}

/* Subtle grain overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    background-repeat: repeat;
}

/* ─── Two-column layout ──────────────────────────────────────── */
.dispatch-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ─── Panels ─────────────────────────────────────────────────── */
.panel {
    padding: 3.25rem 3.5rem;
    display: flex;
    flex-direction: column;
}

.panel-form,
.panel-results {
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.panel-info,
.panel-trello {
    background: var(--bg);
}

/* ─── Brand ──────────────────────────────────────────────────── */
.brand {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 2.75rem;
    text-decoration: none;
}

.brand-mark {
    font-size: 18px;
    line-height: 1;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

/* ─── Panel typography ───────────────────────────────────────── */
.panel-heading {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.035em;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 6px;
}

.panel-sub {
    font-size: 14px;
    color: var(--text-mid);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* ─── Form fields ────────────────────────────────────────────── */
.form-fields {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.field-input {
    padding: 10px 13px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

.field-input:focus {
    border-color: var(--sage);
    box-shadow: 0 0 0 3px rgba(125, 158, 138, 0.12);
}

.field-input::placeholder {
    color: var(--border);
}

.field-textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.55;
}

.form-error {
    font-size: 13px;
    color: var(--urgent-fg);
    margin-top: 2px;
}

/* ─── Submit button ──────────────────────────────────────────── */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--text);
    color: var(--surface);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
    margin-top: 6px;
    letter-spacing: -0.01em;
}

.submit-btn:hover {
    opacity: 0.82;
}

.submit-btn:active {
    transform: scale(0.98);
}

.btn-arrow {
    font-size: 16px;
    line-height: 1;
}

/* ─── Info panel (right, state 1) ────────────────────────────── */
.info-panel-inner {
    padding-top: 1rem;
}

.info-badge {
    display: inline-flex;
    padding: 4px 11px;
    background: rgba(125, 158, 138, 0.13);
    color: var(--sage);
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.info-heading {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.035em;
    color: var(--text);
    margin-bottom: 1rem;
    line-height: 1.18;
}

.info-desc {
    font-size: 14px;
    color: var(--text-mid);
    line-height: 1.65;
    margin-bottom: 2.5rem;
    max-width: 380px;
}

.info-steps {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.info-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.step-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--sage);
    padding-top: 3px;
    min-width: 22px;
    letter-spacing: 0;
}

.step-content h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
    letter-spacing: -0.01em;
}

.step-content p {
    font-size: 13px;
    color: var(--text-mid);
    line-height: 1.55;
}

/* ─── Terminal (state 2) ─────────────────────────────────────── */
.terminal-container {
    min-height: 100vh;
    background: var(--term-bg);
    display: flex;
    flex-direction: column;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.terminal-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red    { background: #ff5f57; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #28c840; }

.terminal-title {
    flex: 1;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.02em;
    margin-right: 54px; /* balance the dots width */
}

.terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(74, 222, 128, 0.2) transparent;
}

.terminal-body::-webkit-scrollbar {
    width: 4px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(74, 222, 128, 0.2);
    border-radius: 2px;
}

.terminal-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--term-green);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* Blinking cursor on the last char */
.terminal-cursor {
    display: inline-block;
    width: 9px;
    height: 16px;
    background: var(--term-green);
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ─── Results panel (state 3, left) ──────────────────────────── */
.results-header {
    margin-bottom: 1.75rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.result-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.result-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-mid);
}

.result-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3;
}

/* Priority badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    align-self: flex-start;
}

.badge-urgent  { background: var(--urgent-bg);  color: var(--urgent-fg);  }
.badge-routine { background: var(--routine-bg); color: var(--routine-fg); }
.badge-low     { background: var(--low-bg);     color: var(--low-fg);     }

/* Draft response box */
.draft-response {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    margin-bottom: 1.5rem;
}

.draft-text {
    font-size: 13.5px;
    color: var(--text-mid);
    line-height: 1.65;
    font-style: italic;
}

/* Confirmation pills */
.confirmation-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border-radius: 100px;
    font-size: 12.5px;
    font-weight: 500;
}

.pill-success { background: var(--low-bg);     color: var(--low-fg);     }
.pill-warn    { background: var(--routine-bg); color: var(--routine-fg); }
.pill-error   { background: var(--urgent-bg);  color: var(--urgent-fg);  }

/* Reset button */
.reset-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    transition: border-color 0.15s, background 0.15s;
    letter-spacing: -0.01em;
}

.reset-btn:hover {
    background: var(--bg);
    border-color: var(--text-mid);
}

/* ─── Board link panel (right, state 3) ─────────────────────── */
.board-panel {
    justify-content: center;
}

.board-eyebrow {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sage);
    margin-bottom: 0.6rem;
}

.board-heading {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.board-desc {
    font-size: 14px;
    color: var(--text-mid);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.board-card-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bcp-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-mid);
}

.bcp-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.bcp-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bcp-list {
    font-size: 12px;
    color: var(--text-mid);
}

.bcp-vendor {
    font-size: 12px;
    color: var(--text-mid);
    font-family: 'JetBrains Mono', monospace;
}

.board-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.board-btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 11px 22px;
    background: var(--text);
    color: var(--surface);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    letter-spacing: -0.01em;
}

.board-btn-primary:hover { opacity: 0.82; }

.board-btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 11px 20px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
}

.board-btn-secondary:hover {
    background: var(--bg);
    border-color: var(--text-mid);
}

/* ─── Blazor error UI — hidden ───────────────────────────────── */
#blazor-error-ui {
    display: none !important;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .dispatch-layout {
        grid-template-columns: 1fr;
    }

    .panel-form,
    .panel-results {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .panel {
        padding: 2.5rem 2rem;
    }

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

    .panel-trello {
        min-height: 400px;
    }

    .terminal-body {
        padding: 1.5rem 1.25rem;
    }

    .terminal-text {
        font-size: 12px;
    }
}
