/* ============================================================
   WINNOW — Design system · private.css
   Account / logged-in pages only (projects, submissions, profile).
   Light cream canvas, warm white cards, app shell + forms.
   Requires core.css loaded first. Never combine with public.css.

   NOTE: not wired into any layout yet — the account-page
   redesign will switch templates/account/** over to
   core.css + private.css.
   ============================================================ */

body {
    background: var(--canvas);
    color: var(--ink);
}

/* ============================================================
   APP HEADER — slim dark bar, logo only
   ============================================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(19, 8, 12, 0.96);
    border-bottom: 1px solid rgba(253, 243, 222, 0.1);
}
.app-header .brand img { width: 46px; height: auto; display: block; }

/* ============================================================
   SHELL + SIDEBAR
   ============================================================ */
.app-shell {
    display: flex;
    align-items: stretch;
}

.rail {
    flex: none;
    width: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 0;
    background: var(--card-bg);
    border-right: 1px solid var(--card-line);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
}

.rail-top,
.rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}

.rail-signout-form { display: flex; }

.rail-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--ink-45);
    transition: background-color 0.15s ease, color 0.15s ease;
}
.rail-icon svg { width: 21px; height: 21px; }
.rail-icon:hover {
    background: rgba(21, 8, 9, 0.06);
    color: var(--ink);
}
.rail-icon.is-active,
.rail-icon.is-active:hover {
    background: var(--wine);
    color: var(--cream);
}
.rail-icon--warn,
.rail-icon--warn:hover {
    background: var(--amber);
    color: #fffdf8;
}

/* content column beside the rail */
.app-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.app-content .flash-region {
    width: 100%;
    max-width: none;
    padding-top: var(--space-2);
}

/* hover tooltip */
.side-tip {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #1c1416;
    color: var(--cream);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.45rem 0.75rem;
    border-radius: 7px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 10;
}
.side-tip::before {
    content: "";
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #1c1416;
}
.rail-icon:hover .side-tip,
.rail-icon:focus-visible .side-tip { opacity: 1; }

/* ============================================================
   MAIN COLUMN
   ============================================================ */
.app-main {
    flex: 1;
    min-width: 0;
    padding: 2.5rem 3rem 4rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.page-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    line-height: 1.1;
    letter-spacing: 0.01em;
    color: var(--ink);
}

.btn-primary svg { width: 17px; height: 17px; }

/* ============================================================
   PROJECT LIST
   ============================================================ */
.projects-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--space-3);
    align-items: start;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.project-card {
    display: flex;
    flex-direction: column;
    min-height: 380px;
    padding: var(--space-3);
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1);
    margin-bottom: var(--space-2);
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink);
    padding: 0.36rem 0.85rem;
    border-radius: 999px;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.status--review { background: #f5e5c6; }
.status--review .status-dot { background: var(--amber); }
.status--vote { background: #f3dbe1; }
.status--vote .status-dot { background: var(--wine); }

.votes-count {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--ink-45);
}
.votes-count svg { width: 16px; height: 16px; }
.votes-count strong { color: var(--ink); font-weight: 600; }

.project-author {
    font-size: 0.85rem;
    color: var(--ink-45);
}

.project-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0.25rem 0 0.7rem;
}
.project-title a { text-decoration: none; transition: color 0.15s ease; }
.project-title a:hover { color: var(--wine); }

.project-desc {
    font-size: 0.9rem;
    color: var(--ink-65);
}

.card-foot { margin-top: auto; padding-top: var(--space-3); }

.format-line {
    font-size: 0.88rem;
    color: var(--ink-65);
    margin-bottom: 0.7rem;
}
.format-line strong { color: var(--ink); font-weight: 600; }

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: var(--ink-65);
    border: 1px solid var(--field-line);
    border-radius: 999px;
    padding: 0.34rem 0.85rem;
}
.tag--hot {
    background: #f3dbe1;
    border-color: transparent;
    color: var(--wine);
    font-weight: 500;
}

/* archive tile */
.archive-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 380px;
    padding: var(--space-3);
    text-align: center;
    text-decoration: none;
    border: 1.5px dashed rgba(201, 146, 47, 0.55);
    border-radius: var(--radius-card);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.archive-tile:hover {
    background: rgba(201, 146, 47, 0.06);
    border-color: var(--amber);
}
.archive-tile svg {
    width: 30px;
    height: 30px;
    color: var(--ink-65);
    margin-bottom: 0.5rem;
}
.archive-title { font-size: 1.05rem; font-weight: 700; }
.archive-sub { font-size: 0.85rem; color: var(--ink-45); }

