:root{
  --purple:#7C3AED;
  --purple-dark:#6D28D9;
  --purple-soft:#F3F0FF;
  --ink:#1F1B2E;
  --muted:#8B8699;
  --line:#ECE9F5;
  --bg:#F7F6FB;
  --card:#FFFFFF;
  --red:#E11D48;
  --red-soft:#FFF1F3;
  --green:#059669;
  --green-soft:#ECFDF5;
  --amber:#B45309;
  --amber-soft:#FFFBEB;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;}
body{
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Helvetica Neue",Helvetica,"Segoe UI",Arial,sans-serif;
  background:var(--bg);color:var(--ink);line-height:1.5;
  min-height:100vh;min-height:100dvh;-webkit-font-smoothing:antialiased;
}
.wrap{max-width:560px;margin:0 auto;padding:20px 16px calc(28px + env(safe-area-inset-bottom));}
.brand{display:flex;align-items:center;gap:9px;margin:4px 2px 18px;}
.brand .dot{
  width:30px;height:30px;border-radius:9px;
  background:linear-gradient(135deg,var(--purple),#A855F7);
  display:flex;align-items:center;justify-content:center;
  color:#fff;font-weight:800;font-size:15px;
  box-shadow:0 4px 12px rgba(124,58,237,.32);
}
.brand b{font-size:15px;font-weight:700;letter-spacing:.2px;}
.brand span{font-size:12px;color:var(--muted);display:block;font-weight:500;}
.brand .right{margin-left:auto;font-size:13px;color:var(--purple);font-weight:600;cursor:pointer;}

.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:18px 16px;margin-bottom:14px;}
.card h2{font-size:16px;margin:0 0 12px;}
.card .sub{font-size:12.5px;color:var(--muted);margin:-8px 0 14px;}

.lbl{font-size:12px;color:var(--muted);font-weight:600;margin:12px 4px 6px;display:block;}
input[type=text],input[type=email],input[type=password],input[type=tel],textarea{
  width:100%;border:1px solid var(--line);border-radius:12px;background:#FCFBFE;
  font-family:inherit;font-size:16px;color:var(--ink);padding:12px;outline:0;
}
input:focus,textarea:focus{border-color:var(--purple);}
textarea{resize:vertical;line-height:1.6;}

.btn{
  display:block;width:100%;border:0;border-radius:14px;padding:14px;
  font-size:15px;font-weight:700;font-family:inherit;cursor:pointer;
  background:linear-gradient(135deg,var(--purple),#9333EA);color:#fff;
  box-shadow:0 8px 18px rgba(124,58,237,.28);margin-top:16px;
}
.btn:disabled{opacity:.45;cursor:not-allowed;box-shadow:none;}
.btn.ghost{background:var(--purple-soft);color:var(--purple-dark);box-shadow:none;}
.btn.small{width:auto;display:inline-block;padding:9px 16px;font-size:13px;margin-top:0;border-radius:11px;}

.seg{display:flex;background:var(--purple-soft);border-radius:14px;padding:4px;gap:4px;}
.seg button{
  flex:1;border:0;background:transparent;border-radius:11px;padding:10px 4px;
  font-size:14px;font-weight:600;color:var(--purple-dark);cursor:pointer;font-family:inherit;
}
.seg button.active{background:#fff;color:var(--purple);box-shadow:0 2px 8px rgba(124,58,237,.18);}

.status{
  display:flex;align-items:center;gap:6px;border-radius:12px;padding:10px 13px;
  font-size:13px;font-weight:600;background:var(--green-soft);color:var(--green);margin-top:10px;
}
.status.over{background:var(--red-soft);color:var(--red);}
.status.warn{background:var(--amber-soft);color:var(--amber);}

.msg{font-size:13px;font-weight:600;margin-top:10px;display:none;}
.msg.err{color:var(--red);display:block;}
.msg.ok{color:var(--green);display:block;}

.pill{
  display:inline-block;font-size:11.5px;font-weight:700;border-radius:999px;padding:3px 10px;
}
.pill.draft{background:var(--purple-soft);color:var(--purple-dark);}
.pill.submitted{background:var(--green-soft);color:var(--green);}

.script-item{border:1px solid var(--line);border-radius:14px;padding:14px;margin-top:12px;}
.script-item .head{display:flex;align-items:center;gap:8px;margin-bottom:8px;}
.script-item .head b{font-size:14px;}
.script-item .preview{font-size:13.5px;color:var(--muted);white-space:pre-wrap;line-height:1.6;}

.foot{text-align:center;color:var(--muted);font-size:12px;margin-top:18px;line-height:1.7;}
.hidden{display:none !important;}
.spin{
  display:inline-block;width:14px;height:14px;border:2px solid rgba(255,255,255,.4);
  border-top-color:#fff;border-radius:50%;animation:sp .7s linear infinite;vertical-align:-2px;margin-right:6px;
}
@keyframes sp{to{transform:rotate(360deg)}}

table{width:100%;border-collapse:collapse;font-size:13px;}
th,td{text-align:left;padding:9px 8px;border-bottom:1px solid var(--line);vertical-align:top;}
th{color:var(--muted);font-size:11.5px;font-weight:600;}
a.wa{color:var(--green);font-weight:700;text-decoration:none;}
