/* ════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════ */
* {
    box-sizing: border-box;
}

/* Single declaration — no need to repeat on html, body separately */
html, body {
    margin: 0;
    background: #f7f2e8;
    color: #1a1208;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
}

/* ════════════════════════════════════════
   DIVIDER
   Shared <hr> separator used by home & about.
════════════════════════════════════════ */
.divider {
    border: none;
    border-top: 1px solid #e3ddd3;
    margin: 0;
}

/* ════════════════════════════════════════
   NAVBAR
   Uses sticky by default for all inner pages.
   home.html overrides to fixed + transparent
   via its own <style> block.
════════════════════════════════════════ */
.navbar {
    background-color: #f7f2e8;
    border-bottom: 1px solid rgba(26, 18, 8, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(26, 18, 8, 0.04);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 68px;
    gap: 20px;
}

.logo {
    color: #1a1208;
    text-decoration: none;
    font-size: 1.25rem;
    display: inline-flex;
    align-items: baseline;
    gap: 0.38ch;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1;
}

.logo-w1 {
    font-weight: 300;
    letter-spacing: 0.06em;
}

.logo-w2 {
    font-weight: 800;
    letter-spacing: -0.04em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.nav-links a {
    color: #6b5f4f;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 6px 10px;
    border-radius: 6px;
    position: relative;
    transition: color 0.15s ease, background-color 0.15s ease;
}

/* Animated underline — slides left → right on hover/active */
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 10px;
    right: 10px;
    height: 2px;
    background-color: #1a1208;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.nav-links a:hover        { color: #1a1208; }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.active       { color: #1a1208; }
.nav-links a.active::after{ transform: scaleX(1); }

/* ════════════════════════════════════════
   HAMBURGER
════════════════════════════════════════ */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #1a1208;
    font-size: 1.70rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 6px;
    transition: background 0.15s ease;
    line-height: 1;
}

.nav-toggle:hover { background-color: #e3ddd3; }

.logout-form { margin: 0; }

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary         { background-color: #8b5e3c; color: #f7f2e8; }
.btn-primary:hover   { background-color: #6f4b30; }

.btn-secondary       { background-color: #e0d9cf; color: #1a1208; }
.btn-secondary:hover { background-color: #d0c9bf; color: #1a1208; }

.btn-success         { background-color: #16a34a; color: #ffffff; }
.btn-success:hover   { background-color: #15803d; }

.btn-danger          { background-color: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover    { background-color: #fecaca; }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

/* ════════════════════════════════════════
   FOCUS STYLES
   Single rule covers everything — no need
   to list every selector individually.
════════════════════════════════════════ */
*:focus         { outline: none; }
*:focus-visible { outline: 2px solid #8b5e3c; outline-offset: 2px; }

/* ════════════════════════════════════════
   FLASH MESSAGES
════════════════════════════════════════ */
.flash-wrapper { margin-top: 20px; }

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Colored dot before each flash message */
.flash::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    opacity: 0.7;
}

.flash-success { background-color: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.flash-danger,
.flash-error   { background-color: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background-color: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background-color: #f7f0e1; color: #6f5e42; border: 1px solid #eaddc2; }

/* Message text takes the row; close button sits at the end */
.flash-text { flex: 1; }

.flash-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;            /* × picks up each flash's own tint */
    font-size: 1.15rem;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s ease;
}
.flash-close:hover { opacity: 1; }

/* JS adds this to fade + lift before the node is removed */
.flash-hide { opacity: 0; transform: translateY(-6px); }

/* Respect reduced-motion: skip the fade, still removes cleanly */
@media (prefers-reduced-motion: reduce) {
    .flash { transition: none; }
}

/* ════════════════════════════════════════
   MAIN CONTENT
   Padding for all inner pages.
   home.html overrides this to 0 via its
   own <style> block so the hero is full-bleed.
════════════════════════════════════════ */
.main-content { padding: 36px 0 60px; }

/* ════════════════════════════════════════
   PAGE HEADER
════════════════════════════════════════ */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1208;
    margin: 0 0 4px;
    letter-spacing: -0.4px;
}

.page-subtitle {
    font-size: 0.875rem;
    color: #746857;
    margin: 0 0 24px;
}

/* ════════════════════════════════════════
   CARD
════════════════════════════════════════ */
.card {
    background: #fffcf5;
    border: 1px solid #ebe5db;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(26, 18, 8, 0.03);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1208;
    margin: 0 0 14px;
}

/* ════════════════════════════════════════
   BADGES
════════════════════════════════════════ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-blue   { background-color: #f4ecda; color: #6f5e42; border: 1px solid #e6d8bd; }
.badge-green  { background-color: #f0fdf4; color: #16a34a; }
.badge-orange { background-color: #fff7ed; color: #ea580c; }
.badge-gray   { background-color: #f3efe8; color: #6b5f4f; border: 1px solid #e0d9cf; }

/* ════════════════════════════════════════
   EMPTY STATE
════════════════════════════════════════ */
.empty       { text-align: center; padding: 48px 24px; color: #8a7d6b; }
.empty-title { font-size: 1rem; font-weight: 600; color: #6b5f4f; margin-bottom: 6px; }
.empty-text  { font-size: 0.875rem; }
.empty-text a       { color: #8b5e3c; text-decoration: none; }
.empty-text a:hover { text-decoration: underline; }
.empty .btn         { margin-top: 18px; }

/* ════════════════════════════════════════
   ABOUT PAGE — BUILDER AVATAR
════════════════════════════════════════ */
.builder-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #ebe5db;
}

/* ════════════════════════════════════════
   FORMS
   Shared form primitives. Promoted here from the
   per-template <style> blocks of login.html,
   register.html, new_message.html and edit_note.html
   so every form page gets them (previously
   applications/new.html and applications/edit.html
   used these class names with nothing defining them).
════════════════════════════════════════ */

/* ── page shell ── */
.form-page {
    max-width: 560px;
    margin: 0 auto;
}

.form-page-back {
    margin-bottom: 20px;
}

.form-page-back a {
    font-size: 0.825rem;
    color: #8b5e3c;
    text-decoration: none;
}

.form-page-back a:hover {
    text-decoration: underline;
}

/* ── card ── */
.auth-card {
    background: #fffcf5;
    border: 1px solid #ebe5db;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 24px rgba(26, 18, 8, 0.06);
}

/* wider variant for the application forms (they carry a textarea) */
.auth-card.form-card-wide {
    max-width: 560px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1208;
    letter-spacing: -0.4px;
    margin: 0 0 6px;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: #746857;
    margin: 0 0 28px;
}

.auth-subtitle a {
    color: #8b5e3c;
    font-weight: 600;
    text-decoration: none;
}

.auth-subtitle a:hover {
    text-decoration: underline;
}

/* ── fields ── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a3f32;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.form-label .optional {
    font-weight: 400;
    color: #a89880;
    margin-left: 4px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d9d2c8;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: #1a1208;
    background: #f7f2e8;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.form-input:focus {
    border-color: #8b5e3c;
    box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.1);
    background: #fffcf5;
}

.form-input::placeholder {
    color: #b0a090;
}

/* a <textarea> or <select> rendered with .form-input still needs
   the element-specific bits the shared rule can't cover */
textarea.form-input {
    resize: vertical;
    line-height: 1.6;
}

select.form-input {
    cursor: pointer;
}

/* ── errors ── */
.field-errors {
    margin-top: 6px;
}

.field-error {
    font-size: 0.78rem;
    color: #dc2626;
    display: block;
    margin-top: 4px;
}

/* ── full-width dark submit (auth pages) ── */
.btn-auth {
    width: 100%;
    padding: 11px;
    background-color: #1a1208;
    color: #f7f2e8;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-auth:hover {
    background-color: #2d2010;
    transform: translateY(-1px);
}

.btn-auth:active {
    transform: translateY(0);
}

/* ── action row (application forms) — terracotta primary + cancel ── */
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #e8e2d9;
}

.form-actions .btn-primary {
    flex: 1;
    padding: 11px 24px;
    text-align: center;
}

/* ── collapsible "Add details" panel ──
   Reuses the global .portal / .portal-trigger / is-open handler in
   main.js — the same mechanism behind the home page sections and the
   account page accordions. Every rule is qualified with .form-portal
   so the home and account accordions are untouched. */
.portal.form-portal {
    background: #f7f2e8;
    border: 1px solid #e3ddd3;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.portal.form-portal:hover {
    border-color: #d9d2c8;
}

.portal.form-portal.is-open {
    border-color: #d9d2c8;
    background: #fffcf5;
}

.portal-trigger.form-portal-head {
    width: 100%;
    padding: 13px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: 'Inter', sans-serif;
    text-align: left;
}

.form-portal-title {
    font-size: 0.825rem;
    font-weight: 600;
    color: #4a3f32;
    letter-spacing: 0.2px;
    transition: color 0.2s ease;
}

.form-portal-optional {
    font-weight: 400;
    color: #a89880;
    margin-left: 4px;
}

.form-portal-head:hover .form-portal-title {
    color: #8b5e3c;
}

.form-portal .portal-arrow {
    font-style: normal;
    color: rgba(139, 94, 60, 0.55);
    font-size: 1rem;
    line-height: 1;
    display: inline-block;
    flex-shrink: 0;
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.form-portal-head:hover .portal-arrow {
    color: rgba(139, 94, 60, 0.85);
}

.portal.form-portal.is-open .portal-arrow {
    transform: rotate(90deg);
    color: rgba(139, 94, 60, 0.7);
}

.portal-body.form-portal-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Generous ceiling: the panel holds four fields and grows by a
   line per validation error. */
.portal.form-portal.is-open .portal-body.form-portal-body {
    max-height: 720px;
}

.portal-body-inner.form-portal-body-inner {
    padding: 14px 16px 16px;
    border-top: 1px solid #f0ece4;
    opacity: 0;
    transition: opacity 0.35s ease 0.15s;
}

.portal.form-portal.is-open .portal-body-inner.form-portal-body-inner {
    opacity: 1;
}

.form-portal-body-inner .form-group:last-child {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
    }

    .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .form-actions .btn {
        text-align: center;
    }
}

.input-error {
    border-color: #dc2626;
    background: #fef2f2;
}

/* ════════════════════════════════════════
   MOBILE
════════════════════════════════════════ */
@media (max-width: 768px) {

    .nav-container {
        flex-wrap: wrap;
        flex-direction: row;
        align-items: center;
        min-height: 60px;
    }

    .nav-toggle { display: block; }

    .nav-right {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 0;
        border-top: 1px solid #e3ddd3;
    }

    .nav-right.open { display: flex; }

    .nav-links {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .nav-links a {
        width: 100%;
        padding: 10px 12px;
    }

    /* On mobile the underline becomes a left border sliding top → bottom */
    .nav-links a::after {
        bottom: auto;
        top: 0;
        left: 0;
        right: auto;
        width: 2px;
        height: 100%;
        transform: scaleY(0);
        transform-origin: top;
        transition: transform 0.2s ease;
    }

    .nav-links a:hover::after,
    .nav-links a.active::after { transform: scaleY(1); }

    .page-title { font-size: 1.25rem; }
}

/* ════════════════════════════════════════
   PIPELINE
════════════════════════════════════════ */
.pipeline-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.pipeline-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b5f4f;
    background: #fffcf5;
    border: 1px solid #ebe5db;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
}

.pipeline-pill:hover {
    background: #f0ebe0;
    border-color: #d0c9bf;
    color: #1a1208;
}

.pipeline-pill.active {
    background: #1a1208;
    border-color: #1a1208;
    color: #f7f2e8;
}

.pipeline-pill .pill-count {
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.7;
}

.pipeline-pill.active .pill-count {
    opacity: 0.8;
}

/* ════════════════════════════════════════
   APPLICATION CARD
════════════════════════════════════════ */
.app-card {
    background: #fffcf5;
    border: 1px solid #ebe5db;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.app-card:hover {
    box-shadow: 0 4px 16px rgba(26, 18, 8, 0.07);
    border-color: #d0c9bf;
}

.app-card-left { flex: 1; min-width: 0; }

.app-card-company {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1208;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card-role {
    font-size: 0.825rem;
    color: #6b5f4f;
    margin: 0 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.app-card-meta-item {
    font-size: 0.75rem;
    color: #8a7d6b;
}

.app-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ════════════════════════════════════════
   STATUS BADGE — APPLICATION
════════════════════════════════════════ */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f3efe8;
    color: #6b5f4f;
    border: 1px solid #e0d9cf;
    white-space: nowrap;
}

/* ════════════════════════════════════════
   APPLICATION DETAIL
════════════════════════════════════════ */
.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.detail-company {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1208;
    margin: 0 0 4px;
    letter-spacing: -0.4px;
}

.detail-role {
    font-size: 1rem;
    color: #6b5f4f;
    margin: 0 0 12px;
    font-weight: 400;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-meta-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #8a7d6b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.detail-meta-value {
    font-size: 0.875rem;
    color: #1a1208;
    font-weight: 500;
}

.detail-meta-value a {
    color: #8b5e3c;
    text-decoration: none;
}

.detail-meta-value a:hover {
    text-decoration: underline;
}

.detail-section {
    margin-bottom: 28px;
}

.detail-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8a7d6b;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0 0 12px;
}

.status-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.linked-email-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f7f2e8;
    border: 1px solid #ebe5db;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 12px;
}

.linked-email-left { flex: 1; min-width: 0; }

.linked-email-category {
    font-size: 0.825rem;
    font-weight: 500;
    color: #1a1208;
    margin: 0 0 2px;
}

.linked-email-date {
    font-size: 0.75rem;
    color: #8a7d6b;
}

.notes-text {
    font-size: 0.875rem;
    color: #1a1208;
    line-height: 1.7;
    white-space: pre-wrap;
    background: #f7f2e8;
    border: 1px solid #ebe5db;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 0;
}

@media (max-width: 768px) {
    .detail-header {
        flex-direction: column;
    }

    .status-buttons {
        gap: 6px;
    }

    .pipeline-pill {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

.notes-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
}

.detail-company a:hover {
    text-decoration: underline;
}

.app-card-muted {
    opacity: 0.6;
}

.app-card-muted:hover {
    opacity: 0.8;
}