/* ============================================================
   RIGHT RAIL — countdown + timeline
   ============================================================ */
.rail {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.rail-card {
    padding: 1.4rem;
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.rail-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
}
.rail-head svg { width: 19px; height: 19px; color: var(--ink); }

.countdown {
    display: flex;
    gap: 0.55rem;
}
.cd-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.55rem 0 0.45rem;
    background: var(--burgundy-deep);
    border-radius: 10px;
}
.cd-num {
    font-family: var(--font-display);
    font-size: 1.55rem;
    line-height: 1.1;
    color: var(--cream);
}
.cd-label {
    font-family: var(--font-mono);
    font-size: 0.52rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cream-45);
}

.estimate {
    font-size: 0.8rem;
    color: var(--ink-45);
    margin-top: var(--space-2);
}
.estimate strong { color: var(--ink); font-weight: 600; }

/* timeline stepper */
.steps { margin-top: 0.25rem; }

.step {
    position: relative;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    column-gap: 0.8rem;
    padding-bottom: 1.5rem;
}
.step:last-of-type { padding-bottom: 0.75rem; }

/* connector */
.step:not(:last-of-type)::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 24px;
    bottom: 4px;
    border-left: 2px dotted rgba(21, 8, 9, 0.25);
}
.step--done:not(:last-of-type)::before {
    border-left: 2px solid var(--green);
}
.step--stopped:not(:last-of-type)::before {
    border-left: 2px solid var(--wine);
}

.step-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step--done .step-marker {
    background: var(--green);
    color: #fff;
}
.step--done .step-marker svg { width: 11px; height: 11px; }
/* a terminal (rejected/disqualified) submission's timeline stops here — honest dead end, not a
   pretend "still coming" step */
.step--stopped .step-marker {
    background: var(--wine);
    color: #fff;
}
.step--stopped .step-marker svg { width: 11px; height: 11px; }
.step--current .step-marker {
    background: var(--card-bg);
    border: 2.5px solid var(--wine);
}
.step--current .step-marker::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--wine);
}
.step--todo .step-marker::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(21, 8, 9, 0.28);
}

.step-label {
    font-size: 0.92rem;
    line-height: 1.35;
    color: var(--ink);
    padding-top: 0.05rem;
}
.step--todo .step-label { color: var(--ink-65); }
.step--stopped .step-label { color: var(--wine); font-weight: 600; }

.step-date {
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    padding-top: 0.15rem;
}
.step--done .step-date { color: var(--green); }
.step--current .step-date { color: var(--wine); }
.step--todo .step-date { color: var(--ink-45); font-weight: 500; }
.step--stopped .step-date { color: var(--wine); }

.learn-more {
    display: inline-block;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}
.learn-more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   FORM PAGES (add / edit project)
   ============================================================ */
.form-page {
    max-width: 1360px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 0;
}

.form-card {
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: 22px;
    box-shadow: var(--shadow-card);
    padding: 3rem;
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 3.5rem;
    align-items: start;
}

.form-card .page-title { margin-bottom: var(--space-3); }

/* progress stepper */
.stepper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: var(--space-3);
}
.step-item {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.9rem;
    font-weight: 600;
}
.step-item--todo { color: var(--ink-45); }

.step-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--wine);
    color: var(--cream);
    font-size: 0.78rem;
    font-weight: 600;
}
.step-dot svg { width: 13px; height: 13px; }
.step-item--todo .step-dot {
    background: transparent;
    border: 1.5px solid rgba(21, 8, 9, 0.3);
    color: var(--ink-45);
}

.step-line {
    width: 54px;
    height: 2px;
    background: rgba(21, 8, 9, 0.16);
    border-radius: 1px;
}
.step-line--done { background: var(--wine); }

/* form sections */
.form-section {
    padding: var(--space-4) 0;
    border-bottom: 1px solid rgba(21, 8, 9, 0.09);
}
.form-section:first-of-type { padding-top: var(--space-3); }

.form-heading {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }

