* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Microsoft JhengHei", Arial, sans-serif;
  background: #f4f6f9; color: #223; font-size: 14px;
}

/* ---------- 登入 ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1a6b54 0%, #2a9d8f 100%); }
.login-card { background: #fff; padding: 40px 36px; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25); width: 360px; }
.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-card .sub { color: #789; margin-bottom: 24px; }
.login-card label { display: block; margin: 12px 0 4px; font-weight: 600; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid #ccd; border-radius: 8px; font-size: 15px; margin-bottom: 6px; }
.login-card button { margin-top: 16px; }
.error { color: #d33; margin-top: 10px; min-height: 18px; }

/* ---------- 版面 ---------- */
header {
  background: #1a6b54; color: #fff; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
header h1 { font-size: 18px; margin-right: 8px; }
header .spacer { flex: 1; }
header .user { opacity: .9; }
nav.tabs { display: flex; gap: 4px; }
nav.tabs button {
  background: transparent; border: none; color: #cfe8e0; padding: 8px 14px;
  font-size: 14px; cursor: pointer; border-radius: 8px 8px 0 0;
}
nav.tabs button.active { background: #f4f6f9; color: #1a6b54; font-weight: 700; }
main { padding: 20px; max-width: 1280px; margin: 0 auto; }

.btn { border: none; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 14px; background: #e2e8f0; color: #223; }
.btn:hover { filter: brightness(.95); }
.btn.primary { background: #1a6b54; color: #fff; }
.btn.danger { background: #d64545; color: #fff; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn.ghost { background: transparent; border: 1px solid #cbd5e1; }

/* ---------- 卡片與表格 ---------- */
.card { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(20,40,60,.07); padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 16px; margin-bottom: 12px; color: #1a4b40; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #edf0f4; white-space: nowrap; }
th { background: #f8fafb; font-size: 12px; color: #567; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #f8fffc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.clickable { color: #1a6b54; font-weight: 600; cursor: pointer; text-decoration: underline dotted; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #d9f2e5; color: #14724a; }
.badge.warn { background: #fdeeda; color: #a05e03; }
.badge.bad { background: #fde3e3; color: #b32d2d; }
.badge.info { background: #e0ecfb; color: #1e5aa8; }
.badge.gray { background: #eceff3; color: #556; }

/* 請假類型顏色 */
.t-VACACIONES { background: #d9f2e5; color: #14724a; }
.t-PERMISO { background: #e0ecfb; color: #1e5aa8; }
.t-INCAPACIDAD { background: #fdeeda; color: #a05e03; }
.t-FALTA { background: #fde3e3; color: #b32d2d; }
.t-OTRO { background: #eceff3; color: #556; }
.s-PENDIENTE { outline: 2px dashed #e3b341; outline-offset: -2px; }

/* ---------- 表單 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #ccd5de; border-radius: 8px; font-size: 14px; background: #fff;
}
.checkbox-line { display: flex; align-items: center; gap: 6px; }
.checkbox-line input { width: auto; }

/* ---------- 行事曆 ---------- */
.cal-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-nav h3 { font-size: 18px; min-width: 140px; text-align: center; }
.cal-mark { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* Google Calendar 風格月曆 */
.gcal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid #dde3ea; border-radius: 10px; overflow: hidden; background: #dde3ea; gap: 1px; }
.gcal-head { background: #f8fafb; padding: 6px 8px; font-size: 12px; font-weight: 700; color: #567; text-align: center; text-transform: uppercase; }
.gcal-day { background: #fff; min-height: 96px; padding: 4px 5px; position: relative; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.gcal-day:hover { background: #f8fffc; }
.gcal-day.weekend { background: #f6f7fa; }
.gcal-day.weekend:hover { background: #f0f3f6; }
.gcal-day.other { background: #fbfcfd; }
.gcal-day.other .gcal-num { color: #bcc5cf; }
.gcal-num { font-size: 12px; font-weight: 600; color: #445; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.gcal-day.today .gcal-num { background: #1a6b54; color: #fff; }
.gcal-chip {
  font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.gcal-chip:hover { filter: brightness(.93); }

/* ---------- 彈窗 ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10,20,30,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 14px; padding: 22px; max-width: 900px; width: 94%; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-bottom: 12px; }
.modal .close-line { display: flex; justify-content: flex-end; margin-top: 14px; }

.muted { color: #789; font-size: 12px; }
.mb8 { margin-bottom: 8px; }
.mt12 { margin-top: 12px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
