:root {
  --navy: #102d4f;
  --navy-2: #173b63;
  --blue: #1f6fb2;
  --sky: #eaf4fd;
  --ink: #172033;
  --muted: #687386;
  --line: #dfe6ee;
  --surface: #ffffff;
  --bg: #f4f7fa;
  --green: #15835d;
  --orange: #d97706;
  --red: #c53d3d;
  --shadow: 0 12px 32px rgba(23, 59, 99, .09);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; line-height: 1.55; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
.topbar { min-height: 72px; background: var(--navy); color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 5vw; box-shadow: 0 2px 12px rgba(0,0,0,.12); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark, .login-brand { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg,#56a8ed,#1f6fb2); color: white; font-size: 22px; font-weight: 900; }
.brand span:last-child { display: grid; }
.brand small { color: #b9d4ec; font-size: 11px; letter-spacing: .08em; }
.nav { display: flex; align-items: center; gap: 8px; }
.nav a, .nav-logout { padding: 9px 13px; border-radius: 9px; border: 0; color: #dbe9f5; background: transparent; cursor: pointer; }
.nav a:hover, .nav a.active { color: white; background: rgba(255,255,255,.12); }
.nav-logout { border: 1px solid rgba(255,255,255,.25); }
.nav-toggle { display: none; border: 0; background: transparent; color: white; font-size: 26px; }
.app-shell { width: min(1400px, 92vw); margin: 0 auto; padding: 38px 0 70px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #e8f5ff 0, transparent 35%), linear-gradient(135deg,#f8fbfe,#e6eef6); }
.login-card { width: min(440px, 100%); padding: 42px; border-radius: 24px; background: white; box-shadow: var(--shadow); text-align: center; border: 1px solid #e7edf3; }
.login-brand { width: 62px; height: 62px; font-size: 30px; margin: 0 auto 16px; }
.login-card h1 { margin: 0 0 6px; font-size: 25px; }
.eyebrow { color: var(--blue)!important; font-size: 11px!important; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 5px!important; }
.muted { color: var(--muted); }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { margin: 0; font-size: clamp(28px,4vw,40px); letter-spacing: -.03em; }
.page-heading p { margin: 6px 0 0; color: var(--muted); }
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; padding: 22px 24px; border-radius: 18px; color: white; box-shadow: var(--shadow); }
.stat-card::after { content:""; position:absolute; width:110px; height:110px; border-radius:50%; right:-35px; top:-40px; background:rgba(255,255,255,.14); }
.stat-card span { display: block; opacity: .9; }
.stat-card strong { font-size: 42px; line-height: 1.2; margin-right: 6px; }
.stat-card.green { background: linear-gradient(135deg,#167b5b,#20a172); }
.stat-card.orange { background: linear-gradient(135deg,#c56c0a,#ef9c2e); }
.stat-card.blue { background: linear-gradient(135deg,#206aa7,#3a91d7); }
.notice-card { background: #fffaf0; border: 1px solid #f1d7a3; border-left: 5px solid var(--orange); border-radius: 14px; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.notice-card p { margin: 2px 0 0; color: var(--muted); }
.chip-list { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip-list span { background: white; border: 1px solid #e9c77f; border-radius: 999px; padding: 5px 11px; font-weight: 700; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 7px 20px rgba(23,59,99,.05); margin-bottom: 20px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 21px 24px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 19px; }
.panel-head p { color: var(--muted); margin: 3px 0 0; font-size: 13px; }
.text-link, .back-link { color: var(--blue); font-weight: 700; }
.back-link { display: inline-block; margin-bottom: 10px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #edf1f5; white-space: nowrap; }
th { color: #607086; background: #f8fafc; font-size: 12px; letter-spacing: .04em; }
tbody tr:hover { background: #fbfdff; }
tbody tr:last-child td { border-bottom: 0; }
.person-link { color: var(--blue); font-weight: 800; }
.empty { color: var(--muted); text-align: center; padding: 38px; }
.status { display: inline-flex; border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: 12px; }
.status.large { padding: 8px 15px; font-size: 14px; }
.status-idle { color: #096246; background: #dbf4e9; }
.status-working { color: #9a4c00; background: #fff0cf; }
.status-leave { color: #155a91; background: #dceefc; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy-2); color: white; box-shadow: 0 5px 12px rgba(23,59,99,.18); }
.btn-secondary { background: var(--blue); color: white; }
.btn-ghost { background: #edf3f8; color: var(--navy-2); }
.btn-danger { color: white; background: var(--red); }
.btn-excel { color: white; background: #177447; }
.btn-large { padding: 13px 20px; }
.btn-small { padding: 7px 10px; font-size: 12px; }
.btn-mic { padding: 16px 22px; color: white; background: linear-gradient(135deg,#1d6fae,#173b63); font-size: 17px; box-shadow: 0 10px 22px rgba(23,59,99,.2); }
.full { width: 100%; margin-top: 12px; }
.two-column { display: grid; grid-template-columns: minmax(290px, .72fr) minmax(0, 1.8fr); gap: 20px; align-items: start; }
.form-panel { padding-bottom: 22px; }
.form-stack { display: grid; gap: 15px; padding: 22px 24px; }
.form-stack label, .filter-grid label { color: #425269; font-size: 13px; font-weight: 700; display: grid; gap: 6px; }
input, select { width: 100%; color: var(--ink); background: white; border: 1px solid #cfd9e4; border-radius: 9px; padding: 10px 12px; outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,111,178,.12); }
.nickname { font-size: 16px; color: var(--blue); padding-left: 8px; }
.filter-panel { padding: 20px 24px; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(130px,1fr)) auto; gap: 12px; align-items: end; }
.filter-actions { display: flex; gap: 7px; }
.settings-panel { max-width: 820px; padding: 28px; }
.setting-row { display: flex; gap: 20px; align-items: center; justify-content: space-between; }
.setting-row h2 { margin: 0; }
.setting-row p { margin: 4px 0 0; color: var(--muted); }
.setting-note { margin: 22px 0; padding: 13px 16px; background: var(--sky); color: #26577e; border-radius: 10px; }
.switch { position: relative; flex: 0 0 58px; height: 32px; }
.switch input { opacity: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #bbc6d2; cursor: pointer; }
.switch span::after { content:""; position: absolute; width: 24px; height: 24px; left:4px; top:4px; background:white; border-radius:50%; transition:.18s; box-shadow:0 2px 6px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(26px); }
.flash-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { border-radius: 10px; padding: 12px 15px; background: #e7f4ff; color: #165783; border: 1px solid #b8ddf8; }
.flash.error { background: #fff0f0; color: #9f2626; border-color: #f2c0c0; }
.flash.success { background: #e6f7ef; color: #126345; border-color: #b7e5d0; }
.dispatch-dialog { width: min(600px, calc(100vw - 30px)); border: 0; border-radius: 22px; padding: 0; color: var(--ink); box-shadow: 0 30px 80px rgba(11,32,55,.35); }
.dispatch-dialog::backdrop { background: rgba(9,26,45,.65); backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; }
.icon-btn { border:0; background:#edf2f6; width:36px; height:36px; border-radius:50%; font-size:24px; cursor:pointer; }
.dispatch-stage { padding: 34px 28px; text-align: center; }
.hidden { display: none!important; }
.record-button { width: 104px; height: 104px; border-radius: 50%; border: 8px solid #d8eaf8; color: white; background: linear-gradient(145deg,#287fc2,#174b77); font-size: 38px; cursor: pointer; box-shadow: 0 12px 28px rgba(31,111,178,.25); }
.record-button.recording { background: linear-gradient(145deg,#e55555,#a91f1f); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(218,55,55,.12); } }
.or-line { display:flex; align-items:center; gap:12px; color:var(--muted); font-size:12px; margin:25px 0 14px; }
.or-line::before, .or-line::after { content:""; flex:1; height:1px; background:var(--line); }
.inline-form { display: flex; gap: 8px; }
.spinner { width: 46px; height: 46px; margin: 10px auto 22px; border: 4px solid #dbe8f3; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.recognized { padding: 14px; background: #f3f7fa; border-radius: 12px; text-align:left; }
.recognized span { color:var(--muted); font-size:12px; }
.recognized p { margin:4px 0 0; font-weight:800; }
.confirm-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:16px 0 22px; }
.confirm-grid div { padding:14px 10px; background:#edf5fb; border-radius:12px; }
.confirm-grid dt { color:var(--muted); font-size:12px; }
.confirm-grid dd { margin:4px 0 0; font-weight:900; color:var(--navy); }
.button-row { display:flex; justify-content:center; gap:10px; }
.error-symbol { display:grid; place-items:center; width:62px; height:62px; margin:0 auto 14px; border-radius:50%; background:#fee2e2; color:var(--red); font-size:32px; font-weight:900; }
@media (max-width: 980px) { .filter-grid { grid-template-columns: repeat(2,1fr); } .two-column { grid-template-columns:1fr; } }
@media (max-width: 760px) {
  .topbar { padding: 0 18px; }
  .nav-toggle { display:block; }
  .nav { display:none; position:absolute; top:68px; left:12px; right:12px; background:var(--navy); border-radius:12px; padding:12px; flex-direction:column; align-items:stretch; box-shadow:var(--shadow); }
  .nav.open { display:flex; }
  .nav form, .nav-logout { width:100%; text-align:left; }
  .app-shell { width:min(94vw,1400px); padding-top:24px; }
  .heading-row, .notice-card { align-items:flex-start; flex-direction:column; }
  .btn-mic { width:100%; }
  .stats-grid { grid-template-columns:1fr; }
  .chip-list { justify-content:flex-start; }
  .filter-grid { grid-template-columns:1fr; }
  .inline-form, .button-row { flex-direction:column; }
  .confirm-grid { grid-template-columns:1fr; }
  .login-card { padding:30px 22px; }
}


/* ---- 系統管理子選單、工作管理、員工匯入 ---- */
.subnav { display: flex; gap: 6px; margin: -8px 0 22px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 10px 16px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--navy-2); }
.subnav a.active { color: var(--navy-2); border-bottom-color: var(--blue); }
.stack { display: grid; gap: 20px; }
.stack .panel { margin-bottom: 0; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions form { margin: 0; }
.cell-input { min-width: 120px; padding: 7px 10px; }
.cell-input.narrow { min-width: 80px; max-width: 100px; }
.check-row { display: flex !important; align-items: center; gap: 8px; font-weight: 600; }
.check-row input[type="checkbox"] { width: auto; }
.side-form { padding: 0 24px; margin: 0; }
.side-form .full { margin-top: 0; }
.format-hint { padding: 12px 14px; background: var(--sky); color: #26577e; border-radius: 10px; font-size: 13px; }
input[type="file"] { padding: 8px; }
.import-result .result-stats { display: flex; gap: 16px; padding: 18px 24px 4px; }
.result-stats > div { flex: 1; padding: 14px 18px; border-radius: 12px; }
.result-stats strong { font-size: 32px; margin-right: 6px; }
.result-ok { background: #e6f7ef; color: #126345; }
.result-fail { background: #fff0f0; color: #9f2626; }
.result-errors { padding: 8px 24px 22px; }
.result-errors h3 { margin: 12px 0 6px; font-size: 15px; }
.result-errors ul { margin: 0; padding-left: 20px; max-height: 260px; overflow: auto; color: #7a2a2a; }

/* ---- 首頁工作紀錄 ---- */
.records-title { margin-bottom: 14px; }
.records-title h2 { margin: 0; font-size: 19px; }
.records-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 16px; border-top: 1px solid #edf1f5; }
.btn.disabled { opacity: .45; pointer-events: none; }
html { scroll-behavior: smooth; }