.field-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    color: var(--ink-65);
    margin-bottom: 0.5rem;
}
.req { color: var(--wine); }

.input {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--card-bg);
    border: 1px solid var(--field-line);
    border-radius: 8px;
    padding: 0.72rem 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: rgba(21, 8, 9, 0.35); }
.input:focus {
    outline: none;
    border-color: var(--wine);
    box-shadow: 0 0 0 3px rgba(107, 21, 41, 0.12);
}

textarea.input {
    resize: vertical;
    min-height: 130px;
    line-height: 1.55;
}

select.input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23847372' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    cursor: pointer;
}
select.input:invalid,
select.input.is-empty { color: rgba(21, 8, 9, 0.45); }

.char-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-45);
    text-align: right;
    margin-top: 0.4rem;
}

/* writers row */
.writers-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr auto;
    gap: 1rem;
    align-items: end;
}
.btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--card-bg);
    border: 1px solid var(--field-line);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.btn-add svg { width: 18px; height: 18px; }
.btn-add:hover { border-color: var(--ink); background: rgba(21, 8, 9, 0.03); }

/* file field */
.file-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink-65);
    background: var(--card-bg);
    border: 1px solid var(--field-line);
    border-radius: 8px;
    padding: 0.72rem 0.95rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.file-field svg { width: 17px; height: 17px; flex: none; }
.file-field:hover { border-color: var(--ink); color: var(--ink); }
.file-field input[type="file"] { display: none; }

/* two-column field rows */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* budget radios */
.radio-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.radio-item {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.95rem;
    color: var(--ink);
    padding: 0.3rem 0;
    cursor: pointer;
}
.radio-item input[type="radio"],
.radio-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--wine);
    cursor: pointer;
}

/* genre checkbox group (writer form, admin classification override) */
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.25rem;
}

/* form footer */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding-top: var(--space-4);
}

/* tips panel */
.tips {
    background: #f6eedd;
    border-radius: var(--radius-card);
    padding: var(--space-3);
}
.tips-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.tips-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--wine);
    color: var(--cream);
}
.tips-icon svg { width: 15px; height: 15px; }

.tips h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-top: 1.1rem;
    margin-bottom: 0.2rem;
}
.tips p {
    font-size: 0.88rem;
    color: var(--ink-65);
}
.tips ol {
    font-size: 0.88rem;
    color: var(--ink-65);
    padding-left: 1.15rem;
    margin: 0.2rem 0 0;
}
.tips ol li { margin-bottom: 0.1rem; }

/* app footer (form page) */
.app-footer {
    max-width: 1360px;
    margin: 0 auto;
    padding: var(--space-4) 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.app-footer p,
.app-footer a {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--ink-45);
    text-decoration: none;
}
.app-footer a { transition: color 0.15s ease; }
.app-footer a:hover { color: var(--ink); }
.app-footer nav { display: flex; gap: var(--space-3); }

/* ============================================================
   AUTH PAGES — centered card on the cream canvas
   (login, register, verify, forgot/reset password)
   ============================================================ */
.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5) var(--space-3);
    min-height: calc(100vh - 64px - 120px); /* header + footer */
}

.auth-card {
    width: 100%;
    max-width: 620px;
    padding: 3rem;
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: 22px;
    box-shadow: var(--shadow-card);
}

.auth-heading {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    margin-bottom: var(--space-3);
}

.auth-subtitle {
    font-size: 0.92rem;
    color: var(--ink-65);
    text-align: center;
    max-width: 44ch;
    margin: calc(-1 * var(--space-2)) auto var(--space-3);
}

/* message panels above the form */
.global-error,
.info-message {
    font-size: 0.88rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: var(--space-2);
}
.global-error {
    background: rgba(107, 21, 41, 0.07);
    border-color: rgba(107, 21, 41, 0.3);
    color: var(--wine);
}
.info-message {
    background: rgba(46, 125, 79, 0.08);
    border-color: rgba(46, 125, 79, 0.35);
    color: var(--green);
}

/* per-field validation error */
.form-error {
    display: block;
    font-size: 0.8rem;
    color: var(--wine);
    margin-top: 0.4rem;
}
.form-error--centered { text-align: center; }

/* input with a trailing eye toggle */
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 2.9rem; }

