:root {
  /* 淺色北歐風（Nord-inspired）設計變數 */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #e9eef5;
  --surface-alt: #fafbfd;
  --border: #e0e5ec;
  --text: #2e3440;
  --muted: #69758a;
  --primary: #5e81ac;
  --primary-dark: #4c6a92;
  --primary-light: #e7edf5;
  --sage: #87a98f;
  --sage-dark: #5f8268;
  --mist: #81a1c1;
  --danger: #bf616a;
  --danger-soft: #f6e6e8;
  --danger-text: #99494f;
  --warning: #c89d52;
  --warning-soft: #f6eedd;
  --warning-text: #8a6d3b;
  --success: #7c9d85;
  --success-soft: #e5eee8;
  --success-text: #4a6b52;
  --shadow: 0 1px 3px rgba(46, 52, 64, 0.06), 0 10px 30px rgba(46, 52, 64, 0.06);
  --shadow-lift: 0 4px 12px rgba(76, 106, 146, 0.14);
  --radius: 10px;
  --focus-ring: 0 0 0 3px rgba(94, 129, 172, 0.18);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Segoe UI", sans-serif;
  line-height: 1.55;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary) 0%, var(--sage) 100%);
  color: #fff; display: grid; place-items: center;
  font-weight: 700;
}
.brand h1 { margin: 0; font-size: 18px; }
.brand p, .eyebrow, .muted, .hint { color: var(--muted); }
.brand p { margin: 2px 0 0; font-size: 12px; }
nav { display: grid; gap: 8px; }
.nav-item {
  min-height: 44px; border: 0; border-radius: var(--radius); background: transparent;
  text-align: left; padding: 0 14px; color: var(--muted); font-size: 15px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-soft); color: var(--text); }
.nav-item.active {
  background: var(--primary-light); color: var(--primary-dark); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}
.side-status {
  margin-top: auto; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-alt);
}
.side-status span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }

