* {
    box-sizing: border-box;
}

:root {
    --primary: #0f3d56;
    --primary-light: #2d6f8e;
    --accent: #3aa0b4;
    --bg: #f5f8fb;
    --text: #102236;
    --muted: #5d6d7f;
    --border: #dce5ee;
}

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    background: radial-gradient(circle at top right, rgba(58, 160, 180, 0.16), transparent 35%), var(--bg);
    color: var(--text);
}

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.hero {
    background: linear-gradient(135deg, #123e56 0%, #2d6f8e 100%);
    color: #f8fcff;
    border-radius: 14px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.12);
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.9rem;
}

.hero .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    opacity: 0.9;
}

.hero h1 {
    margin: 0.5rem 0;
    font-size: 2rem;
}

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(11, 39, 63, 0.08);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.card-head-stack {
    align-items: flex-start;
}

.section-intro {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.planner-card {
    display: grid;
    gap: 1.25rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--muted);
}

select {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    font: inherit;
    color: var(--text);
    background: #fff;
}

.checklist {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.plan-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.plan-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    background: #fbfdff;
}

.plan-section h3 {
    margin: 0 0 0.9rem;
    font-size: 1rem;
}

.plan-section ul {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.65rem;
}

.plan-section li {
    color: var(--muted);
}

.plan-section li strong {
    color: var(--text);
}

.plan-section a,
.source-chip a,
.reference-card a,
.notes a {
    color: var(--primary);
    font-weight: 700;
}

.item-source {
    display: inline-flex;
    align-items: center;
    margin-top: 0.35rem;
    font-size: 0.85rem;
}

.source-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.source-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    background: #f8fbfe;
    font-size: 0.92rem;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.reference-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
}

.reference-card h3 {
    margin-top: 0;
    margin-bottom: 0.65rem;
    font-size: 1rem;
}

.reference-card p {
    color: var(--muted);
    margin: 0 0 0.85rem;
}

.reference-card ul {
    margin: 0 0 0.85rem;
    padding-left: 1.1rem;
    color: var(--muted);
}

.warning-list li {
    color: #8a4b00;
}

.notes {
    display: grid;
    gap: 0.5rem;
}

.check-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem;
    background: #fbfdff;
}

.check-item p {
    margin: 0;
    color: var(--muted);
}

.notes {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: #e9eff5;
    color: var(--primary);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-light {
    background: #fff;
    color: var(--primary);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 18, 30, 0.84);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.overlay-card {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.overlay-actions {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.timer-banner {
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* ── Chat styles ── */

.chat-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    background: #f5f9fc;
    color: var(--primary);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.suggestion-chip:hover {
    background: #e4f0f8;
    border-color: var(--accent);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.chat-message {
    max-width: 88%;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-size: 0.97rem;
    line-height: 1.6;
}

.chat-message strong {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    opacity: 0.7;
}

.chat-message p {
    margin: 0;
    white-space: pre-wrap;
}

.chat-user {
    background: var(--primary);
    color: #fff;
    align-self: flex-end;
}

.chat-user strong {
    color: rgba(255,255,255,0.75);
}

.chat-assistant {
    background: #f3f8fc;
    border: 1px solid var(--border);
    color: var(--text);
    align-self: flex-start;
}

.chat-loading {
    background: #f3f8fc;
    border: 1px solid var(--border);
    color: var(--muted);
    align-self: flex-start;
    font-style: italic;
}

.chat-input-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    font: inherit;
    font-size: 0.97rem;
    resize: none;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-send {
    flex-shrink: 0;
    padding: 0.75rem 1.5rem;
    align-self: flex-end;
}

.chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .chat-message {
        max-width: 100%;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .plan-layout {
        grid-template-columns: 1fr;
    }

    .reference-grid {
        grid-template-columns: 1fr;
    }
}