.eye-btn {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--ink-45);
    cursor: pointer;
    transition: color 0.15s ease;
}
.eye-btn:hover { color: var(--ink); }
.eye-btn svg { width: 19px; height: 19px; }
.eye-btn .icon-eye-off { display: none; }
.eye-btn.is-visible .icon-eye { display: none; }
.eye-btn.is-visible .icon-eye-off { display: block; }

/* consent checkbox */
.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--ink);
    margin: var(--space-3) 0 0;
}
.form-checkbox input[type="checkbox"] {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 0.2rem;
    accent-color: var(--wine);
    cursor: pointer;
}
.form-checkbox a { color: var(--wine); }

/* centered action row + footer links */
.auth-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
}
.auth-actions .btn { min-width: 200px; }
.auth-actions--tight { margin-top: 0; }

.auth-link {
    font-size: 0.9rem;
    text-align: center;
    margin-top: var(--space-3);
}
.auth-link a {
    color: var(--ink);
    font-weight: 600;
    text-underline-offset: 3px;
}
.auth-link a:hover { color: var(--wine); }

.form-forgot {
    text-align: right;
    font-size: 0.85rem;
    margin-top: 0.6rem;
}
.form-forgot a {
    color: var(--ink-65);
    text-underline-offset: 3px;
}
.form-forgot a:hover { color: var(--wine); }

/* "or" divider before the Google button */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-45);
    margin: var(--space-3) 0;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--card-line);
}

/* 6-digit verification code input */
.input--code {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    letter-spacing: 0.45em;
    text-align: center;
}

.auth-resend { text-align: center; margin-top: var(--space-2); }

.link-btn {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.link-btn:hover { color: var(--wine); }

/* ============================================================
   FLASH BANNERS (fragments/flash :: flash-banners) — light canvas
   ============================================================ */
.flash-region {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--space-3);
}
.flash-region:not(:empty) { padding-top: var(--space-2); }

.flash {
    font-size: 0.9rem;
    padding: 0.75rem 1.1rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid;
}
.flash--success {
    background: rgba(46, 125, 79, 0.08);
    border-color: rgba(46, 125, 79, 0.35);
    color: var(--green);
}
.flash--error {
    background: rgba(107, 21, 41, 0.07);
    border-color: rgba(107, 21, 41, 0.3);
    color: var(--wine);
}
.flash--warning {
    background: rgba(201, 146, 47, 0.12);
    border-color: rgba(201, 146, 47, 0.45);
    color: #8a6420;
}
.flash--info {
    background: rgba(21, 8, 9, 0.04);
    border-color: var(--field-line);
    color: var(--ink-65);
}

/* ============================================================
   ADMIN SHELL — header nav, sidebar menu, layout
   ============================================================ */
.admin-header {
    gap: var(--space-3);
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}
.admin-header .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
}
.brand-link {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cream);
    white-space: nowrap;
}

.admin-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem;
    margin: 0 auto;
}
.admin-nav .nav-link {
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--cream-70);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.admin-nav .nav-link:hover {
    color: var(--cream);
    background: rgba(253, 243, 222, 0.08);
}

.admin-header-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.admin-user-name {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    color: var(--cream-45);
}
.signout-form { display: inline-flex; }
.btn-signout {
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--cream-70);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}
.btn-signout:hover { color: var(--cream); }

.admin-layout {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-3);
}

.admin-sidebar {
    flex: none;
    width: 200px;
    position: sticky;
    top: calc(64px + var(--space-4));
}
.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 0.6rem;
}
.sidebar-link {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--ink-65);
    padding: 0.5rem 0.85rem;
    border-radius: 9px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.sidebar-link:hover {
    background: rgba(21, 8, 9, 0.05);
    color: var(--ink);
}
.sidebar-link.is-active {
    background: var(--wine);
    color: var(--cream);
}

.admin-content {
    flex: 1;
    min-width: 0;
}
.admin-content > h1,
.admin-content .page-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    line-height: 1.1;
    letter-spacing: 0.01em;
    color: var(--ink);
}
.subtitle {
    color: var(--ink-65);
    margin: 0.5rem 0 var(--space-3);
}

/* dashboard nav cards */
.nav-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-3);
}
.nav-card {
    display: block;
    padding: var(--space-3);
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(21, 8, 9, 0.06), 0 14px 30px -18px rgba(21, 8, 9, 0.35);
}
.nav-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.nav-card-desc {
    font-size: 0.88rem;
    color: var(--ink-65);
}

