/* Shared styles */
:root{
  --bg:#0b1020;
  --bg2:#0f172a;

  --cardA: rgba(255,255,255,.045);
  --cardB: rgba(255,255,255,.02);

  --muted:#94a3b8;
  --text:#e2e8f0;

  --primary:#60a5fa;
  --primary2:#93c5fd;

  --ring:rgba(96,165,250,.35);
  --danger:#f87171;
  --success:#34d399;

  --radius:18px;
  --shadow: 0 18px 50px rgba(0,0,0,.45);

  --border: rgba(148,163,184,.14);
  --border2: rgba(148,163,184,.20);
}

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

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Helvetica,Arial;
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 15% 0%, rgba(96,165,250,.22), transparent 60%),
    radial-gradient(900px 500px at 85% 10%, rgba(52,211,153,.16), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

/* Header */
.pc-header{
  max-width:1100px;
  margin:42px auto 18px;
  padding:0 16px;
}

.brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.brand-left{
  display:flex;
  gap:14px;
  align-items:center;
  width:100%;
}

.logo-wrap{
  width:64px;
  height:64px;
  border-radius:18px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border:1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  flex: 0 0 auto;
}

.logo{
  width:100%;
  height:100%;
  object-fit:cover;
  transform: scale(1.06);
}

.brand-text{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.badge{
  display:inline-flex;
  width:fit-content;
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  color:#0b1020;
  background:linear-gradient(90deg,#34d399,#60a5fa);
  padding:7px 12px;
  border-radius:999px;
  box-shadow: 0 10px 20px rgba(0,0,0,.18);
}

h1{
  margin:0;
  font-size:28px;
  line-height:1.15;
  letter-spacing:-.02em;
}

.lead{
  margin:0;
  color:var(--muted);
  font-size:14px;
}

/* Layout */
.container{
  max-width:1100px;
  margin:0 auto 70px;
  padding:0 16px;
}

.card{
  background: linear-gradient(180deg, var(--cardA), var(--cardB));
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
  backdrop-filter: blur(10px);
}

.card-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:16px 18px;
  border-bottom:1px solid rgba(148,163,184,.10);
}

.card-header h2{
  margin:0;
  font-size:16px;
  letter-spacing:-.01em;
}

.card-body{
  padding:20px;
}

/* Form grid */
.grid{display:grid;gap:16px}
.cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}

@media (max-width:900px){
  .cols-2,.cols-3{grid-template-columns:1fr}
  .pc-header{margin-top:28px}
  h1{font-size:22px}
  .logo-wrap{width:56px;height:56px;border-radius:16px}
}

/* Fields */
.field label{
  display:block;
  font-weight:650;
  font-size:13px;
  color:var(--primary2);
  margin:0 0 7px 2px;
}

input,select,textarea{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  background: rgba(15,23,42,.55);
  color:var(--text);
  border:1px solid rgba(148,163,184,.20);
  outline:none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}

input::placeholder, textarea::placeholder{
  color: rgba(148,163,184,.65);
}

input:focus,select:focus,textarea:focus{
  border-color: rgba(96,165,250,.75);
  box-shadow: 0 0 0 6px var(--ring);
}

input:active,select:active,textarea:active{
  transform: translateY(0.5px);
}

.section-title{
  display:flex;
  gap:10px;
  align-items:center;
  margin:22px 0 12px;
}

.section-title .dot{
  width:9px;height:9px;
  border-radius:50%;
  background: linear-gradient(180deg, #60a5fa, #34d399);
  box-shadow: 0 0 0 6px rgba(96,165,250,.10);
}

.section-title h3{
  margin:0;
  font-size:14px;
  color:#c7d2fe;
  letter-spacing:.02em;
}

/* Buttons */
.actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  padding:16px 18px;
  border-top:1px solid rgba(148,163,184,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}

.btn{
  appearance:none;
  border:0;
  padding:12px 16px;
  border-radius:14px;
  font-weight:800;
  cursor:pointer;
  transition: transform .1s ease, box-shadow .2s ease, opacity .2s ease;
}

.btn.primary{
  background: linear-gradient(90deg,#2563eb,#60a5fa);
  color:white;
  box-shadow: 0 12px 28px rgba(37,99,235,.25);
}

.btn.primary:hover{ transform: translateY(-1px); }
.btn.primary:active{ transform: translateY(0px); }

.btn.ghost{
  background:transparent;
  border:1px solid rgba(148,163,184,.25);
  color:var(--text);
}

.pill{
  display:inline-flex;
  gap:8px;
  align-items:center;
  background:rgba(148,163,184,.12);
  border:1px solid rgba(148,163,184,.22);
  padding:8px 10px;
  border-radius:999px;
  color: rgba(226,232,240,.9);
}

/* Uploader */
.uploader{
  border:1px dashed rgba(148,163,184,.40);
  border-radius:14px;
  padding:16px;
  text-align:center;
  background: rgba(15,23,42,.35);
}

.uploader p{
  margin:0 0 10px;
  color: var(--muted);
  font-size:13px;
}

/* Signature / tables / modal (kept, slightly refined) */
canvas#signature{
  width:100%;
  height:160px;
  border-radius:14px;
  background:rgba(15,23,42,.75);
  border:1px solid rgba(148,163,184,.22);
}

.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse}
th,td{border-bottom:1px solid rgba(148,163,184,.18);padding:10px;text-align:left}
th{color:#cbd5e1}
tr:hover{background:rgba(255,255,255,.03)}

.chip{
  display:inline-flex;
  gap:6px;
  align-items:center;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.25);
  background:rgba(148,163,184,.10);
  font-size:12px;
}

.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.62);
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.modal.open{display:flex}

