/* ============================================================================
   [NE:atelier] worldweave.css — Worldweave panel (index.php #section-worldweave,
   wired by worldweave.js). Uses app.css design tokens (--surface/--ink/--line…)
   so the panel matches the studio. Docs: 2dguild/docs/narroengine/MODULE_MAP.md
   ============================================================================ */

.ne-worldweave-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.ne-panel h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
}

.ne-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ne-hint {
    margin: 0 0 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--muted);
}

.ne-dim { color: var(--muted); font-size: 0.82rem; }

.ne-field { display: block; margin-bottom: 10px; }
.ne-field > span {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ne-field input,
.ne-field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    box-sizing: border-box;
}
.ne-field input:focus,
.ne-field textarea:focus { outline: none; border-color: var(--blue); }

.ne-btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* Anchor chip in the section intro */
.ne-anchor-chip {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Context summary + canon peek */
.ne-context-summary {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    font-size: 0.88rem;
}
.ne-summary-row { margin-bottom: 4px; }
.ne-canon-peek { margin-top: 8px; }
.ne-canon-peek summary { cursor: pointer; font-weight: 700; font-size: 0.83rem; }
.ne-canon-fact {
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.83rem;
    line-height: 1.45;
}
.ne-canon-fact:last-child { border-bottom: none; }

/* Warden report */
.ne-warden-report {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.86rem;
}
.ne-warden-verdict {
    padding: 8px 12px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
.ne-warden-report[data-verdict="pass"] .ne-warden-verdict strong { color: var(--green); }
.ne-warden-report[data-verdict="warnings"] .ne-warden-verdict strong { color: var(--amber); }
.ne-warden-report[data-verdict="blocked"] .ne-warden-verdict strong { color: var(--danger); }
.ne-violation {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    line-height: 1.45;
}
.ne-violation:last-child { border-bottom: none; }
.ne-violation-rule {
    flex-shrink: 0;
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    color: var(--muted);
    padding-top: 2px;
}
.ne-violation--block .ne-violation-rule { color: var(--danger); }
.ne-violation--warn .ne-violation-rule { color: var(--amber); }

/* Entries (curation list) */
.ne-entries { display: flex; flex-direction: column; gap: 10px; }
.ne-empty { color: var(--muted); font-size: 0.88rem; margin: 4px 0; }
.ne-entries-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}
.ne-entry {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: var(--surface);
    transition: border-color 0.15s ease;
}
.ne-entry--accepted { border-left: 3px solid var(--green); }
.ne-entry--rejected { opacity: 0.55; }
.ne-entry--draft { border-left: 3px solid var(--amber); }
.ne-entry-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.ne-entry-title { flex: 1 1 auto; min-width: 0; }
.ne-entry-title strong { display: inline-block; margin-right: 8px; }
.ne-entry-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ne-mini { padding: 4px 10px; font-size: 0.78rem; }
.ne-danger { color: var(--danger); }
.ne-entry-content {
    margin: 8px 0 0;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--ink);
}
.ne-select { display: inline-flex; align-items: center; padding-top: 2px; }
.ne-select-spacer { width: 16px; flex-shrink: 0; }

/* Proposal status chips */
.ne-chip {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--muted);
    margin-left: 6px;
    vertical-align: 2px;
}
.ne-chip--approved { color: var(--green); border-color: currentColor; }
.ne-chip--pending_review { color: var(--amber); border-color: currentColor; }
.ne-chip--changes_requested { color: var(--amber); border-color: currentColor; }
.ne-chip--declined_final { color: var(--danger); border-color: currentColor; }

@media (max-width: 720px) {
    .ne-entry-top { flex-wrap: wrap; }
    .ne-entry-actions { width: 100%; justify-content: flex-end; }
}

/* [NE:characters] world registration + writs (M5b) */
.ne-cast-list, .ne-borrowables { display: flex; flex-direction: column; gap: 8px; }
.ne-cast-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.ne-cast-row--borrow { background: var(--paper); }
.ne-cast-main { min-width: 0; }
.ne-cast-main strong { margin-right: 6px; }
.ne-cast-notes { margin-top: 3px; font-size: 0.78rem; }
.ne-borrow-head {
    margin-top: 10px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
.ne-chip--under_review { color: var(--amber); border-color: currentColor; }

.ne-register-form {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}
.ne-register-form__title { margin-bottom: 8px; font-size: 0.9rem; }
.ne-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.83rem;
    line-height: 1.45;
    margin-bottom: 8px;
    color: var(--ink);
}
.ne-check input { margin-top: 2px; flex-shrink: 0; }
.ne-writ-period { display: flex; gap: 10px; }
.ne-writ-period .ne-field { flex: 1; }
.ne-writ-status {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    font-size: 0.86rem;
}

