/* =====================================================================
 * The Author's Forge — Warm Paper Studio theme
 *
 * Light editorial palette: ivory paper, gold ink, warm shadows.
 * Designed for women beginners exploring KDP / Etsy / AI publishing.
 * WCAG AA contrast preserved for all body text on every surface.
 * =================================================================== */

:root {
    /* ---------- Surfaces ---------- */
    --paper:        #faf6ef;   /* page background, warm ivory */
    --paper-2:      #f3ede1;   /* sidebar, secondary surface */
    --cream:        #fdf9ef;   /* very light cream */
    --sand:         #f7f1e3;   /* hover, subtle highlight */
    --white:        #ffffff;   /* card surface */
    --warm-tint:    #fffcf3;   /* editor / input paper */

    /* ---------- Ink ---------- */
    --ink:          #2b2620;   /* primary text */
    --ink-soft:     #4a4337;   /* secondary text */
    --muted:        #8a8071;   /* tertiary text, captions */
    --dim:          #b3a995;   /* hints, placeholders */

    /* ---------- Lines ---------- */
    --line:         #e8dfca;
    --line-soft:    #f0e8d6;
    --line-strong:  #d4c9ad;

    /* ---------- Brand: gold ---------- */
    --gold:         #b08538;
    --gold-deep:    #856229;
    --gold-soft:    #d6b97c;
    --gold-tint:    #f5e8c2;

    /* ---------- Accents ---------- */
    --indigo:       #5b6acf;
    --indigo-tint:  #e6e8fa;
    --emerald:      #4d9170;
    --emerald-tint: #dceee5;
    --coral:        #d8745a;
    --coral-tint:   #fbe5dc;
    --danger:       #c25e56;
    --danger-tint:  #fae2df;

    /* ---------- Effects ---------- */
    --shadow-sm:    0 1px 3px  rgba(60, 45, 20, 0.06);
    --shadow-md:    0 8px 24px -10px rgba(80, 60, 30, 0.14);
    --shadow-lg:    0 24px 50px -22px rgba(80, 60, 30, 0.20);
    --shadow-gold:  0 10px 24px -10px rgba(176, 133, 56, 0.40);

    --radius-lg:    16px;
    --radius:       12px;
    --radius-sm:    8px;

    --font-serif:   ui-serif, "Iowan Old Style", "Apple Garamond", Garamond, "Times New Roman", serif;
    --font-sans:    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Inter", Helvetica, Arial, sans-serif;
    --font-mono:    ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}
[x-cloak] { display: none !important; }

/* ============================== AUTH ============================== */

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(80% 60% at 0% 0%, rgba(216, 185, 124, 0.30), transparent 60%),
        radial-gradient(70% 50% at 100% 100%, rgba(216, 116, 90, 0.12), transparent 60%),
        var(--paper);
}
.auth-stage {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
}
.auth-side {
    padding: 3.5rem 4rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    background: linear-gradient(180deg, rgba(255, 252, 243, 0.6), transparent);
    border-right: 1px solid var(--line);
}
.brand-row { display: inline-flex; gap: .75rem; align-items: center; text-decoration: none; color: var(--ink); }
.brand-mark-md {
    display: inline-grid; place-items: center;
    width: 40px; height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--gold-soft), var(--gold));
    color: #fffaef;
    font-family: var(--font-sans); font-weight: 700; letter-spacing: .04em;
    box-shadow: var(--shadow-gold);
    overflow: hidden;
    flex-shrink: 0;
}
.brand-mark-md.gold { background: linear-gradient(135deg, #ecd396, var(--gold)); }
.brand-svg-mark { background: transparent; box-shadow: none; padding: 0; }
.brand-svg-mark svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 14px rgba(176, 133, 56, 0.30)); }
.brand-title { display: block; font-weight: 600; letter-spacing: .01em; color: var(--ink); }
.brand-sub   { display: block; color: var(--muted); font-size: .78rem; }

.auth-pitch { max-width: 36rem; }
.auth-headline {
    font-family: var(--font-serif);
    font-size: 3.2rem;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 1rem 0;
    color: var(--ink);
}
.auth-headline em { font-style: italic; color: var(--gold-deep); }
.auth-lead { color: var(--ink-soft); font-size: 1.05rem; max-width: 32rem; }
.auth-bullets { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: .55rem; color: var(--ink-soft); font-size: .95rem; }
.auth-bullets li::before { content: "·  "; color: var(--gold); }
.auth-foot { color: var(--muted); font-size: .8rem; }

.auth-main { display: grid; place-items: center; padding: 2rem; }
.auth-panel {
    width: 100%;
    max-width: 440px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2.5rem 2rem;
}

.panel-title { font-family: var(--font-serif); font-size: 1.9rem; margin: .25rem 0; line-height: 1.2; color: var(--ink); }
.panel-sub   { color: var(--ink-soft); margin: 0 0 1.5rem; }
.eyebrow {
    text-transform: uppercase; letter-spacing: .2em;
    font-size: .7rem; color: var(--gold-deep); margin: 0 0 .25rem;
    font-weight: 600;
}

/* ============================== FORMS ============================== */

