/* Department workspaces. Load order matters: later files override earlier ones. */
.ws-page {
  min-width: 0;
  font-size: 14px;
}
.ws-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 12px;
}
.ws-columns > section {
  min-width: 0;
}
.ws-page h1 {
  font-size: 22px;
  margin: 0 0 12px;
}
.ws-page h2 {
  font-size: 18px;
  margin: 0 0 10px;
}
.ws-page h3,
.ws-drawer h3 {
  font-size: 14px;
  margin: 0 0 6px;
}
.ws-card {
  padding: 12px 14px;
  border: 1px solid var(--fg-line);
  border-radius: 10px;
  background: var(--fg-surface);
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.ws-card p,
.ws-drawer p {
  margin: 4px 0;
}
.ws-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.ws-presets button {
  text-align: left;
  padding: 12px 14px;
  min-height: 48px;
}
.ws-actions,
.ws-filters,
.ws-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.ws-kpis button {
  flex: 1;
  padding: 12px;
}
.ws-rail {
  min-width: 0;
}
.ws-rail .ws-card {
  font-size: 13px;
}
.ws-badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--fg-line);
  border-radius: 5px;
  color: var(--fg-muted);
  font-size: 11px;
}
.ws-client {
  display: block;
  margin: 8px 0;
}
.ws-client [role='listbox'] {
  display: flex;
  flex-direction: column;
  max-height: 200px;
  overflow: auto;
}
.ws-client [hidden] {
  display: none;
}
.ws-client input {
  width: 100%;
}
.ws-page .real-home {
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
}
.ws-page .home-title,
.ws-page .task-chips,
.ws-page .home-meta,
.ws-page .ex-home {
  display: none;
}
.ws-page .home-dock {
  margin-top: 12px;
}
.ws-page .composer {
  margin-top: 8px;
}
.ws-page .thread:empty {
  display: none;
}
.ws-table-scroll {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--fg-line);
}
.ws-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  white-space: nowrap;
  font-size: 12px;
}
.ws-table th,
.ws-table td {
  padding: 3px 8px;
  height: 34px;
  border-bottom: 1px solid var(--fg-line);
  background: var(--fg-surface);
}
.ws-table th {
  position: sticky;
  top: 0;
  z-index: 3;
}
.ws-table th:first-child,
.ws-table td:first-child {
  position: sticky;
  left: 0;
  min-width: 140px;
  max-width: 140px;
  z-index: 1;
}
.ws-table th:nth-child(2),
.ws-table td:nth-child(2) {
  position: sticky;
  left: 140px;
  z-index: 1;
}
.ws-table th:first-child,
.ws-table th:nth-child(2) {
  z-index: 4;
}
.ws-table input,
.ws-table select {
  padding: 2px 4px;
  min-height: 26px;
  max-width: 150px;
}
.ws-table button {
  padding: 2px 4px;
}
.ws-table .ws-overdue {
  color: var(--fg-warning);
  background: var(--fg-soft);
}
.ws-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ws-fields label,
.ws-drawer form > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ws-intake > label {
  display: inline-flex;
  gap: 4px;
  margin: 6px;
}
.ws-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(520px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100%;
  padding: 14px;
  border: 1px solid var(--fg-line);
  background: var(--fg-surface);
  color: var(--fg-text);
  overflow: auto;
}
.ws-drawer::backdrop {
  background: rgb(0 0 0 / 0.35);
}
.ws-drawer > button {
  margin: 4px;
}
/* docs/ui-guidelines.md §5: close is an × icon at the top right, at least 32x32. */
.ws-drawer > .ws-close {
  position: sticky;
  top: 0;
  float: right;
  margin: -4px -4px 0 8px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--fg-surface);
  color: var(--fg-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.ws-drawer > .ws-close:hover {
  background: var(--fg-soft);
  color: var(--fg-text);
}
.ws-drawer > h2 {
  margin-right: 40px;
}
.ws-drawer h3 {
  margin-top: 14px;
}
.ws-drawer textarea {
  min-height: 80px;
}
.ws-page button:focus-visible,
.ws-drawer button:focus-visible {
  outline: 2px solid var(--fg-accent);
  outline-offset: 2px;
}
@media (max-width: 1000px) {
  .ws-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .ws-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .ws-rail h2,
  .ws-rail h3 {
    grid-column: 1/-1;
  }
}
@media (max-width: 700px) {
  .ws-presets,
  .ws-fields,
  .ws-rail {
    grid-template-columns: minmax(0, 1fr);
  }
  .ws-kpis button {
    flex: 1 1 28%;
  }
  .ws-filters input {
    max-width: 100%;
  }
  .ws-page h1 {
    font-size: 20px;
  }
  .ws-drawer {
    width: 100%;
  }
}
.content:has(> .ws-page) {
  padding: 20px 24px;
}
.ws-page .page-head {
  margin: 0 0 12px;
}
.ws-page .real-home {
  justify-content: flex-start;
  padding-bottom: 0;
}
.ws-rail .ws-presets {
  grid-template-columns: 1fr;
}
.ws-page .home-dock {
  padding-bottom: 8px;
}
@media (max-width: 700px) {
  .content:has(> .ws-page) {
    padding: 14px 12px;
  }
}
.ws-case { display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; font-size: 12px; }
.ws-case-link { width: 100%; text-align: left; cursor: pointer; color: inherit; }
.ws-status { align-self: flex-start; display: inline-block; border-radius: 5px; padding: 2px 6px; background: var(--cf-tint); color: var(--cf-cyan-dark); }
.ws-status[data-status='退件待補'] { background: var(--cf-warning-bg); color: var(--cf-orange); }
.ws-status[data-status='審核中'] { background: var(--cf-warning-bg); color: var(--cf-ink); }
.ws-status[data-status='報告已交付'] { color: var(--cf-success); }
.ws-status[data-status='已結案'] { background: var(--cf-canvas); color: var(--cf-muted); }
.ws-attention { display: flex; gap: 4px; margin-bottom: 8px; }
.ws-attention button { flex: 1; padding: 5px 3px; font-size: 11px; }
.ws-presets button { min-height: 36px; padding: 8px 10px; font-size: 13px; }
.ws-filters { align-items: center; }
.ws-filters label { display: flex; align-items: center; gap: 6px; margin: 0; }
.ws-filters input, .ws-filters select { height: 32px; min-height: 32px; padding: 4px 8px; box-sizing: border-box; }
.ws-table th:first-child, .ws-table td:first-child { box-sizing: border-box; width: 140px; }
.ws-page .composer-form { position: relative; }
#ws-clients { position: absolute; bottom: 100%; left: 0; right: 0; z-index: 10; display: flex; flex-direction: column; max-height: 180px; overflow: auto; border: 1px solid var(--cf-line); border-radius: var(--cf-radius-sm); background: var(--fg-surface); }
#ws-clients[hidden] { display: none; }
#ws-clients button { padding: 8px 10px; text-align: left; }
#ws-case-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-card { white-space: pre-line; }
.ws-card.ws-user { align-self: flex-end; max-width: 70%; background: var(--cf-tint); border-color: transparent; }

/* Compact department dashboards share the customer-usage semantic palette. */
:root {
  --ws-blue: var(--cu-gcp); --ws-blue-bg: var(--cu-gcp-bg); --ws-blue-text: var(--cu-gcp-text);
  --ws-cyan: var(--cu-azure); --ws-cyan-bg: var(--cu-azure-bg); --ws-cyan-text: var(--cu-azure-text);
  --ws-muted: var(--cu-avg); --ws-muted-bg: var(--cu-track); --ws-muted-text: var(--fg-muted);
}
body.dark {
  --ws-blue: var(--cu-gcp); --ws-blue-bg: var(--cu-gcp-bg); --ws-blue-text: var(--cu-gcp-text);
  --ws-cyan: var(--cu-azure); --ws-cyan-bg: var(--cu-azure-bg); --ws-cyan-text: var(--cu-azure-text);
  --ws-muted: var(--cu-avg); --ws-muted-bg: var(--cu-track); --ws-muted-text: var(--fg-muted);
}
.ws-tone-blue { --ws-color: var(--ws-blue); --ws-bg: var(--ws-blue-bg); --ws-text: var(--ws-blue-text); }
.ws-tone-cyan { --ws-color: var(--ws-cyan); --ws-bg: var(--ws-cyan-bg); --ws-text: var(--ws-cyan-text); }
.ws-tone-ok { --ws-color: var(--cu-ok); --ws-bg: var(--cu-ok-bg); --ws-text: var(--cu-ok-text); }
.ws-tone-warn { --ws-color: var(--cu-warn); --ws-bg: var(--cu-warn-bg); --ws-text: var(--cu-warn-text); }
.ws-tone-alert { --ws-color: var(--cu-alert); --ws-bg: var(--cu-alert-bg); --ws-text: var(--cu-alert-text); }
.ws-tone-muted { --ws-color: var(--ws-muted); --ws-bg: var(--ws-muted-bg); --ws-text: var(--ws-muted-text); }
.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ws-head h1 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.ws-head p { margin: 4px 0 0; color: var(--fg-muted); font-size: 13px; }
.ws-badge { border: 0; border-radius: 5px; padding: 2px 6px; background: var(--ws-bg, var(--cu-track)); color: var(--ws-text, var(--fg-muted)); white-space: nowrap; font-weight: 600; }
.ws-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin: 0 0 12px; }
.ws-kpis .ws-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; min-width: 0; padding: 12px 14px; border: 1px solid var(--fg-line); border-top: 3px solid var(--ws-color); border-radius: 10px; background: var(--fg-surface); box-shadow: var(--cu-card-shadow); text-align: left; color: var(--fg-text); }
.ws-kpi > span { color: var(--fg-muted); font-size: 12px; }
.ws-kpi strong { color: var(--ws-text); font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ws-kpi strong small { font-size: 13px; margin-left: 3px; }
.ws-kpi button:hover, button.ws-kpi:hover { background: var(--ws-bg); }
.ws-ratio { width: 100%; height: 6px; fill: var(--ws-color); }
.ws-track { fill: var(--cu-track); }
.ws-card { box-shadow: var(--cu-card-shadow); }
.ws-case, .ws-list-card { border-left: 3px solid var(--ws-color, var(--cu-primary)); padding: 12px 14px; }
.ws-client-name { font-size: 13px; }
.ws-client-name:empty { display: none; }
.ws-person { display: inline-flex; gap: 5px; align-items: center; vertical-align: middle; }
.ws-avatar { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cu-gcp-bg); color: var(--cu-gcp-text); font-size: 10px; font-weight: 650; }
.ws-page .ws-status, .ws-drawer .ws-status, .ws-table .ws-pill-select { background: var(--ws-bg); color: var(--ws-text); border-radius: 999px; font-size: 12px; font-weight: 600; }
.ws-status { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; }
.ws-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ws-color); }
.ws-table .ws-pill-select { border: 1px solid var(--ws-color); padding-left: 8px; }
.ws-pill-select option { color: var(--fg-text); background: var(--fg-surface); }
.ws-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--fg-line); border-radius: 999px; padding: 3px 8px; background: var(--fg-surface); color: var(--ws-text); font-size: 12px; white-space: nowrap; }
.ws-chip b { border-radius: 999px; min-width: 18px; text-align: center; padding: 0 4px; line-height: 20px; background: var(--ws-bg); color: var(--ws-text); font-variant-numeric: tabular-nums; }
.ws-chip:hover { background: var(--ws-bg); }
.ws-attention { flex-wrap: wrap; gap: 6px; }
.ws-attention button { flex: auto; }
.ws-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ws-chart { min-width: 0; white-space: normal; }
.ws-chart > svg { display: block; width: 100%; max-height: 88px; margin: 8px 0; }
.ws-chart rect[class*='ws-tone-'] { fill: var(--ws-color); }
.ws-chart text { fill: var(--fg-muted); font-size: 10px; }
.ws-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11px; color: var(--fg-muted); }
.ws-legend span { display: inline-flex; align-items: center; gap: 4px; }
.ws-legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--ws-color); }
.ws-legend b { font-variant-numeric: tabular-nums; }
.ws-date { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; font-variant-numeric: tabular-nums; }
.ws-date svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.ws-date small { font-size: 11px; }
.ws-page .ws-overdue, .ws-table .ws-overdue, .ws-table .ws-overdue input { color: var(--cu-alert-text); background: var(--cu-alert-bg); }
.ws-page .ws-due, .ws-table .ws-due input { color: var(--cu-warn-text); background: var(--cu-warn-bg); }
.ws-table-scroll { border-radius: 10px; box-shadow: var(--cu-card-shadow); }
.ws-table th { background: var(--cu-subtle); }
.ws-table tbody tr:hover > td { background: var(--cu-subtle); }
.ws-table input { color: inherit; }
.ws-list-card input[type='checkbox'] { accent-color: var(--ws-color); }
.ws-done label { color: var(--cu-ok-text); text-decoration: line-through; }
.ws-tool { display: inline-flex; flex-wrap: wrap; margin-top: 8px; padding: 3px 8px; border-radius: 6px; background: var(--ws-bg); color: var(--ws-text); font-size: 11px; }
.ws-presets button { border: 1px solid var(--fg-line); border-radius: 8px; background: var(--fg-surface); box-shadow: var(--cu-card-shadow); }
.ws-presets button:hover { background: var(--cu-subtle); border-color: var(--cu-primary); }
@media (max-width: 700px) {
  .ws-charts { grid-template-columns: minmax(0, 1fr); }
  .ws-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-head { align-items: flex-start; }
  .ws-head .ws-badge { flex: none; }
}
.ws-table .ws-pill-select { padding-left: 18px; background-image: radial-gradient(circle at 9px 50%, var(--ws-color) 3px, transparent 3.5px); }
.ws-list-group { margin-bottom: 12px; }
.ws-list-group > h2 { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-muted); }
.ws-list-group > h2 small { padding: 1px 6px; border-radius: 999px; background: var(--cu-track); font-variant-numeric: tabular-nums; }
/* Second polish: structured detail, compact filters and proportional due chart. */
.ws-empty, .ws-drawer-sub { color: var(--fg-muted); font-size: 12px; }
.ws-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.ws-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.ws-toolbar .ws-actions, .ws-toolbar .ws-filters { margin: 0; }
.ws-toolbar .ws-filters { flex: 1; flex-wrap: nowrap; }
.ws-filters label { white-space: nowrap; }
.ws-search { position: relative; flex: 1; min-width: 160px; }
.ws-search svg { position: absolute; left: 8px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; color: var(--fg-muted); }
.ws-filters .ws-search input { width: 100%; padding-left: 30px; }
.ws-view-tabs { gap: 4px; }
.ws-view-tabs .ws-chip[aria-pressed='true'] { border-color: var(--cu-primary); box-shadow: inset 0 0 0 1px var(--cu-primary); background: var(--ws-bg); }
.ws-tone-primary { --ws-color: var(--cu-primary); }
.ws-grid { fill: none; stroke: var(--cu-track); }
.ws-date[title] { font-size: 12px; }
.ws-date small, .ws-date-tag { padding: 1px 5px; border-radius: 999px; background: var(--cu-track); font-size: 11px; }
.ws-page .ws-overdue, .ws-table .ws-overdue, .ws-table .ws-overdue input, .ws-drawer .ws-overdue { color: var(--cu-alert-text); background: transparent; }
.ws-page .ws-due, .ws-table .ws-due, .ws-table .ws-due input, .ws-drawer .ws-due { color: var(--cu-warn-text); background: transparent; }
.ws-overdue > small, .ws-overdue .ws-date-tag { background: var(--cu-alert-bg); }
.ws-due > small, .ws-due .ws-date-tag { background: var(--cu-warn-bg); }
.ws-case .ws-case-milestone { white-space: normal; overflow: visible; display: flex; flex-direction: column; gap: 3px; }
.ws-case-milestone > small { color: var(--fg-muted); font-size: 11px; }
.ws-case-milestone > span { overflow-wrap: anywhere; }
.ws-drawer { box-sizing: border-box; font-size: 14px; }
.ws-drawer h2 { font-size: 22px; font-weight: 650; margin-top: 0; margin-bottom: 6px; }
.ws-detail-section { margin: 14px 0; }
.ws-detail-section h3 { font-size: 15px; font-weight: 650; }
.ws-detail-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ws-detail-kpis > div { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 12px; border: 1px solid var(--fg-line); border-radius: 12px; background: var(--cu-subtle); }
.ws-detail-kpis small { color: var(--fg-muted); font-size: 12px; }
.ws-detail-kpis strong { font-size: 14px; overflow-wrap: anywhere; }
.ws-timeline, .ws-stepper, .ws-attachments { list-style: none; padding: 0; margin: 0; }
.ws-timeline { margin-left: 5px; }
.ws-timeline-item { position: relative; border-left: 2px solid var(--cu-track); padding: 0 0 14px 16px; }
.ws-timeline-item::before { content: ''; position: absolute; left: -5px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--ws-color); }
.ws-entry, .ws-entry-meta, .ws-entry-text { overflow-wrap: anywhere; }
.ws-entry-meta, .ws-timeline time { color: var(--fg-muted); font-size: 12px; }
.ws-timeline .ws-date svg { display: none; }
.ws-timeline .ws-date { margin: 0 4px; }
.ws-timeline .ws-date > small { background: transparent; padding: 0; }
.ws-timeline .ws-date { font-size: 0; }
.ws-timeline .ws-date > small { font-size: 12px; }
.ws-step { border-left: 3px solid var(--ws-color); padding: 8px 12px; margin-bottom: 6px; background: var(--cu-subtle); border-radius: 8px; }
.ws-attachment { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--fg-line); padding: 8px 0; }
.ws-check-icon { color: var(--ws-text); font-size: 18px; }
.ws-drawer .ws-card { border-radius: 14px; }
.ws-drawer-footer { position: sticky; bottom: -14px; margin: 14px -14px -14px; padding: 12px 14px; border-top: 1px solid var(--fg-line); background: var(--fg-surface); z-index: 2; box-shadow: var(--cu-card-shadow); }
.ws-drawer-footer button { min-height: 32px; font-size: 13px; border-radius: 8px; }
.ws-drawer-footer .ws-primary { color: var(--cf-white, var(--fg-surface)); background: var(--cu-primary); border-color: var(--cu-primary); }
.ws-drawer-footer .ws-external { padding: 0; border: 0; background: transparent; color: var(--fg-muted); font-size: 12px; }
.ws-external svg { width: 14px; height: 14px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.75; }
@media (min-width: 1200px) { .ws-toolbar { flex-wrap: nowrap; } }
@media (max-width: 700px) { .ws-toolbar .ws-filters { flex-wrap: wrap; } .ws-search { flex-basis: 100%; } .ws-detail-kpis { gap: 4px; } .ws-detail-kpis > div { padding: 8px; } }
/* Keep table rows compact (docs/ui-guidelines.md §3): date tags inline, no wrapping. */
.ws-table td { white-space: nowrap; }
.ws-table td small.ws-date-tag { display: inline-block; margin-left: 6px; vertical-align: middle; }
.ws-table td .ws-date small { display: inline; margin-left: 6px; }
/* PJM list pages (到期與週期 / 週會待追蹤 / 專案事件): structured cards, docs/ui-guidelines.md §4. */
.ws-list-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ws-list-card .ws-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 650; color: var(--fg-text); cursor: pointer; text-align: left; }
.ws-list-card .ws-link:hover { color: var(--cu-primary); text-decoration: underline; text-underline-offset: 3px; }
.ws-list-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 6px 0 0; font-size: 12.5px; color: var(--fg-muted); }
.ws-list-note { margin: 6px 0 0; font-size: 12.5px; color: var(--cu-alert-text); }
.ws-incident { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 0; }
.ws-incident dt { font-size: 11.5px; color: var(--fg-muted); }
.ws-incident dd { margin: 2px 0 0; font-size: 13px; }
@media (max-width: 700px) { .ws-incident { grid-template-columns: 1fr; } }
