* { box-sizing: border-box; }
body {
  font-family: "Microsoft JhengHei", "PingFang TC", -apple-system, sans-serif;
  background: #f4f6f8;
  margin: 0;
  color: #1f2430;
}
header {
  background: #1f2d3d;
  color: #fff;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { font-size: 16px; margin: 0; font-weight: 600; }
header .who { font-size: 13px; color: #cbd5e1; }
header button {
  background: #3b4a5f;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
header button:hover { background: #4c5f78; }

main { max-width: 900px; margin: 24px auto; padding: 0 16px; transition: max-width 0.15s; }
/* 料號管理／設備總覽這種多欄位資料表頁面，900px 塞9欄會太擠，料號欄位擠到換行；
   全螢幕時放寬到 1200px，資料表比較看得清楚 */
main.wide { max-width: 1200px; }
/* 料號欄位鎖定不換行，避免代碼編號較長時（例如 I-S-M-S-01-A）被擠成兩行 */
.itemNoCell { white-space: nowrap; }

.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h2 { margin-top: 0; font-size: 16px; color: #1f2d3d; }

label { display: block; font-size: 13px; color: #555; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
}
button.primary {
  margin-top: 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
button.primary:hover { background: #1d4ed8; }
button.secondary {
  background: #e2e8f0;
  color: #1f2d3d;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  margin-right: 6px;
}
button.danger { background: #fee2e2; color: #991b1b; }
button.approve { background: #dcfce7; color: #166534; }

.item-row { display: flex; gap: 8px; align-items: end; margin-bottom: 8px; }
.item-row > div { flex: 1; }
.item-row button { flex: 0 0 auto; height: 38px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eee; }
th { color: #667085; font-weight: 600; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.pending { background: #fef9c3; color: #854d0e; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }

.subnav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.subnav .subnavBtn {
  background: #fff;
  color: #475467;
  border: 1px solid #d0d5dd;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.subnav .subnavBtn:hover { background: #f4f6f8; }
.subnav .subnavBtn.active {
  background: #1f2d3d;
  color: #fff;
  border-color: #1f2d3d;
}

#loginScreen {
  max-width: 360px;
  margin: 80px auto;
}
.error-msg { color: #d92d20; font-size: 13px; margin-top: 8px; }
.hint { color: #667085; font-size: 12px; margin-top: 6px; }
.empty { color: #98a2b3; font-size: 13px; padding: 12px 0; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  box-sizing: border-box;
}
.modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 360px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-box h3 { margin-top: 0; font-size: 16px; }
.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
/* button.primary 原本設計成表單下方單獨使用（margin-top:16px、10px/18px 的大padding），
   跟 button.secondary（6px/14px 小padding、無margin-top）放在同一排 modal-actions 裡時
   會一個偏低、一個偏高、大小也不一樣，看起來像兩套不同風格的按鈕。這裡統一成同一個尺寸跟基線。 */
.modal-actions button.primary,
.modal-actions button.secondary {
  margin-top: 0;
  margin-right: 0;
  padding: 8px 16px;
  font-size: 14px;
}

/* 送出申請驗證失敗時，用顏色標示出錯的欄位，方便使用者直接找到要修改的地方 */
.field-error {
  border: 1px solid #e11d48 !important;
  background: #fef2f2 !important;
}
