:root{--brand:#89c8d3;--ink:#172026;--muted:#66757d;--bg:#f3f7f8;--danger:#b83b3b;--ok:#19734d}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-family:"Microsoft JhengHei",system-ui,sans-serif}
button,input,select,textarea{font:inherit}.shell{max-width:1050px;margin:auto;padding:14px 12px 90px}.card{background:#fff;border-radius:18px;padding:18px;margin:12px 0;box-shadow:0 5px 18px #0000000e}
.login{max-width:420px;margin:8vh auto}.brand{font-weight:900;color:#37747e}h1{font-size:24px}h2{font-size:19px;margin:0 0 14px}
label{display:block;font-weight:700;margin:10px 0}input,select,textarea{width:100%;padding:12px;border:1px solid #cfdcdf;border-radius:11px;background:#fff;margin-top:5px}textarea{resize:vertical;line-height:1.6}
button{border:0;border-radius:11px;padding:11px 14px;font-weight:800;cursor:pointer}.primary{width:100%;background:var(--brand);color:#10252a}
.top{display:flex;justify-content:space-between;align-items:center}.top small{display:block;color:var(--muted)}
.tabs{position:sticky;top:0;z-index:5;display:flex;gap:6px;overflow:auto;background:var(--bg);padding:8px 0}.tabs button{white-space:nowrap}.tabs .active{background:var(--ink);color:#fff}
.page{display:none}.page.active{display:block}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.grid3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}.admin-grid{display:grid;grid-template-columns:2fr 1fr;gap:12px}
.shift{display:grid;grid-template-columns:105px 1fr auto;gap:10px;padding:12px 0;border-bottom:1px solid #edf1f2}.time{font-weight:900;color:#2f6f79}
.badge{display:inline-block;padding:4px 9px;border-radius:999px;background:#edf4f5;font-size:13px}.danger{color:var(--danger)}.ok{color:var(--ok)}
.warning{background:#fff1f1;border:1px solid #efb6b6;color:#8d2020;padding:12px;border-radius:12px;margin:10px 0;font-weight:800}.safe{background:#effaf5;color:#146343;padding:10px;border-radius:12px;margin:10px 0}
.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;min-width:650px}th,td{padding:9px;border-bottom:1px solid #edf1f2;text-align:left}th{background:#eef5f6}
.salary-total{font-size:24px;font-weight:900;background:var(--ink);color:#fff;border-radius:14px;padding:16px;display:flex;justify-content:space-between}
.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#172026;color:#fff;padding:12px 18px;border-radius:12px;z-index:30}
.photo{max-width:100%;max-height:210px;border-radius:12px}.muted{color:var(--muted);font-size:13px}.mini{padding:6px 9px;margin:2px}.red{background:#fee;color:#922}
@media(max-width:720px){.grid2,.grid3,.admin-grid{grid-template-columns:1fr}.shell{padding:10px}.tabs{margin:0 -10px;padding:8px 10px}.shift{grid-template-columns:88px 1fr}}
.status-modal{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;background:#10252a80;backdrop-filter:blur(3px);padding:20px}
.status-modal[hidden]{display:none}
.status-box{width:min(88vw,340px);background:#fff;border-radius:22px;padding:28px 22px;text-align:center;box-shadow:0 18px 55px #0004}
.status-box h3{margin:14px 0 8px;font-size:22px}
.status-box p{margin:0;color:var(--muted);line-height:1.6}
.spinner{width:48px;height:48px;margin:auto;border:5px solid #dcebed;border-top-color:var(--brand);border-radius:50%;animation:spin .8s linear infinite}
.status-icon{width:54px;height:54px;margin:auto;border-radius:50%;display:grid;place-items:center;font-size:32px;font-weight:900}
.status-icon.ok{background:#e8f8f0;color:var(--ok)}
.status-icon.error{background:#fff0f0;color:var(--danger)}
@keyframes spin{to{transform:rotate(360deg)}}

.sub-card{border:1px solid #e3ecee;border-radius:14px;padding:14px;margin:10px 0;background:#fff}
.sub-head{display:flex;justify-content:space-between;gap:10px;align-items:center}
.sub-flow{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.sub-arrow{color:var(--muted)}
.sub-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.sub-actions button{flex:1;min-width:90px}
.badge.pending{background:#fff3cd;color:#805d00}
.badge.accepted{background:#e8f8f0;color:#146343}
.badge.rejected{background:#fff0f0;color:#922}
.badge.approved{background:#e6f1ff;color:#205b9a}
/* 手機版月班表：四欄完整顯示，不用左右滑 */
@media (max-width:720px){

  .table-wrap{
    overflow-x:visible;
    width:100%;
  }

  .table-wrap table{
    width:100%;
    min-width:0 !important;
    table-layout:fixed;
    font-size:13px;
  }

  .table-wrap th,
  .table-wrap td{
    padding:8px 3px;
    white-space:normal;
    word-break:break-word;
  }

  .table-wrap th:nth-child(1),
  .table-wrap td:nth-child(1){
    width:31%;
  }

  .table-wrap th:nth-child(2),
  .table-wrap td:nth-child(2){
    width:27%;
  }

  .table-wrap th:nth-child(3),
  .table-wrap td:nth-child(3){
    width:26%;
  }

  .table-wrap th:nth-child(4),
  .table-wrap td:nth-child(4){
    width:16%;
    text-align:center;
  }
}

/* ===== 員工公告 / 禁止排休 ===== */
.staff-marquee{display:flex;align-items:center;gap:10px;background:#fff7d6;border:1px solid #f0d979;border-radius:14px;padding:9px 11px;margin:8px 0 4px;overflow:hidden;box-shadow:0 3px 12px #00000008}
.staff-marquee[hidden]{display:none}
.staff-marquee-label{flex:0 0 auto;font-size:13px;font-weight:900;color:#7a5b00;white-space:nowrap}
.staff-marquee-window{min-width:0;flex:1;overflow:hidden;white-space:nowrap}
.staff-marquee-text{display:inline-block;min-width:100%;padding-left:100%;font-weight:900;color:#6e4f00;animation:staffMarquee 18s linear infinite}
@keyframes staffMarquee{from{transform:translateX(0)}to{transform:translateX(-100%)}}

.notice-modal{position:fixed;inset:0;z-index:1100;display:grid;place-items:center;background:#10252a99;backdrop-filter:blur(4px);padding:18px}
.notice-modal[hidden]{display:none}
.notice-modal-box{width:min(92vw,430px);max-height:82vh;overflow:auto;background:#fff;border-radius:24px;padding:24px 20px;text-align:center;box-shadow:0 20px 70px #0005;border-top:7px solid var(--brand)}
.notice-modal-icon{font-size:38px}
.notice-modal-box h2{font-size:23px;margin:8px 0 12px}
.notice-modal-body{text-align:left;line-height:1.8;white-space:pre-wrap;background:#f7fbfc;border-radius:14px;padding:14px;margin-bottom:12px}
.notice-blocked{text-align:left;background:#fff1f1;border:1px solid #efb6b6;color:#8d2020;border-radius:13px;padding:12px;margin:12px 0;font-weight:800;line-height:1.7}
.notice-blocked[hidden]{display:none}
.blocked-date-list{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}
.blocked-date-chip{display:inline-block;background:#ffe4e4;color:#8d2020;border-radius:999px;padding:5px 9px;font-size:13px;font-weight:900}
.checkline{display:flex;align-items:center;gap:9px;background:#f7fbfc;padding:10px 12px;border-radius:12px}
.checkline input{width:auto;margin:0;transform:scale(1.2)}
.notice-admin-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:14px}
.notice-admin-actions button{width:100%}
.notice-admin-card textarea{min-height:70px}
#offRestrictionNotice .restriction-card{background:#fff7d6;border:1px solid #f0d979;color:#6e4f00;border-radius:12px;padding:11px;margin-bottom:10px;line-height:1.6}
#offRestrictionNotice .restriction-card strong{display:block;margin-bottom:5px}
@media(max-width:720px){.notice-admin-actions{grid-template-columns:1fr}.staff-marquee{border-radius:12px}.staff-marquee-label{font-size:12px}.notice-modal-box{padding:20px 16px}}

/* ===== 小野人員工管理 App V1：iPhone-first 介面 ===== */
html{background:var(--bg);-webkit-text-size-adjust:100%}
body{min-height:100dvh;padding-top:env(safe-area-inset-top);-webkit-tap-highlight-color:transparent}
.shell{padding-bottom:calc(92px + env(safe-area-inset-bottom))}
.app-mark{width:58px;height:58px;border-radius:18px;background:var(--brand);display:grid;place-items:center;font-size:27px;font-weight:900;margin:0 auto 14px;color:#173239;box-shadow:0 8px 22px #89c8d355}
.login{text-align:center;padding:28px 22px}.login label{text-align:left}.login h1{margin:5px 0 4px;font-size:27px}.login-subtitle{margin:0 0 22px;color:var(--muted);font-size:14px}
.app-eyebrow{display:block;color:#37747e;font-size:10px;letter-spacing:.16em;font-weight:900;margin-bottom:3px}.top b{display:block;font-size:20px}.logout-btn{background:#fff;border:1px solid #dce7e9;color:#52656b;padding:8px 12px}
@media(max-width:720px){
  .shell{max-width:none;padding:10px 12px calc(92px + env(safe-area-inset-bottom))}
  #appView{padding-top:2px}
  .top{padding:8px 3px 7px}
  .card{border-radius:17px;padding:16px;margin:10px 0;box-shadow:0 3px 14px #0000000b}
  input,select,textarea{font-size:16px;min-height:46px}
  button{min-height:44px}
  .tabs{position:fixed;left:0;right:0;bottom:0;top:auto;z-index:900;margin:0;padding:7px 6px calc(7px + env(safe-area-inset-bottom));gap:2px;display:flex;justify-content:space-around;overflow-x:auto;background:#fffffff2;border-top:1px solid #dce7e9;box-shadow:0 -5px 22px #00000010;backdrop-filter:blur(14px)}
  .tabs button{flex:1 0 52px;min-width:52px;max-width:78px;padding:5px 2px 4px;border-radius:12px;background:transparent;color:#697b80;font-size:10px;line-height:1.15;min-height:51px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px}
  .tabs .active{background:#e7f3f5;color:#285f68}
  .tab-icon{font-size:19px;font-weight:900;line-height:1}
  .staff-marquee{margin:4px 0 8px}
  .salary-total{font-size:21px}
}
@media(min-width:721px){.tab-icon{display:none}}


/* ===== 員工管理 App V2：商用品牌 / iPhone 登入頁 ===== */
body{background:radial-gradient(circle at 8% 7%,#d9f0f3 0 12%,transparent 28%),radial-gradient(circle at 95% 82%,#d5eef2 0 13%,transparent 29%),#f4f9fa}
.login{max-width:390px;margin:clamp(24px,7vh,68px) auto;padding:24px 22px 22px;border:1px solid #e3eef0;box-shadow:0 18px 48px #174a5520}
.login-logo{width:92px;height:74px;margin:0 auto 8px;color:#159aaa}
.login-logo svg{width:100%;height:100%;display:block}
.login h1{font-size:28px;letter-spacing:.04em;margin:2px 0 3px;color:#103a51}
.login-english{font-size:9px;letter-spacing:.24em;color:#70848d;font-weight:800;margin-bottom:10px}
.login-subtitle{font-size:13px;letter-spacing:.04em;margin:0 0 18px;color:#667b84}
.login .primary{background:linear-gradient(135deg,#43bdc8,#159aaa);color:white;box-shadow:0 8px 18px #159aaa35}
.login input,.login select{background:#fbfdfe;border-color:#cbdde1}
@media(max-width:480px){
 body{background:#f4f9fa}
 .shell{padding-left:14px;padding-right:14px}
 .login{margin:18px auto 0;max-width:100%;padding:20px 18px 18px;border-radius:22px}
 .login-logo{width:80px;height:65px;margin-bottom:5px}
 .login h1{font-size:25px}
 .login-subtitle{margin-bottom:14px}
 .login label{margin:8px 0}
 .login input,.login select{min-height:48px}
}

/* ===== 員工管理 App V3：iPhone 實機修正 ===== */
label{min-width:0}
input[type="date"],input[type="month"]{
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
  inline-size:100%;
  box-sizing:border-box;
}
.tab-icon{width:22px;height:22px;display:grid;place-items:center}
.tab-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}

@media(max-width:720px){
  /* App 內容永遠避開瀏海／動態島與狀態列 */
  body{padding-top:0}
  .shell{padding-top:calc(env(safe-area-inset-top) + 14px)}
  #appView{padding-top:0}
  .top{min-height:82px;padding:8px 3px 10px;align-items:flex-start}
  .logout-btn{margin-top:2px}

  /* iOS date/month 具有自己的 intrinsic width，強制限制在卡片內 */
  .card,.card label,.grid2,.grid3,.admin-grid{min-width:0;max-width:100%}
  input,select,textarea{max-width:100%;min-width:0}
  input[type="date"],input[type="month"]{-webkit-min-logical-width:0}

  /* 公告在手機直接完整換行，不再只看到半句 */
  .staff-marquee{align-items:flex-start;overflow:visible;padding:10px 12px;gap:9px}
  .staff-marquee-window{overflow:visible;white-space:normal;min-width:0}
  .staff-marquee-text{display:block;min-width:0;padding-left:0;white-space:normal;word-break:break-word;line-height:1.45;animation:none}

  /* 底部圖示統一為線條 icon */
  .tabs button{font-size:10px;gap:2px}
  .tab-icon{font-size:0}
}

/* ===== 員工管理 App V4：真正 Web Push 通知介面 ===== */
.top-actions{display:flex;align-items:flex-start;gap:7px}
.notification-btn{position:relative;background:#fff;border:1px solid #dce7e9;color:#41656d;padding:8px 10px;display:inline-flex;align-items:center;gap:5px;min-height:38px}
.notification-btn-text{font-size:12px;font-weight:800}
.notification-dot{position:absolute;right:5px;top:5px;width:7px;height:7px;border-radius:50%;background:#e1a62c;box-shadow:0 0 0 2px #fff}
.notification-dot.on{background:#2faf78}.notification-dot.off{background:#d95f5f}
.push-modal{position:fixed;inset:0;z-index:1250;display:grid;place-items:center;background:#10252a99;backdrop-filter:blur(5px);padding:18px}
.push-modal[hidden]{display:none}
.push-modal-box{position:relative;width:min(92vw,430px);max-height:86vh;overflow:auto;background:#fff;border-radius:24px;padding:24px 20px 20px;text-align:center;box-shadow:0 24px 80px #0005;border-top:7px solid var(--brand)}
.push-close{position:absolute;right:12px;top:10px;width:38px;height:38px;min-height:38px;border:0;background:#f2f6f7;border-radius:50%;font-size:25px;line-height:1;color:#63767c;padding:0}
.push-icon{font-size:38px;margin-top:2px}.push-modal-box h2{margin:5px 0 8px;font-size:23px}.push-intro{line-height:1.65;text-align:left;margin-bottom:12px}
.push-status-card{display:flex;align-items:center;gap:12px;text-align:left;background:#f5fafb;border:1px solid #dcebee;border-radius:15px;padding:13px;margin:12px 0}
.push-status-icon{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:#dceff2;font-weight:900;font-size:18px;flex:0 0 auto}
.push-status-card b,.push-status-card small{display:block}.push-status-card small{color:var(--muted);margin-top:3px;line-height:1.4}
.push-status-card.ok{background:#effaf5;border-color:#bce8d4}.push-status-card.ok .push-status-icon{background:#d5f2e4;color:#17734d}
.push-status-card.warn{background:#fff9e9;border-color:#eedca0}.push-status-card.warn .push-status-icon{background:#fff0b7;color:#805d00}
.push-status-card.error{background:#fff1f1;border-color:#efc2c2}.push-status-card.error .push-status-icon{background:#ffe0e0;color:#a62f2f}
.push-hint{background:#fff7d6;border:1px solid #f0d979;color:#6e4f00;border-radius:12px;padding:11px;text-align:left;line-height:1.6;margin-bottom:10px;font-size:13px;font-weight:700}
#enablePushBtn,#testPushBtn{width:100%;margin-top:9px}.push-sound-note{margin-top:13px;background:#f7fbfc;border-radius:12px;padding:11px 12px;text-align:left;font-size:12px;line-height:1.6;color:#5a6c72}.push-footnote{display:block;text-align:left;line-height:1.55;margin-top:10px}
@media(max-width:720px){.notification-btn-text{display:none}.notification-btn{padding:8px 9px}.top-actions{gap:5px}.push-modal{padding:14px}.push-modal-box{padding:22px 16px 18px}}

/* SaaS V1 license gate */
#licenseView .license-logo{font-size:48px;line-height:1;margin-bottom:8px}
#licenseView input{text-transform:uppercase;letter-spacing:.08em}
.license-expired{padding:14px;border-radius:14px;background:#fff4e5;color:#8a5a00;margin:12px 0}
