* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft JhengHei", "微軟正黑體", system-ui, sans-serif;
  background: #f0f2f5; color: #222; line-height: 1.5;
}
.topbar {
  background: #2c3e50; color: #fff; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar h1 { font-size: 18px; }
.topbar-logo { height: 34px; width: auto; background: #fff; border-radius: 50%; padding: 2px; }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 14px; opacity: .9; }
.container { max-width: 1400px; margin: 0 auto; padding: 16px; }

button {
  cursor: pointer; border: none; border-radius: 6px; padding: 7px 14px;
  background: #3498db; color: #fff; font-size: 14px; font-family: inherit;
}
button:hover { background: #2980b9; }
button.secondary { background: #95a5a6; }
button.secondary:hover { background: #7f8c8d; }
button.danger { background: #e74c3c; }
button.danger:hover { background: #c0392b; }
button.small { padding: 3px 8px; font-size: 12px; }

input, select {
  font-family: inherit; font-size: 14px; padding: 6px 8px;
  border: 1px solid #ccc; border-radius: 5px;
}
label { font-size: 14px; }

.card {
  background: #fff; border-radius: 8px; padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin-bottom: 12px; color: #2c3e50; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.mb { margin-bottom: 10px; }

table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 6px 8px; text-align: center; font-size: 13px; }
th { background: #ecf0f1; }

/* 登入頁 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2c3e50, #3498db);
}
.login-box {
  background: #fff; padding: 32px; border-radius: 12px; width: 340px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 6px; color: #2c3e50; }
.login-box p.sub { text-align: center; color: #888; font-size: 13px; margin-bottom: 20px; }
.login-box input { width: 100%; margin-bottom: 12px; padding: 10px; }
.login-box button { width: 100%; padding: 11px; font-size: 16px; }
.err { color: #e74c3c; font-size: 13px; margin-bottom: 10px; min-height: 18px; }

/* 休假顏色 */
.leave-mandatory { background: #e74c3c; color: #fff; font-weight: bold; }
.leave-optional  { background: #f1c40f; color: #333; font-weight: bold; }
.day-weekend { background: #fde8e8; }
.day-holiday { background: #fff3cd; }
.holiday-name { font-size: 10px; color: #c0392b; display: block; }

.legend { display: flex; gap: 16px; font-size: 13px; flex-wrap: wrap; align-items: center; }
.legend span.box { display: inline-block; width: 16px; height: 16px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: #dfe6e9; color: #2d3436; }
.tabs button.active { background: #2c3e50; color: #fff; }
.badge { background: #e74c3c; color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 12px; margin-left: 2px; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; padding: 24px; border-radius: 10px; max-width: 90vw;
  max-height: 85vh; overflow: auto; min-width: 320px;
}
.modal h3 { margin-bottom: 14px; }
.hidden { display: none !important; }

.stat-row td { font-weight: bold; }
.stat-attend { background: #d5f5e3; }
.stat-leave  { background: #fdebd0; }
.stat-diff   { background: #d6eaf8; }
.timer { font-size: 20px; font-weight: bold; color: #e74c3c; }

.schedule-table { overflow-x: auto; }
.schedule-table td.pos-name, .schedule-table td.emp-name { background: #f8f9fa; text-align: left; white-space: nowrap; position: sticky; z-index: 2; }
.schedule-table th.pos-name, .schedule-table th.emp-name { position: sticky; z-index: 3; }
.schedule-table td.pos-name, .schedule-table th.pos-name { left: 0; min-width: 84px; }
.schedule-table td.emp-name, .schedule-table th.emp-name { left: 84px; min-width: 84px; }