.modal-card{
  width:min(1100px,95vw);
  max-height:90vh;
  overflow:auto;
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  border:1px solid rgba(148,163,184,.18);
  border-radius:18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}

.modal-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 16px;
  border-bottom:1px solid rgba(148,163,184,.16);
}

.modal-body{padding:16px}

.kv{
  display:grid;
  grid-template-columns:220px 1fr;
  gap:8px 14px;
}

.pdf-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:12px;
  margin-top:12px;
}

.pdf-box{
  background:rgba(15,23,42,.65);
  border:1px solid rgba(148,163,184,.18);
  border-radius:14px;
  padding:8px;
}

.pdf-box embed{
  width:100%;
  height:320px;
  border-radius:10px;
}

/* Progress Steps */
.progress-steps{
  display:flex;
  justify-content:center;
  gap:8px;
  margin-bottom:24px;
  flex-wrap:wrap;
}

.step{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 16px;
  background:rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius:12px;
  font-size:13px;
  font-weight:500;
  color:var(--muted);
  transition:all .2s ease;
}

.step .step-num{
  width:24px;
  height:24px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  background:rgba(148,163,184,.15);
  font-size:11px;
  font-weight:700;
}

.step.active{
  background:rgba(96,165,250,.12);
  border-color:rgba(96,165,250,.35);
  color:var(--primary2);
}

