/* ===================================================================
   NORASING CREDIT PRE-SCREEN — shared stylesheet
   Brand: green (primary) on white, status colors always paired with
   an icon + text label (never color alone — accessibility, §31).
=================================================================== */
:root{
  --green-900:#0b4a2e; --green-700:#0f8a4f; --green-600:#159a5b; --green-100:#e6f6ee;
  --blue-600:#1f6fb2; --blue-100:#e8f2fb;
  --yellow-700:#8a6d00; --yellow-500:#f2b705; --yellow-100:#fff6db;
  --orange-700:#a0480a; --orange-500:#f2790a; --orange-100:#fff0e0;
  --red-700:#a3231b; --red-500:#e53e30; --red-100:#fde8e6;
  --gray-900:#1c2530; --gray-700:#48545f; --gray-500:#7c8894; --gray-300:#d8dee3; --gray-100:#f4f6f8;
  --white:#ffffff;
  --radius:12px; --radius-sm:8px;
  --shadow:0 1px 3px rgba(16,32,24,.08), 0 1px 2px rgba(16,32,24,.06);
  --shadow-lg:0 8px 24px rgba(16,32,24,.12);
  --sidebar-w:236px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:'Noto Sans Thai','Segoe UI',Sarabun,Tahoma,sans-serif;
  background:var(--gray-100); color:var(--gray-900); font-size:15px; line-height:1.5;
}
a{color:var(--green-700); text-decoration:none}
a:hover{text-decoration:underline}
h1,h2,h3,h4{margin:0 0 8px; font-weight:700; color:var(--gray-900)}
p{margin:0 0 10px}
img{max-width:100%}