.shell { padding: 26px 32px; overflow: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 4px; font-size: 13px; letter-spacing: 0.04em; }
h2 { margin: 0; font-size: 28px; letter-spacing: 0; }
h3 { margin: 0 0 10px; font-size: 17px; }
.toolbar { display: flex; align-items: end; gap: 10px; }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
select, .search, .control {
  height: 40px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 0 12px; color: var(--text); font-size: 14px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.control:focus, select:focus, .search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.textarea {
  min-height: 96px;
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.55;
}
.compact-textarea { min-height: 62px; }
.btn {
  height: 40px; border: 0; border-radius: var(--radius); padding: 0 16px;
  cursor: pointer; font-weight: 600; color: var(--text); background: var(--surface-soft);
  transition: background 0.15s, box-shadow 0.15s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.small { height: 32px; padding: 0 10px; font-size: 12px; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-lift); }
.btn.secondary:hover { background: #dde5ef; }
.btn.danger-soft { color: var(--danger-text); background: var(--danger-soft); }
.btn.danger-soft:hover { background: #efd6d9; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.tiny-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.notice {
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  background: var(--surface); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.notice.show { display: flex; }
.notice button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.view { display: none; }
.view.active { display: block; animation: viewFade 0.18s ease; }
@keyframes viewFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  text-align: left; cursor: pointer; color: var(--text); font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stat:hover, .stat.active { border-color: var(--primary); box-shadow: var(--shadow-lift); }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 30px; margin-top: 8px; }
.stat.danger strong { color: var(--danger); }
.stat.warning strong { color: var(--warning); }
.stat.success strong { color: var(--success); }
.stat.accent strong { color: var(--mist); }

.panel-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; }
.panel-grid.two { grid-template-columns: 1fr 1fr; }
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.wide-chart { grid-column: span 1; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.panel.full { width: 100%; }
.panel.spaced { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 12px; }
.panel-head.compact-head { margin-top: 18px; }
.calendar-panel { display: grid; gap: 12px; }
.info-panel { display: grid; align-content: start; gap: 14px; }
.recent-list { max-height: 300px; overflow: auto; padding-right: 4px; }
.section-divider { height: 1px; background: var(--border); margin: 2px 0; }
.calendar-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekdays span { color: var(--muted); font-size: 12px; text-align: center; font-weight: 700; }
.calendar-cell {
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  padding: 7px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 5px;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s;
}
.calendar-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.calendar-cell.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.calendar-cell.selected {
  border-color: var(--primary-dark);
  background: var(--primary-light);
  box-shadow: var(--focus-ring), inset 0 0 0 1px var(--primary-dark);
}
.calendar-day { color: var(--muted); font-size: 12px; font-weight: 700; }
.calendar-items { display: grid; gap: 3px; min-width: 0; }
.calendar-badge {
  display: block;
  width: 100%;
  border: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 5px;
  padding: 2px 5px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.calendar-badge:hover { filter: brightness(0.97); }
.calendar-badge.appointment { background: var(--success-soft); color: var(--success-text); }
.calendar-badge.manual { background: var(--warning-soft); color: var(--warning-text); }
.employee-tools { display: grid; grid-template-columns: auto minmax(220px, 360px) auto; align-items: center; gap: 10px; }
.filter-pill { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: var(--radius); background: var(--primary-light); color: var(--primary-dark); font-size: 12px; font-weight: 700; white-space: nowrap; }
.form-grid { display: grid; gap: 12px; margin-bottom: 12px; }
.form-grid.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mini-list { display: grid; gap: 8px; }
.mini-list.tall { max-height: 360px; overflow: auto; padding-right: 4px; }
.mini-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px; background: var(--bg); border-radius: var(--radius); }
.mini-item small { color: var(--muted); font-size: 12px; }
.action-item {
  width: 100%;
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.action-item:hover { border-color: var(--border); background: var(--surface-soft); }
.history-box {
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 10px;
}
.meta-list { display: grid; grid-template-columns: 88px 1fr; gap: 10px; margin: 0; }
.meta-list.wide { grid-template-columns: 120px 1fr; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 980px; background: var(--surface); }
.compact-table table { min-width: 680px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; vertical-align: top; }
th { color: var(--muted); background: var(--surface-alt); font-weight: 600; }
tbody tr:hover td { background: var(--surface-alt); }
.tag { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 0 9px; font-size: 12px; background: var(--surface-soft); }
.tag.danger { background: var(--danger-soft); color: var(--danger-text); }
.tag.warning { background: var(--warning-soft); color: var(--warning-text); }
.tag.success { background: var(--success-soft); color: var(--success-text); }
.result-box { margin-top: 14px; color: var(--muted); }
.link-button { border: 0; background: transparent; padding: 0; color: var(--primary-dark); cursor: pointer; text-align: left; font: inherit; }
.link-button:hover { text-decoration: underline; }

.chart-box { min-height: 174px; }
.vbar-chart { height: 174px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 10px; padding-top: 8px; }
.vbar-item { min-width: 0; border: 0; background: transparent; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; align-items: end; gap: 6px; color: var(--text); cursor: pointer; font: inherit; }
.vbar { width: 100%; max-width: 44px; border-radius: 6px 6px 0 0; background: var(--mist); }
.vbar-item.danger .vbar { background: var(--danger); }
.vbar-item.warning .vbar { background: var(--warning); }
.vbar-item.success .vbar { background: var(--success); }
.vbar-item.accent .vbar { background: var(--mist); }
.vbar-value { font-size: 13px; font-weight: 700; }
.vbar-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.hbar-chart { display: grid; gap: 12px; padding-top: 4px; }
.hbar-row { display: grid; grid-template-columns: minmax(110px, 1fr) 1.5fr 28px; align-items: center; gap: 10px; }
.hbar-label { display: grid; gap: 2px; min-width: 0; }
.hbar-label strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label span { color: var(--muted); font-size: 12px; }
.hbar-track { height: 10px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; }
.hbar-track span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.hbar-row b { font-size: 13px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; padding: 28px; background: rgba(46, 52, 64, 0.35); }
.modal-backdrop.show { display: flex; animation: backdropFade 0.15s ease; }
.modal-backdrop.show .modal-panel { animation: modalPop 0.18s ease; }
@keyframes backdropFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.985) translateY(6px); }
  to { opacity: 1; transform: none; }
}
.modal-panel { width: min(1120px, 100%); max-height: min(860px, 92vh); overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: 0 30px 80px rgba(46, 52, 64, 0.24); padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 16px; }
.modal-actions { display: flex; align-items: end; gap: 10px; }
.trend-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.summary-chip { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-alt); display: grid; gap: 4px; }
.summary-chip.compact { padding: 8px 10px; }
.summary-chip span { color: var(--muted); font-size: 12px; }
.summary-chip strong { font-size: 15px; }
.loading-panel { display: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; background: var(--surface-alt); }
.loading-panel.show { display: grid; gap: 8px; }
.loading-track { height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-soft); }
.loading-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width 0.25s ease; }
.loading-panel p { margin: 0; color: var(--muted); font-size: 13px; }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.trend-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); padding: 12px; }
.trend-card-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.trend-card-head strong { font-size: 14px; }
.trend-card-head span { color: var(--muted); font-size: 12px; }
.line-chart { width: 100%; height: 128px; overflow: visible; }
.line-chart line { stroke: var(--border); stroke-width: 1; }
.line-chart .standard-line { stroke: var(--danger); stroke-width: 1.7; stroke-dasharray: 5 5; }
.line-chart path { fill: none; stroke: var(--primary-dark); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.line-chart circle { fill: var(--surface); stroke: var(--primary-dark); stroke-width: 2; }
.line-chart text { fill: var(--muted); font-size: 10px; }
.line-chart .standard-label { fill: var(--danger-text); font-weight: 700; }
.detail-content { display: grid; gap: 16px; }
.detail-section { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); padding: 14px; }
.detail-section h3 { margin-bottom: 12px; }
.detail-section.editing { border-color: var(--primary); background: var(--primary-light); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.detail-row { display: grid; gap: 4px; min-height: 56px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 9px 10px; }
.detail-row span { color: var(--muted); font-size: 12px; }
.detail-row strong { overflow-wrap: anywhere; font-size: 14px; }
.detail-row.editing { align-content: start; }
.detail-edit-input {
  width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); padding: 0 8px; color: var(--text); font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.detail-edit-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }

