/* ============================================
   Components - 通用 UI 元件
   ============================================ */

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(200, 137, 58, 0.3);
}
.btn-primary:active { background: var(--accent-deep); }

.btn-ghost {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid transparent;
}
.btn-ghost:active { background: var(--line-soft); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-outline:active { background: var(--bg-soft); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:active { background: var(--danger-soft); }

.btn-block {
  display: flex;
  width: 100%;
}
.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--r-sm);
}
.btn-lg {
  padding: 16px 24px;
  font-size: 15px;
  border-radius: var(--r-lg);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.card.flat {
  box-shadow: none;
  border-color: var(--line);
}
.card-soft {
  background: var(--bg-soft);
  border: none;
  border-radius: var(--r-lg);
  padding: 16px;
}

/* ---------- 表單 ---------- */
.form-field {
  display: block;
  margin-bottom: 14px;
}
.form-field label,
.form-field > span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--r-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 137, 58, 0.12);
}
/* 時間 / 日期 input:在 iOS 上原生 UI 會撐很寬,這裡縮緊 padding 與字級 */
.form-field input[type="time"],
.form-field input[type="date"] {
  padding: 9px 10px;
  font-size: 14px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.form-row .form-field input[type="date"],
.form-row .form-field input[type="time"] {
  font-size: 13px;
  padding: 8px 8px;
}
.form-field .hint {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
  white-space: pre-line;
}
.form-field .error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* 水平排版表單 */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* 切換組(分段控制) */
.segment {
  display: inline-flex;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.segment-item {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: calc(var(--r-md) - 3px);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.segment-item.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.segment.block {
  display: grid;
  width: 100%;
}
.segment.block.three { grid-template-columns: 1fr 1fr 1fr; }
.segment.block.two { grid-template-columns: 1fr 1fr; }
.segment.block .segment-item {
  text-align: center;
}

/* 顏色選擇 */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
  position: relative;
}
.color-dot:active { transform: scale(0.9); }
.color-dot.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--bg);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s ease;
}
@media (min-width: 640px) {
  .modal { align-items: center; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 32, 24, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-elev);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 92vh;
  overflow-y: auto;
  padding-bottom: var(--safe-bottom);
  animation: slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (min-width: 640px) {
  .modal-card {
    border-radius: var(--r-xl);
    max-height: 85vh;
  }
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--line-strong);
  border-radius: var(--r-pill);
  margin: 8px auto 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 8px;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.modal-body {
  padding: 8px 20px 20px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--toast-bg);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
  opacity: 0;
  white-space: nowrap;
  max-width: 90vw;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ---------- Badge / Tag ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  color: var(--text-soft);
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--accent-deep); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* ---------- 列表項 ---------- */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}
.list-item:active { background: var(--bg-soft); }
.list-item:last-child { border-bottom: none; }
.list-item .left { display: flex; align-items: center; gap: 12px; }
.list-item .right { color: var(--text-mute); font-size: 13px; }
.list-item .chevron { color: var(--text-dim); }

.list-group {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line-soft);
}

/* ---------- Loading / Empty ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-mute);
}
.empty-state .icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.4;
}
.empty-state p {
  font-size: 14px;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 0%, var(--line-soft) 50%, var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- 同步狀態指示 ---------- */
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-mute);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
}
.sync-indicator.ok { color: var(--success); background: var(--success-soft); }
.sync-indicator.err { color: var(--danger); background: var(--danger-soft); }

/* 補休餘額提示 */
.comp-balance {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--accent-deep);
  font-weight: 500;
  line-height: 1.4;
}

/* FAB 選單 */
.fab-menu-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
}
.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, transform 0.1s;
}
.fab-menu-item:active {
  background: var(--accent-soft);
  transform: scale(0.98);
}
.fab-menu-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  border-radius: 50%;
  flex-shrink: 0;
}
.fab-menu-text { flex: 1; min-width: 0; }
.fab-menu-text .title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.fab-menu-text .sub {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 2px;
}
.fab-menu-item .chevron {
  color: var(--text-dim);
  font-size: 22px;
  font-weight: 300;
}

