:root{
  --bg:#0b1220;
  --card: rgba(255,255,255,.06);
  --card2: rgba(255,255,255,.09);
  --border: rgba(255,255,255,.12);
  --txt:#e7eefc;
  --muted:#a8b6d6;
  --blue:#3aa0ff;
  --green:#36d399;
  --amber:#fbbf24;
  --red:#fb7185;
  --shadow: 0 14px 50px rgba(0,0,0,.35);
  --shadow2: 0 10px 26px rgba(0,0,0,.26);
  --radius:18px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0; font-family:var(--sans); color:var(--txt);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(58,160,255,.25), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(54,211,153,.16), transparent 55%),
    linear-gradient(180deg, #070b14, var(--bg) 40%, #070b14);
  min-height:100vh;
  line-height:1.5;
}
a{color:var(--blue); text-decoration:none}
a:hover{text-decoration:underline}
.wrap{max-width:1100px; margin:0 auto; padding:24px}
.topbar{
  display:flex; gap:16px; align-items:center; justify-content:space-between;
  padding:16px 18px; border:1px solid var(--border); border-radius:var(--radius);
  background:linear-gradient(180deg, var(--card2), var(--card));
  box-shadow:var(--shadow);
  position:sticky; top:14px; backdrop-filter: blur(12px);
  z-index:10;
}
.brand{display:flex; align-items:center; gap:12px}
.logo{
  width:42px; height:42px; border-radius:14px;
  background:
    radial-gradient(circle at 30% 30%, rgba(58,160,255,.98), rgba(58,160,255,.12)),
    radial-gradient(circle at 75% 70%, rgba(54,211,153,.35), transparent 55%);
  border:1px solid rgba(58,160,255,.35);
  box-shadow: 0 12px 34px rgba(58,160,255,.14);
  display:grid; place-items:center;
  font-weight:800; letter-spacing:.2px;
  color:rgba(231,238,252,.95);
  text-shadow: 0 12px 24px rgba(0,0,0,.28);
}
.brand h1{font-size:16px; margin:0}
.brand p{margin:0; font-size:12px; color:var(--muted)}
.grid{display:grid; gap:16px}
.grid.two{grid-template-columns: 1.2fr .8fr}
@media (max-width: 900px){ .grid.two{grid-template-columns:1fr} .topbar{position:static}}
.card{
  border:1px solid var(--border); border-radius:var(--radius);
  background:linear-gradient(180deg, var(--card2), var(--card));
  box-shadow:var(--shadow2);
  padding:18px;
}
.card h2{margin:0 0 10px; font-size:18px}
.muted{color:var(--muted)}
.row{display:flex; gap:12px; flex-wrap:wrap}
.pill{
  display:inline-flex; gap:8px; align-items:center;
  padding:6px 10px; border-radius:999px;
  border:1px solid var(--border); background:rgba(255,255,255,.04);
  font-size:12px; color:var(--muted);
}
.btn{
  appearance:none; border:1px solid var(--border); cursor:pointer;
  background:linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
  color:var(--txt); padding:10px 12px; border-radius:12px;
  font-weight:600;
  display:inline-flex; gap:10px; align-items:center; justify-content:center;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{background:rgba(255,255,255,.09); transform: translateY(-1px)}
.btn:active{transform: translateY(0px)}
.btn:focus{outline: none}
.btn:focus-visible{box-shadow: 0 0 0 4px rgba(58,160,255,.18)}
.btn.primary{
  background:linear-gradient(180deg, rgba(58,160,255,.28), rgba(58,160,255,.12));
  border-color: rgba(58,160,255,.38);
}
.btn.danger{
  background:linear-gradient(180deg, rgba(251,113,133,.24), rgba(251,113,133,.10));
  border-color: rgba(251,113,133,.35);
}
.btn.small{padding:8px 10px; border-radius:10px; font-size:13px}
.btn:disabled{opacity:.5; cursor:not-allowed}
.input, select, textarea{
  width:100%; padding:10px 12px; border-radius:12px;
  border:1px solid var(--border);
  background:rgba(5,10,18,.65);
  color:var(--txt);
  outline:none;
}
textarea{min-height:140px; resize:vertical}
label{display:block; margin:10px 0 6px; color:var(--muted); font-size:13px}
.table{width:100%; border-collapse:separate; border-spacing:0 10px}
.table th{color:var(--muted); font-weight:600; font-size:12px; text-align:left; padding:0 10px}
.table td{
  padding:12px 10px; background:rgba(255,255,255,.05);
  border-top:1px solid var(--border); border-bottom:1px solid var(--border);
}
.table tr td:first-child{border-left:1px solid var(--border); border-radius:12px 0 0 12px}
.table tr td:last-child{border-right:1px solid var(--border); border-radius:0 12px 12px 0}
.status{font-family:var(--mono); font-size:12px}
.status.pending{color:var(--amber)}
.status.signed{color:var(--green)}
.status.void{color:var(--red)}
.sigbox{
  border:1px dashed rgba(255,255,255,.25);
  border-radius:14px;
  background:rgba(0,0,0,.25);
  width:100%;
  height:170px;
  overflow:hidden;
  position:relative;
}
canvas{width:100%; height:170px}
.footer{
  margin-top:18px; color:var(--muted); font-size:12px;
  text-align:center;
}

/* Print view */
@media print{
  body{background:#fff; color:#000}
  .topbar, .no-print{display:none !important}
  .card{box-shadow:none; border:1px solid #ddd; background:#fff}
  a{color:#000; text-decoration:none}
}