/* 排序表頭 */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--primary-dark); }
.sort-arrow { display: inline-block; min-width: 12px; color: var(--primary-dark); font-size: 11px; }

/* 建議面談人員 / 附件清單 */
.reminder-item { align-items: center; }
.reminder-item .tiny-actions { flex-direction: column; align-items: stretch; }
.attachment-list { display: grid; gap: 8px; margin-top: 10px; }
.attachment-item { align-items: center; }

/* 總覽 sticky 篩選列 */
.overview-filterbar {
  position: sticky; top: 0; z-index: 60;
  padding: 12px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow-lift);
}
.overview-filterbar::before {
  /* 遮住 .shell 上緣 padding 的縫隙，避免捲動內容從篩選列上方穿出 */
  content: ""; position: absolute; left: -32px; right: -32px; top: -27px; height: 27px;
  background: var(--bg);
}
.filterbar-grid {
  display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px; align-items: end;
}
.filterbar-export { white-space: nowrap; }

/* KPI 分組 */
.stats-group-title {
  margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.04em;
}
.stats-row-secondary { display: grid; grid-template-columns: 3fr 4fr; gap: 16px; margin-bottom: 16px; }
.stats-subgroup { min-width: 0; }
.stats-grid.small { gap: 10px; margin-bottom: 0; }
.stats-grid.small .stat { padding: 10px 12px; }
.stats-grid.small .stat span { font-size: 12px; }
.stats-grid.small .stat strong { font-size: 20px; margin-top: 4px; }