/* ============================================================
   SHARED INTERNAL COMPONENTS — panels, tables, badges
   ============================================================ */
/* generic warm-white card panel */
.panel {
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-3);
}
.panel + .panel { margin-top: var(--space-3); }
.panel-title {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

/* data table — mono headers on a card surface */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    font-size: 0.9rem;
}
.data-table th {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-align: left;
    color: var(--ink-65);
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--field-line);
    white-space: nowrap;
}
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-line);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(21, 8, 9, 0.02); }
.data-table a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.data-table a:hover { color: var(--wine); }
.data-table-right { text-align: right; }

/* status badges */
.badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--field-line);
    color: var(--ink-65);
    white-space: nowrap;
}
.badge--ok      { background: rgba(46, 125, 79, 0.1);  border-color: rgba(46, 125, 79, 0.35);  color: var(--green); }
.badge--warn    { background: #f5e5c6;                 border-color: transparent;              color: #8a6420; }
.badge--danger  { background: rgba(107, 21, 41, 0.08); border-color: rgba(107, 21, 41, 0.3);   color: var(--wine); }
.badge--neutral { background: rgba(21, 8, 9, 0.04);    border-color: transparent;              color: var(--ink-65); }

/* empty state — dashed tile, cream context */
.empty-state {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: var(--ink-65);
    text-align: center;
    padding: var(--space-5) var(--space-3);
    border: 1.5px dashed var(--field-line);
    border-radius: var(--radius-card);
}

/* small helper text under fields */
.hint {
    font-size: 0.8rem;
    color: var(--ink-45);
    margin-top: 0.4rem;
}

/* cover-image preview on the admin submission detail (task 41) — capped so tall portrait art
   can't push the rest of the panel off screen */
.cover-preview {
    display: block;
    max-width: 220px;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 1px solid var(--field-line);
    border-radius: var(--radius-card);
    margin-bottom: 1rem;
}

.btn-wide { width: 100%; }

/* == ACCOUNT PAGE STYLES (agent section — account pages only) == */

/* disabled affordance shared by native :disabled buttons and aria-disabled links */
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* intro copy above a form panel (become-writer, account home) */
.panel-intro p {
    margin: 0 0 0.85rem;
    color: var(--ink-65);
    line-height: 1.6;
}
.panel-intro p:last-child { margin-bottom: 1.25rem; }

/* two-line "add a card" / "no data yet" banner */
.onboarding-banner {
    background: #f6eedd;
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
}
.onboarding-banner-title {
    font-weight: 700;
    color: var(--wine);
    margin-bottom: 0.25rem;
}
.onboarding-banner-body {
    font-size: 0.9rem;
    color: var(--ink-65);
}

/* profile sub-navigation tabs */
.profile-tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--card-line);
    margin-bottom: var(--space-3);
}
.profile-tab {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-65);
    text-decoration: none;
    padding: 0.75rem 0.1rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.profile-tab:hover { color: var(--ink); }
.profile-tab.is-active {
    color: var(--ink);
    border-bottom-color: var(--wine);
}

/* read-only account-settings rows */
.field-static {
    display: block;
    width: 100%;
    font-size: 0.95rem;
    color: var(--ink-65);
    background: rgba(21, 8, 9, 0.03);
    border: 1px solid var(--field-line);
    border-radius: 8px;
    padding: 0.72rem 0.95rem;
}
.field-static--action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

/* generic prev/next pager */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-3);
    font-size: 0.85rem;
    color: var(--ink-45);
}

/* ------------------------------------------------------------
   Payment methods — saved cards, add-card, become-writer chooser
   ------------------------------------------------------------ */
.pm-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    overflow: hidden;
}
.pm-card {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-line);
}
.pm-card:last-child { border-bottom: none; }

.pm-radio {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--field-line);
    flex: none;
    background: var(--card-bg);
    padding: 0;
}
button.pm-radio { cursor: pointer; transition: border-color 0.15s ease; }
button.pm-radio:hover { border-color: var(--wine); }
.pm-radio--active {
    border-color: var(--wine);
    background: var(--wine);
    box-shadow: inset 0 0 0 3px var(--card-bg);
}
.pm-radio-form { display: flex; margin: 0; }

