/* HQ v0.2：只補足共用後台樣式未涵蓋的資訊密度與窄螢幕行為。 */
.bo-top {
  grid-template-columns: minmax(160px, 1fr) minmax(0, auto) minmax(160px, 1fr);
}
.bo-nav {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  white-space: nowrap;
}
.bo-nav .tab { flex: 0 0 auto; }
.who {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--s2);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
}
.who:hover,
.who:focus-visible {
  color: var(--red);
  border-bottom-color: var(--red);
  outline: none;
}
.page-note { margin: var(--s1) 0 0; }
.menu-set-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: 0 0 var(--s4);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--hair);
}
.menu-set-tab {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--hair);
  border-radius: var(--r);
  background: var(--white);
}
.menu-set-tab.selected { border-color: var(--red); }
.menu-set-tab > button:first-child {
  min-height: 44px;
  padding: 0 var(--s3);
  border: 0;
  border-radius: var(--r) 0 0 var(--r);
  background: transparent;
  color: var(--ink-2);
  font-family: var(--serif);
}
.menu-set-tab.selected > button:first-child { color: var(--red); }
.menu-set-tab > button:last-child {
  min-height: 44px;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0 var(--r) var(--r) 0;
  border-left: 1px solid var(--hair);
}
.tool-field {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}
.tool-field input,
.tool-field select {
  height: 40px;
  min-width: 120px;
  padding: 0 var(--s2);
  border: 1px solid var(--hair);
  border-radius: var(--r);
  background: var(--white);
}
.table-scroll { overflow-x: auto; }
.table-scroll .tbl { min-width: 680px; }
.actions {
  display: flex;
  gap: var(--s2);
  white-space: nowrap;
}
button.danger { color: var(--red); border-color: var(--red); }
.wide-modal { width: min(820px, 100%); }
.modal h4 {
  margin: var(--s5) 0 var(--s2);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--hair);
  font-family: var(--serif);
  font-size: 16px;
}
.modal h4:first-child { margin-top: 0; }
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2) var(--s4);
  margin: var(--s3) 0 var(--s4);
}
.check-grid label {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  min-width: 0;
  color: var(--ink-2);
  font-size: 14px;
}
.check-grid input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--red); }
.check-grid small,
.field small {
  display: block;
  margin-top: var(--s1);
  color: var(--ink-3);
  font-size: 12px;
}
.notify-actions {
  display: flex;
  justify-content: flex-end;
  margin: calc(var(--s3) * -1) 0 var(--s4);
}
.att-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.att-card {
  display: block;
  min-height: 0;
  padding: var(--s4);
  border: 1px solid var(--hair);
  background: var(--white);
  color: var(--ink);
  text-align: left;
}
.att-card:hover { border-color: var(--ink-2); }
.att-card.selected { border-left: 4px solid var(--red); }
.att-card-name {
  display: block;
  margin-bottom: var(--s3);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}