.step.active .step-num{
  background:linear-gradient(135deg,#2563eb,#60a5fa);
  color:white;
}

.step.completed{
  background:rgba(52,211,153,.08);
  border-color:rgba(52,211,153,.25);
  color:var(--success);
}

.step.completed .step-num{
  background:linear-gradient(135deg,#059669,#34d399);
  color:white;
}

.step-connector{
  width:24px;
  height:2px;
  background:var(--border2);
  border-radius:2px;
}

@media(max-width:900px){
  .progress-steps{gap:6px}
  .step{padding:8px 12px;font-size:12px}
  .step-connector{width:12px}
}

/* Loading Button State */
.btn.loading{
  position:relative;
  pointer-events:none;
  opacity:.75;
}

.btn.loading::after{
  content:"";
  position:absolute;
  width:18px;
  height:18px;
  top:50%;
  left:50%;
  margin:-9px 0 0 -9px;
  border:2px solid transparent;
  border-top-color:white;
  border-radius:50%;
  animation:spin .6s linear infinite;
}

.btn.loading span{
  visibility:hidden;
}

@keyframes spin{
  to{transform:rotate(360deg)}
}

/* Enhanced Field Styling */
.field{
  position:relative;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea{
  border-color:var(--danger);
  background:rgba(248,113,113,.06);
}

.field.has-error label{
  color:var(--danger);
}

.field .error-msg{
  display:none;
  font-size:11px;
  color:var(--danger);
  margin-top:4px;
  padding-left:2px;
}

.field.has-error .error-msg{
  display:block;
}

/* Required Field Indicator */
.field label .required{
  color:var(--danger);
  margin-left:2px;
}

/* Input Icons */
input[type="date"],
input[type="number"]{
  padding-right:14px;
}

/* Better Focus States */
input:focus,select:focus,textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 4px var(--ring);
  background:rgba(15,23,42,.7);
}

/* Valid Input Styling */
input:valid:not(:placeholder-shown):not(:focus),
select:valid:not(:focus){
  border-color:rgba(52,211,153,.35);
}

/* Checkbox and Radio Styling */
input[type="checkbox"],
input[type="radio"]{
  width:18px;
  height:18px;
  accent-color:var(--primary);
  cursor:pointer;
}

/* Inline Labels */
.inline{
  display:flex;
  align-items:center;
  gap:8px;
}

label.inline{
  font-weight:400;
  font-size:14px;
  cursor:pointer;
}

/* Error Summary Box */
.error-summary{
  background:rgba(248,113,113,.08);
  border:1px solid rgba(248,113,113,.35);
  border-radius:var(--radius);
  padding:16px 20px;
  margin-bottom:20px;
}

.error-summary h3{
  margin:0 0 8px;
  font-size:15px;
  color:var(--danger);
  display:flex;
  align-items:center;
  gap:8px;
}

.error-summary ul{
  margin:0;
  padding-left:20px;
  color:rgba(248,113,113,.9);
  font-size:13px;
}

.error-summary li{
  margin:4px 0;
}

/* Success Animation */
@keyframes successPulse{
  0%{transform:scale(1)}
  50%{transform:scale(1.02)}
  100%{transform:scale(1)}
}

.success-card{
  animation:successPulse .3s ease;
}

/* Improved Section Titles */
.section-title{
  display:flex;
  gap:12px;
  align-items:center;
  margin:28px 0 16px;
  padding-bottom:10px;
  border-bottom:1px solid rgba(148,163,184,.08);
}

.section-title .dot{
  width:10px;height:10px;
  border-radius:50%;
  background:linear-gradient(135deg,#60a5fa,#34d399);
  box-shadow:0 0 12px rgba(96,165,250,.4);
}

.section-title h3{
  margin:0;
  font-size:15px;
  color:#c7d2fe;
  letter-spacing:.01em;
  font-weight:600;
}

/* Tooltip */
.tooltip{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:16px;
  height:16px;
  background:rgba(148,163,184,.2);
  border-radius:50%;
  font-size:10px;
  color:var(--muted);
  cursor:help;
  margin-left:6px;
}

.tooltip::after{
  content:attr(data-tip);
  position:absolute;
  bottom:calc(100% + 8px);
  left:50%;
  transform:translateX(-50%);
  background:#1e293b;
  color:var(--text);
  padding:8px 12px;
  border-radius:8px;
  font-size:12px;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition:opacity .2s;
  box-shadow:0 4px 12px rgba(0,0,0,.3);
  z-index:10;
}

.tooltip:hover::after{
  opacity:1;
}

/* File Upload Enhancement */
.uploader{
  border:2px dashed rgba(148,163,184,.30);
  border-radius:16px;
  padding:24px;
  text-align:center;
  background:rgba(15,23,42,.25);
  transition:all .2s ease;
}

.uploader:hover{
  border-color:rgba(96,165,250,.5);
  background:rgba(96,165,250,.05);
}

.uploader.drag-over{
  border-color:var(--primary);
  background:rgba(96,165,250,.1);
}

.uploader p{
  margin:0 0 12px;
  color:var(--muted);
  font-size:14px;
}

.uploader input[type="file"]{
  width:auto;
  padding:10px;
  background:rgba(96,165,250,.1);
  border:1px solid rgba(96,165,250,.3);
  border-radius:10px;
  cursor:pointer;
}

.uploader input[type="file"]:hover{
  background:rgba(96,165,250,.15);
}

/* Card Enhancements */
.card{
  background:linear-gradient(180deg,var(--cardA),var(--cardB));
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow),0 0 0 1px rgba(255,255,255,.02) inset;
  overflow:hidden;
  backdrop-filter:blur(12px);
}

.card-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:18px 22px;
  border-bottom:1px solid rgba(148,163,184,.10);
  background:rgba(255,255,255,.015);
}

.card-body{
  padding:24px;
}

/* Better Actions Footer */
.actions{
  display:flex;
  gap:12px;
  justify-content:flex-end;
  padding:18px 22px;
  border-top:1px solid rgba(148,163,184,.10);
  background:linear-gradient(180deg,rgba(255,255,255,.02),transparent);
}

/* Primary Button Enhancement */
.btn.primary{
  background:linear-gradient(135deg,#2563eb,#3b82f6);
  color:white;
  box-shadow:0 8px 24px rgba(37,99,235,.3),0 0 0 1px rgba(255,255,255,.1) inset;
  padding:14px 28px;
  font-size:15px;
  letter-spacing:.01em;
}

.btn.primary:hover{
  transform:translateY(-2px);
  box-shadow:0 12px 32px rgba(37,99,235,.4),0 0 0 1px rgba(255,255,255,.15) inset;
}

.btn.primary:active{
  transform:translateY(0);
}

/* ── Signature Pad ── */
.signature-section{
  margin-top:16px;
}

.sig-pad-wrap{
  position:relative;
  border:2px solid rgba(148,163,184,.25);
  border-radius:14px;
  overflow:hidden;
  background:rgba(15,23,42,.75);
  touch-action:none;
}

.sig-pad-wrap canvas{
  display:block;
  width:100%;
  height:180px;
  cursor:crosshair;
}

.sig-pad-wrap.has-sig{
  border-color:rgba(52,211,153,.4);
}

.sig-pad-wrap.signing{
  border-color:rgba(96,165,250,.6);
  box-shadow:0 0 0 4px var(--ring);
}

.btn-clear-sig{
  position:absolute;
  top:8px;
  right:8px;
  background:rgba(248,113,113,.15);
  color:var(--danger);
  border:1px solid rgba(248,113,113,.3);
  padding:5px 12px;
  border-radius:8px;
  font-size:12px;
  font-weight:600;
  cursor:pointer;
  transition:background .15s;
  z-index:2;
}

.btn-clear-sig:hover{
  background:rgba(248,113,113,.25);
}

.sig-hint{
  margin:6px 0 0 2px;
  font-size:12px;
  color:var(--muted);
  opacity:.7;
}

@media(max-width:900px){
  .sig-pad-wrap canvas{
    height:150px;
  }
}