.pm-card-label { flex: 1; font-size: 0.95rem; color: var(--ink); }
.pm-card-exp { color: var(--ink-45); font-size: 0.85rem; margin-left: 0.5rem; }
.pm-default-badge {
    margin-left: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wine);
}
.pm-remove-note { font-size: 0.8rem; color: var(--ink-45); }
.pm-remove-form { margin: 0; }
.pm-remove-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    color: var(--wine);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

/* become-writer "choose a saved card" list */
.pm-choose { border: none; padding: 0; margin: 0; min-width: 0; }
.pm-choose > legend { padding: 0; margin-bottom: 0.5rem; }
.pm-choose-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--field-line);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.pm-choose-option:hover,
.pm-choose-option:has(input:checked) { border-color: var(--wine); }
.pm-add-another {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--wine);
}

/* "Add New Payment Method" row (submission checkout, phase 1) */
.pm-add {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    color: var(--ink-65);
    text-decoration: none;
}
.pm-add-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--field-line);
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    flex: none;
}

.pm-add-card { max-width: 480px; margin-top: var(--space-3); }

/* Stripe Elements mount points (card + address) */
.stripe-card-element {
    border: 1px solid var(--field-line);
    border-radius: 8px;
    padding: 0.72rem 0.95rem;
    background: var(--card-bg);
}

/* ------------------------------------------------------------
   Drag-and-drop script upload (see _upload.html + dropzone.js)
   ------------------------------------------------------------ */
.dropzone {
    border: 1.5px dashed var(--field-line);
    border-radius: var(--radius-card);
    background: var(--card-bg);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone:hover { border-color: var(--wine); }
.dropzone.is-dragover { border-color: var(--wine); background: rgba(107, 21, 41, 0.05); }
.dropzone-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: var(--space-3) var(--space-2);
    cursor: pointer;
    text-align: center;
}
.dropzone-label svg { width: 26px; height: 26px; color: var(--ink-45); }
.dropzone-prompt { font-size: 0.95rem; color: var(--ink); }
.dropzone-browse { color: var(--wine); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.dropzone-hint {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-45);
}
.dropzone-filename {
    margin: 0;
    padding: 0 var(--space-2) var(--space-2);
    font-size: 0.85rem;
    color: var(--green);
    text-align: center;
}
.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* empty-state sub-elements (icon / title / body) + page-level modifier */
.empty-state--page { max-width: 560px; margin: var(--space-5) auto; }
.empty-state-icon { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.6; }
.empty-state-title {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
    margin-bottom: 0.5rem;
}
.empty-state-body { margin-bottom: 1.25rem; }

/* right-hand widget column beside project cards / detail content — named
   distinctly from .rail (the left icon nav) to avoid colliding with it. */
.side-rail {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* icon-only "back to list" link on the project-detail page */
.detail-back {
    display: inline-flex;
    color: var(--ink-45);
    margin-bottom: var(--space-2);
    transition: color 0.15s ease;
}
.detail-back:hover { color: var(--ink); }
.detail-back svg { width: 20px; height: 20px; }

/* breadcrumb above the project-detail page */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--ink-45);
    margin-bottom: var(--space-2);
}
.breadcrumb a { color: var(--ink-45); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumb-sep { color: var(--field-line); }

/* locked-for-review notice on the project-detail page */
.locked-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.88rem;
    color: var(--ink-65);
    line-height: 1.5;
    padding: 0.85rem 1rem;
    background: rgba(46, 125, 79, 0.06);
    border: 1px solid rgba(46, 125, 79, 0.3);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
}
.locked-banner-icon { width: 18px; height: 18px; flex: none; margin-top: 0.1rem; color: var(--green); }

/* processing spinner (script conversion in progress) */
.conversion-processing { display: flex; align-items: center; gap: 0.6rem; }
.conversion-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex: none;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* script download / re-upload row on the project-detail page */
.detail-file-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-2) 0;
    border-top: 1px solid var(--card-line);
    margin-bottom: var(--space-2);
}
.detail-file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}
.detail-file-link:hover { color: var(--wine); text-decoration: underline; }
.detail-file-link svg { width: 17px; height: 17px; flex: none; }

.detail-replace-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: var(--space-2);
}
.detail-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: var(--space-2);
}
.detail-actions-end { margin-left: auto; }
.inline-form { display: inline; }
.detail-divider {
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--card-line);
}
.detail-coverage-pending { font-size: 0.88rem; color: var(--ink-65); }