.att-card-name small {
  margin-left: var(--s1);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
}
.att-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
  color: var(--ink-2);
  font-size: 12px;
}
.att-card-grid span { display: flex; justify-content: space-between; gap: var(--s2); }
.att-card-grid b { color: var(--ink); font-size: 14px; }
.att-card-grid .att-warn,
.att-card-grid .att-warn b { color: var(--red); }
.att-summary-row { cursor: pointer; }
.att-summary-row:focus-visible td { background: var(--paper-2); outline: 1px solid var(--red); outline-offset: -1px; }
.att-detail-row td { padding: 0; background: var(--paper); }
.att-days { padding: var(--s3) var(--s4); }
.att-day {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: var(--s2) var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--hair);
  font-size: 13px;
}
.att-day:last-child { border-bottom: 0; }
.att-day ul {
  grid-column: 2 / 4;
  margin: 0;
  padding-left: var(--s4);
}
.att-day li { margin: var(--s1) 0; }
.attendance-fixes { overflow-x: auto; }
.attendance-fixes .tbl { min-width: 700px; }
.line-group-picker { margin: var(--s4) 0; padding: var(--s3) 0; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.line-group-picker h4 { margin: 0 0 var(--s2); }
.line-group-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--hair); }
.line-group-row:first-child { border-top: 0; }
.line-group-row b, .line-group-row span { display: block; }
.line-group-picker p { margin: var(--s2) 0 0; }
.line-group-picker #lineGroups + h4 { margin-top: var(--s4); }
.line-user-row > div { min-width: 0; overflow-wrap: anywhere; }
.line-user-check { display: flex; flex: none; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s2); white-space: nowrap; cursor: pointer; }
.line-user-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--red); }
.tag.good { border-color: var(--green); color: var(--green); }
.kpi-note.warn,
.line-group-picker p.warn { color: var(--red); }
#notifyLogTbl { min-width: 760px; }
.section-head { margin-bottom: var(--s3); }
.section-head h2 { margin-bottom: 0; }
.system-value { font-size: 21px !important; }
.kpi-note {
  margin-top: var(--s2);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere; /* 長網址（維護帳號看的 Webhook）要在卡片內換行 */
}
.ext-list { display: grid; gap: 0; }
.ext-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--hair);
}
.ext-item:last-child { border-bottom: 0; }
.ext-item p { margin: var(--s1) 0 0; }
.support-links,
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}
.bo-foot {
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}
.foot-links a {
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: none;
}
.foot-links a:hover { color: var(--red); }
.btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: .45;
}
body.readonly [data-write] { display: none !important; }

@media (max-width: 820px) {
  .bo-top { grid-template-columns: 1fr; }
  .bo-nav {
    width: calc(100vw - var(--s6));
    margin: 0 calc(var(--s3) * -1);
    padding-left: var(--s3);
    border-radius: 0;
  }
  .bo-right { justify-content: space-between; }
  .bo-tools { width: 100%; flex-wrap: wrap; }
  .tool-field { flex: 1 1 145px; justify-content: space-between; }
  .tool-field input,
  .tool-field select { min-width: 0; max-width: 100%; }
  .check-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .bo-main { padding: var(--s4); }
  .bo-head h1 { font-size: 22px; }
  .bo-tools > .btn,
  .bo-tools > button { flex: 1 1 auto; }
  .att-overview { grid-template-columns: minmax(0, 1fr); }
  .att-day { grid-template-columns: 90px minmax(0, 1fr); }
  .att-day > .num { grid-column: 2; }
  .att-day ul { grid-column: 1 / -1; }
  .bo-foot { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 700px) {
  .bo-top { grid-template-columns: minmax(0, 1fr) auto; }
  .bo-main { padding: var(--s3) var(--s3) 80px; }
  .tool-field { flex: 1 1 145px; justify-content: space-between; }
  .table-scroll .tbl th,
  .table-scroll .tbl td { font-size: 13px; white-space: nowrap; }
}

/* 報表下載 */
.report-panel { display: grid; gap: var(--s4); max-width: 560px; }
.report-quick { display: flex; flex-wrap: wrap; gap: var(--s2); }
.report-quick .active { background: var(--ink); color: var(--paper); }
.report-quick button { min-height: 44px; }
.report-dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); }
.report-dates .field { min-width: 0; }
.report-dates input { min-width: 0; width: 100%; }
.report-go { min-height: 56px; font-size: 18px; }
.report-hint.bad { color: var(--red); }
.report-preview .modal { display: flex; flex-direction: column; overflow: hidden; width: min(960px, 100%); }
.report-preview header,
.report-preview footer { flex-shrink: 0; }
.report-preview .body { min-height: 0; overflow: auto; }
.report-preview img { display: block; max-width: 100%; height: auto; }
.report-preview footer { flex-wrap: wrap; }
.report-preview button { min-height: 44px; }
@media (max-width: 700px) {
  .report-go { width: 100%; }
}
