@layer rental-features {
  .contract-workspace-dialog { width: min(1160px,96vw); max-width: 1160px; max-height: 94dvh; }
  .cw-inner { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .cw-toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
  .cw-toolbar label { display: grid; gap: 5px; min-width: 160px; }
  .cw-toolbar .muted { align-self: center; }
  .cw-notice { margin: 0; color: var(--ui-muted); }
  .cw-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; min-height: 0; }
  .cw-edit { display: grid; gap: 10px; align-content: start; min-width: 0; }
  .cw-edit > label { display: grid; gap: 6px; min-width: 0; }
  #cwBody { min-height: 400px; max-height: 65dvh; resize: vertical; }
  #cwVariables > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
  .cw-variable-controls { display: flex; gap: 8px; }
  .cw-variable-controls select { min-width: 0; flex: 1; }
  .cw-preview { min-width: 0; }
  .cw-preview h3 { margin: 0; }
  .cw-preview > p { margin: 4px 0 8px; }
  .cw-paper { padding: 20px; max-height: 70dvh; overflow: auto; border: 1px solid var(--ui-border); background: var(--ui-paint-surface); box-shadow: var(--ui-shadow-soft); overflow-wrap: anywhere; font-family: '宋体',serif; }
  .cw-paper h4 { text-align: center; margin: 0 0 16px; font-size: 18px; color: var(--ui-text); }
  .cw-paper p { margin: 0 0 8px; line-height: 1.6; white-space: pre-wrap; }
  .cw-doc-heading { font-weight: 700; }
  .cw-footer { position: sticky; bottom: 0; display: grid; grid-template-columns: minmax(0,1fr); min-width: 0; gap: 6px; padding: 10px 0 0; background: var(--ui-paint-surface); }
  .cw-footer .inline-checkbox { min-height: 44px; min-width: 0; }
  .cw-footer .inline-checkbox span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .cw-error { margin: 0; color: var(--ui-danger); overflow-wrap: anywhere; }
  .cw-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
  @media (max-width:720px) {
    .contract-workspace-dialog { width: calc(100vw - 16px); max-height: 95dvh; }
    .cw-layout { grid-template-columns: minmax(0,1fr); }
    .cw-toolbar { gap: 8px; }
    .cw-toolbar label { flex: 1; min-width: 0; }
    #cwBody { height: 260px; min-height: 260px; }
    .cw-paper { padding: 12px; max-height: 50dvh; }
    .cw-actions > button { flex: 1; }
  }
}
