:root{
      --bg:#f6f7fb;
      --panel:#ffffff;
      --border:#cfd5df;
      --text:#1f2937;
      --muted:#6b7280;
      --btnText:#fff;
      --shadow:0 10px 26px rgba(0,0,0,.08);
      --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    }


    *{box-sizing:border-box}
    html,body{height:100%}
    

    body{
      margin:0;
      font-family:var(--sans);
      color:var(--text);
      background:linear-gradient(#fbfcff, var(--bg));
    }

    .topbar{
      height:56px;
      background:#fff;
      border-bottom:1px solid #e5e7eb;
      display:flex;
      align-items:center;
      justify-content:space-between;
      padding:0 16px;
      gap:12px;
    }
    .brand{display:flex;align-items:center;gap:10px;min-width:0;}
    .brand-badge{
      width:28px;height:28px;border-radius:7px;
      background:linear-gradient(134deg,#2b6cb0,#6ea8ff);
      box-shadow:0 8px 18px rgba(43,108,176,.25);
    }
    .brand-text{display:flex;flex-direction:column;line-height:1.05;min-width:0;}
    .brand-text .org{font-size:13px;font-weight:700;color:#374151;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
    .brand-text .app{font-size:16px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
    .top-actions{display:flex;align-items:center;gap:10px;}
    .pill-btn{
      border:1px solid #cfd5df;background:#f8fafc;color:#374151;
      border-radius:999px;padding:8px 12px;font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap;
    }
    .avatar{
      width:28px;height:28px;border-radius:999px;border:1px solid #d1d5db;
      background:linear-gradient(134deg,#f3f4f6,#e5e7eb);
      display:grid;place-items:center;font-size:12px;color:#6b7280;
    }

    .wrap{  padding:80px 18px 40px;display:flex;justify-content:center;}
    .window{
      width:min(1000px, 100%);
      background:var(--panel);
      border:1px solid var(--border);
      border-radius:8px;
      box-shadow:var(--shadow);
      padding:18px 18px 14px;
    }
    .title{
      text-align:center;
      font-family:var(--mono);
      letter-spacing:.08em;
      font-size:18px;
      margin:6px 0 18px;
      color:#111827;
    }

    .controls{display:grid;grid-template-columns: 1fr 340px;gap:14px;align-items:start;margin-bottom:10px;}
    .control-box{border:1px solid var(--border);border-radius:4px;padding:10px;background:#fbfcff;}
    .control-row{display:grid;grid-template-columns: 120px 1fr;gap:10px;align-items:center;margin-bottom:8px;font-size:12px;color:#374151;}
    .control-row:last-child{margin-bottom:0}
    .input{
      height:24px;border:1px solid var(--border);border-radius:3px;padding:0 8px;background:#fff;
      font-family:var(--mono);font-size:12px;outline:none;
    }
    .input:focus{border-color:#7aa7ff; box-shadow:0 0 0 3px rgba(122,167,255,.18)}

    .grid-wrap{border:1px solid var(--border);border-radius:4px;overflow:hidden;}
    table{width:100%;border-collapse:collapse;font-size:14px;font-family:var(--mono);}
    thead th{
      background:#2f343f;color:#fff;text-align:left;padding:6px 8px;font-weight:700;
      border-right:1px solid rgba(255,255,255,.12);white-space:nowrap;
    }
    thead th:last-child{border-right:none}
    tbody td{padding:5px 8px;border-top:1px solid #e5e7eb;color:#111827;white-space:nowrap;}
    tbody tr:nth-child(even) td{background:#f6f7fb;}
    tbody td.center{text-align:center}
    tbody td.right{text-align:right}

    .pay-btn{
      height:20px;border-radius:3px;border:1px solid #64748b;
      background:linear-gradient(#8aa0c4, #6f86ab);
      color:#fff;font-size:11px;font-weight:800;cursor:pointer;padding:0 10px;line-height:18px;
    }
    .pay-btn:active{transform:translateY(1px)}
    .pay-btn[disabled]{opacity:.45;cursor:not-allowed;transform:none;}

    .pager{
      display:flex;justify-content:center;gap:24px;padding:8px 10px;background:#eef2ff;
      border-top:1px solid var(--border);font-size:12px;color:#4b5563;font-family:var(--mono);
    }
    .pager a{color:#4f46e5;text-decoration:none;}

    .actions{margin-top:18px;display:flex;justify-content:center;gap:14px;flex-wrap:wrap;}
    .btn{
      min-width:98px;height:26px;border-radius:4px;border:1px solid #64748b;
      background:linear-gradient(#8aa0c4, #6f86ab);
      color:var(--btnText);font-size:12px;font-weight:700;cursor:pointer;padding:0 14px;
    }
    .btn.secondary{background:linear-gradient(#93a6c6, #7d93b8);}
    .btn:active{transform:translateY(1px)}
    .subaction{margin-top:8px;display:flex;justify-content:flex-start;padding-left:6px;}
    .subaction .btn{min-width:180px;height:24px;font-weight:700;font-size:11px;}

    @media (max-width: 820px){
      .controls{grid-template-columns:1fr}
      .control-box{max-width:520px;margin:0 auto}
    }

    /* Modal */
    .modal-backdrop{
      position:fixed;inset:0;background:rgba(15, 23, 42, .45);
      display:none;align-items:center;justify-content:center;padding:18px;z-index:9999;
    }
    .modal-backdrop.open{display:flex;}

    .modal{
      width:min(860px, 100%);
      background:#f2f3f6;
      border:1px solid #b9c2cf;
      border-radius:3px;
      box-shadow:0 18px 50px rgba(0,0,0,.22);
      overflow:hidden;
      font-family:var(--mono);
      color:#111827;
    }
    .modal-titlebar{background:#e9edf5;border-bottom:1px solid #c8d0dd;padding:8px 10px;font-weight:700;font-size:13px;}
    .modal-body{padding:12px 12px 10px;}
    .modal-topgrid{
      display:grid;
      grid-template-columns: 120px 1fr 140px;
      gap:6px 10px;
      align-items:center;
      font-size:15px;
    }
    .modal-topgrid .label{color:#374151}
    .modal-topgrid .value{font-weight:700}
    .modal-topgrid .value.right{text-align:right; width:100%}
    .modal-divider{margin:10px 0;height:1px;background:#c8d0dd;}

    .modal-subtable{margin-bottom:12px;}
    .modal-subtable .head{
      background:#2f343f;color:#fff;font-weight:700;font-size:12px;padding:6px 8px;
      display:grid;grid-template-columns: 54px 1fr 120px;gap:10px;
    }
    .modal-subtable .rows{min-height:110px;padding:10px;color:#6b7280;font-size:12px;}

    .pay-entry-grid{
      display:grid;
      grid-template-columns: 150px 220px 140px 120px;
      gap:10px;
      align-items:end;
      padding:6px 2px 2px;
      font-size:12px;
    }
    .pay-entry-grid .lbl{
      font-family:var(--sans);
      font-weight:700;
      color:#374151;
      margin-bottom:4px;
    }
    .field{
      height:22px;border:1px solid #c8d0dd;border-radius:2px;background:#fff;
      padding:0 8px;display:flex;align-items:center;font-weight:700;
    }
    .field.amount{justify-content:flex-end;font-variant-numeric:tabular-nums;}
    .field.inputlike{padding:0;overflow:hidden;}
    .field input{
      width:100%;height:100%;border:0;outline:none;padding:0 8px;
      font-family:var(--mono);font-size:12px;font-weight:700;background:transparent;
    }

    .pj-label{
      height:22px;display:flex;align-items:center;
      font-family:var(--sans);font-weight:800;color:#111827;
      padding-left:2px;white-space:nowrap;
    }
    .pj-label.hidden{display:none;}
    .approval-wrap.hidden{display:none;}

    .modal-actions{
      display:flex;justify-content:center;gap:12px;padding:10px 12px 12px;background:#f2f3f6;
    }
    .modal-actions .btn{min-width:110px;height:26px;font-family:var(--sans);}
    .modal-actions .btn.secondary{min-width:120px;}