/*
 * Enterprise layout refinement — native CSS only.
 *
 * The compiled application bundle adds the hesc-* hooks at render time. This
 * file only changes layout; it never moves React-owned DOM after rendering.
 */

/* Workbench: quick work, overdue work and follow-ups share one primary row. */
.hesc-workbench-refined {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.hesc-workbench-refined > .hesc-page-header {
  grid-column: 1 / -1;
  margin: 0;
}

.hesc-workbench-refined > .hesc-workbench-quick {
  order: 1;
  grid-column: span 2;
  min-height: 152px;
  margin: 0;
}

.hesc-workbench-refined > .hesc-workbench-kpis,
.hesc-workbench-refined > .hesc-workbench-details,
.hesc-workbench-refined > .hesc-operations-refined,
.hesc-workbench-refined .hesc-operations-management-refined,
.hesc-workbench-refined .hesc-operations-management-refined > .hesc-operations-management-left {
  display: contents;
}

.hesc-workbench-refined .hesc-workbench-overdue-summary,
.hesc-workbench-refined .hesc-workbench-followup-summary {
  order: 1;
  grid-column: span 1;
  min-height: 152px;
  margin: 0;
}

.hesc-workbench-refined .hesc-workbench-task-list {
  order: 2;
  grid-column: 1 / -1;
  margin: 0;
}

/* Keep operations together, then place system-only status last. */
.hesc-workbench-refined > .hesc-operations-refined > .hesc-section-heading {
  order: 3;
  grid-column: 1 / -1;
  margin: 8px 0 0;
}

.hesc-workbench-refined > .hesc-operations-refined > .hesc-kpis {
  order: 4;
  grid-column: 1 / -1;
}

.hesc-workbench-refined .hesc-operations-groups-card,
.hesc-workbench-refined .hesc-operations-reminders-card {
  order: 5;
  grid-column: span 2;
  margin: 0;
}

.hesc-workbench-refined .hesc-operations-activity-card {
  order: 6;
  grid-column: 1 / -1;
  margin: 0;
}

.hesc-workbench-refined::after {
  content: "系统信息";
  order: 7;
  grid-column: 1 / -1;
  padding-top: 24px;
  border-top: 1px solid var(--hesc-border, #22445b);
  color: var(--hesc-text, #e6f3f8);
  font-size: 1.05rem;
  font-weight: 700;
}

.hesc-workbench-refined .hesc-workbench-system-info {
  order: 8;
  grid-column: span 1;
  margin: 0;
}

.hesc-workbench-refined .hesc-operations-hidden-metric {
  display: none !important;
}

/* Assistant stays centred on wide displays instead of drifting right. */
.hesc-assistant-layout-refined {
  width: min(calc(100% - 48px), 1560px);
  margin-inline: auto !important;
}

.hesc-assistant-layout-refined .hesc-ai-workbench {
  grid-template-columns: clamp(240px, 18vw, 280px) minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 1800px) {
  .hesc-assistant-layout-refined {
    transform: translateX(18px);
  }
}

/* Reminder centre: creation controls stay left; reminders scroll independently. */
.hesc-reminder-refined {
  grid-template-columns: minmax(0, 1.06fr) minmax(380px, 0.94fr);
  grid-template-areas:
    "editor reminders"
    "manual reminders";
  gap: 28px;
  align-items: start;
}

.hesc-reminder-refined .hesc-reminder-editor {
  grid-area: editor;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.hesc-reminder-refined .hesc-reminder-manual {
  grid-area: manual;
  min-width: 0;
  margin: 8px 0 0;
}

.hesc-reminder-refined .hesc-reminder-list-panel {
  grid-area: reminders;
  min-width: 0;
  max-height: min(68vh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  border: 1px solid var(--hesc-border, #22445b);
  border-radius: 12px;
  background: var(--hesc-panel, #102131);
}

/* Script-level hidden state still protects the page if this stylesheet fails. */
#hermes-followup-backdrop[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .hesc-workbench-refined > .hesc-workbench-quick,
  .hesc-workbench-refined .hesc-workbench-overdue-summary,
  .hesc-workbench-refined .hesc-workbench-followup-summary,
  .hesc-workbench-refined .hesc-operations-groups-card,
  .hesc-workbench-refined .hesc-operations-reminders-card,
  .hesc-workbench-refined .hesc-workbench-system-info {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .hesc-workbench-refined {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .hesc-workbench-refined > .hesc-workbench-quick,
  .hesc-workbench-refined .hesc-workbench-overdue-summary,
  .hesc-workbench-refined .hesc-workbench-followup-summary,
  .hesc-workbench-refined .hesc-operations-groups-card,
  .hesc-workbench-refined .hesc-operations-reminders-card,
  .hesc-workbench-refined .hesc-workbench-system-info {
    grid-column: 1 / -1;
  }

  .hesc-assistant-layout-refined {
    width: min(calc(100% - 28px), 1560px);
    transform: none;
  }

  .hesc-assistant-layout-refined .hesc-ai-workbench,
  .hesc-reminder-refined {
    grid-template-columns: minmax(0, 1fr);
  }

  .hesc-reminder-refined {
    grid-template-areas:
      "editor"
      "manual"
      "reminders";
  }

  .hesc-reminder-refined .hesc-reminder-list-panel {
    max-height: 52vh;
  }
}