/* 圖表分頁 */
.chart-tabs-panel { margin-bottom: 16px; }
.tab-bar { display: flex; gap: 6px; background: var(--surface-soft); border-radius: var(--radius); padding: 4px; }
.tab-btn {
  border: 0; background: transparent; border-radius: 7px; padding: 7px 16px;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--surface); color: var(--primary-dark); box-shadow: var(--shadow); }
.chart-tab { display: none; }
.chart-tab.active { display: block; }
.chart-tab .chart-grid { margin-bottom: 0; }
.chart-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-cell {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-alt); padding: 14px;
}

/* 甜甜圈圖 */
.donut-wrap { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.donut-chart { width: 132px; height: 132px; }
.donut-seg { cursor: pointer; transition: opacity 0.15s; }
.donut-seg:hover { opacity: 0.82; }
.donut-total { font-size: 26px; font-weight: 700; fill: var(--text); }
.donut-label { font-size: 11px; fill: var(--muted); }
.donut-legend { display: grid; gap: 6px; min-width: 0; }
.legend-item {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent;
  color: var(--text); font-size: 13px; cursor: pointer; padding: 3px 6px; border-radius: 6px;
  text-align: left;
}
.legend-item:hover { background: var(--surface-soft); }
.legend-item strong { margin-left: auto; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend-dot.tone-warning { background: var(--warning); }
.legend-dot.tone-accent { background: var(--mist); }
.legend-dot.tone-success { background: var(--success); }

/* 油錶指針圖 */
.gauge-wrap { display: grid; gap: 6px; justify-items: center; }
.gauge-chart { width: 168px; height: 100px; overflow: visible; }
.gauge-needle { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.gauge-needle-group { animation: gaugeSwing 0.9s ease-out; }
@keyframes gaugeSwing { from { transform: rotate(0deg); } }
.gauge-pivot { fill: var(--text); }
.gauge-value { font-size: 20px; font-weight: 700; fill: var(--text); }
.gauge-caption { margin: 0; font-size: 12px; }

/* 備份彈窗 */
.modal-panel.narrow { width: min(640px, 100%); }

/* 授權鎖定畫面 */
.lock-overlay {
  position: fixed; inset: 0; z-index: 3000; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(46, 52, 64, 0.55); backdrop-filter: blur(4px);
}
.lock-overlay.show { display: flex; animation: backdropFade 0.2s ease; }
.lock-card {
  width: min(440px, 100%); background: var(--surface); border-radius: 14px;
  padding: 28px; display: grid; gap: 14px;
  box-shadow: 0 30px 80px rgba(46, 52, 64, 0.3);
  animation: modalPop 0.2s ease;
}
.lock-card h2 { font-size: 22px; }
.lock-actions { display: flex; gap: 10px; }
.lock-actions .btn { flex: 1; }
.sidebar > #openBackupBtn { width: 100%; }

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .stats-grid, .panel-grid, .panel-grid.two, .chart-grid { grid-template-columns: 1fr 1fr; }
  .form-grid.four-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .employee-tools { grid-template-columns: 1fr; width: 100%; }
}

@media (max-width: 640px) {
  .shell { padding: 18px; }
  .stats-grid, .panel-grid, .panel-grid.two, .chart-grid, .chart-grid.two { grid-template-columns: 1fr; }
  .stats-row-secondary { grid-template-columns: 1fr; }
  .filterbar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.two-cols, .form-grid.four-cols { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
  .modal-backdrop { padding: 12px; align-items: stretch; }
  .modal-panel { max-height: none; }
  .modal-head { flex-direction: column; }
  .modal-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .calendar-weekdays, .calendar-grid { gap: 4px; }
  .calendar-cell { min-height: 72px; padding: 5px; }
  .calendar-badge { font-size: 10px; }
}

/* ===== Toast 通知 ===== */
.toast-container { position: fixed; right: 18px; bottom: 18px; z-index: 4000; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--surface); border-left: 4px solid var(--success); border-radius: 10px; box-shadow: 0 10px 30px rgba(46, 52, 64, 0.22); font-size: 13.5px; line-height: 1.5; animation: toastIn 0.2s ease; }
.toast.error { border-left-color: var(--danger); }
.toast .toast-icon { font-size: 16px; }
.toast .toast-msg { flex: 1; overflow-wrap: anywhere; word-break: normal; }
.toast button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; }
.toast.leaving { opacity: 0; transform: translateX(12px); transition: all 0.25s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== 清單工具列（排序 / 年度 / 展開） ===== */
.list-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 2px 8px; }
.list-toolbar select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 12.5px; }
.list-toolbar .btn { padding: 4px 10px; font-size: 12.5px; }
.list-toolbar .muted { font-size: 12px; margin-left: auto; }
.list-expand-btn { width: 100%; margin-top: 6px; }

