/* Shared shell for the live demos. Per-demo styles live in /assets/css/demos/<name>.css */
.demo-section { padding: 0 0 clamp(2rem, 5vw, 4rem); margin-top: -2.5rem; position: relative; z-index: 2; }
.demo { background: var(--white); border: 1px solid var(--line); border-radius: calc(var(--radius) * 1.3); box-shadow: var(--shadow-lg); overflow: hidden; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fbf8f3); }
.demo-bar-title { display: flex; align-items: center; gap: .75rem; font: 650 1rem/1.2 var(--display); }
.demo-bar-note { font-size: .86rem; color: var(--muted); }
.demo-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
.demo-body.single { grid-template-columns: 1fr; }
.demo-in { padding: clamp(1.25rem, 3vw, 2rem); border-right: 1px solid var(--line); display: grid; gap: 1.1rem; align-content: start; }
.demo-out { padding: clamp(1.25rem, 3vw, 2rem); background: var(--paper); min-height: 420px; position: relative; }
@media (max-width: 900px) { .demo-body { grid-template-columns: 1fr; } .demo-in { border-right: 0; border-bottom: 1px solid var(--line); } }
.demo h2, .demo h3 { font-size: 1.15rem; margin: 0 0 .2rem; }
.demo-label { font: 650 .78rem/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; }
.demo-examples { display: flex; flex-wrap: wrap; gap: .45rem; }
.demo-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.demo-empty { display: grid; place-items: center; text-align: center; color: var(--muted); min-height: 340px; padding: 2rem; border: 2px dashed var(--line); border-radius: var(--radius); }
.demo-empty b { display: block; font: 650 1.15rem/1.3 var(--display); color: var(--ink); margin-bottom: .3rem; }
.demo-error { padding: 1rem 1.2rem; border-radius: var(--radius-sm); background: #fbe6e1; color: #8f2d14; font-weight: 600; }
.demo-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .86rem; color: var(--muted); margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.demo-meta b { color: var(--ink); }
.demo-badge { display: inline-flex; align-items: center; gap: .4rem; font: 650 .74rem/1 var(--body); letter-spacing: .05em; text-transform: uppercase; padding: .4rem .6rem; border-radius: 999px; background: var(--sea-soft); color: var(--sea); }
.demo-badge.offline { background: var(--paper-2); color: var(--muted); }
.is-loading { position: relative; pointer-events: none; }
.is-loading > * { opacity: .35; filter: blur(1px); transition: opacity .2s; }
.is-loading::after { content: ''; position: absolute; left: 50%; top: 120px; width: 44px; height: 44px; margin-left: -22px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--sun); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-code { font: .84rem/1.6 var(--mono); background: #07101b; color: #b7f5ea; border-radius: var(--radius-sm); padding: 1rem 1.1rem; overflow: auto; max-height: 420px; white-space: pre; margin: 0; }
.demo-table { width: 100%; border-collapse: collapse; font-size: .96rem; }
.demo-table th, .demo-table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.demo-table th { font: 650 .74rem/1.2 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.demo-table td.num, .demo-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.demo-table tfoot td { border: 0; padding: .35rem .5rem; }
.demo-table tfoot tr:last-child td { font: 700 1.2rem/1.2 var(--display); padding-top: .6rem; border-top: 2px solid var(--ink); }
.demo-disclaimer { font-size: .86rem; color: var(--muted); margin: 1rem 0 0; }

/* ── Output as a document (design pass) ──
   Empty state: a ghost sheet with skeleton rows, so the panel never looks broken before first use. */
.demo-empty { position: relative; align-content: end; background: var(--white); border: 1.5px dashed var(--line-2, #d9cfbd); border-radius: 12px; padding: 2rem 1.5rem 2.25rem; overflow: hidden; }
.demo-empty::before { content: ''; position: absolute; left: 1.5rem; right: 1.5rem; top: 1.5rem; height: 170px; opacity: .9; background:
  linear-gradient(#ece6da, #ece6da) 0 0 / 46% 14px no-repeat,
  linear-gradient(#f1ece3, #f1ece3) 100% 0 / 22% 14px no-repeat,
  linear-gradient(#f3eee5, #f3eee5) 0 44px / 100% 1px no-repeat,
  linear-gradient(#f1ece3, #f1ece3) 0 64px / 62% 10px no-repeat, linear-gradient(#f1ece3, #f1ece3) 100% 64px / 14% 10px no-repeat,
  linear-gradient(#f1ece3, #f1ece3) 0 92px / 54% 10px no-repeat, linear-gradient(#f1ece3, #f1ece3) 100% 92px / 12% 10px no-repeat,
  linear-gradient(#f1ece3, #f1ece3) 0 120px / 66% 10px no-repeat, linear-gradient(#f1ece3, #f1ece3) 100% 120px / 16% 10px no-repeat,
  linear-gradient(#ece6da, #ece6da) 100% 156px / 30% 14px no-repeat; }
.demo-empty > div { position: relative; padding-top: 170px; }
/* A finished result can sit on a sheet: <div class="demo-sheet"><span class="demo-stamp">Draft</span>…</div> */
.demo-sheet { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: clamp(1.25rem, 3vw, 2rem); }
.demo-stamp { position: absolute; top: 1.1rem; right: 1.1rem; padding: .3rem .7rem; border: 2px solid var(--sun); border-radius: 6px; color: var(--sun-ink); font: 800 .78rem/1 var(--body); letter-spacing: .16em; text-transform: uppercase; transform: rotate(6deg); opacity: .85; }
.demo-table tbody tr:nth-child(even) td { background: #faf6ef; }
.demo-table td.num, .demo-table th.num { font-variant-numeric: tabular-nums; }
.demo-total { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: 1rem; padding: 1rem 1.1rem; border-radius: 12px; background: var(--sea-soft); }
.demo-total span { font-weight: 650; }
.demo-total b { font: 700 1.75rem/1 var(--display); color: var(--sea); font-variant-numeric: tabular-nums; }