/* destructive action (submission delete) */
.btn-danger { background: var(--burgundy); color: var(--cream); }
.btn-danger:hover { background: var(--wine); transform: translateY(-1px); }

/* CSS-only confirmation dialog, revealed via :target */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
}
.modal-overlay:target { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(21, 8, 9, 0.5); cursor: default; }
.modal {
    position: relative;
    width: 100%;
    max-width: 26rem;
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-3);
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal-text { font-size: 0.9rem; color: var(--ink-65); line-height: 1.5; margin-bottom: var(--space-3); }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; align-items: center; }

/* checkout summary lines (inside a .panel) */
.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
}
.summary-label { font-size: 0.88rem; color: var(--ink-65); }
.summary-value { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.summary-divider { height: 1px; background: var(--card-line); margin: 0.75rem 0; }
.summary-total .summary-label,
.summary-total .summary-value { font-size: 1rem; font-weight: 700; color: var(--ink); }

/* payment-success confirmation card (reuses .auth-card for the card itself) */
.confirmed-page { display: flex; justify-content: center; padding: var(--space-5) var(--space-3); }
.confirmed-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(46, 125, 79, 0.1);
    border: 1px solid rgba(46, 125, 79, 0.35);
    color: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.1rem;
}
.confirmed-icon svg { width: 26px; height: 26px; }
.confirmed-heading { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.25rem; }
.confirmed-amount { font-size: 0.9rem; color: var(--ink-65); margin-bottom: var(--space-3); }
.confirmed-amount strong { color: var(--ink); }
.confirmed-lock-notice {
    text-align: left;
    font-size: 0.88rem;
    color: var(--ink-65);
    line-height: 1.5;
    padding: 0.85rem 1rem;
    background: rgba(21, 8, 9, 0.03);
    border: 1px solid var(--card-line);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
}
.confirmed-next-steps { text-align: left; margin-bottom: var(--space-3); }
.confirmed-next-title {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-45);
    margin-bottom: 0.6rem;
}
.confirmed-steps-list { list-style: decimal; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.confirmed-steps-list li { font-size: 0.88rem; color: var(--ink-65); line-height: 1.5; }
.confirmed-actions { display: flex; flex-direction: column; align-items: center; gap: 0.85rem; }

/* == ADMIN PAGE STYLES (agent section — admin pages only) == */

/* filter bars — HTMX-driven list filter forms (users, submissions, audit log) */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
}
.filter-bar .field { margin-bottom: 0; min-width: 160px; }
.filter-bar .btn { flex: none; }

/* definition-list detail rows (user / submission / season / packet detail pages) */
.detail-list {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
}
.detail-list dt {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-45);
    padding: 0.35rem 0;
}
.detail-list dd {
    padding: 0.35rem 0;
    margin: 0;
    color: var(--ink);
    word-break: break-word;
}

/* compact stacked form — decision forms inside a narrow table cell */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.form-stack .input,
.form-stack .btn { width: 100%; }

/* narrow panel modifier — single-payment refund form */
.panel--narrow { max-width: 560px; }

/* finance dashboard net column */
.positive { color: var(--green); font-weight: 600; }
.negative { color: var(--wine); font-weight: 600; }

/* audit log payload column */
.payload-cell {
    max-width: 320px;
    overflow-wrap: break-word;
    font-size: 0.82rem;
    color: var(--ink-45);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
    .projects-layout { grid-template-columns: minmax(0, 1fr); }
    .rail {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .rail-card { flex: 1 1 320px; }
}

@media (max-width: 1020px) {
    .form-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
    .form-card { padding: var(--space-4); }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { position: static; width: 100%; }
    .sidebar-menu { flex-direction: row; flex-wrap: wrap; }
    .nav-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .app-main { padding: var(--space-4) var(--space-3); }
    .auth-main { padding: var(--space-3); }
    .auth-card { padding: var(--space-3); }
    .cards-grid { grid-template-columns: minmax(0, 1fr); }
    .project-card, .archive-tile { min-height: 0; }
    .writers-row { grid-template-columns: 1fr 1fr; }
    .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .rail { display: none; }
    .page-head { flex-direction: column; align-items: flex-start; }
}