.form-stack { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field > span { color: var(--ink-soft); font-size: .85rem; font-weight: 500; }
.field > small { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.field input, .field select, .field textarea,
.install-form input, .install-form select,
.filter-row input, .filter-row select,
.select-sm {
    background: var(--warm-tint);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: .7rem .85rem;
    font: inherit;
    font-size: .98rem;
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
    width: 100%;
}
.field textarea { font-family: var(--font-serif); line-height: 1.6; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--dim); }
.field input:focus, .field select:focus, .field textarea:focus,
.install-form input:focus, .install-form select:focus,
.filter-row input:focus, .filter-row select:focus,
.select-sm:focus {
    border-color: var(--gold);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(176, 133, 56, 0.15);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; flex-wrap: wrap; }
.form-card { display: grid; gap: 1.1rem; padding: 2rem; }
.form-foot { text-align: center; color: var(--muted); font-size: .9rem; margin: 1rem 0 0; }
.link { color: var(--gold-deep); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .12s ease, color .12s ease; font-weight: 500; }
.link:hover { color: var(--gold); border-color: var(--gold); }
.checkbox { display: inline-flex; gap: .5rem; align-items: center; cursor: pointer; color: var(--ink-soft); font-size: .9rem; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--gold); }

/* ============================== BUTTONS ============================== */