/* ===== 清單項目操作鈕 ===== */
.mini-item.row-item { cursor: pointer; border: 1px solid transparent; text-align: left; width: 100%; align-items: center; }
.mini-item.row-item:hover { border-color: var(--accent, #5e81ac); background: var(--surface-soft, #eceff4); }
.mini-item .row-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.mini-item .row-actions .btn { padding: 4px 9px; font-size: 12px; }

/* ===== 紀錄詳情彈窗 ===== */
#recordViewContent .detail-section { margin-bottom: 12px; }
.record-attachments { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ===== 面談獨立填寫視窗 ===== */
.focus-panel { width: min(1480px, 98vw); max-height: 96vh; }
.focus-grid { display: grid; grid-template-columns: minmax(320px, 5fr) minmax(420px, 7fr); gap: 18px; align-items: start; }
.focus-side { position: sticky; top: 0; max-height: calc(96vh - 120px); overflow: auto; padding-right: 4px; }
.focus-tab { display: none; margin-top: 10px; }
.focus-tab.active { display: block; }
.focus-tab .trend-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); display: grid; gap: 10px; }
.focus-form { min-width: 0; }
.focus-form .panel { box-shadow: none; border: 1px solid var(--border); }
.focus-form textarea.control { min-height: 96px; }
@media (max-width: 1100px) { .focus-grid { grid-template-columns: 1fr; } .focus-side { position: static; max-height: none; } }

/* ===== 附件燈箱 ===== */
.lightbox-panel { width: min(900px, 96vw); }
.lightbox-body { display: flex; justify-content: center; align-items: center; background: var(--bg); border-radius: 10px; padding: 10px; }
.lightbox-body img { max-width: 100%; max-height: 70vh; border-radius: 6px; }

/* ===== 趨勢圖標準線（低於異常用不同色） ===== */
.line-chart .standard-line.low-bad { stroke: #b48ead; }
.line-chart .standard-label.low-bad { fill: #8d6a99; }

/* ===== 員工 360° 資訊卡 ===== */
.employee-card { display: none; background: var(--surface-soft, #eceff4); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.employee-card-main { font-size: 14px; }
.employee-card-meta { margin-top: 6px; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.employee-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ===== 中文排版美感（v7.3）=====
   text-wrap: pretty — 由排版引擎避免「行尾孤字」與過短末行（Chromium 117+，舊環境自動忽略）
   text-wrap: balance — 標題多行時左右行長均衡
   line-break: strict — 標點不落行首、CJK 嚴格斷行規則 */
body { line-break: strict; }
p, li, small, .hint, .muted, .toast-msg, .mini-item span, .detail-row strong,
.employee-card-meta, .summary-chip, .lock-card p, .gauge-caption, .calendar-badge,
.result-box, .stats-group-title, dd {
  text-wrap: pretty;
}
h1, h2, h3, .panel-head h3, .modal-head h2, .lock-card h2, .trend-card-head strong {
  text-wrap: balance;
}