/* 自訂時段列(可刪除版本) */
.quick-shift-custom-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 8px;
}
.quick-shift-delete {
  color: var(--danger);
  width: 40px;
  flex-shrink: 0;
}
.quick-shift-add {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-soft);
}

/* ============================================
   同步狀態指示器
   ============================================ */
.sync-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: auto;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-mute);
  transition: background 0.15s;
}
.sync-badge:active { background: var(--bg-soft); }
.sync-badge.sync-idle    { color: var(--success, #5a8a5a); }
.sync-badge.sync-syncing { color: var(--accent); }
.sync-badge.sync-pending { color: var(--accent-deep); }
.sync-badge.sync-offline { color: var(--text-mute); }
.sync-badge.sync-error   { color: var(--danger); }
.sync-badge.sync-pending {
  background: var(--accent-soft);
  border-radius: 12px;
}
.sync-count {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.sync-badge .spin { animation: spin 1.2s linear infinite; transform-origin: center; }

/* 同步詳情 modal */
.sync-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.sync-detail-row .label { color: var(--text-mute); }
.sync-detail-row .value { font-weight: 500; }
.sync-detail-row .value.sync-state-idle    { color: var(--success, #5a8a5a); }
.sync-detail-row .value.sync-state-syncing { color: var(--accent); }
.sync-detail-row .value.sync-state-pending { color: var(--accent-deep); }
.sync-detail-row .value.sync-state-offline { color: var(--text-mute); }
.sync-detail-row .value.sync-state-error   { color: var(--danger); }
.sync-detail-error {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  margin-top: 8px;
  word-break: break-word;
}

/* ============================================
   進階選項收合(打卡 / 編輯紀錄)
   ============================================ */
.adv-options {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
}
.adv-options summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}
.adv-options summary::-webkit-details-marker { display: none; }
.adv-options summary .chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-mute);
  border-bottom: 2px solid var(--text-mute);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.adv-options[open] summary .chevron { transform: rotate(225deg); }
.adv-options[open] summary {
  border-bottom: 1px dashed var(--line);
  color: var(--accent-deep);
}
.adv-options .adv-content {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- 進階選項子項目(加班規則 / 額外津貼)---------- */
.adv-sub {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  overflow: hidden;
}
.adv-sub > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
.adv-sub > summary::-webkit-details-marker { display: none; }
.adv-sub-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 0 0 auto;
}
.adv-sub-desc {
  font-size: 11px;
  color: var(--text-mute);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adv-sub > summary .chevron {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-mute);
  border-bottom: 2px solid var(--text-mute);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.adv-sub[open] > summary .chevron { transform: rotate(225deg); }
.adv-sub[open] > summary {
  border-bottom: 1px solid var(--line);
}
.adv-sub-content {
  padding: 12px;
}

/* ---------- 額外津貼編輯器 ---------- */
.allowance-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.allowance-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.allowance-name {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 14px;
  background: var(--bg-soft);
  color: var(--text);
}
.allowance-amt {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 3px;
  width: 96px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
}
.allowance-amt .unit {
  font-size: 12px;
  color: var(--text-mute);
  flex: 0 0 auto;
}
.allowance-amt input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  text-align: right;
  outline: none;
}
.allowance-del {
  flex: 0 0 auto;
}
.allowance-add {
  align-self: flex-start;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
}
.allowance-sum {
  font-size: 12px;
  color: var(--text-mute);
  text-align: right;
  margin-top: 2px;
}
.allowance-empty {
  font-size: 12px;
  color: var(--text-mute);
  padding: 4px 0;
}

/* ---------- 班次備註輸入 ---------- */
.note-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  min-height: 44px;
}
.note-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}

/* ---------- 請假假別 chips(休假彈窗)---------- */
.leave-type-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.leave-type-chip {
  padding: 7px 13px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  border: 1px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
}
.leave-type-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- 跨夜班 toggle 列 ---------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  cursor: pointer;
}
.toggle-row-text { flex: 1; min-width: 0; }
.toggle-row-title { font-size: 14px; font-weight: 600; color: var(--text); }
.toggle-row-sub { font-size: 11px; color: var(--text-mute); margin-top: 2px; line-height: 1.4; }
.toggle-checkbox {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============================================================
   通知鈴鐺 + 通知中心 + 過期換現彈跳 + 休假額度
   ============================================================ */

/* 鈴鐺(嵌在 header 按鈕排,取代原設定齒輪位置) */
.notify-bell {
  position: relative;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: transparent;
  border: none;
  color: var(--text-soft, #5a5048);
  cursor: pointer;
}
.notify-bell-dot {
  position: absolute;
  top: 0; right: 0;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger, #e5484d);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* 通知中心項目 */
.notify-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  touch-action: pan-y;
  will-change: transform;
}
.notify-item.read { opacity: 0.55; }
.notify-item-icon { font-size: 20px; flex-shrink: 0; }
.notify-item-main { flex: 1; min-width: 0; }
.notify-item-title { font-weight: 600; font-size: 14px; }
.notify-item-body { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.notify-item-time { font-size: 11px; color: var(--text-mute); margin-top: 4px; }
.notify-item-del {
  flex-shrink: 0;
  width: 24px; height: 24px;
  color: var(--text-mute);
  font-size: 14px;
}
.notify-item:not(.read) .notify-item-title::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--info);
  margin-right: 6px;
  vertical-align: middle;
}

/* 過期換現彈跳 */
.expire-group {
  border: 1px solid var(--line);
  border-radius: var(--r-md, 10px);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg-soft, #faf8f4);
}
.expire-group-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.expire-group-name { font-weight: 600; font-size: 14px; flex: 1; }
.expire-group-company { font-size: 11px; color: var(--text-mute); }
.expire-group-actions { display: flex; gap: 8px; }
.expire-group-actions .btn { flex: 1; }

/* 換現選項 */
.cashout-options { display: flex; flex-direction: column; gap: 8px; }
.cashout-opt {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md, 10px);
  background: var(--bg-card);
}
.cashout-opt.active {
  border-color: var(--accent);
  background: var(--bg-soft, #faf3e8);
}
.cashout-amount {
  margin-top: 12px;
  font-size: 18px; font-weight: 700;
  color: var(--accent);
  text-align: center;
}

/* 休假額度卡片(公司設定頁) */
.quota-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md, 10px);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg-card);
}
.quota-row-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.quota-name { font-weight: 600; font-size: 15px; flex: 1; }
.quota-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-soft, #eee);
  color: var(--text-mute);
}
.quota-info-line { font-size: 13px; color: var(--text-mute); margin: 2px 0; }
.quota-actions { display: flex; gap: 12px; margin-top: 8px; }
.quota-batch-edit {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.quota-batch-title {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; font-size: 13px; margin-bottom: 6px;
}
.quota-sum-line {
  font-weight: 600; font-size: 13px;
  color: var(--accent);
  margin-top: 6px;
}
.btn-text.danger { color: var(--danger); }

/* 休假額度進階設定 可展開列(明顯可點) */
.quota-adv-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  margin: 12px 0 4px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: var(--r-md, 10px);
  background: var(--bg-soft, #f3ede0);
  cursor: pointer;
  text-align: left;
}
.quota-adv-toggle-main { display: flex; flex-direction: column; gap: 2px; }
.quota-adv-toggle-title { font-weight: 600; font-size: 14px; color: var(--text, #2a2622); }
.quota-adv-toggle-sub { font-size: 11px; color: var(--text-mute, #948a7e); }
.quota-adv-toggle-caret { font-size: 14px; color: var(--text-mute, #948a7e); }

/* 過期處理撤銷卡 */
.undo-info-card {
  border: 1px solid var(--line, #e5e5e5);
  border-radius: var(--r-md, 10px);
  padding: 14px;
  background: var(--bg-soft, #f3ede0);
}
.undo-info-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; color: var(--text, #2a2622); }
.undo-info-line { font-size: 13px; color: var(--text-soft, #5a5048); margin: 3px 0; }

/* 每日明細圖:工時/休假 維度切換 */
.work-dim-seg {
  display: inline-flex;
  gap: 0;
  margin: 4px 0 8px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: 8px;
  overflow: hidden;
}
.work-dim-btn {
  padding: 5px 16px;
  font-size: 13px;
  background: transparent;
  border: none;
  color: var(--text-soft, #5a5048);
  cursor: pointer;
}
.work-dim-btn.active {
  background: var(--accent, #c8893a);
  color: #fff;
  font-weight: 600;
}

/* 近期工時趨勢圖卡 */
.trend-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 4px 0; background: transparent; border: none;
  cursor: pointer;
}
.trend-toggle-title { font-size: 16px; font-weight: 600; color: var(--text, #2a2622); }
.trend-toggle-caret { font-size: 14px; color: var(--text-mute, #948a7e); }
.trend-controls {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px;
}

/* 過期彈窗:來源明細 */
.expire-group-sources {
  margin: 6px 0 10px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.025);
  border-radius: 8px;
}
.expire-source-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-soft, #5a5048);
  padding: 2px 0;
}
.expire-source-label { flex: 1; }
.expire-source-hours { font-weight: 600; color: var(--text, #2a2622); }

/* 主頁列表檢視 */
.cal-list-view { padding: 8px 0 80px; }
.cal-list-date {
  font-size: 13px; font-weight: 600;
  color: var(--text-soft, #5a5048);
  margin: 14px 4px 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft, #f0ebe0);
}
.icon-btn.active {
  background: var(--accent, #c8893a);
  color: #fff;
}

/* 主頁搜尋檢視 */
.cal-search-view { padding: 8px 0 80px; }
.cal-search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0 12px;
}
.cal-search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line, #e5e5e5);
  border-radius: 10px;
  font-size: 15px;
  background: var(--bg-card);
  color: var(--text, #2a2622);
}
.cal-search-count {
  font-size: 12px; color: var(--text-mute, #948a7e);
  margin: 4px 4px 8px;
}
.cal-search-results { min-height: 200px; }

/* 休假額度剩餘卡:控制列 */
.leave-ov-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap; margin: 10px 0 8px;
}
.leave-ov-controls .work-dim-seg { flex-shrink: 0; }
.leave-ov-controls .btn { flex-shrink: 0; white-space: nowrap; }
.leave-ov-wrap { margin-top: 4px; }

/* 休假額度剩餘:列表美化 */
.leave-overview-body { margin-top: 4px; }

/* 公司分組標題 */
.leave-ov-company {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700;
  color: var(--text);
  margin: 14px 0 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.leave-ov-company:first-child { margin-top: 4px; }
.leave-ov-company .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* 假別列:名稱左、時數右,同一行 */
.leave-ov-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.leave-ov-row:last-child { border-bottom: none; }
.leave-ov-name {
  font-size: 14px; color: var(--text);
  flex: 1; min-width: 0;
}
.leave-ov-val {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 1px; flex-shrink: 0; text-align: right;
}
.leave-ov-hours {
  font-size: 14px; font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.leave-ov-note {
  font-size: 11px; color: var(--text-mute);
}

/* 每日明細圖:圖例 */
.work-chart-legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  justify-content: center;
  margin: 10px 0 2px;
  padding: 0 4px;
}
.legend-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-soft);
}
.legend-dot {
  width: 11px; height: 11px; border-radius: 3px;
  flex-shrink: 0; display: inline-block;
}
/* 走勢線:細長條 */
.legend-line {
  width: 16px; height: 3px; border-radius: 2px;
}
/* 加班:斜紋 */
.legend-hatch {
  background-image: repeating-linear-gradient(
    45deg, rgba(255,255,255,0.5) 0 2px, transparent 2px 4px
  );
  background-blend-mode: overlay;
}

/* 收入組成:可點擊的圖例列 */
.pie-legend-clickable {
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s;
}
.pie-legend-clickable:active { background: var(--bg-soft); }
.pie-legend-chev {
  color: var(--text-mute);
  font-size: 15px;
  margin-left: 4px;
}

/* 扣項合計:可點擊 bar */
.income-deduction-bar {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 12px 14px;
  margin-top: 4px;
  background: var(--bg-soft);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.income-deduction-bar .lbl { font-size: 14px; color: var(--text-soft); }
.income-deduction-bar .amt { margin-left: auto; font-weight: 700; font-family: var(--font-mono); }
.income-deduction-bar .amt.neg { color: var(--danger); }

/* 共用明細視窗 */
.breakdown-note {
  font-size: 12px; color: var(--text-mute);
  background: var(--bg-soft);
  padding: 10px 12px; border-radius: 8px;
  margin-bottom: 12px; line-height: 1.5;
}
.breakdown-list { display: flex; flex-direction: column; }
.breakdown-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 11px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row-main { flex: 1; min-width: 0; }
.breakdown-row-label { font-size: 14px; color: var(--text); }
.breakdown-row-sub { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.breakdown-row-amt {
  font-weight: 700; font-family: var(--font-mono);
  font-variant-numeric: tabular-nums; color: var(--text);
  flex-shrink: 0;
}
.breakdown-row-amt.neg { color: var(--danger); }
.breakdown-total {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 12px;
  border-top: 2px solid var(--line);
  font-size: 15px; font-weight: 600; color: var(--text);
}
.breakdown-total-amt { font-family: var(--font-mono); font-weight: 700; }
.breakdown-total-amt.neg { color: var(--danger); }

/* 休假時間段:快速帶入 */
.leave-quick-shifts {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 4px 0 8px;
}
.leave-quick-label {
  font-size: 11px; color: var(--text-mute);
  margin-right: 2px;
}
.leave-quick-chip {
  padding: 5px 12px;
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-soft);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.leave-quick-chip:active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* ===== 分享功能 ===== */
.share-label {
  display: block; font-size: 12px; color: var(--text-mute);
  margin: 14px 0 6px; letter-spacing: 0.03em;
}
.share-pw-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-soft);
  margin-top: 16px; cursor: pointer;
}
.share-result { margin-top: 16px; }
.share-result-title { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 8px; }
.share-url-box {
  font-size: 12px; word-break: break-all;
  background: var(--bg-soft); padding: 10px 12px;
  border-radius: 8px; color: var(--text-soft);
  font-family: var(--font-mono);
}
.share-hist-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.share-hist-row.expired { opacity: 0.5; }
.share-hist-title { font-size: 14px; color: var(--text); }
.share-hist-sub { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

/* 接收唯讀頁 */
.shared-screen { padding: 0 16px 40px; max-width: 560px; margin: 0 auto; }
.shared-center {
  min-height: 70vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  text-align: center; padding: 0 24px;
}
.shared-center-text { font-size: 15px; color: var(--text-soft); }
.shared-error-text { font-size: 12px; color: var(--danger); margin: 4px 0; }
.shared-pw-input {
  margin-top: 14px; max-width: 280px; width: 100%;
}
.shared-spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: shared-spin 0.8s linear infinite;
}
@keyframes shared-spin { to { transform: rotate(360deg); } }
.shared-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 4px 12px;
}
.shared-title { font-size: 20px; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.shared-badge {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-deep); font-weight: 600;
}
.shared-month-switch {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 8px 0 16px;
}
.shared-month-label { font-size: 16px; font-weight: 600; color: var(--text); min-width: 120px; text-align: center; }
.shared-total-card {
  background: var(--hero-grad); border: 1px solid var(--line-soft);
  border-radius: var(--r-xl); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.shared-total-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--text-soft); padding: 5px 0;
}
.shared-total-row .v { font-weight: 600; color: var(--text); font-family: var(--font-mono); }
.shared-total-row .v.muted { color: var(--text-mute); }
.shared-total-row.big { font-size: 17px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.shared-total-row.big .v { color: var(--accent); font-size: 20px; }
.shared-co-card {
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 12px;
}
.shared-co-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.shared-co-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.shared-co-name { font-weight: 600; color: var(--text); }
.shared-co-row {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text-soft); padding: 3px 0;
}
.shared-co-row.total { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line-soft); font-weight: 600; color: var(--text); }
.shared-foot { font-size: 11px; color: var(--text-mute); text-align: center; margin-top: 20px; line-height: 1.6; }

/* modal 內未包在 .form-field 的 input(如分享密碼、貼連結),統一套用好看的輸入框樣式 */
.modal-body > input[type="text"],
.modal-body > input[type="password"],
.modal-body > input[type="number"],
.modal-body > input[type="search"],
.modal-body > div > input[type="text"],
.modal-body > div > input[type="password"],
.pw-input-wrap > input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--r-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-body > input[type="text"]:focus,
.modal-body > input[type="password"]:focus,
.modal-body > input[type="number"]:focus,
.modal-body > input[type="search"]:focus,
.modal-body > div > input[type="text"]:focus,
.modal-body > div > input[type="password"]:focus,
.pw-input-wrap > input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 137, 58, 0.12);
}
/* 接收唯讀頁的密碼輸入框 */
.shared-pw-input {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--r-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.shared-pw-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 137, 58, 0.12);
}

/* 每日明細:放大鈕 */
.chart-zoom-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: var(--bg-soft);
  border-radius: 8px; color: var(--text-soft); cursor: pointer;
}
.chart-zoom-btn:active { background: var(--line); }

/* 放大視窗 */
.zoom-modal-card { max-height: 92vh; }
.zoom-chart-scroller {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
/* 橫向長條模式:固定高度上限,內容超出才上下捲動 */
.zoom-chart-scroller.vertical-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  height: 68vh;
  max-height: 68vh;
}
.zoom-chart-box {
  height: 420px;
  min-width: 100%;
}
.zoom-chart-box canvas { height: 100% !important; }

/* ===== 分享接收:唯讀 App 外框 ===== */
.shared-top-banner {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  background: var(--accent-deep, #a86d2a);
  color: #fff;
  font-size: 13px; font-weight: 600;
}
.shared-top-left { display: flex; align-items: center; gap: 7px; }
.shared-top-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; opacity: 0.9; }
.shared-top-exit {
  background: rgba(255,255,255,0.2); color: #fff;
  border: none; border-radius: 999px;
  padding: 5px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.shared-top-exit:active { background: rgba(255,255,255,0.35); }
.shared-tabbar { grid-template-columns: 1fr 1fr !important; }

/* 放大視窗圖例 */
.zoom-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 4px 2px 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 10px;
}
.zoom-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-soft);
}
.zoom-legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

/* 密碼欄:顯示/隱藏切換 */
.pw-input-wrap { display: flex; gap: 8px; align-items: stretch; }
.pw-input-wrap input { flex: 1; }
.pw-reveal-btn {
  flex-shrink: 0; padding: 0 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-md); color: var(--text-soft);
  font-size: 13px; cursor: pointer;
}
.pw-reveal-btn:active { background: var(--line); }
/* 分享紀錄:按鈕組 */
.share-hist-btns { display: flex; gap: 6px; flex-shrink: 0; }

/* 公司篩選 chip(主頁篩選列 + 分享公司選擇共用) */
.cofilter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--bg-soft);
  background: var(--bg-soft);
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cofilter-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
}
.cofilter-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* 清單項目:大字標題 + 小字副標(讓專有名詞當輔助說明) */
.li-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.li-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.25; }
.li-sub { font-size: 12px; color: var(--text-mute); line-height: 1.2; }

/* Modal 標題下的小字副標 */
.modal-sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; }

/* 強調版分段選擇:選中項用強調色填滿(比白底版更明顯) */
.segment.segment--accent .segment-item.active {
  background: var(--accent, #c8893a);
  color: #fff;
  box-shadow: none;
}
