/* ── AshenWaypoints Editor ── waystone library + placement/capture form ── */
:root {
  /* Staff-ledger variant: re-source the editor palette onto the shared
     dashboard theme tokens (theme.css) - parchment surfaces, launcher ink,
     gold accent. Interior drafting-table inlays keep their dark hexes. */
  --bg: var(--ashen-canvas); --bg-2: var(--ashen-canvas-deep); --panel: var(--ashen-panel); --panel-2: var(--ashen-panel-strong);
  --line: var(--ashen-hairline); --line-2: var(--ashen-hairline-strong); --text: var(--ashen-ink); --muted: var(--ashen-ink-muted);
  --accent: var(--ashen-accent); --gold: var(--ashen-accent-text); --red: var(--ashen-red);
  --green: var(--ashen-emerald); --blue: var(--ashen-sky);
  --radius: 12px; --radius-sm: 8px;
  --font: var(--ashen-body);
}

body { margin: 0; background: var(--bg); color: var(--text); font: 14px var(--font); }

/* .page/.workspace/.library/.library-tools/#search scaffolding lives in
   theme.css; only Waystone-specific placements override it here. */
#waystone-list { flex: 1; overflow-y: auto; padding: 12px; }
.editor { overflow-y: auto; }

/* ── Waystone cards ── */
.waystone-card {
  padding: 10px 12px; border: 1px solid var(--line-2); background: var(--panel-2);
  border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: border-color .12s, background .12s, transform .1s;
}
.waystone-card:hover { border-color: var(--line); background: var(--accent-dim); transform: translateX(2px); }
.waystone-card.selected { border-color: var(--gold); background: var(--accent-dim); box-shadow: 0 0 0 1px var(--gold) inset; }
.waystone-card .card-icon {
  width: 36px; height: 36px; flex: none; border-radius: 8px;
  background: var(--ashen-violet-dim); border: 1px solid rgba(142,90,188,.35);
  color: var(--ashen-violet-text);
  display: grid; place-items: center; font-size: 16px;
}
.waystone-card .card-body { min-width: 0; flex: 1; }
.waystone-card .card-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.waystone-card .card-meta { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; }

/* ── Waystate badges (base .badge/.published/.draft live in theme.css) ── */
.badge.disabled { background: var(--ashen-violet-dim); color: var(--ashen-violet-text); }
.badge.world { background: rgba(75,89,112,.14); color: #4B5970; }

/* ── Editor ── */
.editor-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  color: var(--muted); padding: 24px;
}
.editor-empty .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .7; }
.editor-empty h2 { margin: 0 0 6px; color: var(--text); }
.editor-empty p { margin: 0; font-size: 13px; max-width: 360px; }

.editor-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
}
.editor-head h2 { margin: 0; font-size: 20px; }
.editor-head .slug { color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.editor-head .spacer { flex: 1; }
.editor-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.field input, .field select, .field textarea {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; font: inherit; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { min-height: 84px; resize: vertical; }
.field .hint { color: var(--muted); font-size: 11px; margin: 0; }

.field-section {
  grid-column: 1 / -1; margin-top: 6px;
  border: 1px solid var(--line-2); border-radius: 9px; padding: 14px 16px;
  background: var(--accent-dim);
}
.field-section h3 { margin: 0 0 12px; color: var(--gold); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.field-section .form-grid { margin-top: 0; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.check-row label { color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500; cursor: pointer; }
.check-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); }

/* ── Position capture ── */
.pos-capture { display: flex; gap: 8px; margin-bottom: 12px; }
.pos-capture input {
  flex: 1; background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px; font: inherit; outline: none;
}
.pos-capture input:focus { border-color: var(--accent); }

/* ── Pricing preview ── */
.cost-preview {
  grid-column: 1 / -1; margin-top: 6px;
  border: 1px dashed var(--line); border-radius: 9px; padding: 10px 14px;
  background: var(--accent-dim); color: var(--muted); font-size: 12px;
}
.cost-preview .cost-label { color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; font-size: 10.5px; }
.cost-preview .cost-free { color: var(--green); font-weight: 600; }

/* toasts + #toast-container live in theme.css (Tailwind-positioned) */

/* Scoped to #app (not global) so Tailwind's responsive `hidden md:flex` nav still renders. */
#app .hidden { display: none !important; }
.muted { color: var(--muted); }

@media (max-width: 900px) {
  .page { display: block; height: auto; min-height: 0; padding: 16px; }
  .workspace { grid-template-columns: 1fr; height: auto; }
  .library { overflow: visible; }
  #waystone-list { overflow: visible; }
  .editor { overflow: visible; }
  .form-grid { grid-template-columns: 1fr; }
  .pos-capture { flex-direction: column; }
}