.btn{
  display:inline-flex; align-items:center; gap:6px; justify-content:center;
  padding:10px 18px; border-radius:var(--radius-sm); border:1px solid transparent;
  font-weight:600; font-size:14px; cursor:pointer; background:var(--gray-100); color:var(--gray-900);
}
.btn:hover{text-decoration:none; filter:brightness(0.97)}
.btn-primary{background:var(--green-700); color:#fff}
.btn-primary:hover{background:var(--green-900)}
.btn-outline{background:#fff; border-color:var(--gray-300); color:var(--gray-900)}
.btn-danger{background:var(--red-500); color:#fff}
.btn-warn{background:var(--orange-500); color:#fff}
.btn-sm{padding:6px 12px; font-size:13px}
.btn-block{width:100%}
.btn[disabled]{opacity:.5; cursor:not-allowed}

/* ---------------- Login ---------------- */
.login-wrap{min-height:100vh; display:flex}
.login-left{
  flex:1.1; background:linear-gradient(160deg,var(--green-900),var(--green-700) 60%,#0a3a24);
  color:#fff; display:flex; flex-direction:column; justify-content:center; padding:60px;
}
.login-left h1{color:#fff; font-size:34px}
.login-left p{color:#d9f0e3; max-width:420px}
.login-right{flex:1; display:flex; align-items:center; justify-content:center; background:#fff; padding:30px}
.login-card{width:100%; max-width:360px}
.login-logo{display:flex; align-items:center; gap:10px; margin-bottom:22px}
.login-logo .mark{width:42px;height:42px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-weight:800}
.field{margin-bottom:16px}
.field label{display:block; font-size:13px; font-weight:600; color:var(--gray-700); margin-bottom:6px}
.field input[type=text],.field input[type=password],.field input[type=number],.field input[type=email],
.field input[type=date],.field input[type=tel],.field select,.field textarea{
  width:100%; padding:10px 12px; border:1px solid var(--gray-300); border-radius:var(--radius-sm);
  font-size:14px; font-family:inherit; background:#fff; color:var(--gray-900);
}
.field textarea{resize:vertical; min-height:80px}
.field small.hint{display:block; margin-top:4px; color:var(--gray-500); font-size:12px}
.field .error{color:var(--red-700); font-size:12px; margin-top:4px}
.field-row{display:flex; gap:12px; flex-wrap:wrap}
.field-row .field{flex:1; min-width:160px}
.checkbox-row{display:flex; align-items:center; gap:8px; margin-bottom:10px}

@media (max-width:820px){ .login-left{display:none} }

/* ---------------- App shell ---------------- */
.app-shell{display:flex; min-height:100vh}
.sidebar{
  width:var(--sidebar-w); background:var(--green-900); color:#fff; flex-shrink:0;
  display:flex; flex-direction:column; position:sticky; top:0; height:100vh; overflow-y:auto;
}
.sidebar .brand{display:flex; align-items:center; gap:10px; padding:18px 16px; border-bottom:1px solid rgba(255,255,255,.12)}
.sidebar .brand .mark{width:36px;height:36px;border-radius:9px;background:#fff;color:var(--green-900);display:flex;align-items:center;justify-content:center;font-weight:800}
.sidebar .brand .name{font-weight:800; font-size:15px; line-height:1.2}
.sidebar .brand .sub{font-size:11px; color:#bfe3cf}
.sidebar nav{flex:1; padding:10px}
.sidebar nav a{
  display:flex; align-items:center; gap:10px; color:#d7f0e3; padding:10px 12px; border-radius:8px;
  font-size:14px; margin-bottom:2px;
}
.sidebar nav a:hover{background:rgba(255,255,255,.08); text-decoration:none}
.sidebar nav a.active{background:#fff; color:var(--green-900); font-weight:700}
.sidebar nav .section-label{font-size:11px; text-transform:uppercase; color:#7fc39b; margin:14px 12px 6px; letter-spacing:.04em}
.sidebar .user-box{padding:14px 16px; border-top:1px solid rgba(255,255,255,.12); font-size:13px}
.sidebar .user-box .role{color:#9fdcbb; font-size:12px}

.main{flex:1; min-width:0; display:flex; flex-direction:column}
.topbar{
  background:#fff; border-bottom:1px solid var(--gray-300); padding:14px 24px;
  display:flex; align-items:center; justify-content:space-between; gap:12px; position:sticky; top:0; z-index:20;
}
.topbar h1{font-size:19px; margin:0}
.topbar .crumbs{font-size:12px; color:var(--gray-500)}
.content{padding:22px 24px 90px; flex:1}

/* ---------------- Flash ---------------- */
.flash{padding:12px 16px; border-radius:var(--radius-sm); margin-bottom:16px; font-size:14px; font-weight:600}
.flash-success{background:var(--green-100); color:var(--green-900); border:1px solid #bfe6d1}
.flash-error{background:var(--red-100); color:var(--red-700); border:1px solid #f3c4bf}
.flash-info{background:var(--blue-100); color:#0d4d80; border:1px solid #c4dff3}

/* ---------------- Cards / KPI ---------------- */
.grid{display:grid; gap:16px}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-2{grid-template-columns:repeat(2,1fr)}
@media (max-width:960px){ .grid-4,.grid-3,.grid-2{grid-template-columns:repeat(2,1fr)} }
@media (max-width:600px){ .grid-4,.grid-3,.grid-2{grid-template-columns:1fr} }

.card{background:#fff; border-radius:var(--radius); box-shadow:var(--shadow); padding:18px}
.card-title{font-size:13px; font-weight:700; color:var(--gray-500); text-transform:uppercase; letter-spacing:.03em; margin-bottom:10px}

.kpi{padding:18px}
.kpi .num{font-size:30px; font-weight:800; line-height:1.1}
.kpi .label{color:var(--gray-500); font-size:13px; margin-top:4px}
.kpi.kpi-green .num{color:var(--green-700)}
.kpi.kpi-yellow .num{color:var(--yellow-700)}
.kpi.kpi-orange .num{color:var(--orange-700)}
.kpi.kpi-red .num{color:var(--red-700)}

/* ---------------- Badges (icon + text, never color alone) ---------------- */
.badge{display:inline-flex; align-items:center; gap:6px; padding:5px 11px; border-radius:999px; font-size:12.5px; font-weight:700; white-space:nowrap}
.badge-green{background:var(--green-100); color:var(--green-900)}
.badge-yellow{background:var(--yellow-100); color:var(--yellow-700)}
.badge-orange{background:var(--orange-100); color:var(--orange-700)}
.badge-red{background:var(--red-100); color:var(--red-700)}
.badge-gray{background:var(--gray-100); color:var(--gray-700)}
.badge-blue{background:var(--blue-100); color:#0d4d80}

/* ---------------- Table ---------------- */
.table-wrap{overflow-x:auto; background:#fff; border-radius:var(--radius); box-shadow:var(--shadow)}
table{width:100%; border-collapse:collapse; font-size:13.5px}
table th{text-align:left; padding:12px 14px; background:var(--gray-100); color:var(--gray-700); font-weight:700; white-space:nowrap; border-bottom:1px solid var(--gray-300)}
table td{padding:11px 14px; border-bottom:1px solid var(--gray-100); vertical-align:middle}
table tr:hover td{background:#fafcfb}
.table-actions{display:flex; gap:8px}

/* ---------------- Stepper ---------------- */
.stepper{display:flex; align-items:center; margin-bottom:22px; overflow-x:auto; padding-bottom:4px}
.stepper .step{display:flex; align-items:center; flex-shrink:0}
.stepper .dot{
  width:30px; height:30px; border-radius:50%; background:var(--gray-300); color:#fff; font-weight:700; font-size:13px;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.stepper .step.done .dot{background:var(--green-700)}
.stepper .step.active .dot{background:var(--green-900); box-shadow:0 0 0 4px var(--green-100)}
.stepper .lbl{font-size:12px; margin-left:8px; color:var(--gray-500); white-space:nowrap}
.stepper .step.active .lbl{color:var(--green-900); font-weight:700}
.stepper .line{width:28px; height:2px; background:var(--gray-300); margin:0 8px; flex-shrink:0}
.stepper .step.done + .step .line, .stepper .line.done{background:var(--green-700)}

@media (max-width:700px){ .stepper .lbl{display:none} .stepper .line{width:14px} }

/* ---------------- Autosave indicator ---------------- */
.autosave{font-size:12.5px; color:var(--gray-500); display:flex; align-items:center; gap:6px}
.autosave.ok{color:var(--green-700)}
.autosave.err{color:var(--red-700)}
.autosave .dot-live{width:7px;height:7px;border-radius:50%;background:var(--green-600)}

/* ---------------- Score gauge ---------------- */
.score-gauge{display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center}
.score-gauge .ring{width:150px;height:150px;border-radius:50%;display:flex;align-items:center;justify-content:center;position:relative}
.score-gauge .ring .num{font-size:34px; font-weight:800}
.score-gauge .ring .max{font-size:13px; color:var(--gray-500)}

/* ---------------- Misc ---------------- */
.muted{color:var(--gray-500)}
.small{font-size:12.5px}
.hr{border:none; border-top:1px solid var(--gray-300); margin:18px 0}
.tag-list{display:flex; flex-wrap:wrap; gap:8px}
.pill{background:var(--gray-100); border-radius:999px; padding:4px 10px; font-size:12.5px}
.kv{display:grid; grid-template-columns:1fr auto; gap:6px 14px; font-size:13.5px}
.kv .k{color:var(--gray-500)}
.kv .v{font-weight:700; text-align:right}
.section-block{margin-bottom:22px}
.list-check li{margin-bottom:6px}
ul.plain{list-style:none; margin:0; padding:0}
ul.plain li{padding:7px 0; border-bottom:1px dashed var(--gray-300); font-size:13.5px}
ul.plain li:last-child{border-bottom:none}
.icon-ok:before{content:"✓ "; color:var(--green-700); font-weight:800}
.icon-warn:before{content:"⚠ "; color:var(--orange-700); font-weight:800}
.icon-x:before{content:"✕ "; color:var(--red-700); font-weight:800}

.form-actions{display:flex; justify-content:space-between; margin-top:22px; gap:10px; flex-wrap:wrap}
.two-col{display:grid; grid-template-columns:2fr 1fr; gap:20px}
@media (max-width:960px){ .two-col{grid-template-columns:1fr} }

/* ---------------- Mobile bottom nav ---------------- */
.bottom-nav{display:none}
@media (max-width:820px){
  .sidebar{display:none}
  .app-shell{display:block}
  .content{padding:16px 14px 90px}
  .topbar{padding:12px 16px}
  .bottom-nav{
    display:flex; position:fixed; bottom:0; left:0; right:0; background:#fff; border-top:1px solid var(--gray-300);
    box-shadow:0 -2px 10px rgba(0,0,0,.06); z-index:50;
  }
  .bottom-nav a{
    flex:1; display:flex; flex-direction:column; align-items:center; gap:2px; padding:9px 2px 8px;
    color:var(--gray-500); font-size:11px; text-decoration:none;
  }
  .bottom-nav a.active{color:var(--green-700); font-weight:700}
  .bottom-nav .ic{font-size:19px}
}

/* ---------------- Utility ---------------- */
.text-right{text-align:right}
.text-center{text-align:center}
.mt0{margin-top:0} .mb0{margin-bottom:0}
.w100{width:100%}
.flex{display:flex} .items-center{align-items:center} .justify-between{justify-content:space-between}
.gap8{gap:8px} .gap12{gap:12px} .gap16{gap:16px}
