:root {
  --bg:#f4f5f7; --text:#222; --muted:#666; --card-bg:#fff;
  --border:#e0e0e0; --border-strong:#ccc; --th-bg:#fafafa; --day-bg:#fcfcfc;
  --input-bg:#fff; --brand:#b3001b; --brand-dark:#8c0015; --ghost-hover:#fbe9ec;
}
/* 深色配色（共用一份變數） */
:root[data-theme="dark"] {
  --bg:#16181d; --text:#e8e8ea; --muted:#9aa0a6; --card-bg:#23262c;
  --border:#383b42; --border-strong:#4a4d55; --th-bg:#2b2e35; --day-bg:#20232a;
  --input-bg:#2a2d33; --brand:#ff5468; --brand-dark:#ff7383; --ghost-hover:#3a262a;
}
/* 跟隨系統：系統為深色時才套深色 */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:#16181d; --text:#e8e8ea; --muted:#9aa0a6; --card-bg:#23262c;
    --border:#383b42; --border-strong:#4a4d55; --th-bg:#2b2e35; --day-bg:#20232a;
    --input-bg:#2a2d33; --brand:#ff5468; --brand-dark:#ff7383; --ghost-hover:#3a262a;
  }
}
.theme-btn { background:rgba(255,255,255,.15); color:#fff; border:1px solid rgba(255,255,255,.4);
  padding:8px 12px; border-radius:6px; cursor:pointer; font-size:14px; }
.theme-btn:hover { background:rgba(255,255,255,.28); }
* { box-sizing: border-box; }
body { margin:0; font-family:"Microsoft JhengHei","PingFang TC",sans-serif;
  background:var(--bg); color:var(--text); }
