/* ==========================================================================
   Rally Manager — design tokens
   Palette: stone (#EDEAE2), ink (#20242B), rally yellow (#F2B705),
            stage green (#2F5233), alert rust (#B8412F)
   Type: Oswald (display/plate), Inter (body), JetBrains Mono (data/timing)
   Signature: chevron corner marks referencing pace-note direction arrows
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

:root {
    --stone: #EDEAE2;
    --stone-dim: #E1DDD1;
    --ink: #20242B;
    --ink-soft: #4B505C;
    --yellow: #F2B705;
    --green: #2F5233;
    --rust: #B8412F;
    --white: #FFFFFF;

    --radius: 3px;
    --border: 2px solid var(--ink);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--stone);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

h1, h2, h3, .brand, .btn, th {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

code, .mono, .stat-value {
    font-family: 'JetBrains Mono', monospace;
}

/* ---------------- Layout ---------------- */

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: var(--ink);
    border-bottom: 4px solid var(--yellow);
}

.brand {
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.brand img {
    display: block;
}

.site-header nav a {
    color: var(--stone);
    text-decoration: none;
    margin-left: 20px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}

.site-header nav a:hover {
    border-bottom-color: var(--yellow);
}

.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--ink-soft);
    font-size: 0.85rem;
}

/* ---------------- Signature: chevron corner card ---------------- */
/* Rally pace notes use chevron arrows to mark corner severity;
   we reuse that mark as a corner flourish on card-style panels. */

.card {
    position: relative;
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
}

.card::before {
    content: "";
    position: absolute;
    top: -2px;
    left: 24px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid var(--yellow);
}

.card h1, .card h2 {
    margin-top: 0;
}

.plate {
    display: inline-block;
    background: var(--ink);
    color: var(--yellow);
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--radius);
    letter-spacing: 0.08em;
    font-size: 0.85rem;
}

/* ---------------- Forms ---------------- */

label {
    display: block;
    font-family: 'Oswald', sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    margin-bottom: 6px;
    margin-top: 18px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--ink);
    border-radius: var(--radius);
    background: var(--stone);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--ink);
}

input:focus {
    outline: 3px solid var(--yellow);
    outline-offset: 1px;
}

.help-text {
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin-top: 4px;
}

.field-error {
    color: var(--rust);
    font-size: 0.85rem;
    margin-top: 4px;
}

.btn {
    display: inline-block;
    margin-top: 24px;
    padding: 12px 28px;
    background: var(--yellow);
    color: var(--ink);
    border: var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--ink);
    color: var(--yellow);
}

.btn-secondary {
    background: var(--stone);
}

/* ---------------- Flash messages ---------------- */

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
    border-left: 4px solid;
}

.flash-error   { background: #F6E4E0; border-color: var(--rust);  color: var(--rust); }
.flash-success { background: #E4EDE6; border-color: var(--green); color: var(--green); }

/* ---------------- Dashboard bits ---------------- */

.team-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.team-logo {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: var(--border);
    border-radius: var(--radius);
    background: var(--stone-dim);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--stone-dim);
}

.stat-label {
    color: var(--ink-soft);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-weight: 500;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

th, td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--stone-dim);
    font-size: 0.9rem;
}

th {
    font-size: 0.75rem;
    color: var(--ink-soft);
}

tr.is-you td {
    background: #FBF0C7;
    font-weight: 600;
}

/* ---------------- Scrollable tables ----------------
   Wrap any table that could get wide (many stage columns, long statements)
   in <div class="table-scroll">...</div>. The table itself gets a floor
   width so columns don't get crushed illegibly; the wrapper scrolls
   horizontally instead of blowing out the page layout. */

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table {
    min-width: 480px;
}

/* ---------------- Mobile ---------------- */

@media (max-width: 640px) {
    .container {
        padding: 20px 14px 48px;
    }

    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 16px;
    }

    .site-header nav {
        display: flex;
        flex-wrap: wrap;
        row-gap: 8px;
        column-gap: 16px;
        width: 100%;
    }

    .site-header nav a {
        margin-left: 0;
    }

    .card {
        padding: 20px;
    }

    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    .team-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .stat-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    th, td {
        padding: 8px;
        font-size: 0.82rem;
    }

    .btn {
        display: block;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        margin-right: 0 !important;
    }

    .btn + .btn {
        margin-top: 10px;
    }

    /* Inline admin action forms shouldn't stack full-width like primary
       page buttons -- keep them compact and side-by-side where they fit. */
    form[style*="display: inline-block"] .btn,
    form[style*="display:inline-block"] .btn {
        display: inline-block;
        width: auto;
    }
}


/* ---------------- Logo picker ---------------- */

.logo-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.logo-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border: 2px solid var(--stone-dim);
    border-radius: var(--radius);
    background: var(--white);
    cursor: pointer;
    text-align: center;
}

.logo-option:hover {
    border-color: var(--ink-soft);
}

.logo-option.is-selected {
    border-color: var(--yellow);
    box-shadow: 0 0 0 2px var(--yellow);
}

.logo-option-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
}

.swatch-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--ink);
    cursor: pointer;
    padding: 0;
}

input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 2px;
    border: 2px solid var(--ink);
    border-radius: var(--radius);
    background: var(--white);
    cursor: pointer;
}

@media (max-width: 640px) {
    .logo-picker {
        grid-template-columns: repeat(3, 1fr);
    }
}

.age-label {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    background: var(--stone-dim);
    padding: 2px 8px;
    border-radius: var(--radius);
    margin-left: 6px;
}