.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    font: 500 .95rem/1 var(--font-sans);
    padding: .7rem 1.15rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
    color: var(--ink);
    background: transparent;
}
.btn.primary {
    background: linear-gradient(180deg, var(--gold-soft), var(--gold));
    color: #fffaef;
    border-color: var(--gold-deep);
    box-shadow: var(--shadow-gold);
    font-weight: 600;
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(176, 133, 56, 0.55); }
.btn.primary:active { transform: translateY(0); }
.btn.primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost  { background: var(--white); border-color: var(--line-strong); color: var(--ink-soft); }
.btn.ghost:hover { border-color: var(--gold); color: var(--ink); background: var(--cream); }
.btn.danger { background: var(--danger-tint); border-color: rgba(194, 94, 86, 0.4); color: #8a3a35; }
.btn.danger:hover { background: #f7d3cf; border-color: var(--danger); }
.btn.block  { width: 100%; justify-content: center; }

/* ============================== ALERTS ============================== */

.alert { padding: .9rem 1.1rem; border-radius: var(--radius); margin: 0 0 1rem; font-size: .92rem; }
.alert.success { background: var(--emerald-tint); border: 1px solid rgba(77, 145, 112, 0.35); color: #2d6a4f; }
.alert.error   { background: var(--danger-tint);  border: 1px solid rgba(194, 94, 86, 0.35);  color: #8a3a35; }
.alert.warn    { background: var(--gold-tint);    border: 1px solid rgba(176, 133, 56, 0.35); color: var(--gold-deep); }
.alert.float   { animation: fadein .35s ease; box-shadow: var(--shadow-md); }

/* ============================== APP SHELL ============================== */

.app-body {
    min-height: 100vh;
    background:
        radial-gradient(70% 50% at 100% 0%, rgba(216, 185, 124, 0.10), transparent 60%),
        radial-gradient(60% 60% at 0% 100%, rgba(216, 116, 90, 0.06), transparent 60%),
        var(--paper);
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: 64px 1fr;
    grid-template-areas:
        "side topbar"
        "side content";
}
.sidebar {
    grid-area: side;
    background: linear-gradient(180deg, var(--paper-2), var(--paper));
    border-right: 1px solid var(--line);
    padding: 1.6rem 1.2rem;
    display: flex; flex-direction: column; gap: 1.5rem;
    position: sticky; top: 0; height: 100vh;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;       /* Firefox */
    -ms-overflow-style: none;    /* IE / old Edge */
}
.sidebar::-webkit-scrollbar { width: 0; height: 0; display: none; } /* Chrome / Safari / Edge */
.admin-sidebar { background: linear-gradient(180deg, #f0e8d3, var(--paper-2)); }
.nav { display: grid; gap: .15rem; grid-template-columns: minmax(0, 1fr); }
.nav-section {
    margin: 1rem 0 .25rem;
    padding: 0 .6rem;
    text-transform: uppercase;
    letter-spacing: .18em;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .6rem;
    border-radius: 8px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: .92rem;
    transition: background .15s ease, color .15s ease;
    border: 1px solid transparent;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.nav-item:hover { background: var(--sand); color: var(--ink); }
.nav-item.active {
    background: var(--gold-tint);
    color: var(--gold-deep);
    border-color: rgba(176, 133, 56, 0.30);
    font-weight: 600;
}
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; color: var(--gold); font-size: .9rem; flex-shrink: 0; }
.nav-icon-svg { color: var(--gold-deep); }
.nav-icon-svg svg { width: 18px; height: 18px; display: block; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-tag {
    margin-left: auto;
    font-size: .72rem;
    min-width: 18px;
    height: 18px;
    padding: 0 .35rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: var(--emerald-tint);
    color: #2d6a4f;
    font-weight: 700;
    line-height: 1;
}
.nav-tag.locked-tag {
    background: transparent;
    color: var(--dim);
    border: 1px solid var(--line-strong);
}

.upgrade-item { display: flex; gap: .55rem; align-items: center; }
.upgrade-item.unlocked .nav-icon-svg { color: var(--gold); }
.upgrade-item.locked .nav-icon-svg { color: var(--muted); opacity: .85; }
.upgrade-item.locked .nav-label { color: var(--ink-soft); }
.upgrade-item:hover .nav-icon-svg { color: var(--gold); opacity: 1; }
.upgrade-item.locked:hover .nav-tag.locked-tag { border-color: var(--gold-soft); color: var(--gold-deep); }
.upgrade-item.active .nav-icon-svg { color: var(--gold); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-foot { margin-top: auto; display: grid; gap: .75rem; }
.credit-pill {
    display: flex; justify-content: space-between; align-items: center;
    border: 1px solid var(--line-strong);
    padding: .55rem .8rem;
    border-radius: var(--radius-sm);
    background: var(--white);
}
.credit-label { color: var(--muted); font-size: .8rem; }
.credit-val   { font-weight: 700; color: var(--gold-deep); }

.topbar {
    grid-area: topbar;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--line);
    background: rgba(250, 246, 239, 0.80);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 30;
}
.hamburger { display: none; background: transparent; border: 0; cursor: pointer; gap: 4px; flex-direction: column; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--ink); }
.crumb { display: flex; gap: .5rem; align-items: center; color: var(--ink-soft); font-size: .9rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.crumb-sep { color: var(--dim); }

.topbar-actions { display: flex; gap: .9rem; align-items: center; }
.hello { color: var(--ink-soft); font-size: .9rem; }
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-tint), var(--gold-soft));
    border: 1px solid var(--line-strong);
    display: grid; place-items: center;
    color: var(--gold-deep);
    font-weight: 700; font-size: .85rem;
}
.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    background: var(--sand);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-weight: 600;
}
.badge.gold   { background: var(--gold-tint); border-color: rgba(176, 133, 56, 0.40); color: var(--gold-deep); }
.badge.subtle { background: var(--sand); }
.badge.active, .badge.completed { background: var(--emerald-tint); border-color: rgba(77, 145, 112, 0.40); color: #2d6a4f; }
.badge.suspended, .badge.failed { background: var(--danger-tint);  border-color: rgba(194, 94, 86, 0.40); color: #8a3a35; }
.badge.draft       { background: var(--sand); }
.badge.in_progress,
.badge.processing  { background: var(--indigo-tint); border-color: rgba(91, 106, 207, 0.40); color: #3d4cb0; }
.badge.ready       { background: var(--gold-tint); border-color: rgba(176, 133, 56, 0.40); color: var(--gold-deep); }
.badge.pending     { background: var(--sand); }
.badge.archived    { background: var(--sand); opacity: .8; }
.badge.error, .badge.warn { background: var(--gold-tint); color: var(--gold-deep); }
.badge.info        { background: var(--indigo-tint); color: #3d4cb0; }

.content {
    grid-area: content;
    padding: 2rem 2.5rem 4rem;
    overflow-x: auto;
}

/* ============================== HEROS / SECTIONS ============================== */

.hero {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin: .5rem 0 2rem;
    gap: 2rem;
    flex-wrap: wrap;
    animation: fadein .35s ease;
}
.hero.compact { margin-bottom: 1rem; }
.hero-title { font-family: var(--font-serif); font-size: 2.4rem; margin: .25rem 0; letter-spacing: -0.01em; line-height: 1.1; color: var(--ink); }
.hero-sub   { color: var(--ink-soft); margin: 0; font-size: 1rem; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.section { margin: 2.5rem 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 1rem; }
.section-head h2 { font-family: var(--font-serif); font-size: 1.4rem; margin: 0; color: var(--ink); }

/* ============================== METRIC CARDS ============================== */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 2rem;
}
.metric-grid.small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem 1rem;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
    box-shadow: var(--shadow-sm);
}
.metric-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.metric-label { margin: 0; color: var(--muted); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.metric-value { font-family: var(--font-serif); font-size: 2rem; margin: .4rem 0; color: var(--ink); }
.metric-value.status-text { font-size: 1.4rem; }
.metric-foot  { margin: 0; color: var(--muted); font-size: .8rem; }

.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    margin: 0 0 1.5rem;
    box-shadow: var(--shadow-sm);
}
.card-title { font-family: var(--font-serif); font-size: 1.2rem; margin: 0 0 .9rem; color: var(--ink); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ============================== PROJECT CARDS ============================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.proj-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    overflow: hidden;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
    display: flex; flex-direction: column;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}
.proj-card:hover { transform: translateY(-3px); border-color: var(--gold-soft); box-shadow: var(--shadow-md); }
.proj-cover {
    aspect-ratio: 3/4;
    background: linear-gradient(160deg, #f3e3b8, #c9a55a);
    display: flex; flex-direction: column;
    position: relative; overflow: hidden;
    color: #7a4e1a;
}
/* Fiction books: dark dramatic cover */
.proj-cover[data-mode="fiction"] {
    background: linear-gradient(160deg, #2c1f0f, #5a3515);
    color: #e8d5a3;
}
/* Edition type variants */
.proj-cover[data-edition="illustrated"] { background: linear-gradient(160deg, #d8dcf5, #8e9add); color: #2d3888; }
.proj-cover[data-edition="study"]       { background: linear-gradient(160deg, #c9e6d6, #6daa8a); color: #1e5c3c; }
.proj-cover[data-edition="collector"]   { background: linear-gradient(160deg, #f8d4c4, #d48c6a); color: #7c3320; }
/* Top spine highlight */
.proj-cover::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px;
    background: rgba(255,255,255,.25);
}
/* Inner border frame */
.proj-cover::after {
    content: ""; position: absolute; inset: 10px;
    border: 1px solid rgba(255,255,255,.25);
    pointer-events: none; z-index: 2;
}
.proj-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Book cover inner layout */
.cover-inner {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 1.5rem .9rem 1.25rem;
    gap: .4rem; position: relative; z-index: 1;
}
.cover-deco { font-size: 1.75rem; line-height: 1; opacity: .8; margin-bottom: .25rem; }
.cover-title {
    font-family: var(--font-serif); font-size: .88rem; font-weight: 700;
    line-height: 1.35; color: currentColor; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 5;
    -webkit-box-orient: vertical; overflow: hidden;
}
.cover-author {
    font-size: .68rem; color: currentColor; opacity: .65; margin: .4rem 0 0;
    letter-spacing: .08em; text-transform: uppercase;
}
.proj-meta { padding: 1rem 1.1rem 1.2rem; display: grid; gap: .35rem; }
.proj-title { font-family: var(--font-serif); font-size: 1.1rem; margin: .35rem 0 0; line-height: 1.25; color: var(--ink); }
.proj-author { color: var(--ink-soft); margin: 0; font-size: .88rem; }
.proj-status { color: var(--muted); margin: .25rem 0 0; font-size: .8rem; display: flex; align-items: center; gap: .35rem; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.draft       { background: var(--dim); }
.status-dot.in_progress { background: var(--indigo); }
.status-dot.ready       { background: var(--gold); }
.status-dot.archived    { background: var(--line-strong); }
.dim { color: var(--muted); font-size: .85em; }

/* ============================== EMPTY ============================== */

.empty {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--cream);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
}
.empty-illustration { font-family: var(--font-serif); font-size: 4rem; color: var(--gold-soft); opacity: .9; }
.empty h3 { font-family: var(--font-serif); font-size: 1.5rem; margin: .5rem 0; color: var(--ink); }
.empty p { color: var(--ink-soft); max-width: 38rem; margin: 0 auto 1.5rem; }

/* ============================== QUICK ACTIONS ============================== */

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.quick {
    display: flex; gap: 1rem; align-items: center;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    text-decoration: none;
    color: var(--ink);
    transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
    box-shadow: var(--shadow-sm);
}
.quick:hover { transform: translateY(-2px); border-color: var(--gold-soft); background: var(--cream); box-shadow: var(--shadow-md); }
.quick-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--gold-tint);
    color: var(--gold-deep);
    display: grid; place-items: center;
    font-size: 1.3rem;
}
.quick-text { display: grid; }
.quick-text strong { font-family: var(--font-serif); font-size: 1.05rem; color: var(--ink); }
.quick-text span { color: var(--muted); font-size: .85rem; }

/* ============================== MODE PICKER ============================== */

.mode-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
    margin-bottom: 1.5rem;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .3rem;
    padding: 1.1rem 1.25rem;
    border: 2px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--white);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s, box-shadow .15s;
    font-family: inherit;
}

.mode-btn:hover { border-color: var(--gold); background: var(--gold-tint); }
.mode-btn.active { border-color: var(--gold); background: var(--gold-tint); box-shadow: var(--shadow-sm); }

.mode-icon  { font-size: 1.4rem; line-height: 1; }
.mode-label { font-family: var(--font-serif); font-size: 1rem; color: var(--ink); font-weight: 600; }
.mode-desc  { font-size: .82rem; color: var(--ink-soft); line-height: 1.4; }

/* ============================== ARCHITECT PICKER ============================== */

.architect-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: .6rem;
    margin-bottom: .5rem;
}

.arch-pick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    padding: .85rem .5rem;
    border: 2px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--white);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s, box-shadow .15s;
    position: relative;
}

.arch-pick-card input[type="radio"] { display: none; }

.arch-pick-card:hover  { border-color: var(--gold); background: var(--gold-tint); }
.arch-pick-card.selected { border-color: var(--gold); background: var(--gold-tint); box-shadow: var(--shadow-sm); }

.arch-pick-avatar {
    width: 2.6rem; height: 2.6rem;
    border-radius: 50%;
    background: var(--gold);
    color: var(--white);
    font-family: var(--font-serif);
    font-size: .95rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.arch-pick-name  { font-family: var(--font-serif); font-size: .9rem; color: var(--ink); font-weight: 600; line-height: 1.2; }
.arch-pick-genre { font-size: .72rem; color: var(--ink-soft); line-height: 1.3; }

.arch-pick-card .badge.small {
    position: absolute;
    top: .4rem; right: .4rem;
    font-size: .62rem;
    padding: .1rem .35rem;
}

/* ============================== EDITION PICKER ============================== */

.edition-picker { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .35rem; }
.edition-option {
    display: grid; gap: .25rem;
    padding: 1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    background: var(--white);
}
.edition-option input { display: none; }
.edition-option strong { color: var(--ink); font-family: var(--font-serif); }
.edition-option span { color: var(--ink-soft); font-size: .85rem; }
.edition-option.active { border-color: var(--gold); background: var(--gold-tint); box-shadow: var(--shadow-sm); }

/* ============================== TABLES ============================== */

.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { text-align: left; padding: .7rem .55rem; border-bottom: 1px solid var(--line-soft); }
.data-table th {
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .72rem;
    background: var(--cream);
}
.data-table tbody tr:hover { background: var(--sand); }
.pos { color: var(--emerald); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

/* ============================== PAGER ============================== */

.pager { display: flex; gap: .25rem; flex-wrap: wrap; margin: 1.5rem 0; }
.pager a {
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    color: var(--ink-soft);
    text-decoration: none;
    font-size: .85rem;
    background: var(--white);
}
.pager a.active { background: var(--gold-tint); border-color: var(--gold-soft); color: var(--gold-deep); font-weight: 600; }
.pager a:hover { border-color: var(--gold-soft); }

/* ============================== FILTER ROW ============================== */

.filter-row { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* ============================== CHAPTER EDITOR ============================== */

.editor-grid { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; }
.editor-pane { padding: 1.5rem; }
.chapter-form { display: grid; gap: 1rem; }
.chapter-title-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.6rem;
    padding: .25rem 0;
    border-bottom: 1px solid var(--line);
    outline: none;
}
.chapter-title-input:focus { border-bottom-color: var(--gold); }
.chapter-body-input {
    width: 100%;
    background: var(--warm-tint);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 1.5rem 1.75rem;
    font-family: var(--font-serif);
    font-size: 1.04rem;
    line-height: 1.75;
    resize: vertical;
    min-height: 480px;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(60, 45, 20, 0.04);
}
.chapter-body-input:focus { border-color: var(--gold); background: var(--white); box-shadow: 0 0 0 3px rgba(176, 133, 56, 0.15); }

.ai-pane { position: relative; }
.ai-sticky { position: sticky; top: 88px; display: grid; gap: 1rem; }
.ai-card-sm { padding: 1.2rem 1.3rem; }
.ai-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .25rem; }
.ai-card-sm h3 { font-family: var(--font-serif); font-size: 1.1rem; margin: 0; color: var(--ink); }
.ai-actions { display: grid; gap: .4rem; margin: .8rem 0 .6rem; }
.ai-output { display: grid; gap: .8rem; max-height: 320px; overflow-y: auto; }
.ai-block {
    border-left: 3px solid var(--gold);
    padding: .65rem .85rem;
    background: var(--gold-tint);
    border-radius: 4px;
    font-size: .88rem;
    color: var(--ink-soft);
}
.ai-block header { display: flex; justify-content: space-between; margin-bottom: .35rem; }
.ai-image { margin-top: .6rem; width: 100%; border-radius: 4px; border: 1px solid var(--line); }

.chapter-list { display: grid; gap: .5rem; }
.chapter-row {
    display: flex; align-items: center; gap: 1.2rem;
    padding: .95rem 1.15rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    text-decoration: none;
    color: var(--ink);
    transition: border-color .15s, transform .15s, box-shadow .15s;
    box-shadow: var(--shadow-sm);
}
.chapter-row:hover { border-color: var(--gold-soft); transform: translateX(2px); box-shadow: var(--shadow-md); }
.ch-index { font-family: var(--font-serif); color: var(--gold-deep); font-size: 1.2rem; font-weight: 600; }
.ch-meta h4 { margin: 0; font-family: var(--font-serif); font-size: 1.05rem; color: var(--ink); }
.ch-meta p  { margin: .15rem 0 0; color: var(--muted); font-size: .82rem; }
.ch-arrow   { margin-left: auto; color: var(--dim); font-size: 1.4rem; }

.chapter-jump-list { padding: 0; margin: .25rem 0 0; list-style: none; max-height: 220px; overflow-y: auto; }
.chapter-jump-list li a { display: block; padding: .35rem .45rem; color: var(--ink-soft); text-decoration: none; font-size: .88rem; border-radius: 4px; }
.chapter-jump-list li a:hover { background: var(--sand); }
.chapter-jump-list li a.current { color: var(--gold-deep); background: var(--gold-tint); font-weight: 600; }

/* ============================== AI GRID ============================== */

.ai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.ai-card {
    background: var(--white);
    border: 1px solid var(--line);
    padding: 1.2rem 1.3rem 1.1rem;
    border-radius: var(--radius);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
    box-shadow: var(--shadow-sm);
}
.ai-card:hover { transform: translateY(-2px); border-color: var(--gold-soft); box-shadow: var(--shadow-md); }
.ai-card h3 { font-family: var(--font-serif); margin: 0 0 .4rem; font-size: 1.1rem; color: var(--ink); }
.ai-card p  { color: var(--ink-soft); font-size: .9rem; margin: 0 0 .8rem; }

/* ============================== TABS ============================== */

.tab-row { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tab {
    padding: .55rem 1rem;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font: inherit;
    font-weight: 500;
}
.tab.active { color: var(--ink); border-bottom-color: var(--gold); }

/* ============================== COMPLIANCE / CHECKS ============================== */

.check-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .5rem; }
.check-list label { display: flex; gap: .55rem; align-items: flex-start; color: var(--ink-soft); cursor: pointer; }
.check-list input { margin-top: .25rem; accent-color: var(--gold); }
.health-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-top: .5rem; }
.health-item { display: flex; gap: .65rem; align-items: center; padding: .6rem .85rem; border-radius: var(--radius-sm); background: var(--cream); border: 1px solid var(--line); }
.health-item.ok span  { color: var(--emerald); font-weight: 700; }
.health-item.bad span { color: var(--danger);  font-weight: 700; }
.callout { padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--indigo-tint); border: 1px solid rgba(91, 106, 207, 0.25); color: #3d4cb0; margin-top: 1rem; font-size: .9rem; }
.kv { display: grid; grid-template-columns: 9rem 1fr; row-gap: .4rem; column-gap: 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; color: var(--ink); }

/* ============================== FORMAT PICKER ============================== */

.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: .5rem; }
.format-option {
    display: grid; gap: .15rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    background: var(--white);
}
.format-option input { display: none; }
.format-option strong { font-family: var(--font-serif); color: var(--ink); }
.format-option span { color: var(--muted); font-size: .8rem; }
.format-option.active { border-color: var(--gold); background: var(--gold-tint); box-shadow: var(--shadow-sm); }

/* ============================== DANGER ZONE ============================== */

.danger-zone {
    display: flex; gap: 1rem; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(194, 94, 86, 0.30);
    background: var(--danger-tint);
    border-radius: var(--radius);
    margin-top: 2rem;
}
.danger-zone p { color: #8a3a35; margin: .15rem 0 0; font-size: .85rem; opacity: .85; }
.danger-zone strong { color: #8a3a35; }

/* ============================== ERROR PAGES ============================== */

.error-body { min-height: 100vh; display: grid; place-items: center; background: var(--paper); color: var(--ink); padding: 2rem; }
.error-stage { max-width: 480px; text-align: center; }
.error-stage h1 { font-family: var(--font-serif); font-size: 2.4rem; margin: .25rem 0 1rem; color: var(--ink); }
.error-detail { text-align: left; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; font-family: var(--font-mono); font-size: .8rem; color: var(--ink-soft); margin-top: 2rem; overflow-x: auto; }

/* ============================== ANIMATIONS ============================== */

@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.metric-card, .proj-card, .ai-card, .chapter-row, .quick, .card { animation: fadein .35s ease backwards; }
.card-grid > * { animation: fadein .35s ease backwards; }
.card-grid > *:nth-child(1) { animation-delay: .03s; }
.card-grid > *:nth-child(2) { animation-delay: .06s; }
.card-grid > *:nth-child(3) { animation-delay: .09s; }
.card-grid > *:nth-child(4) { animation-delay: .12s; }
.card-grid > *:nth-child(5) { animation-delay: .15s; }
.card-grid > *:nth-child(6) { animation-delay: .18s; }

/* Skeleton loader */
.skeleton { background: linear-gradient(90deg, var(--cream) 0%, var(--sand) 50%, var(--cream) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* Spinner */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== RESPONSIVE ============================== */

@media (max-width: 1024px) {
    .auth-stage { grid-template-columns: 1fr; }
    .auth-side { border-right: none; border-bottom: 1px solid var(--line); padding: 2rem; }
    .auth-headline { font-size: 2.4rem; }
    .editor-grid { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .metric-grid, .metric-grid.small { grid-template-columns: 1fr 1fr; }
    .quick-grid { grid-template-columns: 1fr; }
    .edition-picker, .format-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .app-body { grid-template-columns: 1fr; grid-template-rows: 64px 1fr; grid-template-areas: "topbar" "content"; }
    .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 280px; transform: translateX(-100%); transition: transform .25s ease; z-index: 50; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .hamburger { display: inline-flex; }
    .content { padding: 1.25rem 1rem 3rem; }
    .metric-grid, .metric-grid.small { grid-template-columns: 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .hero-title { font-size: 1.8rem; }
}

/* ============================================================
   ARCHITECT INDEX — card grid
   ============================================================ */
.architect-tier { margin-bottom: 2.5rem; }
.tier-label {
    font-family: var(--font-serif); font-size: 1.25rem; color: var(--ink);
    margin: 0 0 1.25rem; display: flex; align-items: center; gap: .75rem;
}
.architect-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.architect-card {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 1.5rem 1rem 1.25rem;
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius-lg); text-decoration: none; color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
    position: relative;
}
.architect-card:hover {
    border-color: var(--gold); box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.arch-emoji { font-size: 2.4rem; margin: 0 0 .6rem; line-height: 1; }
.arch-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-soft), var(--gold-deep));
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-serif); font-size: 1.1rem; color: #fff;
    font-weight: 700; margin: 0 0 .75rem;
    box-shadow: 0 2px 8px rgba(133,98,41,.2);
}
.arch-meta { display: flex; flex-direction: column; gap: .25rem; width: 100%; }
.arch-name {
    font-family: var(--font-serif); font-size: 1rem; font-weight: 700;
    color: var(--ink); margin: 0;
}
.arch-genre { font-size: .78rem; color: var(--ink-soft); margin: 0; line-height: 1.4; }
.arch-styles { font-size: .75rem; color: var(--gold-deep); font-weight: 600; margin: .25rem 0 0; }
.arch-write-cta {
    display: none; margin-top: .75rem; font-size: .8rem; font-weight: 600;
    color: var(--gold-deep); border-top: 1px solid var(--line); width: 100%;
    padding-top: .6rem;
}
.architect-card:hover .arch-write-cta { display: block; }

.vault-locked-banner {
    background: var(--cream); border: 1px dashed var(--gold-soft);
    border-radius: var(--radius-lg); padding: 2rem; text-align: center;
}
.vault-locked-banner p { color: var(--ink-soft); margin: 0 0 .5rem; }
.vault-locked-banner p:last-of-type { margin-bottom: 1.25rem; }

/* ============================================================
   ARCHITECT DETAIL — show page
   ============================================================ */
.arch-detail-hero {
    display: flex; align-items: center; gap: 1.25rem;
    background: linear-gradient(135deg, var(--gold-tint), var(--cream));
    border: 1px solid var(--gold-soft); border-radius: var(--radius-lg);
    padding: 1.5rem 2rem; margin-bottom: 1.5rem;
}
.arch-detail-emoji { font-size: 3rem; line-height: 1; flex-shrink: 0; }
.arch-detail-info { flex: 1; }
.arch-detail-info .eyebrow { margin: 0 0 .25rem; }
.arch-detail-info h1 { font-family: var(--font-serif); font-size: 1.8rem; margin: 0 0 .35rem; }
.arch-detail-info p { margin: 0; color: var(--ink-soft); }
.arch-kindle-badge {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius); padding: .5rem .9rem;
    font-size: .82rem; color: var(--ink-soft); text-align: center;
    flex-shrink: 0;
}
.arch-kindle-badge strong { display: block; color: var(--ink); font-size: .9rem; }

.architect-detail { display: grid; gap: 1.25rem; }
.arch-detail-card {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 1.5rem;
}
.arch-detail-card h3 {
    font-family: var(--font-serif); font-size: 1.15rem;
    margin: 0 0 .75rem; color: var(--ink);
}
.arch-prompt-preview {
    color: var(--ink-soft); line-height: 1.75; margin: 0;
    font-style: italic; font-size: .95rem;
}
.arch-styles-section {
    background: var(--white); border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 1.5rem;
}
.arch-styles-section h3 {
    font-family: var(--font-serif); font-size: 1.15rem;
    margin: 0 0 .25rem; color: var(--ink);
}
.style-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem; margin-top: 1rem;
}
.style-card {
    background: var(--cream); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem;
    transition: border-color .15s;
}
.style-card:hover { border-color: var(--gold-soft); }
.style-card strong {
    font-family: var(--font-serif); display: block;
    margin: 0 0 .35rem; color: var(--ink); font-size: .95rem;
}
.style-card p { margin: 0; font-size: .85rem; color: var(--ink-soft); line-height: 1.5; }
.arch-cta { display: flex; gap: 1rem; align-items: center; padding-top: .5rem; }

/* ============================================================
   NEW PROJECT — step progress bar
   ============================================================ */
.step-bar {
    display: flex; align-items: stretch;
    background: var(--cream); border: 1px solid var(--line);
    border-radius: var(--radius-lg); overflow: hidden;
    margin-bottom: 1.75rem;
}
.step-item {
    flex: 1; display: flex; align-items: center; gap: .6rem;
    padding: .8rem 1.25rem; font-size: .875rem;
    color: var(--muted); border-right: 1px solid var(--line);
    transition: background .2s;
}
.step-item:last-child { border-right: none; }
.step-item.active {
    background: var(--gold-tint); color: var(--gold-deep); font-weight: 600;
}
.step-item.done { color: var(--emerald); }
.step-num {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--line-strong); color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 700; flex-shrink: 0;
}
.step-item.active .step-num { background: var(--gold-deep); }
.step-item.done .step-num { background: var(--emerald); content: '✓'; }

/* ============================================================
   DASHBOARD — onboarding banner (shown when 0 projects)
   ============================================================ */
.onboard-banner {
    background: linear-gradient(135deg, var(--gold-tint), var(--cream));
    border: 1px solid var(--gold-soft); border-radius: var(--radius-lg);
    padding: 2rem; margin-bottom: 2rem;
}
.onboard-banner h2 {
    font-family: var(--font-serif); font-size: 1.6rem;
    margin: 0 0 .35rem; color: var(--ink);
}
.onboard-banner > p { color: var(--ink-soft); margin: 0 0 1.5rem; }
.onboard-steps {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 1rem; margin-bottom: 1.5rem;
}
.onboard-step {
    background: rgba(255,255,255,.75); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem 1.1rem;
}
.onboard-step-num {
    font-size: 1.6rem; font-weight: 800; color: var(--gold-deep);
    font-family: var(--font-serif); line-height: 1; margin: 0 0 .4rem;
}
.onboard-step h4 {
    font-family: var(--font-serif); font-size: 1rem;
    margin: 0 0 .2rem; color: var(--ink);
}
.onboard-step p { font-size: .83rem; color: var(--ink-soft); margin: 0; line-height: 1.5; }

/* ============================================================
   RESPONSIVE additions
   ============================================================ */
@media (max-width: 1024px) {
    .architect-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .architect-grid { grid-template-columns: repeat(2, 1fr); }
    .arch-detail-hero { flex-wrap: wrap; }
    .onboard-steps { grid-template-columns: 1fr; }
    .step-bar { flex-direction: column; }
    .step-item { border-right: none; border-bottom: 1px solid var(--line); }
    .step-item:last-child { border-bottom: none; }
}

/* =================================================================
   Admin tab nav — used inside hub pages (sales, ai, settings)
   ================================================================= */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 0 0 1.5rem; flex-wrap: wrap; }
.tab { padding: .7rem 1.15rem; color: var(--muted); font-size: .92rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; font-weight: 500; }
.tab:hover { color: var(--ink-soft); }
.tab.active { color: var(--gold-deep); border-bottom-color: var(--gold); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }


/* =================================================================
   Story Outline wizard — 6-question grid + generated outline
   ================================================================= */
.outline-form { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-sm); }
.six-q-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.q-block { display: grid; gap: .45rem; }
.q-label { display: flex; align-items: baseline; gap: .5rem; }
.q-key { font-family: var(--font-sans); font-size: .72rem; font-weight: 700; letter-spacing: .12em; color: var(--gold-deep); background: var(--gold-tint); padding: .2rem .55rem; border-radius: 999px; }
.q-sub { color: var(--ink-soft); font-size: .9rem; font-weight: 600; }
.q-input { width: 100%; background: var(--warm-tint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .85rem; font-family: var(--font-serif); font-size: .95rem; line-height: 1.55; color: var(--ink); resize: vertical; min-height: 4.2rem; }
.q-input::placeholder { color: var(--dim); }
.q-input:focus { outline: none; border-color: var(--gold-soft); box-shadow: 0 0 0 3px rgba(176, 133, 56, .12); }
.outline-options { margin-top: 1.25rem; color: var(--ink-soft); font-size: .92rem; }
.outline-options select { margin-left: .4rem; background: var(--warm-tint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .45rem .6rem; font-size: .9rem; color: var(--ink); }
.outline-result { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-sm); margin-bottom: 1.75rem; display: grid; gap: 1.5rem; }
.outline-section h3 { margin: 0 0 .5rem; font-size: 1.05rem; color: var(--gold-deep); }
.outline-section p { margin: 0; color: var(--ink-soft); line-height: 1.7; font-family: var(--font-serif); }
.outline-chapters h3 { margin: 0 0 .85rem; font-size: 1.05rem; color: var(--gold-deep); }
.chapter-list { display: grid; gap: .65rem; }
.chapter-item { display: flex; gap: .9rem; align-items: flex-start; background: var(--cream); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .85rem 1rem; }
.ch-num { flex: 0 0 auto; font-family: var(--font-sans); font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: var(--gold-deep); background: var(--gold-tint); border-radius: 999px; padding: .25rem .6rem; margin-top: .1rem; white-space: nowrap; }
.ch-body strong { display: block; color: var(--ink); margin-bottom: .2rem; }
.ch-body p { margin: 0; color: var(--ink-soft); font-size: .9rem; line-height: 1.6; }
.outline-regen { border-top: 1px dashed var(--line); padding-top: .85rem; }
.section-rule { border: none; border-top: 1px solid var(--line); margin: 2rem 0 1.5rem; }
@media (max-width: 860px) { .six-q-grid { grid-template-columns: 1fr; } }

/* =================================================================
   Writing editor — path selector, controls, canvas
   ================================================================= */
.hidden { display: none !important; }
.editor-no-outline { background: var(--gold-tint); border: 1px solid var(--gold-soft); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.editor-no-outline p { margin: 0; color: var(--ink-soft); }
.writing-paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
.path-btn { text-align: left; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; cursor: pointer; font-family: var(--font-sans); font-size: .95rem; font-weight: 600; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.path-btn:hover { border-color: var(--gold-soft); }
.path-btn.active { border-color: var(--gold); background: var(--gold-tint); box-shadow: var(--shadow-sm); }
.path-desc { display: block; margin-top: .3rem; font-size: .78rem; font-weight: 400; color: var(--muted); line-height: 1.45; }
.editor-workspace { display: grid; grid-template-columns: 340px 1fr; gap: 1.25rem; align-items: start; }
.editor-controls { display: grid; gap: 1rem; }
.chapter-picker { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow-sm); }
.picker-label { display: grid; gap: .4rem; color: var(--ink-soft); font-size: .85rem; font-weight: 600; }
.picker-label select { width: 100%; background: var(--warm-tint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .7rem; font-size: .92rem; color: var(--ink); font-weight: 500; }
.picker-hint { margin: .55rem 0 0; font-size: .78rem; color: var(--muted); line-height: 1.5; }
.path-panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; box-shadow: var(--shadow-sm); display: grid; gap: .85rem; }
.path-panel h3 { margin: 0; font-size: 1rem; color: var(--ink); }
.path-panel label { display: grid; gap: .35rem; color: var(--ink-soft); font-size: .85rem; font-weight: 500; }
.path-panel input, .path-panel textarea, .path-panel select { width: 100%; background: var(--warm-tint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .75rem; font-size: .92rem; color: var(--ink); font-family: var(--font-sans); }
.path-panel textarea { font-family: var(--font-serif); line-height: 1.55; resize: vertical; }
.path-panel input:focus, .path-panel textarea:focus, .path-panel select:focus { outline: none; border-color: var(--gold-soft); box-shadow: 0 0 0 3px rgba(176, 133, 56, .12); }
.path-panel .dim { margin: 0; font-size: .8rem; }
.editor-canvas { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; display: flex; flex-direction: column; min-height: 560px; }
.canvas-toolbar { display: flex; align-items: center; gap: .5rem; padding: .65rem .9rem; border-bottom: 1px solid var(--line-soft); background: var(--cream); }
.canvas-chapter-label { font-family: var(--font-sans); font-size: .8rem; font-weight: 700; letter-spacing: .04em; color: var(--gold-deep); }
.toolbar-spacer { flex: 1; }
.canvas-body { flex: 1; padding: 1.75rem 2rem; font-family: var(--font-serif); font-size: 1.02rem; line-height: 1.8; color: var(--ink); overflow-y: auto; max-height: 65vh; }
.canvas-body:focus { outline: none; }
.canvas-body p { margin: 0 0 1em; }
.canvas-placeholder { color: var(--dim); font-style: italic; }
.canvas-status { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .9rem; border-top: 1px solid var(--line-soft); background: var(--cream); font-size: .8rem; color: var(--muted); }
.btn.is-busy { opacity: .65; cursor: progress; }
@media (max-width: 980px) { .editor-workspace { grid-template-columns: 1fr; } .writing-paths { grid-template-columns: 1fr; } }

/* =================================================================
   Publish toolkit — optimizer stats, compliance, title/blurb output
   ================================================================= */
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; flex-wrap: wrap; }
.card-header-row .card-title { margin: 0; }
.optimizer-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: .75rem 0; }
.stat-block { background: var(--cream); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .9rem 1rem; display: grid; gap: .2rem; }
.stat-block.highlight { background: var(--gold-tint); border-color: var(--gold-soft); }
.stat-number { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.stat-block.highlight .stat-number { color: var(--gold-deep); }
.stat-label { font-size: .76rem; color: var(--muted); letter-spacing: .02em; }
.progress-bar-wrap { height: 8px; background: var(--sand); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold-soft), var(--gold)); border-radius: 999px; transition: width .4s ease; }
.suggestion-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.suggestion { padding: .6rem .85rem; border-radius: var(--radius-sm); font-size: .88rem; line-height: 1.55; border: 1px solid var(--line-soft); background: var(--cream); color: var(--ink-soft); }
.suggestion.warning { background: var(--coral-tint); border-color: #efc4b5; color: #8a4632; }
.suggestion.goal { background: var(--emerald-tint); border-color: #bcdccd; color: #2f6d51; }
.suggestion.info, .suggestion.tip { background: var(--indigo-tint); border-color: #cdd2f1; color: #46519e; }
.category-table-toggle summary { font-size: .85rem; }
.row-active td { background: var(--gold-tint); font-weight: 600; }
.compliance-badges { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 .85rem; }
.info-box { background: var(--cream); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .85rem 1rem; font-size: .9rem; color: var(--ink-soft); line-height: 1.6; margin: .6rem 0; }
.blurb-box { background: var(--warm-tint); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; font-family: var(--font-serif); line-height: 1.7; color: var(--ink); margin: .5rem 0 1rem; white-space: pre-wrap; }
.blurb-box.code-box { font-family: var(--font-mono); font-size: .84rem; line-height: 1.6; color: var(--ink-soft); }

/* Buy-credits link in the sidebar foot */
.buy-credits-link { display: block; text-align: center; margin: .5rem 0; padding: .45rem .6rem; font-size: .82rem; font-weight: 700; color: var(--gold-deep); background: var(--gold-tint); border: 1px solid var(--gold-soft); border-radius: var(--radius-sm); text-decoration: none; }
.buy-credits-link:hover { background: var(--gold-soft); color: #fff; }
