/* GoDashKPI — โทน windows-classic น้ำเงิน ตามแนว GoDensityHos/GoCard/pharmGO
   คลาสหลักใช้ชื่อเดียวกับ godensity.css เพื่อให้ทุกระบบเป็นแนวเดียวกัน */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Sarabun', 'Leelawadee UI', sans-serif;
  font-size: 13px; color: #22313f; background: #eef2f6;
}
a { color: #1a5276; }

/* ── top bar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(90deg, #1a5276, #003366);
  color: #fff; padding: 8px 14px; box-shadow: 0 2px 4px rgba(0,0,0,.25);
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
}
.topbar .brand { font-weight: 700; font-size: 14px; }
.topbar .brand a { color: #fff; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar nav a { color: #dceaf5; text-decoration: none; font-weight: 600; }
.topbar nav a:hover { color: #fff; text-decoration: underline; }
.topbar nav a.on { color: #fff; border-bottom: 2px solid #7fb3d8; }
.topbar .who { color: #bcd6ea; font-size: 12px; }
.page { padding: 8px 10px; }
.page-narrow { max-width: 980px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.page-head h1 { margin: 0; font-size: 17px; color: #1a5276; }
.page-head .sub { color: #6b7d92; font-size: 12px; }

/* ── buttons ── */
.btn {
  display: inline-block; padding: 4px 14px; font-family: inherit; font-size: 12.5px;
  border: 1px solid #7a8ba0; border-radius: 4px; cursor: pointer;
  background: linear-gradient(#fdfefe, #dfe8ef); color: #22313f; text-decoration: none;
}
.btn:hover { background: linear-gradient(#ffffff, #cfdde9); }
.btn:active { background: #cfdde9; }
.btn-primary { background: linear-gradient(#3d7cad, #1a5276); border-color: #12405e; color: #fff; font-weight: 600; }
.btn-primary:hover { background: linear-gradient(#4a8cbf, #1f6291); }
.btn-success { background: linear-gradient(#2eb886, #148f54); border-color: #0e6e40; color: #fff; font-weight: 600; }
.btn-success:hover { background: linear-gradient(#37c993, #17a260); }
.btn-danger { background: linear-gradient(#e57368, #b03a2e); border-color: #8e2e24; color: #fff; font-weight: 600; }
.btn-danger:hover { background: linear-gradient(#ef8378, #c74537); }
.btn-sm { padding: 2px 10px; font-size: 12px; }

/* ── VB-style frame + form grid ── */
fieldset.vb-frame {
  border: 1px solid #9fb2c4; border-radius: 4px; background: #f7fafc;
  padding: 8px 12px; margin: 0 0 8px;
}
fieldset.vb-frame legend { color: #1a5276; font-weight: 700; font-size: 12.5px; padding: 0 6px; }
.field-grid { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.field-grid label { color: #33556e; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 10px; }
.form-grid.cols2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.form-row { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.form-row.span-all { grid-column: 1 / -1; }
.form-row label { color: #33556e; font-weight: 600; font-size: 12px; }
input[type=text], input[type=date], input[type=number], input[type=password],
input[type=email], input[type=url], select, textarea {
  font-family: inherit; font-size: 12.5px; padding: 3px 6px;
  border: 1px solid #9fb2c4; border-radius: 3px; background: #fff; color: #22313f;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #7fb3d8; outline-offset: 0; }
input[readonly], textarea[readonly] { background: #f0f4f8; color: #5c6c80; }
.hint { font-size: 11px; color: #8a97a8; }
.mono { font-family: Consolas, 'Sarabun', monospace; }

/* ── status line + alerts ── */
.findpt-status {
  background: #fffbe8; border: 1px solid #e3d38f; border-radius: 3px;
  color: #6b5d1f; padding: 3px 10px; font-size: 12px; margin-bottom: 4px;
}
.alert { border-radius: 4px; padding: 6px 10px; font-size: 12.5px; margin-bottom: 8px; }
.alert-ok { background: #e3f4ea; border: 1px solid #8fc8a6; color: #1c7a43; }
.alert-info { background: #eaf2f8; border: 1px solid #a9cce3; color: #1a5276; }
.alert-err { background: #fde7e3; border: 1px solid #e2a59a; color: #b03a2e; }
.alert-warn { background: #fff3cd; border: 1px solid #e6cf7a; color: #8a6d00; }
.empty-row { text-align: center; color: #8a97a8; padding: 12px !important; }

/* ── data table ── */
table.data-table { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; }
.data-table th, .data-table td { border: 1px solid #d5dde5; padding: 3px 7px; }
.data-table thead th {
  position: sticky; top: 0; background: linear-gradient(#eaf2f8, #d6e6f2);
  color: #1a5276; z-index: 1; white-space: nowrap;
}
.data-table tbody tr:nth-child(even) { background: #f6fafd; }
.data-table tbody tr:hover { background: #eaf2fa; }
.data-table td.num { text-align: right; font-family: Consolas, Sarabun; }
.data-table td.ctr, .data-table th.ctr { text-align: center; }
.data-table tr.row-child td:first-child { padding-left: 22px; color: #5c6c80; }
.grid-wrap { max-height: 480px; overflow: auto; border: 1px solid #c5d3e3; background: #fff; }
.grid-wrap.tall { max-height: none; }

/* ── KPI tiles ── */
.dn-kpis { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.dn-kpi {
  flex: 1 1 130px; min-width: 130px; background: #fff; border: 1px solid #c5d3e3;
  border-radius: 6px; padding: 8px 12px; box-shadow: 0 1px 2px rgba(26,82,118,.08);
}
.dn-kpi .v { font-size: 21px; font-weight: 700; color: #1a5276; line-height: 1.2; }
.dn-kpi .l { font-size: 11px; color: #6b7d92; }
.dn-kpi.warn .v { color: #b03a2e; }
.dn-kpi.good .v { color: #148f54; }

/* ── cards ── */
.dn-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; margin-bottom: 10px; }
.dn-grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 10px; }
.dn-card { background: #fff; border: 1px solid #c5d3e3; border-radius: 6px; padding: 8px 10px; min-width: 0; }
.dn-card h4 { margin: 0 0 6px; font-size: 12.5px; color: #1a5276; border-bottom: 1px solid #e3ecf3; padding-bottom: 4px; }
.dn-card canvas { width: 100%; display: block; }
.dn-note { font-size: 11px; color: #8a97a8; margin-top: 3px; }
a.dn-card { display: block; text-decoration: none; color: inherit; }
a.dn-card:hover { border-color: #7fb3d8; box-shadow: 0 2px 6px rgba(26,82,118,.18); }

/* ── badges ── */
.dn-badge { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 11px; font-weight: 600; }
.dn-b-ok { background: #e3f4ea; color: #1c7a43; border: 1px solid #8fc8a6; }
.dn-b-no { background: #fde7e3; color: #b03a2e; border: 1px solid #e2a59a; }
.dn-b-wn { background: #fff3cd; color: #8a6d00; border: 1px solid #e6cf7a; }
.dn-b-mut { background: #eef2f6; color: #6b7d92; border: 1px solid #c5d3e3; }
.dn-b-inf { background: #eaf2f8; color: #1a5276; border: 1px solid #a9cce3; }

/* ── tabs ── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid #1a5276; margin: 6px 0 8px; flex-wrap: wrap; }
.tab {
  padding: 6px 14px; background: #dfe8ef; border: 1px solid #b9c4d0; border-bottom: none;
  border-radius: 6px 6px 0 0; cursor: pointer; color: #33556e; font-weight: 600;
  font-size: 12px; text-decoration: none; display: inline-block;
}
.tab.on { background: #1a5276; color: #fff; }

/* ── progress bar ── */
.progress { height: 8px; border-radius: 4px; overflow: hidden; background: #dfe8ef; border: 1px solid #c5d3e3; }
.progress .fill { height: 100%; background: linear-gradient(90deg, #2eb886, #148f54); }
.progress .fill.warn { background: linear-gradient(90deg, #e57368, #b03a2e); }

/* ── login ── */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a5276, #0d3350 60%, #062338);
}
.login-card {
  width: 340px; background: #fff; border-radius: 10px; padding: 26px 30px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.login-head { text-align: center; margin-bottom: 14px; }
.login-head .logo { font-size: 38px; }
.login-head h1 { margin: 4px 0 2px; font-size: 22px; color: #1a5276; }
.login-head .sub { font-size: 12.5px; color: #6b7d92; line-height: 1.5; }
.login-card label { display: block; margin: 10px 0 3px; font-weight: 600; color: #33556e; }
.login-card input { width: 100%; padding: 7px 9px; font-size: 14px; }
.login-err {
  background: #fde7e3; border: 1px solid #e2a59a; color: #b03a2e;
  border-radius: 4px; padding: 6px 10px; font-size: 12.5px; margin-bottom: 6px;
}
.login-foot { margin-top: 16px; text-align: center; font-size: 11px; color: #9aa8b8; }

/* ── hero (หน้าแรกสาธารณะ) ── */
.hero {
  background: linear-gradient(135deg, #1a5276, #0d3350 60%, #062338);
  color: #fff; padding: 26px 18px; border-radius: 0 0 8px 8px; margin-bottom: 10px;
}
.hero h1 { margin: 0 0 4px; font-size: 24px; }
.hero .sub { color: #bcd6ea; font-size: 13px; }

/* ── footer ── */
.site-foot {
  margin-top: 14px; padding: 10px 14px; border-top: 1px solid #c5d3e3;
  color: #8a97a8; font-size: 11.5px; text-align: center; background: #f7fafc;
}
.site-foot a { color: #6b7d92; }
