.civil-site-log-workbench {
  --csl-border: #d7dee8;
  --csl-muted: #667085;
  --csl-panel: #fff;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 720px;
  height: calc(100vh - 250px);
  color: #1f2937;
}

.csl-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(150px, 1fr) minmax(150px, 1fr) 142px 142px auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--csl-border);
  border-radius: 10px;
  background: #f8fafc;
}

.csl-toolbar label,
.csl-form-grid label,
.csl-upload,
.csl-reopen label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #475467;
  font-size: 12px;
  font-weight: 600;
}

.csl-toolbar select,
.csl-toolbar input,
.csl-form-grid select,
.csl-form-grid input,
.csl-form-grid textarea,
.csl-reopen textarea {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 8px 9px;
  background: #fff;
  color: #111827;
  font: inherit;
}

.csl-toolbar-actions,
.csl-card-actions,
.csl-view-switch,
.csl-pagination {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.csl-loading,
.csl-readonly-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
}

.csl-work-area {
  display: grid;
  grid-template-columns: minmax(520px, 1.25fr) minmax(390px, .95fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  margin-top: 10px;
}

.csl-flow-panel,
.csl-site-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--csl-border);
  border-radius: 10px;
  background: var(--csl-panel);
  overflow: hidden;
}

.csl-flow-panel {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.csl-site-panel {
  display: flex;
  flex-direction: column;
}

.csl-section-head,
.csl-site-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.csl-section-head h3,
.csl-site-title h3,
.csl-card h4,
.csl-modal h3 {
  margin: 0;
}

.csl-section-head p,
.csl-site-title p,
.csl-help {
  margin: 4px 0 0;
  color: var(--csl-muted);
  font-size: 12px;
}

.csl-table-wrap {
  min-height: 0;
  flex: 1 1 auto;
  margin-top: 10px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.csl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.csl-table th,
.csl-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.csl-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  color: #475467;
}

.csl-table td small,
.csl-list small {
  display: block;
  margin-top: 3px;
  color: var(--csl-muted);
}

.csl-table tr[data-csl-log] {
  cursor: pointer;
}

.csl-table tr[data-csl-log]:hover {
  background: #f8fafc;
}

.csl-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f0fb;
  color: #245b97;
  font-size: 11px;
  font-weight: 700;
}

.csl-pagination {
  justify-content: flex-end;
  padding-top: 10px;
  color: var(--csl-muted);
  font-size: 12px;
}

.csl-site-title {
  padding: 13px 14px;
  border-bottom: 1px solid var(--csl-border);
  background: #f8fafc;
}

.csl-site-title > div > span {
  color: var(--csl-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.csl-side-scroll {
  min-height: 0;
  flex: 1 1 auto;
  padding: 10px;
  overflow: auto;
}

.csl-card {
  padding: 11px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.csl-card + .csl-card {
  margin-top: 9px;
}

.csl-card h4 {
  margin-bottom: 9px;
  color: #344054;
  font-size: 14px;
}

.csl-facts,
.csl-modal-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.csl-facts div,
.csl-modal-facts div {
  padding: 7px;
  border-radius: 6px;
  background: #f8fafc;
}

.csl-facts dt,
.csl-modal-facts dt {
  color: var(--csl-muted);
  font-size: 11px;
}

.csl-facts dd,
.csl-modal-facts dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.csl-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.csl-wide {
  grid-column: 1 / -1;
}

.csl-card-actions {
  justify-content: flex-end;
  margin-top: 9px;
}

.csl-list {
  display: grid;
  gap: 6px;
  margin: 0 0 9px;
  padding: 0;
  list-style: none;
}

.csl-list li {
  display: grid;
  grid-template-columns: minmax(90px, .65fr) minmax(120px, 1.35fr) auto;
  gap: 7px;
  align-items: start;
  padding: 7px;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
}

.csl-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.csl-photo {
  min-height: 74px;
  border: 1px dashed #94a3b8;
  border-radius: 7px;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}

.csl-photo small {
  display: block;
  margin-top: 5px;
  color: var(--csl-muted);
}

.csl-upload {
  margin-top: 8px;
}

.csl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  padding: 14px;
  color: var(--csl-muted);
  text-align: center;
}

.csl-error {
  display: grid;
  gap: 4px;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff1f2;
  color: #991b1b;
  font-size: 12px;
}

.csl-error code {
  overflow-wrap: anywhere;
  color: #7f1d1d;
}

.csl-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .58);
}

.csl-modal {
  width: min(760px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 45px rgba(15, 23, 42, .35);
}

.csl-modal > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.csl-modal-body {
  max-height: calc(88vh - 62px);
  padding: 14px;
  overflow: auto;
}

.csl-photo-preview {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  margin: auto;
  object-fit: contain;
}

/* ===== Expander 折叠区域（对齐桌面版 SettingsExpander）===== */
.csl-expander {
  margin-top: 9px;
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  background: #fafbfd;
  overflow: hidden;
}

.csl-expander + .csl-expander {
  margin-top: 9px;
}

.csl-expander > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: #334155;
  font-size: 13px;
  user-select: none;
}

.csl-expander > summary::-webkit-details-marker {
  display: none;
}

.csl-expander > summary::after {
  content: "⌄";
  font-size: 18px;
  color: #475569;
  transition: transform .15s ease;
}

.csl-expander[open] > summary::after {
  transform: rotate(180deg);
}

.csl-expander[open] > summary {
  border-bottom: 1px solid #e2e8f0;
}

.csl-expander-body {
  padding: 10px;
  background: #fff;
}

.csl-expander-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #e8f0fb;
  color: #245b97;
  font-size: 11px;
  font-weight: 700;
}

/* ===== 工地状态管理按钮组 ===== */
.csl-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
}

.csl-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.csl-status-pill.is-active {
  background: #e6f6ec;
  color: #16813b;
}

.csl-status-pill.is-paused {
  background: #fff3e0;
  color: #c56a00;
}

.csl-status-pill.is-ended {
  background: #fee2e2;
  color: #b91c1c;
}

/* ===== 配置审计（只读）明细 ===== */
.csl-audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}

.csl-audit-table th,
.csl-audit-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.csl-audit-table th {
  background: #f1f5f9;
  color: #475467;
  font-weight: 600;
}

.csl-audit-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.csl-audit-diff > div {
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.csl-audit-diff > div > strong {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
}

/* ===== 草稿提示条 ===== */
.csl-draft-hint {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  font-size: 11px;
}

.csl-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475467;
}

.csl-switch input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

@media (max-width: 1200px) {
  .csl-toolbar { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .csl-toolbar-actions { grid-column: 1 / -1; }
  .csl-work-area { grid-template-columns: 1fr; overflow: auto; }
  .csl-flow-panel, .csl-site-panel { min-height: 560px; }
}

@media (max-width: 720px) {
  .civil-site-log-workbench { height: auto; min-height: 0; }
  .csl-toolbar, .csl-form-grid, .csl-facts, .csl-modal-facts { grid-template-columns: 1fr; }
  .csl-wide { grid-column: auto; }
  .csl-section-head, .csl-site-title { flex-direction: column; }
  .csl-list li { grid-template-columns: 1fr; }
}
