:root {
      --bg: #eef5f2;
      --bg2: #f9fbf8;
      --ink: #102522;
      --muted: #5c726e;
      --line: rgba(15, 118, 110, .16);
      --teal: #0f766e;
      --teal-dark: #0b4f4a;
      --amber: #b7791f;
      --red: #b42318;
      --card: rgba(255,255,255,.82);
      --shadow: 0 24px 80px rgba(4, 33, 29, .12);
      --radius: 28px;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background:
        radial-gradient(circle at 20% 0%, rgba(15,118,110,.16), transparent 32%),
        radial-gradient(circle at 90% 10%, rgba(183,121,31,.12), transparent 30%),
        linear-gradient(180deg, var(--bg2), var(--bg));
      color: var(--ink);
    }

    .shell {
      width: min(1180px, calc(100vw - 32px));
      margin: 0 auto;
      padding: 32px 0 48px;
    }

    header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 18px;
      margin-bottom: 28px;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      font-weight: 850;
      letter-spacing: -.02em;
    }

    .mark {
      width: 42px;
      height: 42px;
      display: grid;
      place-items: center;
      border-radius: 16px;
      background: var(--teal-dark);
      color: white;
      box-shadow: 0 14px 32px rgba(15,118,110,.24);
    }

    .pill {
      display: inline-flex;
      align-items: center;
      gap: 9px;
      padding: 10px 14px;
      border-radius: 999px;
      background: rgba(255,255,255,.7);
      border: 1px solid var(--line);
      color: var(--teal-dark);
      font-weight: 750;
      font-size: .9rem;
    }

    .dot {
      width: 9px;
      height: 9px;
      border-radius: 99px;
      background: var(--teal);
    }

    .hero {
      display: grid;
      grid-template-columns: 1fr;
      gap: 22px;
    }

    .card {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: clamp(22px, 4vw, 42px);
      backdrop-filter: blur(16px);
    }

    .eyebrow {
      color: var(--teal);
      text-transform: uppercase;
      letter-spacing: .09em;
      font-size: .78rem;
      font-weight: 850;
      margin-bottom: 14px;
    }

    h1 {
      margin: 0;
      font-size: clamp(2.3rem, 7vw, 5.7rem);
      line-height: .92;
      letter-spacing: -.07em;
      max-width: 900px;
    }

    .lead {
      margin: 22px 0 0;
      max-width: 760px;
      color: var(--muted);
      font-size: clamp(1.05rem, 2vw, 1.35rem);
      line-height: 1.5;
    }

    .composer {
      margin-top: 26px;
      display: grid;
      gap: 14px;
    }

    textarea {
      width: 100%;
      min-height: 190px;
      resize: vertical;
      border: 1px solid var(--line);
      border-radius: 24px;
      padding: 20px;
      font: inherit;
      font-size: 1.05rem;
      line-height: 1.5;
      color: var(--ink);
      background: rgba(255,255,255,.8);
      outline: none;
    }

    textarea:focus,
    [contenteditable="true"]:focus {
      border-color: rgba(15,118,110,.5);
      box-shadow: 0 0 0 4px rgba(15,118,110,.10);
    }

    .actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
    }

    button {
      border: 0;
      border-radius: 999px;
      padding: 12px 18px;
      cursor: pointer;
      font: inherit;
      font-weight: 800;
      transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    }

    button:hover { transform: translateY(-1px); }
    button:active { transform: translateY(0); }

    .primary {
      background: var(--teal-dark);
      color: white;
      box-shadow: 0 16px 36px rgba(15,118,110,.25);
    }

    .soft {
      background: rgba(15,118,110,.09);
      color: var(--teal-dark);
      border: 1px solid var(--line);
    }

    .danger {
      background: rgba(180,35,24,.08);
      color: var(--red);
      border: 1px solid rgba(180,35,24,.18);
    }

    .hint {
      color: var(--muted);
      font-size: .95rem;
    }

    .feedback {
      min-height: 24px;
      color: var(--amber);
      font-weight: 750;
    }

    .hidden { display: none !important; }

    .overlay {
      position: fixed;
      inset: 0;
      z-index: 30;
      display: grid;
      place-items: center;
      padding: 20px;
      background: rgba(3,18,24,.58);
      backdrop-filter: blur(10px);
    }

    .popup {
      width: min(540px, 100%);
      background: linear-gradient(180deg, #fbfffd, #edf7f4);
      border: 1px solid rgba(15,118,110,.2);
      border-radius: 30px;
      box-shadow: 0 30px 100px rgba(0,0,0,.25);
      padding: 28px;
    }

    .popup h2 {
      margin: 10px 0 10px;
      font-size: clamp(1.8rem, 4vw, 2.7rem);
      line-height: 1;
      letter-spacing: -.04em;
    }

    .chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 18px 0;
    }

    .chip {
      padding: 8px 11px;
      border-radius: 999px;
      background: rgba(15,118,110,.09);
      color: var(--teal-dark);
      border: 1px solid var(--line);
      font-weight: 760;
      font-size: .9rem;
    }

    .matrix-wrap {
      display: grid;
      gap: 16px;
    }

    .matrix-top {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 18px;
      flex-wrap: wrap;
    }

    .matrix-top h2 {
      margin: 0;
      font-size: clamp(1.9rem, 4vw, 3rem);
      letter-spacing: -.05em;
      line-height: 1;
    }

    .matrix-sub {
      margin-top: 10px;
      color: var(--muted);
      max-width: 760px;
      line-height: 1.45;
    }


    .matrix-anchor {
      margin-top: 16px;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 10px;
      max-width: 100%;
    }

    .matrix-anchor-item {
      border: 1px solid var(--line);
      border-radius: 18px;
      background: rgba(255,255,255,.72);
      padding: 12px 14px;
      min-height: 78px;
    }

    .matrix-anchor-item span {
      display: block;
      color: var(--teal);
      text-transform: uppercase;
      letter-spacing: .06em;
      font-size: .72rem;
      font-weight: 850;
      margin-bottom: 6px;
    }

    .matrix-anchor-item strong {
      display: block;
      color: var(--ink);
      font-size: .95rem;
      line-height: 1.35;
      font-weight: 780;
    }

    .table-scroll {
      overflow: auto;
      border-radius: 24px;
      border: 1px solid var(--line);
      background: white;
    }

    table {
      border-collapse: collapse;
      width: 100%;
      min-width: 920px;
    }

    th, td {
      border-bottom: 1px solid rgba(15,118,110,.12);
      border-right: 1px solid rgba(15,118,110,.10);
      padding: 14px;
      vertical-align: top;
      text-align: left;
    }

    th {
      background: #eef8f5;
      color: var(--teal-dark);
      font-size: .86rem;
      text-transform: uppercase;
      letter-spacing: .04em;
      min-width: 190px;
    }

    td {
      min-height: 64px;
      line-height: 1.45;
      color: #233b38;
    }

    th[contenteditable="true"],
    td[contenteditable="true"] {
      outline: none;
      cursor: text;
    }

    .row-actions,
    .col-actions {
      width: 76px;
      min-width: 76px;
      text-align: center;
    }

    .tiny {
      padding: 8px 10px;
      border-radius: 12px;
      font-size: .85rem;
    }

    .json-box {
      width: 100%;
      min-height: 160px;
      margin-top: 12px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: .88rem;
    }

    @media (max-width: 720px) {
      header { align-items: flex-start; flex-direction: column; }
      .card { padding: 22px; border-radius: 24px; }
      .actions button { width: 100%; }
    }
