:root{
  --primary:#00129A;
  --accent:#83131C;
  --bg:#F6F8FC;
  --card:#FFFFFF;
  --line:#E4E7EC;
  --text:#0F1728;
  --muted:#667085;
  --shadow:0 10px 20px rgba(16,24,40,0.08);
  --header-h:64px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:'Kanit',system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,'Helvetica Neue',Arial}
a{color:inherit;text-decoration:none}

.app{display:block;min-height:100vh}

/* Top Header (new) */
.headerbar{
  position:sticky; top:0; z-index:60;
  height:var(--header-h);
  background:linear-gradient(180deg,var(--primary),#000A6C);
  color:#fff; box-shadow:var(--shadow);
  display:flex; align-items:center; gap:14px;
  padding:0 18px;
}
.headerbar .brand{display:flex;align-items:center;gap:10px;min-width:160px}
.headerbar .logo{font-weight:800;font-size:22px;letter-spacing:.4px}
.headerbar .logo span{color:var(--accent)}
.headerbar .nav{display:flex;align-items:center;gap:8px; overflow:auto}
.headerbar .link{padding:8px 10px;border-radius:10px;color:#E8ECFF;white-space:nowrap}
.headerbar .link:hover,.headerbar .link.active{background:rgba(255,255,255,.14)}
.headerbar .spacer{flex:1}
.headerbar .hamb{display:none}

/* Main */
.main{flex:1;padding:28px;width:100%;max-width:none}

/* UI */
.page-title{font-size:26px;font-weight:800;margin:12px 0 10px}
.page-sub{color:var(--muted);margin:0 0 18px}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:20px;box-shadow:var(--shadow)}
.kpis{display:grid;grid-template-columns:repeat(3,minmax(180px,1fr));gap:16px}
.kpi{display:flex;align-items:center;justify-content:space-between}
.k{font-size:13px;color:var(--muted)} .v{font-size:24px;font-weight:800}
.actions{display:flex;gap:10px;flex-wrap:wrap}
.btn{height:44px;padding:0 16px;border-radius:12px;border:1px solid transparent;font-weight:700;cursor:pointer}
.btn.primary{background:var(--primary);color:#fff}
.btn.accent{background:var(--accent);color:#fff}
.btn.ghost{background:#fff;border-color:var(--line)}
.btn.block{width:100%}

/* FORMS */
.form{display:flex;flex-direction:column;gap:10px}
.field{display:flex;flex-direction:column;margin-bottom:10px}
.label{font-weight:700;font-size:14px;margin-bottom:10px}
.input,select,textarea{width:100%;height:44px;padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:#fff;outline:none;font-family:inherit}
textarea{height:120px;resize:vertical}
.input:focus,select:focus,textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(0,18,154,.14)}
.help{font-size:12px;color:var(--muted)}

/* Tables */
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:10px 12px;border-bottom:1px solid var(--line);text-align:left;white-space:nowrap}
.table th{font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}

/* Stepper */
.stepper{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-bottom:14px}
.step{background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 12px;text-align:center;font-weight:700}
.step.active{border-color:var(--primary);box-shadow:0 0 0 3px rgba(0,18,154,.12)}
.step.done{border-color:#17B26A}

/* Signature */
.sig{border:1px dashed var(--line);border-radius:12px;padding:12px;background:#fff}
#sigCanvas{width:100%;height:240px;border-radius:10px;border:1px solid var(--line);background:#fff;touch-action:none}

/* Responsive */
@media(max-width:980px){
  .headerbar .nav{display:none}
  .headerbar .hamb{display:inline-flex;align-items:center;justify-content:center;background:#fff;color:#0f1728;border-radius:10px;height:36px;padding:0 10px;border:1px solid #e6e8ef}
  .drawer{position:fixed;inset:var(--header-h) 0 auto 0;background:#fff;border-bottom:1px solid var(--line);box-shadow:var(--shadow);display:none;padding:12px;z-index:59}
  .drawer.open{display:block}
  .drawer a{display:inline-block;margin:6px 8px 6px 0;padding:8px 10px;border-radius:10px;border:1px solid var(--line)}
}