.topbar { display:flex; justify-content:space-between; align-items:center;
  background:#b3001b; color:#fff; padding:12px 20px; position:relative; z-index:2; }
.brand { font-weight:bold; font-size:18px; }
.userbox { display:flex; gap:14px; align-items:center; font-size:14px; }
.container { max-width:1200px; margin:24px auto; padding:0 16px; }
.card { background:var(--card-bg); border-radius:10px; padding:24px; box-shadow:0 1px 4px rgba(0,0,0,.08); }
h1 { margin-top:0; font-size:22px; }
h2 { font-size:17px; margin:18px 0 8px; }
.muted { color:var(--muted); font-size:14px; }
.alert { background:#fdecea; border:1px solid #f5c6cb; color:#a12; padding:10px 14px; border-radius:6px; margin:12px 0; }
.alert.warn { background:#fff7e6; border-color:#ffd591; color:#a6630f; }
.alert.ok { background:#e9f7ec; border-color:#a3d9b1; color:#1c7a3a; }
.alert li.hard { color:#b3001b; font-weight:bold; }

label { display:block; margin:10px 0 4px; font-size:14px; }
input, select { padding:7px 9px; border:1px solid var(--border-strong); border-radius:5px; font-size:14px;
  background:var(--input-bg); color:var(--text); }
input[type=date], .login-card input { width:220px; }
.pw-field { display:flex; align-items:center; gap:8px; }
.pw-field input { flex:1; }
.pw-toggle { flex-shrink:0; background:var(--input-bg); color:var(--muted); border:1px solid var(--border-strong); padding:6px 10px;
  border-radius:5px; cursor:pointer; font-size:13px; }
.pw-toggle:hover { background:var(--th-bg); }
.btn-primary { background:var(--brand); color:#fff; border:none; padding:10px 18px; border-radius:6px; cursor:pointer; font-size:15px; }
.btn-primary:hover { background:var(--brand-dark); }
.btn-ghost { background:var(--card-bg); color:var(--brand); border:1px solid var(--brand); padding:8px 14px; border-radius:6px; cursor:pointer; text-decoration:none; font-size:14px; }
.btn-ghost:hover { background:var(--ghost-hover); }
.row { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-top:14px; }

.login-card { max-width:380px; margin:60px auto; }
.steps { list-style:none; display:flex; gap:8px; padding:0; margin:8px 0 18px; flex-wrap:wrap; }
.steps li { background:var(--th-bg); color:var(--muted); padding:5px 12px; border-radius:20px; font-size:13px; }
.steps li.on { background:var(--brand); color:#fff; }

.table-wrap { overflow-x:auto; }
table { border-collapse:collapse; width:100%; margin-top:10px; }
th, td { border:1px solid var(--border); padding:5px; text-align:center; font-size:13px; }
th { background:var(--th-bg); }
#roster input { width:90%; }
#roster .c-day { width:48px; }

.zone-sec { margin-top:18px; }
.day-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.day-col { border:1px solid var(--border); border-radius:6px; background:var(--day-bg); }
.day-head { background:var(--th-bg); padding:5px; text-align:center; font-size:13px; font-weight:bold; }
.day-head small { font-weight:normal; color:#888; }
.cell { padding:5px; min-height:60px; }
.pers { display:flex; align-items:center; gap:2px; background:#eef3fb; border-radius:4px; padding:3px; margin-bottom:4px; font-size:12px; flex-wrap:wrap; }
.pers.ot { background:#ffe0b2; border:1px solid #ff9800; }
.pers .pn { flex:1; min-width:42px; }
.pers .pn b { color:#b3001b; }
.pers input { width:42px; padding:2px; font-size:12px; }
.pers .px { background:none; border:none; color:#999; cursor:pointer; }
.btn-add { width:100%; background:none; border:1px dashed #bbb; color:#888; border-radius:4px; cursor:pointer; font-size:12px; padding:3px; }
.btn-add:hover { border-color:#b3001b; color:#b3001b; }

.labor-panel { border-radius:6px; padding:10px 14px; margin:12px 0; border:1px solid; }
.labor-panel.ok { background:#e9f7ec; border-color:#a3d9b1; }
.labor-panel.over { background:#fdecea; border-color:#f5c6cb; }
.ot-panel li.note-only { color:#a12; list-style:none; }
.ot-chip { background:#ffe0b2; padding:1px 6px; border-radius:4px; }
.ot-panel { background:#fff8ef; border:1px solid #ffd591; border-radius:6px; padding:10px 14px; margin:12px 0; }
.ot-panel summary { cursor:pointer; font-weight:bold; color:#a6630f; }
.ot-panel li { margin:6px 0; }
.ot-panel li.adopted { opacity:.5; text-decoration:line-through; }

.sticky-actions { position:sticky; bottom:0; background:var(--card-bg); padding:12px 0; border-top:1px solid var(--border); margin-top:18px; }
code { background:var(--th-bg); padding:1px 5px; border-radius:3px; }

/* 登入頁：圖示＋底線輸入框，滿版漸層背景 */
.login-shell { position:fixed; inset:0; z-index:1; display:flex; align-items:center; justify-content:center;
  padding:20px;
  background: radial-gradient(circle at 25% 15%, rgba(255,255,255,.15), transparent 55%),
              linear-gradient(135deg, #c8102e 0%, #7a0016 65%, #4a000d 100%); }
.login-box { width:100%; max-width:360px; color:#fff; text-align:center; }
.login-title { font-size:24px; margin:0 0 6px; font-weight:600; }
.login-sub { color:rgba(255,255,255,.75); font-size:13px; margin:0; }
.login-field { display:flex; align-items:center; gap:12px; border-bottom:1px solid rgba(255,255,255,.4);
  padding:10px 4px; margin:22px 0; text-align:left; }
.login-icon { font-size:18px; opacity:.85; width:22px; text-align:center; flex-shrink:0; }
.login-field input { flex:1; background:transparent; border:none; color:#fff; font-size:16px; outline:none; padding:2px; }
.login-field input::placeholder { color:rgba(255,255,255,.55); }
.login-eye { flex-shrink:0; background:transparent; color:rgba(255,255,255,.85);
  border:1px solid rgba(255,255,255,.4); border-radius:5px; padding:4px 10px; cursor:pointer; font-size:13px; }
.login-eye:hover { background:rgba(255,255,255,.18); }
.login-btn { width:100%; margin-top:12px; background:#fff; color:#b3001b; font-weight:bold; }
.login-btn:hover { background:#f2f2f2; }
.login-hint { margin-top:22px; color:rgba(255,255,255,.7); font-size:13px; }
