/* Workbench portal authority 2026-08-28 */
:root {
  --workbench-gap: 14px;
  --workbench-panel-radius: 8px;
}

.view-root:has(> .workbench-content-portal) {
  padding: 16px;
  overflow: auto;
}

.workbench-content-portal {
  width: min(100%, 1480px);
  margin: 0 auto;
}

.workbench-portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 0.95fr);
  gap: var(--workbench-gap);
  align-items: stretch;
}

.workbench-portal-main,
.workbench-portal-side {
  display: grid;
  gap: var(--workbench-gap);
  min-width: 0;
}

.workbench-portal-main {
  grid-template-rows: auto minmax(220px, 1fr);
}

.workbench-portal-side {
  grid-template-rows: repeat(2, minmax(210px, 1fr));
}

.workbench-status-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--workbench-gap);
}

.workbench-status-group {
  min-width: 0;
  min-height: 112px;
  padding: 12px 14px 10px;
  border-radius: var(--workbench-panel-radius);
  color: #fff;
}

.workbench-status-group.blue { background: #5e9eea; }
.workbench-status-group.coral { background: #ef7e7f; }
.workbench-status-group.violet { background: #747be2; }
.workbench-status-group.teal { background: #2ab69e; }

.workbench-status-group h2 {
  margin: 0 0 8px;
  color: inherit;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.workbench-status-group > div {
  display: grid;
  grid-template-columns: repeat(var(--workbench-status-columns, 4), minmax(0, 1fr));
  min-width: 0;
}

.workbench-status-group button {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 62px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color 180ms ease, transform 180ms ease;
}

.workbench-status-group button:hover {
  background: rgb(255 255 255 / 14%);
}

.workbench-status-group button:active { transform: translateY(1px); }

.workbench-status-group button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.workbench-status-group button strong {
  align-self: end;
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 20px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.workbench-status-group button span {
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.workbench-portal-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dfe5ec;
  border-radius: var(--workbench-panel-radius);
  background: #fff;
}

.workbench-portal-panel > header {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid #e6ebf0;
}

.workbench-portal-panel > header h2 {
  position: relative;
  margin: 0;
  padding-left: 10px;
  color: #1d2129;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.workbench-portal-panel > header h2::before {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: #1677ff;
  content: "";
}

.workbench-common-flow-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(74px, 1fr));
  gap: 10px;
  padding: 20px 14px;
}

.workbench-common-flow-grid button {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 88px;
  padding: 6px 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #1d2129;
  cursor: pointer;
  transition: background-color 180ms ease;
}

.workbench-common-flow-grid button:hover { background: #f3f7fc; }
.workbench-common-flow-grid button:focus-visible { outline: 2px solid #1677ff; outline-offset: -2px; }

.workbench-common-flow-grid button > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #287fe5;
}

.workbench-common-flow-grid button > span.tone-1 { background: #8179e9; }
.workbench-common-flow-grid button > span.tone-2 { background: #48b86b; }
.workbench-common-flow-grid button > span.tone-3 { background: #25b9b4; }
.workbench-common-flow-grid button > span.tone-4 { background: #f0a124; }
.workbench-common-flow-grid button > span.tone-5 { background: #e68c42; }

.workbench-common-flow-grid img {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
}

.workbench-common-flow-grid strong {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.workbench-content-list {
  min-height: 160px;
  padding: 2px 14px 10px;
}

.workbench-content-list button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  background: transparent;
  color: #1d2129;
  text-align: left;
  cursor: pointer;
}

.workbench-content-list button:last-child { border-bottom: 0; }
.workbench-content-list button:hover strong { color: #0f61c9; }
.workbench-content-list button:focus-visible { outline: 2px solid #1677ff; outline-offset: 2px; }

.workbench-content-list button span {
  max-width: 74px;
  overflow: hidden;
  color: #6e7681;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.workbench-content-list button strong {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.workbench-content-list button time {
  color: #6e7681;
  font-size: 11px;
  white-space: nowrap;
}

.workbench-content-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  color: #6e7681;
  font-size: 12px;
}

.workbench-content-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(720px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #1d2129;
  box-shadow: 0 8px 24px rgb(15 52 118 / 22%);
}

.workbench-content-dialog::backdrop { background: rgb(7 20 41 / 48%); }

.workbench-content-dialog > header,
.workbench-content-dialog > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.workbench-content-dialog > header { border-bottom: 1px solid #e6ebf0; }
.workbench-content-dialog > footer { border-top: 1px solid #e6ebf0; }
.workbench-content-dialog > header span,
.workbench-content-dialog > footer time { color: #6e7681; font-size: 12px; }
.workbench-content-dialog h2 { margin: 2px 0 0; font-size: 18px; line-height: 1.4; }
.workbench-content-dialog > header > button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f4f8; color: #394150; font-size: 22px; cursor: pointer; }
.workbench-content-dialog-body { max-height: 390px; padding: 20px; overflow: auto; font-size: 14px; line-height: 1.75; }
.workbench-content-dialog > footer > div { display: flex; gap: 8px; }

.workbench-content-attachments {
  padding: 12px 20px 16px;
  border-top: 1px solid #edf0f3;
}

.workbench-content-attachments h3 { margin: 0 0 8px; font-size: 13px; }
.workbench-content-attachments > div { display: grid; gap: 8px; max-height: 180px; overflow: auto; }
.workbench-content-attachments .attachment-image-link { width: 100%; }

.system-content-management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 14px;
}

.system-content-management-grid > section {
  min-width: 0;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  overflow: hidden;
}

.system-content-management-grid > section > header { padding: 11px 14px; border-bottom: 1px solid #e6ebf0; background: #f6f8fa; }
.system-content-management-grid h3 { margin: 0; color: #1d2129; font-size: 14px; }

[data-system-content-form] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 14px;
  border-bottom: 1px solid #e6ebf0;
}

[data-system-content-form] label:not(.system-content-publish) { display: grid; gap: 5px; min-width: 0; }
[data-system-content-form] label > span { color: #4e5969; font-size: 12px; }
[data-system-content-form] .wide { grid-column: 1 / -1; }
[data-system-content-form] :is(input, textarea) { width: 100%; min-width: 0; border: 1px solid #cfd7e2; border-radius: 6px; background: #fff; color: #1d2129; font: inherit; }
[data-system-content-form] input { height: 36px; padding: 0 10px; }
[data-system-content-form] input[type="file"] { height: auto; min-height: 38px; padding: 6px 8px; }
[data-system-content-form] textarea { min-height: 78px; padding: 8px 10px; resize: vertical; line-height: 1.55; }
[data-system-content-form] :is(input, textarea):focus { border-color: #1677ff; outline: 2px solid rgb(22 119 255 / 16%); }
.system-content-publish { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; font-size: 12px; }
.system-content-publish input { width: 16px; height: 16px; }
.system-content-form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }

.system-content-attachment-list {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid #dfe5ec;
  border-radius: 6px;
  background: #f8fafc;
}

.system-content-attachment-list[hidden] { display: none; }
.system-content-attachment-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.system-content-attachment-row .attachment-image-link { flex: 1; min-width: 0; }
.system-content-attachment-empty { color: #6e7681; font-size: 12px; }

.system-content-records { max-height: 300px; overflow: auto; }
.system-content-records article { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 12px; border-bottom: 1px solid #edf0f3; }
.system-content-records article:last-child { border-bottom: 0; }
.system-content-records article > div:first-child { display: grid; min-width: 0; gap: 2px; }
.system-content-records article strong { overflow: hidden; color: #1d2129; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.system-content-records article span { color: #6e7681; font-size: 11px; }
.system-content-records article > div:last-child { display: flex; flex: none; gap: 6px; }

html[data-color-scheme="dark"] .workbench-portal-panel,
html[data-color-scheme="dark"] .workbench-content-dialog,
html[data-color-scheme="dark"] [data-system-content-form] :is(input, textarea) {
  background: #1d2530;
  color: #f4f7fb;
}

html[data-color-scheme="dark"] .workbench-portal-panel,
html[data-color-scheme="dark"] .system-content-management-grid > section,
html[data-color-scheme="dark"] [data-system-content-form] :is(input, textarea) { border-color: #3f4b5a; }
html[data-color-scheme="dark"] .system-content-attachment-list { border-color: #3f4b5a; background: #202b38; }
html[data-color-scheme="dark"] .workbench-portal-panel > header,
html[data-color-scheme="dark"] .workbench-content-dialog > :is(header, footer),
html[data-color-scheme="dark"] [data-system-content-form],
html[data-color-scheme="dark"] .system-content-records article { border-color: #354150; }
html[data-color-scheme="dark"] .workbench-portal-panel > header h2,
html[data-color-scheme="dark"] .workbench-common-flow-grid button,
html[data-color-scheme="dark"] .workbench-content-list button,
html[data-color-scheme="dark"] .system-content-management-grid h3,
html[data-color-scheme="dark"] .system-content-records article strong { color: #f4f7fb; }
html[data-color-scheme="dark"] .workbench-common-flow-grid button:hover { background: #273444; }
html[data-color-scheme="dark"] .system-content-management-grid > section > header { background: #202b38; border-color: #354150; }

@media (max-width: 1180px) {
  .workbench-portal-grid { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.85fr); }
  .workbench-common-flow-grid { grid-template-columns: repeat(4, minmax(74px, 1fr)); }
}

@media (max-width: 900px) {
  .workbench-portal-grid { grid-template-columns: 1fr; }
  .workbench-portal-side { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
  .system-content-management-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .view-root:has(> .workbench-content-portal) { padding: 10px; }
  .workbench-status-board { grid-template-columns: 1fr; }
  .workbench-status-group { min-height: 104px; }
  .workbench-common-flow-grid { grid-template-columns: repeat(4, minmax(64px, 1fr)); padding: 14px 8px; gap: 8px 4px; }
  .workbench-common-flow-grid button { min-height: 84px; }
  .workbench-portal-side { grid-template-columns: 1fr; }
  .workbench-content-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; border-radius: 0; }
  .workbench-content-dialog-body { max-height: calc(100dvh - 142px); }
  [data-system-content-form] { grid-template-columns: 1fr; }
  [data-system-content-form] .wide { grid-column: auto; }
  .system-content-records article { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .workbench-status-group button,
  .workbench-common-flow-grid button { transition: none; }
}
