/* ============================================================
   Experience API — Stripe-like theme
   White surfaces, ink text, one accent. Minimal, modern, calm.
   ============================================================ */

   :root {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --paper: #f6f8fa;
    --ink: #1a1f36;
    --ink-soft: #687385;
    --line: #e3e8ee;
    --accent: #2142ff;
    --accent-soft: #f0efff;
    --accent-hover: #0026ff;
    --good: #217a05;
    --good-soft: #e8f5e3;
    --warn: #df1b41;
    --warn-soft: #fdeef1;
    --gold: #a15c07;
    --gold-soft: #fdf3e0;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
    --shadow-sm: 0 1px 2px rgba(26, 31, 54, 0.05);
    --shadow-md: 0 2px 5px rgba(26, 31, 54, 0.08), 0 1px 1px rgba(26, 31, 54, 0.04);
    --radius: 8px;
  }
  
  * { box-sizing: border-box; }
  
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }
  
  main { max-width: 1080px; margin: 0 auto; padding: 24px 24px 64px; }
  
  h1, h2, h3 { font-weight: 600; color: var(--ink); }
  a { color: var(--accent); }
  
  /* ---------- top bar ---------- */
  .topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 10px 24px;
  }
  .brand { display: flex; align-items: baseline; gap: 10px; }
  .mark {
    font-family: var(--mono); font-size: 12px; font-weight: 700;
    color: var(--accent); background: var(--accent-soft);
    padding: 3px 8px; border-radius: 6px; letter-spacing: 0.02em;
  }
  .brandsub { font-size: 12.5px; color: var(--ink-soft); }
  .expertpick { margin-left: auto; font-size: 12.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 10px; }
  .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
  .topbar-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
  
  /* ---------- tabs ---------- */
  .tabs {
    display: flex; gap: 2px; margin: 18px 0 20px;
    border-bottom: 1px solid var(--line);
  }
  .tab {
    appearance: none; background: none; border: none; cursor: pointer;
    font-family: var(--sans); font-size: 13.5px; font-weight: 500;
    color: var(--ink-soft); padding: 9px 14px;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color 0.12s;
  }
  .tab:hover { color: var(--ink); }
  .tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
  .tabpanel { display: none; }
  .tabpanel.is-active { display: block; }
  
  /* ---------- cards / sections ---------- */
  .editor, .testpanel, .scopebox {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
  }
  .view { display: none; }
  .view.is-active { display: block; }
  
  .eyebrow {
    display: block;
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--ink-soft);
  }
  .eyebrow em { font-style: normal; color: var(--warn); font-weight: 600; text-transform: none; letter-spacing: 0; margin-left: 4px; font-size: 10.5px; }
  
  /* ---------- forms ---------- */
  .field { display: block; }
  .field .eyebrow { margin-bottom: 5px; }
  input, textarea, select {
    width: 100%;
    font-family: var(--sans); font-size: 13.5px; color: var(--ink);
    background: var(--surface);
    border: 1px solid #d5dbe1; border-radius: 6px;
    padding: 8px 10px;
    transition: border-color 0.12s, box-shadow 0.12s;
  }
  input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.15);
  }
  input::placeholder, textarea::placeholder { color: #a3acb9; }
  textarea { resize: vertical; }
  .fieldgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .prodgrid { display: grid; gap: 12px; }
  .testgrid { display: grid; grid-template-columns: 220px; }
  .lbl { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); margin: 8px 0 4px; }
  
  /* ---------- buttons ---------- */
  button {
    font-family: var(--sans); font-size: 13.5px; font-weight: 500;
    border-radius: 6px; cursor: pointer;
    padding: 8px 14px;
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  }
  .primary {
    background: var(--accent); color: #fff; border: 1px solid var(--accent);
    box-shadow: var(--shadow-sm);
  }
  .primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .primary:disabled { opacity: 0.55; cursor: default; }
  .ghost {
    background: var(--surface); color: var(--ink); border: 1px solid #d5dbe1;
    box-shadow: var(--shadow-sm);
  }
  .ghost:hover { border-color: #b6bfca; }
  .danger, .danger-ghost {
    background: var(--surface); color: var(--warn); border: 1px solid #f2c6d0;
  }
  .danger:hover, .danger-ghost:hover { border-color: var(--warn); background: var(--warn-soft); }
  .save { width: 100%; margin-top: 10px; }
  .savestate { font-size: 12.5px; color: var(--ink-soft); min-height: 18px; margin: 6px 0 0; }
  
  /* ---------- status / rows ---------- */
  .statusrow {
    display: flex; align-items: center; gap: 16px;
    font-size: 13px; color: var(--ink-soft);
    border-top: 1px solid var(--line);
    margin-top: 16px; padding-top: 14px;
  }
  .statusrow b { color: var(--ink); font-weight: 600; }
  .badge {
    display: inline-block; font-size: 11.5px; font-weight: 600;
    padding: 2px 8px; border-radius: 20px;
  }
  .badge.live { background: var(--good-soft); color: var(--good); }
  .badge.pending { background: var(--gold-soft); color: var(--gold); }
  
  /* ---------- skills sidebar ---------- */
  .domains { }
  .domains ul { list-style: none; margin: 10px 0; padding: 0; }
  .ditem {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; border-radius: 6px; cursor: pointer;
    font-size: 13.5px; color: var(--ink);
    border: 1px solid transparent;
  }
  .ditem:hover { background: var(--paper); }
  .ditem.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .ditem .count { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
  .ditem.is-active .count { color: var(--accent); }
  .editor-head { display: flex; align-items: center; gap: 12px; }
  .dname {
    font-size: 16px; font-weight: 600; border: 1px solid transparent;
    padding: 6px 8px; margin-left: -8px;
  }
  .dname:hover { border-color: #d5dbe1; }
  .domain-danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
  
  /* ---------- material blocks ---------- */
  .block { margin-top: 20px; }
  .block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
  .block-help { font-size: 12.5px; color: var(--ink-soft); margin: 4px 0 10px; line-height: 1.55; }
  .row {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; margin-bottom: 10px; background: var(--surface);
    position: relative;
  }
  .row .remove {
    position: absolute; top: 8px; right: 8px;
    background: none; border: none; color: var(--ink-soft);
    font-size: 15px; padding: 2px 6px;
  }
  .row .remove:hover { color: var(--warn); }
  .emptyhint { font-size: 13px; color: var(--ink-soft); padding: 14px 0; }
  .err { color: var(--warn); font-size: 13px; background: var(--warn-soft); border-radius: 6px; padding: 10px 12px; }
  .loading { color: var(--ink-soft); font-size: 13px; }
  
  /* ---------- calibration ---------- */
  .calblock {
    border: 1px solid var(--accent); border-radius: var(--radius);
    padding: 16px 18px; background: #fbfbff;
  }
  .calprogress { margin-top: 10px; }
  .calprogress-top { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
  .calbar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
  .calbar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
  .calscenario {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px; margin-bottom: 12px;
  }
  .calscenario p { margin: 6px 0 0; font-size: 13.5px; }
  .calbaseline { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
  .calbaseline pre {
    white-space: pre-wrap; font-family: var(--sans); font-size: 13px; line-height: 1.55;
    margin: 8px 0 0; max-height: 320px; overflow-y: auto; color: var(--ink-soft);
  }
  .calform .field { margin-top: 10px; }
  .calcard {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 8px; background: var(--surface);
  }
  .calcard summary { cursor: pointer; font-size: 13px; color: var(--ink); }
  .calcard summary b { color: var(--accent); }
  .calbody { margin-top: 10px; }
  .calbody .field { margin-top: 8px; }
  .calbody p { font-size: 12.5px; color: var(--ink-soft); }
  
  /* ---------- economics readout ---------- */
  .econread { margin-top: 14px; }
  .econtable { width: 100%; border-collapse: collapse; font-size: 13px; }
  .econtable th {
    text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--ink-soft);
    padding: 6px 8px; border-bottom: 1px solid var(--line);
  }
  .econtable td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
  .econtable td.lbl { color: var(--ink-soft); margin: 0; }
  .econtable td.earncell { color: var(--good); font-weight: 600; }
  .econnote { font-size: 12px; color: var(--ink-soft); margin-top: 8px; line-height: 1.5; }
  
  /* ---------- test / diff ---------- */
  .testresult { margin-top: 18px; }
  .diff { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .diff-col { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
  .diff-col h3 { margin: 0 0 10px; font-size: 13px; }
  .diff-col.you { border-color: var(--accent); }
  .colsub { display: block; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); margin-top: 3px; }
  .baseline-text { font-size: 12.5px; color: var(--ink-soft); white-space: pre-wrap; max-height: 420px; overflow-y: auto; }
  .action { border-top: 1px solid var(--line); padding: 10px 0; }
  .action:first-child { border-top: none; padding-top: 0; }
  .a-title { font-weight: 600; font-size: 13.5px; }
  .a-why { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
  .grounded { font-size: 11.5px; color: var(--accent); margin-top: 4px; }
  .assume, .skip, .needs { font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
  .deliverable { white-space: pre-wrap; font-size: 13px; max-height: 420px; overflow-y: auto; }
  .meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 8px; }
  
  .delta { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
  .delta-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .delta-q { font-size: 12.5px; font-weight: 600; }
  .verdict { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 20px; background: var(--paper); }
  .verdict.strong { background: var(--good-soft); color: var(--good); }
  .verdict.moderate { background: var(--gold-soft); color: var(--gold); }
  .verdict.weak, .verdict.none { background: var(--warn-soft); color: var(--warn); }
  .meter { height: 6px; background: var(--line); border-radius: 3px; margin: 12px 0 6px; position: relative; }
  .needle {
    position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); border: 2px solid #fff; box-shadow: var(--shadow-md);
    transform: translateX(-50%); transition: left 0.5s;
  }
  .meter-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-soft); }
  .delta-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; }
  .deltahint { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-soft); font-style: italic; }
  
  /* ---------- code / keys ---------- */
  .howto, .keyfull, pre.howto {
    font-family: var(--mono); font-size: 12px; line-height: 1.6;
    background: #f8fafc; color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; white-space: pre-wrap; word-break: break-all;
  }
  .keyrow code {
    display: block; font-family: var(--mono); font-size: 12.5px;
    background: #f8fafc; border: 1px solid var(--line); border-radius: 6px;
    padding: 9px 12px; word-break: break-all;
  }
  
  /* ---------- buyer dashboard ---------- */
  .dashgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .bignum { font-size: 28px; font-weight: 600; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
  .subnum { font-size: 12.5px; color: var(--ink-soft); }
  .packbtns { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
  .packbtn { flex: 1; min-width: 120px; text-align: center; }
  .provlist { margin-top: 10px; }
  .provcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; background: var(--surface); }
  .provtop { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
  .provprice { font-size: 12.5px; color: var(--accent); font-weight: 600; white-space: nowrap; }
  .provdesc { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
  .provhandle { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }
  .provhandle code { font-family: var(--mono); background: var(--paper); padding: 1px 6px; border-radius: 4px; }
  
  /* ---------- admin / tables ---------- */
  .difftable { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
  .difftable th {
    text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--ink-soft);
    padding: 8px; border-bottom: 1px solid var(--line);
  }
  .difftable td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
  .difftable tr.changed td { background: var(--gold-soft); }
  .prow.same td { color: var(--ink-soft); }
  
  /* ---------- local builder leftovers (dev tool) ---------- */
  .examplebar { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
  .chip { font-size: 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 4px 12px; cursor: pointer; }
  .chip:hover { border-color: var(--accent); color: var(--accent); }
  .kindsel { width: auto; }
  .econ { margin-top: 14px; }
  .econ-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .econ-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
  .ecell { font-variant-numeric: tabular-nums; font-size: 13px; }
  .ecell.earn { color: var(--good); font-weight: 600; }
  .ecell.cogs, .ecell.out { color: var(--ink-soft); }
  .econ-note, .verbhint, .pfloor { font-size: 12px; color: var(--ink-soft); }
  .pricing { margin-top: 10px; }
  .pricebreak { font-size: 12.5px; color: var(--ink-soft); }
  .priceinput { max-width: 140px; }
  .modal { position: fixed; inset: 0; background: rgba(26,31,54,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
  .modal-body { background: var(--surface); border-radius: var(--radius); padding: 22px 24px; max-width: 480px; box-shadow: var(--shadow-md); }
  .modal-title { font-weight: 600; margin-bottom: 10px; }
  .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
  
  @media (max-width: 860px) {
    .fieldgrid, .grid2, .diff, .dashgrid { grid-template-columns: 1fr; }
    main { padding: 16px 14px 48px; }
  }