:root {
  --ink: #253268;
  --muted: #70789d;
  --paper: #ffffff;
  --canvas: #f5f6fc;
  --line: #dfe3f4;
  --teal: #4856bd;
  --teal-dark: #303f9f;
  --mint: #e9ebfb;
  --apricot: #fff0d4;
  --blue: #e8ebff;
  --brand-orange: #ffb132;
  --danger: #b95449;
  --shadow: 0 18px 48px rgba(48, 63, 159, 0.10);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 86% 0, rgba(72, 86, 189, .13), transparent 27rem),
    radial-gradient(circle at 8% 10%, rgba(255, 177, 50, .12), transparent 20rem),
    var(--canvas);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(72, 86, 189, .25);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  min-height: 72px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-logo-crop { display: block; width: 42px; height: 42px; overflow: hidden; flex: 0 0 42px; border-radius: 10px; background: white; box-shadow: 0 7px 18px rgba(48, 63, 159, .18); }
.brand-logo-crop img { display: block; width: 42px; height: auto; }
.brand strong, .brand small, .account strong, .account small { display: block; }
.brand strong { letter-spacing: .08em; }
.brand small, .account small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.app-header nav { display: flex; gap: 8px; }
.app-header nav a {
  padding: 9px 14px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.app-header nav a.active { color: var(--teal-dark); background: var(--mint); font-weight: 800; }
.switch-user-link { display: none; color: var(--teal-dark) !important; border: 1px solid var(--line); background: white; font-weight: 800; }
.account { display: flex; align-items: center; gap: 9px; }
.account > a { margin-left: 8px; color: var(--teal-dark); font-size: 12px; font-weight: 800; text-decoration: none; }
.account-logout { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--mint);
  font-weight: 800;
}

