:root{
      /* Paleta baseada no logo (dominante #286EB4) */
      --fm-blue: #286EB4;
      --fm-blue-2: #3175B5;
      --fm-blue-3: #6E9CC6;
      --fm-ice: #F9FBFC;

      --bg: #F6FAFF;
      --card: #FFFFFF;
      --text: #0F172A;
      --muted: #475569;
      --line: rgba(15, 23, 42, .10);

      --radius: 16px;
      --shadow: 0 10px 30px rgba(2, 6, 23, .08);
      --shadow-sm: 0 6px 18px rgba(2, 6, 23, .08);
      --ring: 0 0 0 4px rgba(40,110,180,.18);
    }

    *{box-sizing:border-box}
    body{
      margin:0;
      font-family:Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
      color:var(--text);
      background:
        radial-gradient(1100px 500px at 10% -10%, rgba(40,110,180,.16), transparent 60%),
        radial-gradient(900px 420px at 90% 10%, rgba(110,156,198,.18), transparent 60%),
        linear-gradient(180deg, var(--bg), #EEF5FF);
      min-height:100vh;
    }

    /* Topbar */
    .topbar{
      background: linear-gradient(90deg, var(--fm-blue), var(--fm-blue-2));
      color:white;
      padding:18px 16px;
      position:sticky;
      top:0;
      z-index:10;
      box-shadow: 0 8px 24px rgba(2,6,23,.12);
    }
    .topbar-inner{
      max-width:1100px;
      margin:0 auto;
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:16px;
    }
    .brand{
      display:flex;
      align-items:center;
      gap:12px;
      min-width:0;
    }
    .brand img{
      width:44px;height:44px;
      border-radius:12px;
      background:rgba(255,255,255,.12);
      padding:6px;
      object-fit:contain;
    }
    .brand-title{
      display:flex;
      flex-direction:column;
      line-height:1.1;
      min-width:0;
    }
    .brand-title strong{
      font-weight:700;
      letter-spacing:.2px;
      font-size:16px;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }
    .brand-title span{
      font-size:12px;
      opacity:.9;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }

    /* Layout */
    .wrap{
      max-width:1100px;
      margin:22px auto 60px;
      padding:0 14px;
    }

    .card{
      background:var(--card);
      border:1px solid var(--line);
      border-radius:var(--radius);
      box-shadow:var(--shadow);
      padding:18px;
    }

    .grid{
      display:grid;
      grid-template-columns: 1.15fr .85fr;
      gap:14px;
    }
    @media (max-width: 920px){
      .grid{grid-template-columns:1fr}
    }

    .h{
      display:flex;
      align-items:flex-end;
      justify-content:space-between;
      gap:12px;
      margin-bottom:12px;
    }
    .h h1{
      margin:0;
      font-size:18px;
      font-weight:700;
      letter-spacing:.2px;
    }
    .h p{
      margin:0;
      color:var(--muted);
      font-size:12px;
    }

    /* Inputs / Buttons */
    label{
      display:block;
      font-size:12px;
      color:var(--muted);
      margin-bottom:6px;
    }
    .row{
      display:flex;
      gap:10px;
      align-items:flex-end;
      flex-wrap:wrap;
    }
    .field{
      flex:1;
      min-width:200px;
    }
    input{
      width:100%;
      border:1px solid var(--line);
      border-radius:12px;
      padding:10px 12px;
      outline:none;
      font:inherit;
      font-size:13px;
      background: #fff;
      transition: box-shadow .15s ease, border-color .15s ease, transform .06s ease;
    }
    input:focus{
      border-color: rgba(40,110,180,.6);
      box-shadow: var(--ring);
    }

    .btns{display:flex; gap:10px; flex-wrap:wrap}
    button{
      font:inherit;
      border-radius:12px;
      padding:10px 14px;
      border:1px solid transparent;
      cursor:pointer;
      transition: transform .06s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
      user-select:none;
    }
    button:active{transform: translateY(1px)}
    .btn-primary{
      background: linear-gradient(180deg, #2E77BE, var(--fm-blue));
      color:white;
      box-shadow: var(--shadow-sm);
    }
    .btn-primary:hover{opacity:.95}
    .btn-ghost{
      background: #fff;
      border-color: rgba(40,110,180,.25);
      color: var(--fm-blue);
    }
    .btn-ghost:hover{
      background: rgba(40,110,180,.06);
      border-color: rgba(40,110,180,.35);
    }
    .btn-danger{
      background:#fff;
      border-color: rgba(239,68,68,.35);
      color:#EF4444;
    }
    .btn-danger:hover{background: rgba(239,68,68,.06)}

    /* Table */
    .table-wrap{
      margin-top:14px;
      border:1px solid var(--line);
      border-radius:var(--radius);
      overflow:hidden;
    }
    table{
      width:100%;
      border-collapse:separate;
      border-spacing:0;
      background:#fff;
    }
    thead th{
      position:sticky;
      top:0;
      z-index:2;
      background: linear-gradient(180deg, rgba(40,110,180,.10), rgba(40,110,180,.06));
      color:#0B2545;
      font-size:12px;
      font-weight:600;
      text-align:left;
      padding:10px 10px;
      border-bottom:1px solid var(--line);
    }
    tbody td{
      padding:8px 10px;
      border-bottom:1px solid rgba(15,23,42,.06);
      vertical-align:middle;
    }
    tbody tr:nth-child(even){background: rgba(2,6,23,.015)}
    .col-idx{width:46px; color:rgba(15,23,42,.7); font-weight:600}
    .col-x{width:56px; text-align:right}

    .x{
      width:38px;
      height:36px;
      padding:0;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      border-radius:12px;
    }

    /* Preview / Output */
    .aside{
      display:flex;
      flex-direction:column;
      gap:14px;
    }
    .mini{
      background: linear-gradient(180deg, rgba(40,110,180,.10), rgba(40,110,180,.04));
      border:1px solid rgba(40,110,180,.18);
      border-radius:var(--radius);
      padding:14px;
    }
    .mini h3{
      margin:0 0 8px 0;
      font-size:13px;
      font-weight:700;
      color:#0B2545;
    }
    .kvs{
      display:grid;
      grid-template-columns: 1fr;
      gap:6px;
      font-size:12px;
      color: var(--muted);
    }
    .kv{
      display:flex;
      justify-content:space-between;
      gap:10px;
    }
    .kv strong{color:var(--text); font-weight:700}

    .out{
      background: #0B1220;
      color: #E5E7EB;
      border-radius:var(--radius);
      padding:14px;
      border:1px solid rgba(255,255,255,.08);
      font-size:12px;
      white-space:pre-wrap;
      overflow:auto;
    }
    .out a{color:#93C5FD}
    .hint{
      margin-top:10px;
      font-size:12px;
      color: var(--muted);
    }