/* GoEmp — โทน windows-classic น้ำเงิน ตามแนว GoCard/pharmGO/GoDensityHos */
:root {
  --navy: #003366; --blue: #1a5276; --mid: #2471a3; --light: #d6eaf8;
  --green: #148f54; --orange: #b9770e; --red: #b03a2e; --yellow: #fffbe8;
  --border: #c5d3e3; --border2: #9fb2c4; --text: #22313f; --bg: #eef2f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Sarabun', 'Leelawadee UI', sans-serif;
  font-size: 13px; color: var(--text); background: var(--bg);
}

/* ── top bar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(90deg, var(--blue), var(--navy));
  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 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 .who { color: #bcd6ea; font-size: 12px; }
.page { padding: 10px 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: var(--text);
  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-warning { background: linear-gradient(#e2a02b, #b9770e); border-color: #8a5a0a; color: #fff; font-weight: 600; }
.btn-danger { background: linear-gradient(#d45a4b, #b03a2e); border-color: #8a2b22; color: #fff; font-weight: 600; }
.btn-sm { padding: 2px 10px; font-size: 12px; }

/* ── VB-style frame + form grid ── */
fieldset.vb-frame {
  border: 1px solid var(--border2); border-radius: 4px; background: #f7fafc;
  padding: 8px 12px; margin: 0 0 10px; min-width: 0;
}
fieldset.vb-frame legend { color: var(--blue); 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; }
input[type=text], input[type=date], input[type=number], input[type=password], select, textarea {
  font-family: inherit; font-size: 12.5px; padding: 3px 6px;
  border: 1px solid var(--border2); border-radius: 3px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #7fb3d8; outline-offset: 0; }

/* ── status strip ── */
.status-line {
  background: var(--yellow); border: 1px solid #e3d38f; border-radius: 3px;
  color: #6b5d1f; padding: 4px 10px; font-size: 12px; margin-bottom: 8px;
}
.empty-row { text-align: center; color: #8a97a8; padding: 12px !important; }

/* ── data table (sticky header + zebra) ── */
.grid-wrap { max-height: 62vh; overflow: auto; border: 1px solid var(--border2); background: #fff; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(#3d7cad, #1a5276); color: #fff;
  padding: 5px 8px; text-align: left; white-space: nowrap; border-right: 1px solid #2a608a;
}
table.data-table td { padding: 4px 8px; border-bottom: 1px solid #e3ebf3; vertical-align: top; }
table.data-table tbody tr:nth-child(even) { background: #f4f8fb; }
table.data-table tbody tr:hover { background: var(--light); }
table.data-table td.num { text-align: right; font-family: Consolas, monospace; }

/* ── cards / KPI tiles ── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); min-width: 0; }
.card h4 { margin: 0 0 8px; color: var(--blue); font-size: 13px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.kpis { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.kpi {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 16px; min-width: 130px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.kpi .v { font-size: 22px; font-weight: 700; color: var(--blue); }
.kpi .l { font-size: 11.5px; color: #6b7d92; }
.kpi.good .v { color: var(--green); }
.kpi.warn .v { color: var(--red); }

/* ── badges ── */
.badge { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 11px; font-weight: 600; }
.b-ok { background: #e2f5ec; color: #0e6e40; border: 1px solid #9ed9bd; }
.b-no { background: #fde7e3; color: #8a2b22; border: 1px solid #e2a59a; }
.b-wn { background: #fdf3d8; color: #8a6d00; border: 1px solid #e3d38f; }
.b-in { background: #e3eef7; color: #12405e; border: 1px solid #a9c8de; }

/* ── tabs ── */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: -1px; }
.tab {
  padding: 5px 16px; border: 1px solid var(--border2); border-bottom: none;
  border-radius: 5px 5px 0 0; background: linear-gradient(#f2f6fa, #dbe5ee);
  cursor: pointer; font-weight: 600; color: #4a6076; font-size: 12.5px;
}
.tab.on { background: #fff; color: var(--blue); position: relative; z-index: 2; }
.pane { display: none; background: #fff; border: 1px solid var(--border2); padding: 10px; }
.pane.on { display: block; }

/* ── modal (ใช้กับ modal.js — คลาส gc-modal-*) ── */
.gc-modal-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(10,25,40,.45);
  display: flex; align-items: center; justify-content: center;
}
.gc-modal-card {
  width: min(420px, 92vw); background: #fff; border-radius: 8px;
  border: 1px solid var(--border2); box-shadow: 0 14px 44px rgba(0,0,0,.45); overflow: hidden;
}
.gc-modal-hdr {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-weight: 700; color: #fff;
  background: linear-gradient(90deg, var(--blue), var(--navy));
}
.gc-modal-danger .gc-modal-hdr { background: linear-gradient(90deg, #c0483a, #8a2b22); }
.gc-modal-warning .gc-modal-hdr { background: linear-gradient(90deg, #d29b2a, #8a5a0a); }
.gc-modal-success .gc-modal-hdr { background: linear-gradient(90deg, #2eb886, #0e6e40); }
.gc-modal-body { padding: 16px 14px; font-size: 13.5px; line-height: 1.6; }
.gc-modal-ftr { padding: 8px 14px 12px; text-align: right; }

/* ── login ── */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a5276, #0d3350 60%, #062338);
  font-family: 'Sarabun', 'Leelawadee UI', sans-serif;
}
.login-card {
  width: 360px; 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: var(--blue); }
.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: var(--red);
  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; }