/* ============================================================================
   [NE:atelier] ADVANCED REWORK (2026-07) — status strip, world browser,
   writ-gate highlight. Rendered by worldweave.js v0.2.x.
   ============================================================================ */

/* Section-intro status strip: anchor + Warden + writ + proposals chips */
.ne-status-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.ne-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.8rem;
    white-space: nowrap;
}

.ne-status-chip strong { font-weight: 700; }
.ne-status-chip[data-tone="good"] { color: var(--green); border-color: currentColor; }
.ne-status-chip[data-tone="warn"] { color: var(--amber); border-color: currentColor; }
.ne-status-chip[data-tone="bad"] { color: var(--danger); border-color: currentColor; }
.ne-status-chip[data-tone="dim"] { color: var(--muted); }

.ne-field-note {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
}

/* World browser — the context packet, browsable. Overview line + accordions
   for canon, events, people, inventory, and house style. */
.ne-browser-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 4px;
}

.ne-browser-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.76rem;
    color: var(--muted);
}

.ne-browser-stat strong { color: var(--ink); font-size: 0.85rem; }

.ne-browser details {
    margin-top: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.ne-browser details > summary {
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.83rem;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ne-browser details > summary::-webkit-details-marker { display: none; }

.ne-browser details > summary::after {
    content: "";
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.ne-browser details[open] > summary::after { transform: rotate(225deg); }

.ne-browser-count {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--muted);
}

.ne-browser-body {
    padding: 4px 12px 10px;
    border-top: 1px dashed var(--line);
}

.ne-event-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.84rem;
    line-height: 1.45;
}

.ne-event-row:last-child { border-bottom: none; }

.ne-event-severity {
    flex-shrink: 0;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.ne-event-severity[data-severity="major"],
.ne-event-severity[data-severity="catastrophic"] { color: var(--danger); border-color: currentColor; }
.ne-event-severity[data-severity="moderate"] { color: var(--amber); border-color: currentColor; }

.ne-event-ack { color: var(--green); font-size: 0.78rem; font-weight: 700; }

.ne-inv-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.83rem;
}

.ne-inv-row:last-child { border-bottom: none; }

.ne-inv-lifecycle {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.ne-style-note {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
}

/* Writ-gate highlight: fetchContext catches ne-writ-required and walks the
   author here — the panel pulses once and keeps an accent ring. */
#ne-writ-panel.ne-writ-needed {
    border-color: var(--amber);
    box-shadow: 0 0 0 1px var(--amber);
}

.ne-writ-gate-note {
    margin: 0 0 10px;
    padding: 9px 12px;
    border: 1px solid var(--amber);
    border-radius: var(--radius);
    background: rgba(180, 83, 9, 0.07);
    color: var(--amber);
    font-size: 0.84rem;
    line-height: 1.5;
}

@keyframes ne-writ-pulse {
    0% { box-shadow: 0 0 0 1px var(--amber); }
    45% { box-shadow: 0 0 0 6px rgba(180, 83, 9, 0.25); }
    100% { box-shadow: 0 0 0 1px var(--amber); }
}

#ne-writ-panel.ne-writ-needed.ne-writ-pulse {
    animation: ne-writ-pulse 1.1s ease 2;
}

@media (max-width: 860px) {
    .ne-status-strip { justify-content: flex-start; }
}

/* Fix: app.css styles bare `input` as a full-width 42px text field, which
   blew the register/writ checkboxes up into giant squares and shoved their
   label text outside the panel. Scope them back to real checkbox size. */
.ne-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-height: 0;
    padding: 0;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--accent);
}

/* ── BIBLE SPLIT REWORK — scenes panel + manual story-fact form ──────────────
   The scene rail/editor markup moved here from the old Story Bible Scene tab
   (ids unchanged; wiring stays in studio.js). bible-shell layout rules ride in
   from app.css — only worldweave-specific framing lives here. The org panel
   followed in the world-elements rework (orgs are world elements). */
.ne-scenes-panel .bible-shell { margin-top: 6px; }
.ne-orgs-panel .bible-shell { margin-top: 6px; }

.ne-fact-add {
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.ne-fact-add > summary {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.ne-fact-form { margin-top: 10px; }
.ne-fact-form .form-grid { margin-bottom: 8px; }

/* Legacy private facts (old Canon tab) render read-only in the unified list */
.ne-entry--legacy { opacity: 0.85; border-style: dashed; }
.ne-entry--legacy .ne-entry-meta { font-style: italic; }
.ne-origin-chip {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 0.68rem;
    color: var(--muted);
}