.page-wrap { width: min(1180px, calc(100% - 56px)); margin: 0 auto; padding: 48px 0 70px; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 7px; color: #839592; font-size: 10px; font-weight: 800; letter-spacing: .22em; }
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 9px;
  color: var(--teal-dark);
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 600;
  letter-spacing: -.04em;
}
h2 { margin-bottom: 6px; font-family: Georgia, "Noto Serif TC", serif; font-size: 25px; }
.page-title p:last-child, .panel-title p { margin-bottom: 0; color: var(--muted); }
.title-actions { display: flex; gap: 10px; }
.title-actions input {
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
}
.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { color: white; background: linear-gradient(135deg, var(--teal), var(--teal-dark)); box-shadow: 0 9px 20px rgba(48, 63, 159, .20); }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { border-color: #cbd8d4; color: var(--ink); background: white; box-shadow: none; }
.button:disabled { color: #8c9b98; background: #e3e9e6; box-shadow: none; cursor: default; }

.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: rgba(255, 255, 255, .97); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 0 23px; border-bottom: 1px solid var(--line); }
.panel-header > span { color: var(--muted); font-size: 11px; }
.claim-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.claim-header-actions > span { margin-right: 5px; color: var(--muted); font-size: 11px; }
.header-summary { display: flex; align-items: baseline; gap: 8px; margin-right: 3px; white-space: nowrap; }
.header-summary > span { color: var(--muted); font-size: 11px; }
.header-summary > strong { font-family: Georgia, serif; font-size: 19px; color: var(--ink); }
.claim-header-actions input,.claim-header-actions select { width: 145px; height: 38px; padding: 0 9px; border: 1px solid #cad7d3; border-radius: 9px; color: var(--ink); background: white; font-size: 12px; font-weight: 700; }
.claim-header-actions .button { min-height: 38px; height: 38px; padding: 0 13px; font-size: 11px; white-space: nowrap; }
.claim-deadline-banner { margin: 12px 18px 0; padding: 10px 13px; border: 1px solid #e85b52; border-radius: 10px; color: #a2231c; background: #fff2a8; font-size: 11px; font-weight: 800; }
.claim-deadline-banner.locked { color: #8b302b; background: #fff1ef; }
.tabs button.deadline-alert { padding-right: 9px; padding-left: 9px; border: 1px solid #e85b52; border-radius: 8px; color: #b4231a; background: #fff2a8; animation: claim-alert 1.25s ease-in-out infinite alternate; }
@keyframes claim-alert { from { box-shadow: 0 0 0 rgba(232,91,82,0); } to { box-shadow: 0 0 0 4px rgba(232,91,82,.15); } }
.tabs { display: flex; gap: 22px; }
.tabs button {
  position: relative;
  padding: 19px 0 16px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.tabs button.active { color: var(--teal); font-weight: 800; }
.tabs button.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--teal);
  content: "";
}
.claim-list { min-height: 270px; }
.claim-row {
  display: grid;
  min-height: 76px;
  grid-template-columns: 42px 74px minmax(180px, 1fr) 105px 105px 100px;
  align-items: center;
  gap: 13px;
  padding: 12px 23px;
  border-bottom: 1px solid #edf1ef;
}
.claim-row:hover { background: #f8f9ff; }
.claim-badge { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; font-size: 12px; font-weight: 800; }
.claim-badge.transport { background: var(--mint); }
.claim-badge.purchase { background: var(--apricot); }
.claim-badge.leave { background: var(--blue); }
.claim-row time, .claim-main span { color: var(--muted); font-size: 11px; }
.claim-main strong, .claim-main span { display: block; }
.claim-main strong { margin-bottom: 4px; font-size: 14px; }
.claim-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-chip, .submitted-chip { justify-self: start; padding: 5px 8px; border-radius: 7px; color: #526b67; background: #edf2ef; font-size: 10px; }
.submitted-chip { color: var(--teal); background: var(--mint); }
.claim-value { font-family: Georgia, serif; text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions button { padding: 5px; border: 0; color: var(--teal); background: transparent; font-size: 11px; cursor: pointer; }
.row-actions button.danger { color: var(--danger); }
.empty-state { display: grid; min-height: 270px; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.empty-state > span { display: grid; width: 45px; height: 45px; margin-bottom: 12px; place-items: center; border: 1px dashed #9dbbb4; border-radius: 50%; color: var(--teal); font-size: 22px; }
.empty-state p { margin: 5px 0 0; font-size: 12px; }
.submit-row { display: flex; align-items: center; justify-content: flex-end; gap: 24px; padding: 18px 23px; border-top: 1px solid var(--line); background: #f8faf7; }
.submit-row > div { margin-right: auto; }
.submit-row strong, .submit-row small { display: block; }
.submit-row strong { margin-bottom: 3px; font-size: 13px; }
.submit-row small { color: var(--muted); }

dialog {
  width: min(620px, calc(100% - 28px));
  max-height: 90vh;
  padding: 0;
  overflow-y: auto;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(37, 50, 104, .25);
}
dialog::backdrop { background: rgba(37, 50, 104, .43); backdrop-filter: blur(3px); }
dialog form > header { display: flex; align-items: flex-start; justify-content: space-between; padding: 28px 32px 18px; border-bottom: 1px solid var(--line); }
.dialog-title-row { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 15px; margin-right: 14px; }
dialog h2 { margin-bottom: 0; }
.icon-button { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 22px; cursor: pointer; }
.type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 32px 0; padding: 0; border: 0; }
.type-picker legend { grid-column: 1 / -1; margin-bottom: 7px; color: #566966; font-size: 12px; font-weight: 800; }
.type-picker label { display: flex; min-height: 50px; align-items: center; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 14px; padding: 24px 32px; }
.dynamic-fields { display: contents; }
.form-grid label, .settings-form label { color: #526764; font-size: 12px; font-weight: 800; }
.form-grid input, .form-grid select, .form-grid textarea, .settings-form input, .settings-form select, .login-card input, .login-card select {
  width: 100%;
  margin-top: 7px;
  border: 1px solid #cad7d3;
  border-radius: 9px;
  color: var(--ink);
  background: white;
}
.form-grid input, .form-grid select, .settings-form input, .settings-form select, .login-card input, .login-card select { height: 43px; padding: 0 11px; }
.form-grid textarea { padding: 11px; resize: vertical; }
.form-grid .full, .settings-form .full, .field-help.full, .leave-help.full { grid-column: 1 / -1; }
.field-help { margin: -4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.unit-control { display: grid; grid-template-columns: 1fr 90px; }
.unit-control input { border-radius: 9px 0 0 9px; }
.unit-control select { border-left: 0; border-radius: 0 9px 9px 0; }
.leave-help { padding: 13px 15px; border-left: 3px solid #6f93ac; border-radius: 5px 9px 9px 5px; background: #eef4f7; }
.leave-help p { margin: 4px 0 0; color: #5d7278; font-size: 11px; line-height: 1.6; }
.leave-datetime-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(120px,.55fr); gap: 14px; }
.sheet-entry { margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fafbff; }
.sheet-entry legend { padding: 0 7px; color: var(--teal-dark); font-size: 12px; font-weight: 800; }
.sheet-entry-grid { display: grid; align-items: end; gap: 10px; }
.transport-entry { grid-template-columns: .8fr 1.2fr 1.2fr .75fr .85fr auto; }
.purchase-entry { grid-template-columns: .8fr 1fr 1.2fr .7fr .75fr 1.1fr auto; }
.entry-calculation { display: flex; min-height: 43px; align-items: center; justify-content: flex-end; gap: 7px; padding: 0 10px; border: 1px solid #b8d9cf; border-radius: 9px; color: var(--teal-dark); background: var(--mint); white-space: nowrap; }
.entry-total { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 7px; }
.entry-total .entry-calculation { min-width: 0; padding: 0 8px; font-size: 11px; }
.entry-total .entry-calculation strong { font-size: 13px; }
.entry-total > .button { min-height: 43px; padding: 0 15px; white-space: nowrap; }
.sheet-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.sheet-list > header,.sheet-list > footer { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; background: #f6f8fb; }
.sheet-list > footer { color: var(--teal-dark); border-top: 1px solid var(--line); }
.sheet-list > footer strong { font-size: 18px; }
.sheet-item-row { display: grid; grid-template-columns: 22px 48px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 10px 13px; border-top: 1px solid #edf0f5; }
.sheet-item-row:first-child { border-top: 0; }
.sheet-item-row time,.sheet-item-row small { color: var(--muted); font-size: 10px; }
.sheet-item-row strong,.sheet-item-row small { display: block; }
.empty-sheet-list { padding: 20px; color: var(--muted); text-align: center; font-size: 11px; }
.inbox-row { grid-template-columns: 22px minmax(0,1fr) auto auto; }
.review-item { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbff; }
.review-item > strong { grid-column: 1 / -1; }
dialog form > footer { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 32px 26px; border-top: 1px solid var(--line); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: 10px;
  color: white;
  background: var(--teal-dark);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

.admin-tabs { display: flex; gap: 8px; margin: 30px 0 14px; }
.admin-tabs button { padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--paper); cursor: pointer; }
.admin-tabs button.active { color: white; border-color: var(--teal); background: var(--teal); font-weight: 800; }
.panel-title { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-title h2 { margin-bottom: 4px; }
.panel-title p { font-size: 12px; }
.count-badge { padding: 6px 10px; border-radius: 999px; color: var(--teal); background: var(--mint); font-size: 11px; font-weight: 800; }
.employee-row {
  display: grid;
  grid-template-columns: 40px 1.2fr repeat(3, 1fr) 1.2fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid #edf1ef;
}
.employee-row:last-child { border-bottom: 0; }
.employee-row small, .employee-row strong { display: block; }
.employee-row small { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.employee-row strong { font-size: 13px; }
.salary-mask { letter-spacing: .18em; color: var(--muted); }
.employee-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.employee-flags span { padding: 4px 6px; border-radius: 6px; color: #7d5d33; background: #fff2df; font-size: 9px; }
.small-button { min-height: 34px; padding: 0 12px; font-size: 11px; }
.danger-button { color: var(--danger); border: 1px solid #e7c4c4; background: #fff6f6; }
.employee-actions, .panel-title-actions { display: flex; align-items: center; gap: 8px; }
.hidden { display: none !important; }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 24px; }
.check-label { display: flex !important; align-items: center; gap: 8px; }
.check-label input { width: 18px !important; height: 18px !important; margin: 0 !important; }
.highway-setting-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f7faf8; color: #526764; font-size: 12px; font-weight: 800; }
.switch-control { display: inline-flex !important; align-items: center; gap: 6px; margin-right: 8px; cursor: pointer; }
.switch-control input { position: absolute; width: 1px !important; height: 1px !important; opacity: 0; }
.switch-control b { color: var(--muted); font-size: 9px; }
.switch-track { position: relative; width: 46px; height: 25px; border-radius: 999px; background: #aeb8b5; transition: .18s ease; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgba(0,0,0,.22); transition: .18s ease; }
.switch-control input:checked + b + .switch-track { background: var(--teal); }
.switch-control input:checked + b + .switch-track .switch-knob { transform: translateX(21px); }
.switch-control:focus-within .switch-track { outline: 3px solid rgba(48,63,159,.18); }
.inline-rate { display: inline-block !important; width: 64px; }
.settings-form .inline-rate input { height: 34px; margin: 0; padding: 0 7px; text-align: right; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.form-save { display: flex; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--line); }
.schedule-box { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #f7faf8; }
.schedule-box > strong { color: var(--ink); font-size: 13px; }
.schedule-box > p { margin: 3px 0 12px; color: var(--muted); font-size: 11px; }
.schedule-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.leave-duration { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid #b8d9cf; border-radius: 10px; background: var(--mint); }
.leave-duration span, .leave-duration small { color: var(--muted); font-size: 11px; }
.leave-duration strong { color: var(--teal-dark); font-size: 18px; }
.leave-type-field select { font-size: 14px; font-weight: 700; }
.tab-badge { display: inline-grid; min-width: 19px; height: 19px; margin-left: 4px; padding: 0 5px; place-items: center; border-radius: 999px; color: var(--danger); background: #fff; font-size: 10px; }
.inbox-tabs { display: flex; gap: 7px; padding: 13px 18px; border-bottom: 1px solid var(--line); background: #fafbff; }
.inbox-tabs button { min-height: 35px; padding: 0 15px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: white; font-size: 11px; font-weight: 800; cursor: pointer; }
.inbox-tabs button.active { color: white; border-color: var(--teal); background: var(--teal); }
.approval-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.approval-row:last-child { border-bottom: 0; }
.approval-row strong, .approval-row span, .approval-row small { display: block; }
.approval-row span { margin-top: 5px; color: #415d59; font-size: 12px; }
.approval-row small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.approval-actions { display: flex; gap: 7px; }
/* 忘記密碼 */
.forgot-form { margin: 10px 0 0; }
.link-button { padding: 0; border: 0; background: none; color: var(--teal-dark); font-size: 12px; font-weight: 800; text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--ink); }

.status-chip { display: inline-flex !important; width: max-content; padding: 5px 8px; border-radius: 999px; color: #5d6b68; background: #edf1ef; font-size: 10px !important; font-weight: 800; }

/* 申請內容檢視 */
.claim-row[data-claim-id] { cursor: pointer; }
.claim-row[data-claim-id]:hover { background: #f6f8fb; }
.claim-row[data-claim-id]:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
#claim-detail-dialog { width: min(640px, 100%); }
#claim-detail-dialog > header { display: flex; align-items: flex-start; justify-content: space-between; padding: 26px 30px 16px; border-bottom: 1px solid var(--line); }
#claim-detail-dialog > footer { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 30px 24px; border-top: 1px solid var(--line); }
.detail-body { display: grid; gap: 18px; padding: 22px 30px; }
.detail-block > h3 { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.detail-block > p { margin: 0; font-size: 13px; line-height: 1.6; }
.detail-empty { margin: 0; color: var(--muted); font-size: 12px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.detail-table th { padding: 7px 8px; color: var(--muted); text-align: left; font-size: 10px; font-weight: 800; border-bottom: 1px solid var(--line); white-space: nowrap; }
.detail-table td { padding: 8px; border-bottom: 1px solid #edf0f5; }
.detail-table tr:last-child td { border-bottom: 0; }
.detail-total { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border-radius: 10px; background: var(--mint); color: var(--teal-dark); }
.detail-total strong { font-size: 18px; }
.detail-pairs { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.detail-pairs dt { color: var(--muted); font-size: 11px; font-weight: 800; }
.detail-pairs dd { margin: 0; }
.detail-trail,.review-trail { display: grid; gap: 10px; margin: 0; padding: 0 0 0 16px; font-size: 12px; }
.detail-trail li,.review-trail li { padding-left: 4px; }
.detail-trail small,.review-trail small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.detail-trail p,.review-trail p { margin: 5px 0 0; padding: 7px 9px; border-radius: 8px; background: #f6f8fb; line-height: 1.5; }
.review-context { display: grid; gap: 16px; padding: 0 32px 20px; }
.review-block > h3 { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 800; }
.review-block > p { margin: 0; font-size: 13px; line-height: 1.6; }
.review-empty { color: var(--muted); font-size: 12px; }
.status-submitted, .status-cancellation_requested { color: #80581d; background: #fff0d1; }
.status-approved { color: #176657; background: #dff4ed; }
.status-returned, .status-rejected, .status-cancelled { color: #8b4141; background: #fae4e4; }
.compact-dialog { width: min(440px, calc(100vw - 32px)); }
.compact-dialog .dialog-copy { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.login-brand { display: flex; justify-content: center; margin-bottom: 24px; }
.login-logo { display: block; width: 132px; height: auto; }
.compact-logo { width: 92px; margin: 0 auto 18px; }
.login-card h1 { margin-bottom: 12px; }
.login-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.login-card form { display: grid; gap: 15px; margin: 25px 0 18px; text-align: left; }
.login-card form .button { width: 100%; }
.login-card > small { color: var(--muted); font-size: 10px; }
.login-card label { color: #526764; font-size: 12px; font-weight: 800; }
.login-help-link { color: var(--brand); font-size: 13px; font-weight: 800; }
.form-message { padding: 11px 13px; border-radius: 10px; font-size: 13px; text-align: left; }
.error-message { color: #8b4141 !important; background: #fae4e4; }
.success-message { color: #205b4f !important; background: #e0f4ee; }
.password-rule { padding: 10px 12px; border-radius: 10px; background: #f2f7f5; font-size: 12px; }
.account-password-page { min-height: calc(100vh - 74px); }

@media (max-width: 900px) {
  .app-header { grid-template-columns: auto 1fr auto; padding: 0 18px; }
  .brand > span:last-child { display: none; }
  .claim-row { grid-template-columns: 40px 66px 1fr 95px 90px; }
  .type-chip { display: none; }
  .employee-row { grid-template-columns: 40px 1fr 1fr auto; }
  .employee-row > div:nth-of-type(3), .employee-row > div:nth-of-type(4), .employee-flags { display: none; }
}

@media (max-width: 640px) {
  .app-header { min-height: 62px; grid-template-columns: auto 1fr; }
  .app-header nav { justify-self: end; }
  .app-header nav { gap: 2px; }
  .app-header nav a { padding: 8px 6px; font-size: 10px; white-space: nowrap; }
  .app-header nav .switch-user-link { display: inline-flex; align-items: center; }
  .account { display: none; }
  .page-wrap { width: calc(100% - 28px); padding: 28px 0 40px; }
  .page-title { align-items: center; }
  .page-title > div > p { display: none; }
  h1 { margin: 0; font-size: 30px; }
  .title-actions input { width: 132px; min-height: 40px; padding: 0 7px; font-size: 12px; }
  .title-actions .button { min-height: 40px; padding: 0 12px; font-size: 12px; }
  .panel { border-radius: 14px; }
  .panel-header { flex-wrap: wrap; padding: 0 13px 10px; overflow-x: visible; }
  .panel-header > span { display: none; }
  .tabs { gap: 18px; }
  .tabs button { padding: 15px 0 13px; white-space: nowrap; }
  .claim-header-actions { width: 100%; justify-content: flex-end; }
  .claim-header-actions > span { display: none; }
  .claim-header-actions { gap: 7px; }
  .header-summary { flex: 1 1 auto; justify-content: flex-start; gap: 6px; margin-right: 0; }
  .header-summary > strong { font-size: 17px; }
  .claim-header-actions input,.claim-header-actions select { width: 118px; }
  .claim-row { position: relative; grid-template-columns: 37px 1fr auto; min-height: 82px; gap: 10px; padding: 12px 13px; }
  .claim-badge { width: 35px; height: 35px; }
  .claim-row time, .type-chip { display: none; }
  .claim-main strong { max-width: 48vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .claim-value { align-self: start; padding-top: 3px; font-size: 13px; }
  .row-actions { position: absolute; right: 8px; bottom: 5px; }
  .submit-row { padding: 14px; }
  .submit-row > div { display: none; }
  .submit-row .button { width: 100%; }
  dialog { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 21px 21px 0 0; }
  dialog form > header { padding: 22px 20px 15px; }
  .type-picker { margin: 20px 20px 0; }
  .form-grid { grid-template-columns: 1fr; padding: 20px; }
  .form-grid .full, .leave-help.full, .field-help.full { grid-column: auto; }
  dialog form > footer { position: sticky; bottom: 0; padding: 13px 20px; background: var(--paper); }
  .employee-row { grid-template-columns: 38px 1fr auto; padding: 14px; }
  .employee-row > div:not(.employee-name):not(.employee-actions) { display: none; }
  .employee-row .employee-actions { display: flex; }
  .settings-form { grid-template-columns: 1fr; padding: 18px; }
  .settings-form .full { grid-column: auto; }
  .schedule-grid { grid-template-columns: 1fr 1fr; }
  .approval-row { grid-template-columns: 1fr auto; padding: 15px; }
  .approval-actions { grid-column: 1 / -1; }
  .transport-entry,.purchase-entry { grid-template-columns: 1fr 1fr; }
  .entry-calculation { grid-column: 1 / -1; }
  .entry-total { grid-column: 1 / -1; }
  .entry-total .entry-calculation { flex: 1; grid-column: auto; }
  .leave-datetime-row { grid-template-columns: minmax(0,1fr) 112px; gap: 8px; }
  .inbox-row { grid-template-columns: 22px 1fr auto; }
  .inbox-row .approval-actions { grid-column: 2 / -1; }
  .review-item { grid-template-columns: 1fr 1fr; }
  #claim-detail-dialog > header { padding: 20px 18px 14px; }
  #claim-detail-dialog > footer { padding: 13px 18px 20px; }
  .detail-body { padding: 18px; gap: 15px; }
  .detail-table { display: block; overflow-x: auto; white-space: nowrap; }
  .review-context { padding: 0 20px 18px; }
}
#claim-dialog { width: min(1120px, calc(100% - 28px)); }
#claim-review-dialog { width: min(900px, calc(100% - 28px)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Project progress portal */
.project-page { width: min(1500px, calc(100% - 48px)); }
.project-workspace { display: grid; height: 760px; min-height: 0; grid-template-columns: minmax(300px, 370px) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 21px; background: rgba(255,255,255,.97); box-shadow: var(--shadow); }
.project-result-count { padding: 10px 4px 0; color: var(--muted); text-align: right; font-size: 11px; }
.project-browser { display: grid; min-width: 0; grid-template-rows: auto minmax(0,1fr); overflow: hidden; border-right: 1px solid var(--line); background: #fafbff; }
.project-browser > header { position: relative; z-index: 3; display: grid; gap: 11px; padding: 10px 18px 14px; border-bottom: 1px solid var(--line); background: rgba(250,251,255,.96); backdrop-filter: blur(12px); }
.project-list-toolbar { display: flex; align-items: center; gap: 18px; }
.project-list-toolbar .mobile-project-scope { display: grid; flex: 1; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.project-list-toolbar .mobile-project-scope button { min-height: 34px; padding: 0 7px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 10px; white-space: nowrap; cursor: pointer; }
.project-list-toolbar .mobile-project-scope button.active { color: white; background: var(--teal); font-weight: 800; }
.project-list-toolbar #add-project { flex: 0 0 auto; min-height: 40px; padding: 0 13px; white-space: nowrap; }
.project-search span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.project-search input, .project-filter-row select { width: 100%; height: 42px; padding: 0 11px; border: 1px solid #cad2ea; border-radius: 10px; color: var(--ink); background: white; }
.project-filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.project-list { min-height: 0; max-height: none; overflow-y: scroll; scrollbar-gutter: stable; }
.project-card { display: grid; width: 100%; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 11px; padding: 15px 17px; border: 0; border-bottom: 1px solid #e8ebf7; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.project-card:hover { background: #f3f5ff; }
.project-card.active { background: white; box-shadow: inset 4px 0 0 var(--brand-orange); }
.project-card-main strong, .project-card-main small, .project-card-main span { display: block; }
.project-card-main strong { overflow: hidden; margin-bottom: 5px; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.project-card-main small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.project-card-main span { margin-top: 7px; color: var(--teal-dark); font-size: 10px; font-weight: 800; }
.project-card-meta { display: grid; justify-items: end; gap: 9px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.status-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: #9da6bd; }
.status-dot.active { background: #e74f4f; box-shadow: 0 0 0 4px rgba(231,79,79,.10); }
.status-dot.completed { background: #43a27d; }
.status-dot.paused { background: var(--brand-orange); }
.status-dot.cancelled { background: #7d8496; }
.project-list-empty { padding: 42px 20px; color: var(--muted); text-align: center; font-size: 12px; }
.project-detail { min-width: 0; overflow-y: auto; padding: 27px; background: white; }
.project-detail.loading { opacity: .55; pointer-events: none; }
.project-detail.empty { display: grid; place-items: center; }
.project-detail-empty { color: var(--muted); text-align: center; }
.project-detail-empty > span { display: grid; width: 52px; height: 52px; margin: 0 auto 13px; place-items: center; border: 1px dashed #aeb8d7; border-radius: 50%; color: var(--teal-dark); font-family: Georgia, serif; font-size: 22px; }
.project-detail-empty strong { display: block; color: var(--ink); }
.project-detail-empty p { margin: 7px 0 0; font-size: 11px; }
.project-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.project-detail-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.project-detail-kicker span { padding: 4px 7px; border-radius: 999px; color: #854d45; background: #ffebe8; font-weight: 800; }
.project-detail-header h2 { margin-bottom: 7px; font-size: 30px; }
.project-detail-header p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.project-detail-actions { display: flex; gap: 8px; }
.project-lifecycle-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.project-lifecycle-actions .danger { border-color: #e4a5a0; color: #a4312a; background: #fff7f6; }
.project-lifecycle-actions .success { border-color: #9cc9b4; color: #176247; background: #f2fbf7; }
.status-history { margin-top: 13px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fafbff; }
.status-history h4 { margin: 0 0 9px; font-size: 12px; }
.status-history p { margin: 5px 0; color: var(--muted); font-size: 10px; }
.reference-deleted { color: #a4312a; text-decoration: line-through; }
.project-facts { display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; margin: 22px 0; }
.project-facts div { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafbff; }
.project-facts span, .project-facts strong { display: block; }
.project-facts span { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.project-facts strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.route-section { padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(180deg,#fcfcff,#f7f8fe); }
.route-section > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading-actions { display: flex; align-items: center; gap: 10px; }
.project-info-panel > header.section-heading-actions { justify-content: space-between; }
.route-section h3, .project-info-panel h3, .capacity-panel h3 { margin: 0; font-family: Georgia,"Noto Serif TC",serif; font-size: 20px; }
.route-section header p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.route-toggle { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.route-toggle button { min-height: 30px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; }
.route-toggle button.active { color: white; background: var(--teal); font-weight: 800; }
.project-route { margin: 26px 0 20px; padding: 0; list-style: none; }
.route-stop { position: relative; }
.route-stop button { position: relative; z-index: 2; display: grid; width: 100%; place-items: center; padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; }
.route-point { position: relative; z-index: 3; display: block; width: 17px; height: 17px; border: 4px solid #f8f9fe; border-radius: 50%; background: #f8f9fe; box-shadow: 0 0 0 2px #aab1c6; }
.route-stop.current .route-point { background: #e84444; box-shadow: 0 0 0 2px #e84444, 0 0 0 7px rgba(232,68,68,.12); }
.route-stop.selected:not(.current) .route-point { background: #aab1c6; box-shadow: 0 0 0 2px #aab1c6; }
.route-point .pulse { position: absolute; inset: -9px; border: 2px solid rgba(232,68,68,.3); border-radius: 50%; animation: project-pulse 1.8s ease-out infinite; }
@keyframes project-pulse { 0% { transform: scale(.65); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.route-label { display: grid; width: min(145px,100%); margin-top: 10px; place-items: center; text-align: center; }
.route-label small { color: var(--muted); font-size: 8px; }
.route-label strong { margin-top: 3px; font-size: 10px; line-height: 1.35; }
.route-label em { margin-top: 5px; padding: 3px 6px; border-radius: 999px; color: #6f778c; background: #eceef5; font-size: 8px; font-style: normal; }
.route-stop.status-completed .route-label em { color: #2d795e; background: #e2f3ec; }
.route-stop.status-rework .route-label em { color: #9b463f; background: #fae6e3; }
.metro-route { display: grid; grid-template-columns: repeat(10,minmax(112px,1fr)); min-width: 1120px; margin-top: 58px; overflow: visible; }
#project-route:has(.metro-route) { overflow-x: auto; padding-bottom: 6px; }
.metro-route .route-stop::after { position: absolute; top: 7px; left: 50%; z-index: 0; width: 100%; height: 4px; background: #c9cddd; content: ""; }
.metro-route .route-stop:last-child::after { display: none; }
.snake-route { display: grid; min-height: 420px; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(4,1fr); row-gap: 34px; }
.snake-route .route-stop[data-sequence="0"] { grid-area: 1/1; }
.snake-route .route-stop[data-sequence="1"] { grid-area: 1/2; }
.snake-route .route-stop[data-sequence="2"] { grid-area: 1/3; }
.snake-route .route-stop[data-sequence="3"] { grid-area: 2/3; }
.snake-route .route-stop[data-sequence="4"] { grid-area: 2/2; }
.snake-route .route-stop[data-sequence="5"] { grid-area: 2/1; }
.snake-route .route-stop[data-sequence="6"] { grid-area: 3/1; }
.snake-route .route-stop[data-sequence="7"] { grid-area: 3/2; }
.snake-route .route-stop[data-sequence="8"] { grid-area: 3/3; }
.snake-route .route-stop[data-sequence="9"] { grid-area: 4/3; }
.snake-route .route-stop::after { position: absolute; z-index: 0; background: #c9cddd; content: ""; }
.snake-route .route-stop[data-sequence="0"]::after,.snake-route .route-stop[data-sequence="1"]::after,.snake-route .route-stop[data-sequence="6"]::after,.snake-route .route-stop[data-sequence="7"]::after { top: 7px; left: 50%; width: 100%; height: 4px; }
.snake-route .route-stop[data-sequence="3"]::after,.snake-route .route-stop[data-sequence="4"]::after { top: 7px; right: 50%; width: 100%; height: 4px; }
.snake-route .route-stop[data-sequence="2"]::after,.snake-route .route-stop[data-sequence="5"]::after,.snake-route .route-stop[data-sequence="8"]::after { top: 7px; left: calc(50% - 2px); width: 4px; height: calc(100% + 34px); }
.snake-route .route-stop[data-sequence="9"]::after { display: none; }
.stage-latest { position: absolute; top: -18px; left: calc(50% + 12px); z-index: 5; color: #db3e37; font-size: 8px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; transform: rotate(-30deg); transform-origin: left center; }
.stage-drag-handle { touch-action: none; }
.stage-drag-handle .route-point { cursor: grab; }
.stage-drag-handle.dragging .route-point { cursor: grabbing; transform: scale(1.2); }
.stage-note-card { padding: 16px 18px; border: 1px solid #d9ddec; border-left: 4px solid #aab1c6; border-radius: 13px; background: white; box-shadow: 0 8px 24px rgba(48,63,159,.06); }
.stage-note-card.current { border-left-color: #e84444; }
.stage-note-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.stage-note-card header span { color: var(--muted); font-size: 9px; }
.stage-note-card h4 { margin: 3px 0 0; font-size: 14px; }
.stage-note-card > header > strong { padding: 5px 8px; border-radius: 999px; color: #7d4b46; background: #ffebe8; font-size: 9px; }
.stage-note-list { display: grid; gap: 8px; margin-top: 12px; }
.stage-note-list > div { display: grid; grid-template-columns: 80px 1fr 80px; gap: 10px; padding-top: 8px; border-top: 1px solid #edf0f8; }
.stage-note-list time, .stage-note-list small { color: var(--muted); font-size: 9px; }
.stage-note-list p { margin: 0; color: #4b5474; font-size: 10px; line-height: 1.55; }
.stage-note-list p strong { color: var(--ink); }
.stage-note-card details { margin-top: 10px; color: var(--teal-dark); font-size: 10px; }
.full-stage-history p { padding: 8px; border-radius: 8px; color: var(--ink); background: #f7f8fc; line-height: 1.5; }
.full-stage-history time { display: inline-block; min-width: 90px; color: var(--muted); }
.project-lower-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 13px; margin-top: 14px; }
.project-side-stack { display: grid; align-content: start; gap: 13px; }
.stage-history-table { margin-top: 14px; border-top: 1px solid #edf0f8; }
.stage-history-head,.stage-history-row { display: grid; grid-template-columns: 105px minmax(0,1fr) 92px; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid #edf0f8; }
.stage-history-head { color: var(--muted); font-size: 9px; }
.stage-history-row time { color: var(--muted); font-size: 9px; }
.stage-history-row p { margin: 0; color: #4b5474; font-size: 10px; line-height: 1.55; }
.stage-history-row button { padding: 3px 5px; border: 1px solid #cad2ea; border-radius: 6px; color: var(--teal-dark); background: white; font-size: 8px; cursor: pointer; }
.stage-note-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stage-note-actions,.stage-history-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.stage-note-actions strong { white-space: nowrap; }
.stage-note-actions button { padding: 4px 7px; border: 1px solid #cad2ea; border-radius: 7px; color: var(--teal-dark); background: white; font-size: 9px; cursor: pointer; }
.stage-history-actions button.danger { color: var(--danger); border-color: #e7c4c4; background: #fff6f6; }
.mobile-detail-nav { display: none; }
.project-info-panel,.capacity-panel { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.project-info-panel dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 15px 0 0; }
.project-info-panel dt { margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.project-info-panel dd { margin: 0; overflow-wrap: anywhere; font-size: 10px; line-height: 1.45; }
.project-info-panel .project-notes { grid-column: 1 / -1; }
.capacity-panel > header { display: flex; align-items: center; justify-content: space-between; }
.capacity-panel > header { gap: 10px; }
.capacity-panel > header button { padding: 4px 7px; border: 1px solid #cad2ea; border-radius: 7px; color: var(--teal-dark); background: white; font-size: 9px; cursor: pointer; }
.capacity-history { display: grid; gap: 8px; margin-top: 14px; }
.capacity-row { display: grid; grid-template-columns: 88px 85px minmax(0,1fr) auto; gap: 8px; align-items: start; padding: 9px; border-radius: 9px; background: #f7f8fc; }
.capacity-row.current { box-shadow: inset 3px 0 0 var(--brand-orange); background: #fff9ed; }
.capacity-row.capacity-single { grid-template-columns: minmax(0,1fr) auto; align-items: center; box-shadow: none; background: #f7f8fc; }
.capacity-row span,.capacity-row small { color: var(--muted); font-size: 8px; }
.capacity-row strong { font-size: 11px; }
.capacity-actions { display: flex; gap: 4px; justify-content: flex-end; }
.capacity-actions button { padding: 3px 5px; border: 1px solid #cad2ea; border-radius: 6px; color: var(--teal-dark); background: white; font-size: 8px; cursor: pointer; }
.capacity-actions button.danger { color: var(--danger); border-color: #e7c4c4; background: #fff6f6; }
.muted-text { margin: 0; color: var(--muted); font-size: 10px; }
.project-dialog small { color: var(--muted); }
.form-grid label:has(.open-combo-suggestions) { position: relative; }
.open-combo-suggestions { position: absolute; top: calc(100% + 3px); left: 0; z-index: 30; display: none; width: 100%; max-height: 190px; overflow-y: auto; padding: 5px; border: 1px solid #cbd6e2; border-radius: 10px; background: white; box-shadow: 0 12px 30px rgba(37,50,104,.18); }
label:focus-within > .open-combo-suggestions:not(:empty) { display: grid; }
.open-combo-suggestions > span { display: grid; grid-template-columns: minmax(0,1fr) 28px; align-items: center; border-bottom: 1px solid #edf0f5; }
.open-combo-suggestions > span:last-child { border-bottom: 0; }
.open-combo-suggestions button { min-width: 0; min-height: 34px; padding: 0 8px; overflow: hidden; border: 0; color: var(--teal-dark); background: transparent; font-size: 11px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.open-combo-suggestions .remove-suggestion { width: 22px; min-height: 22px; margin: 0 auto; padding: 0; border-radius: 50%; color: white; background: var(--danger); font-family: "Comic Sans MS", "Segoe Print", cursive; font-size: 17px; line-height: 22px; text-align: center; }
.wide-dialog { width: min(760px,calc(100% - 28px)); }
.progress-rule-note,.capacity-warning { padding: 12px 14px; border-radius: 9px; color: #6f5b3e; background: #fff5df; font-size: 10px; line-height: 1.6; }
.capacity-warning { color: #914d47; background: #ffedeb; }

@media (min-width: 1260px) {
  #project-route { min-width: 0; align-self: center; }
}

@media (max-width: 1100px) {
  .project-workspace { grid-template-columns: 310px minmax(0,1fr); }
  .project-facts { grid-template-columns: 1fr 1fr; }
  .project-lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .project-page { width: calc(100% - 24px); padding-top: 22px; }
  .project-workspace { display: block; height: auto; overflow: visible; border: 0; background: transparent; box-shadow: none; }
  #projects-app:not(.mobile-detail-open) .project-detail { display: none; }
  #projects-app.mobile-detail-open .project-browser { display: none; }
  .project-browser { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
  .project-browser > header { position: static; }
  .project-list-toolbar { gap: 16px; }
  .project-list-toolbar #add-project { min-height: 40px; padding: 0 12px; font-size: 10px; }
  .project-list { max-height: none; }
  .project-detail { margin-top: 12px; padding: 16px 13px; border: 1px solid var(--line); border-radius: 15px; }
  .mobile-detail-nav { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; margin: -4px 0 16px; }
  .mobile-detail-nav button { width: 42px; height: 38px; border: 1px solid #cad2ea; border-radius: 10px; color: var(--teal-dark); background: white; font-size: 19px; font-weight: 800; }
  .mobile-detail-nav button:first-child { justify-self: start; }
  .mobile-detail-nav button:nth-child(2) { justify-self: center; }
  .mobile-detail-nav button:last-child { justify-self: end; }
  .project-detail-header { display: block; }
  .project-detail-header h2 { font-size: 24px; }
  .project-detail-actions { margin-top: 12px; }
  .project-facts { gap: 7px; margin: 15px 0; }
  .project-facts div { padding: 10px; }
  .route-section { padding: 14px 10px; }
  .route-section > header { align-items: flex-start; }
  .section-heading-actions { align-items: flex-start; }
  .route-section header p { display: none; }
  .route-toggle { display: none; }
  .snake-route { min-height: 500px; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(4,1fr); row-gap: 54px; }
  .snake-route .route-stop { grid-area: auto; }
  .snake-route .route-stop[data-sequence="0"] { grid-area: 1/1; }
  .snake-route .route-stop[data-sequence="1"] { grid-area: 1/2; }
  .snake-route .route-stop[data-sequence="2"] { grid-area: 1/3; }
  .snake-route .route-stop[data-sequence="3"] { grid-area: 2/3; }
  .snake-route .route-stop[data-sequence="4"] { grid-area: 2/2; }
  .snake-route .route-stop[data-sequence="5"] { grid-area: 2/1; }
  .snake-route .route-stop[data-sequence="6"] { grid-area: 3/1; }
  .snake-route .route-stop[data-sequence="7"] { grid-area: 3/2; }
  .snake-route .route-stop[data-sequence="8"] { grid-area: 3/3; }
  .snake-route .route-stop[data-sequence="9"] { grid-area: 4/3; }
  .snake-route .route-stop::after { display: none; }
  .snake-route .route-stop[data-sequence="0"]::after,.snake-route .route-stop[data-sequence="1"]::after,.snake-route .route-stop[data-sequence="6"]::after,.snake-route .route-stop[data-sequence="7"]::after { display: block; top: 7px; left: 50%; width: 100%; height: 4px; }
  .snake-route .route-stop[data-sequence="3"]::after,.snake-route .route-stop[data-sequence="4"]::after { display: block; top: 7px; right: 50%; left: auto; width: 100%; height: 4px; }
  .snake-route .route-stop[data-sequence="2"]::after,.snake-route .route-stop[data-sequence="5"]::after,.snake-route .route-stop[data-sequence="8"]::after { display: block; top: 7px; left: calc(50% - 2px); width: 4px; height: calc(100% + 54px); }
  .route-label { width: 100px; }
  .route-label strong { font-size: 9px; }
  .stage-latest { top: -20px; font-size: 7px; }
  .stage-history-head,.stage-history-row { grid-template-columns: 72px minmax(0,1fr) 80px; gap: 7px; }
  .project-info-panel dl { grid-template-columns: 1fr; }
  .capacity-row { grid-template-columns: 74px 70px minmax(0,1fr) auto; }
  .capacity-row.capacity-single { grid-template-columns: minmax(0,1fr) auto; }
}

/* 通訊錄與聯繫紀錄摘要 --------------------------------------------------- */
.contact-panel { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.contact-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.contact-panel > header h3 { margin: 0; font-size: 15px; }
.contact-panel > header button { min-height: 32px; padding: 0 12px; border: 1px solid #cad2ea; border-radius: 8px; color: var(--teal-dark); background: white; font-size: 11px; font-weight: 800; cursor: pointer; }
.contact-list { display: grid; gap: 8px; }
.contact-row,.contact-log-row { display: grid; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #f6f8fb; }
.contact-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.contact-log-row { grid-template-columns: 92px minmax(0, 1fr) auto; }
.contact-log-row > time { color: var(--muted); font-size: 11px; font-weight: 700; }
.contact-main { min-width: 0; }
.contact-main strong { display: block; font-size: 13px; }
.contact-main small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; word-break: break-all; }
.contact-org { padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.contact-org-taipower { color: #1c5b8a; background: #ddeefb; }
.contact-org-county { color: #176657; background: #dff4ed; }
.contact-org-agency { color: #7a5b12; background: #fbf0d6; }
.contact-org-private { color: #5b4a86; background: #e9e4f8; }
.contact-actions { display: flex; gap: 6px; }
.contact-actions button { min-height: 28px; padding: 0 9px; border: 1px solid #cbd8d4; border-radius: 7px; background: white; font-size: 10px; font-weight: 800; cursor: pointer; }
.contact-actions button.danger { color: var(--danger); border-color: #e7c4c4; background: #fff6f6; }

/* 日期／時／分 滾輪 */
.wheel-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.wheel-picker { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; }
.wheel-heading { display: grid; grid-template-columns: 1.4fr 1fr 1fr; padding: 7px 0; border-bottom: 1px solid var(--line); background: #f6f8fb; text-align: center; color: var(--muted); font-size: 10px; font-weight: 800; }
.wheel-columns { position: relative; display: grid; grid-template-columns: 1.4fr 1fr 1fr; height: 200px; }
.wheel-column { position: relative; z-index: 1; height: 200px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.wheel-column::-webkit-scrollbar { display: none; }
.wheel-column:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.wheel-column ul { margin: 0; padding: 80px 0; list-style: none; }
.wheel-column li { display: flex; height: 40px; align-items: center; justify-content: center; scroll-snap-align: center; color: #9aa7b8; font-size: 15px; font-variant-numeric: tabular-nums; transition: color .12s, font-weight .12s; }
.wheel-highlight { position: absolute; top: 80px; left: 0; right: 0; height: 40px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(48, 63, 159, .05); pointer-events: none; }

/* 公共行事曆 ----------------------------------------------------------- */
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 20px; }
.calendar-range { flex: 1 1 auto; color: var(--ink); font-size: 13px; font-weight: 800; }
.calendar-nav { display: flex; gap: 6px; }
.calendar-nav .button { min-height: 34px; padding: 0 12px; font-size: 11px; white-space: nowrap; }
.calendar-nav-day { display: none; }
.calendar-board { display: grid; gap: 14px; padding: 0 20px 20px; }
.calendar-week { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.calendar-grid { display: grid; grid-template-columns: 96px repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.calendar-grid:first-child { border-top: 0; }
.calendar-head { background: #f6f8fb; }
.calendar-corner { padding: 8px 10px; color: var(--muted); font-size: 11px; font-weight: 800; }
.calendar-day-head { padding: 7px 6px; border-left: 1px solid var(--line); text-align: center; }
.calendar-day-head span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
.calendar-day-head strong { display: block; font-size: 12px; }
/* 週末＝假日。很淡的紅底，只是提示，不搶內容。 */
.calendar-day-head.is-weekend { background: #fdf0f0; }
.calendar-day-head.is-weekend span { color: #c2686d; }
/* 今天放在週末之後，週末的今天仍然以「今天」的顏色為準。 */
.calendar-day-head.is-today { background: var(--mint); color: var(--teal-dark); }
.calendar-member { display: flex; align-items: center; padding: 8px 10px; background: #fafbff; font-size: 12px; font-weight: 800; }
.calendar-cell { position: relative; min-height: 52px; padding: 7px 8px; border-left: 1px solid var(--line); cursor: pointer; }
.calendar-cell:hover { background: #f6f8fb; }
.calendar-cell:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.calendar-cell.filled { background: #fffdf3; }
.calendar-cell.filled:hover { background: #fdf7e3; }
.calendar-cell.is-weekend { background: #fdf6f6; }
.calendar-cell.is-weekend:hover { background: #fbeded; }
/* 週末又有內容：兩種底色混一下，假日仍然看得出來。 */
.calendar-cell.is-weekend.filled { background: #fdf8f0; }
.calendar-cell.is-weekend.filled:hover { background: #fbf2e4; }
.calendar-cell-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; font-size: 11px; line-height: 1.45; word-break: break-word; }
.calendar-more { position: absolute; right: 3px; bottom: 2px; padding: 0 5px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; line-height: 1.1; cursor: pointer; }
.calendar-more:hover { background: #e7ecf5; color: var(--ink); }
.calendar-tooltip { position: absolute; z-index: 60; max-width: 230px; padding: 6px 9px; border-radius: 8px; background: rgba(37, 50, 104, .94); color: white; font-size: 11px; line-height: 1.4; pointer-events: none; }
.calendar-history-body { padding: 20px 30px; }
.calendar-history { display: grid; gap: 10px; margin: 0; padding-left: 18px; }
.calendar-history small { display: block; color: var(--muted); font-size: 10px; }
.calendar-history p { margin: 4px 0 0; padding: 7px 9px; border-radius: 8px; background: #f6f8fb; font-size: 12px; line-height: 1.5; }
#calendar-history-dialog { width: min(460px, 100%); }
#calendar-history-dialog > header,#calendar-edit-dialog > header { display: flex; align-items: flex-start; justify-content: space-between; padding: 24px 30px 15px; border-bottom: 1px solid var(--line); }
#calendar-history-dialog > footer,#calendar-edit-dialog > footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 30px 22px; border-top: 1px solid var(--line); }
#calendar-edit-dialog { width: min(460px, 100%); }
#calendar-jump-dialog { width: min(360px, 100%); }
.jump-body { padding: 18px 24px 6px; }
.jump-toolbar { display: flex; align-items: center; gap: 5px; margin-bottom: 11px; }
.jump-toolbar strong { flex: 1; text-align: center; font-size: 14px; }
.jump-toolbar .button { min-height: 30px; padding: 0 9px; font-size: 13px; }
.jump-head { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 3px; }
.jump-head span { padding: 3px 0; text-align: center; color: var(--muted); font-size: 11px; font-weight: 800; }
.jump-head span.is-weekend { color: #c2686d; }
/* 可點的單位是整列，不是單一天——挑一天等於挑那一週。 */
.jump-week { display: grid; grid-template-columns: repeat(7, 1fr); border-radius: 8px; cursor: pointer; }
.jump-week:hover { background: var(--mint); }
.jump-week:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.jump-week.is-current { box-shadow: inset 0 0 0 2px var(--teal-dark); }
.jump-day { padding: 7px 0; text-align: center; font-size: 12px; }
.jump-day.is-weekend { color: #c2686d; }
.jump-day.is-today { font-weight: 800; color: var(--teal-dark); }
/* 排在最後：不屬於本月的日子一律淡掉，蓋過上面的顏色。 */
.jump-day.is-outside { color: #c3c8de; }

@media (max-width: 760px) {
  .calendar-toolbar { padding: 13px; }
  .calendar-range { flex: 1 1 100%; order: -1; }
  .calendar-nav-day { display: flex; }
  .calendar-board { padding: 0 13px 16px; }
  .calendar-grid { grid-template-columns: 72px repeat(3, minmax(0, 1fr)); }
  .calendar-cell { min-height: 62px; }
  /* 長按已還給系統選字，「⋯」是手機上看歷程的唯一入口，要點得到（原本只有 5x13px）。 */
  .calendar-more { display: flex; align-items: center; justify-content: center; right: 0; bottom: 0; min-width: 32px; min-height: 32px; padding: 0; font-size: 17px; }
  /* 第 4 行會被「⋯」蓋住，所以手機上收到 3 行並讓出右下角。 */
  .calendar-cell-text { -webkit-line-clamp: 3; padding-right: 26px; }
  .calendar-history-body { padding: 16px 18px; }
}


/* ---------- 專案e：仿專案管制表的格線 ---------- */
/* 這一頁只給桌機用（LAN 內部），手機上連導覽列都不出現。 */
@media (max-width: 760px) { .nav-desktop-only { display: none; } }

/* 專案e 是內部桌機專用，把螢幕寬度用完。
   .page-wrap 是 width: min(1180px, …) 鎖死的，要覆寫 width 本身，只寫 max-width 沒有用。
   兩種目標螢幕：1920x1080（約四分之一的人）與 2560x1600（其餘）。 */
.grid-page { width: calc(100% - 36px); max-width: none; padding: 26px 0 32px; }
.grid-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 14px 18px; }
.grid-filters fieldset { display: flex; align-items: center; gap: 12px; margin: 0; padding: 0; border: 0; }
/* 兩組圓點之間加一條垂直線，才看得出「顯示範圍」與「公司」是兩件事。 */
.grid-filters fieldset + fieldset { padding-left: 20px; border-left: 1px solid var(--line); }
.grid-filters legend { float: left; margin-right: 10px; padding: 0; color: var(--muted); font-size: 11px; font-weight: 800; }
.grid-filters label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.grid-count { margin: 0 0 0 auto; color: var(--muted); font-size: 11px; }

/* 只為了讓圓角切齊，不要連垂直方向都夾掉。 */
.grid-panel { padding: 0; overflow: clip; }
/* 放大字型或視窗變窄時，格線會比容器寬——這裡負責左右拉。
   max-height 用 max() 夾住：放大到很大時 100vh-250px 會變得極小甚至為負，
   捲動區塊塌掉的話橫向捲軸也跟著消失。 */
/* 水平捲軸一律顯示（overflow-x: scroll 而不是 auto）。
   auto 只有在內容真的超寬時才出現，欄寬剛好塞得下的螢幕就完全看不到捲軸，
   使用者不知道右邊還有沒有東西。固定顯示，位置也才穩定不會忽有忽無。
   高度再收一點，確保捲軸落在視窗內，不必先往下捲頁面才摸得到。 */
.grid-scroll { overflow-x: scroll; overflow-y: auto; min-height: 320px; max-height: max(320px, calc(100vh - 285px)); overscroll-behavior-x: contain; }
/* 捲軸做粗一點、顏色明顯一點，才好抓。 */
.grid-scroll::-webkit-scrollbar { width: 12px; height: 14px; }
.grid-scroll::-webkit-scrollbar-track { border-top: 1px solid var(--line); background: #f4f6fb; }
.grid-scroll::-webkit-scrollbar-thumb { border: 3px solid #f4f6fb; border-radius: 8px; background: #b9c0d8; }
.grid-scroll::-webkit-scrollbar-thumb:hover { background: #98a1c0; }
.grid-scroll { scrollbar-color: #b9c0d8 #f4f6fb; }
/* 下限要跟欄寬算式對得起來：左欄 250 + 9 欄各 140 = 1510px。
   原本寫 1400 比實際最小寬度還小，等於沒有作用。 */
.project-grid { min-width: 1510px; }

/* 左欄要一直看得到，橫向捲動時釘住。 */
/* 聯絡人改成兩行之後左欄收回 250px。
   1920 螢幕：9 欄各約 180px；2560 螢幕：各約 251px。 */
.grid-row { display: grid; grid-template-columns: 250px repeat(9, minmax(140px, 1fr)); border-top: 1px solid var(--line); }
.grid-row:first-child { border-top: 0; }
.grid-header { position: sticky; top: 0; z-index: 3; background: #f6f8fb; }
.grid-col-head { padding: 8px 9px; border-left: 1px solid var(--line); }
.grid-col-head strong { display: block; font-size: 11px; line-height: 1.35; }
.grid-col-head span { display: block; color: var(--muted); font-size: 10px; }
.grid-head-cell { position: sticky; left: 0; z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; background: #fafbff; }
.grid-header .grid-head-cell { z-index: 4; background: #f6f8fb; }
.grid-head-cell strong { font-size: 12px; line-height: 1.35; }
.grid-head-cell span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.grid-head-cell.is-closed strong { color: var(--muted); }
/* 左欄每一行都是「標籤: 值」，游標停在標籤後面就知道要改哪一種資料。 */
.grid-head-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; line-height: 1.5; }
.grid-field-label { color: var(--muted); font-size: 10px; white-space: nowrap; }
.grid-field-static { font-size: 10px; }
.grid-field { border-radius: 4px; font-size: 11px; cursor: pointer; }
.grid-head-line strong.grid-field { font-size: 12px; }
.grid-field-static-name { font-size: 12px; }
.grid-field:hover { background: #e7ecf5; text-decoration: underline dotted; }
.grid-field:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.grid-field.is-empty { color: #b9bed6; }
/* 聯絡人：接在案場資訊下面，用一條細線隔開。 */
.grid-contacts { margin-top: 5px; padding-top: 4px; border-top: 1px dotted var(--line); display: grid; gap: 1px; }
/* 兩行：上排是「聯絡人N:」與單位別（靠兩端），下排是稱呼與電話。 */
.grid-contact { padding: 2px 3px; border-radius: 4px; font-size: 10px; cursor: pointer; }
.grid-contact + .grid-contact { margin-top: 2px; }
.grid-contact-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.grid-contact-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.grid-contact:hover { background: #e7ecf5; }
.grid-contact:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.grid-contact-name { font-size: 11px; line-height: 1.4; }
.grid-contact-phone { color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-contact-org { flex: none; padding: 0 5px; border-radius: 7px; background: #eef1f8; color: var(--muted); white-space: nowrap; }
.grid-contact-add { justify-self: start; margin-top: 2px; padding: 0 4px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.grid-contact-add:hover { background: #e7ecf5; color: var(--ink); }
.danger-text { color: #c02b2b; }
/* 對話框內的錯誤訊息。modal dialog 在 top layer，toast 會被蓋住，所以錯誤要放這裡。 */
.form-error { margin: 12px 30px 0; padding: 9px 12px; border: 1px solid #f0c2c2; border-radius: 9px; background: #fdf3f3; color: #a32222; font-size: 12px; line-height: 1.5; }
.grid-corner { justify-content: flex-end; font-size: 11px; font-weight: 800; }

.grid-cell { position: relative; min-height: 62px; padding: 5px 6px 18px; border-left: 1px solid var(--line); }
/* 所有格子一律同一個底色。原本依關卡狀態上綠／黃／紅底，
   跟使用者自己標的黃底混在一起分不出誰是誰——標記與否只用紅框表示。 */
/* 標記＝只有紅框，不動底色。 */
.grid-cell.is-marked { box-shadow: inset 0 0 0 2px #e84444; }
.grid-entries { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
/* 日期自己一行、摘要在下面。日期帶了年份很長，並排會把欄寬吃光。 */
.grid-entry { position: relative; padding: 3px 18px 3px 3px; border-radius: 5px; font-size: 11px; line-height: 1.4; }
.grid-entry + .grid-entry { margin-top: 3px; border-top: 1px dotted var(--line); padding-top: 4px; }
.grid-entry-date { display: inline-block; }
.grid-entry-text { color: inherit; }
.grid-entry:hover { background: rgba(37, 50, 104, .06); }
.grid-entry-date { font-variant-numeric: tabular-nums; font-weight: 800; }
.grid-entry-text { word-break: break-word; }
/* 暫定：整筆轉灰。期限：日期加黑框。 */
.grid-entry.kind-tentative { color: #9aa0b8; }
.grid-entry.kind-deadline .grid-entry-date { padding: 0 3px; border: 1px solid #1d2340; border-radius: 3px; }
/* 備註：不是某天發生的事，日期不加粗、整筆退到左邊一條線後面。 */
.grid-entry.kind-note { border-left: 2px solid #c3c8de; padding-left: 6px; }
.grid-entry.kind-note .grid-entry-date { font-weight: 400; color: var(--muted); }
/* 匯入時年份是推出來的：日期底下畫一條波浪線，跟「暫定」的灰字不衝突。 */
.grid-entry.year-unconfirmed .grid-entry-date { text-decoration: underline wavy #d99a2b; text-underline-offset: 2px; cursor: help; }
.grid-entry-more { position: absolute; right: 0; top: 1px; opacity: 0; padding: 0 3px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; line-height: 1.1; cursor: pointer; }
.grid-entry:hover .grid-entry-more, .grid-entry-more:focus-visible { opacity: 1; }
.grid-add { position: absolute; right: 3px; bottom: 2px; opacity: 0; padding: 0 5px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.grid-cell:hover .grid-add, .grid-add:focus-visible { opacity: 1; }
.grid-add:hover { background: #e7ecf5; color: var(--ink); }
.grid-empty { grid-column: 1 / -1; padding: 22px; }

.grid-menu { position: fixed; z-index: 80; display: grid; min-width: 128px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 10px 26px rgba(37,50,104,.16); }
.grid-menu button { padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 12px; text-align: left; cursor: pointer; }
.grid-menu button:hover { background: #f2f5fb; }
.grid-menu button.danger { color: #c02b2b; }
/* 四種標記互斥：打勾的那個才顯示黑勾，其餘留空位讓文字對齊。 */
.grid-menu-kinds { display: grid; padding-bottom: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.grid-menu-kinds button { display: grid; grid-template-columns: 14px 1fr; align-items: center; }
.grid-menu-tick { visibility: hidden; color: #1d2340; font-size: 11px; }
.grid-menu-kinds button.is-checked .grid-menu-tick { visibility: visible; }
.grid-menu-kinds button.is-checked { font-weight: 800; }
/* 整格紅框：跟上面的四種標記分開，永遠顯示。 */
.grid-menu-cell-actions { padding-top: 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.grid-menu-cell-actions button { display: grid; grid-template-columns: 14px 1fr; align-items: center; width: 100%; }
.grid-menu-cell-actions button.is-checked .grid-menu-tick { visibility: visible; }
/* 選單一旦開著就很難關掉，右上角給一個明確的紅色圓圈叉叉。 */
.grid-menu { position: fixed; padding-top: 22px; }
.grid-menu-close { position: absolute; right: 5px; top: 4px; display: flex; align-items: center; justify-content: center; width: 17px; height: 17px; padding: 0; border: 1px solid #e05656; border-radius: 50%; background: white; color: #e05656; font-size: 10px; line-height: 1; cursor: pointer; }
.grid-menu-close:hover { background: #e05656; color: white; }
.grid-menu-group { display: grid; }
.grid-menu[data-mode="cell"] .grid-menu-group[data-for="entry"] { display: none; }
/* 關鍵：.grid-menu 有 display: grid，會蓋過 hidden 屬性（那只是 UA 的 display:none），
   所以 menu.hidden = true 根本藏不起來，選單就再也關不掉。 */
.grid-menu[hidden] { display: none; }
/* 選單開著時把來源反白，才不會忘記是從哪一格／哪一筆開的。 */
.grid-entry.menu-source { outline: 2px solid var(--teal); outline-offset: -1px; }
.grid-cell.menu-source { outline: 2px dashed var(--teal); outline-offset: -3px; }

.grid-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 2px 0; color: var(--muted); font-size: 11px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 22px; height: 12px; border-radius: 3px; background: #eef1f8; }
.legend-swatch.legend-tentative { background: #dfe2ee; }
.legend-swatch.legend-note { border-left: 2px solid #c3c8de; border-radius: 0; background: #f2f4fa; }
.legend-swatch.legend-deadline { border: 1px solid #1d2340; background: transparent; }
