.mdw-shell {
  --mdw-accent: var(--theme-color, #49b1f5);
  --mdw-border: color-mix(in srgb, var(--font-color, #4c4948) 18%, transparent);
  --mdw-muted: color-mix(in srgb, var(--font-color, #4c4948) 66%, transparent);
  --mdw-panel: var(--card-bg, #fff);
  --mdw-soft: color-mix(in srgb, var(--mdw-accent) 7%, var(--mdw-panel));
  color: var(--font-color, #4c4948);
}

.mdw-shell *,
.mdw-shell *::before,
.mdw-shell *::after {
  box-sizing: border-box;
}

.mdw-shell [hidden] {
  display: none !important;
}

.mdw-intro,
.mdw-connection,
.mdw-library,
.mdw-stage {
  border: 1px solid var(--mdw-border);
  border-radius: 16px;
  background: var(--mdw-panel);
}

.mdw-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--mdw-accent) 15%, var(--mdw-panel)), var(--mdw-panel));
}

.mdw-intro h2,
.mdw-intro p,
.mdw-library h2,
.mdw-empty-state h2,
.mdw-document-header h2,
.mdw-document-header p,
.mdw-connection h2,
.mdw-connection p,
.mdw-deployment h2,
.mdw-deployment p,
.mdw-conflict p {
  margin: 0;
}

.mdw-intro p,
.mdw-connection p {
  margin-top: 0.35rem;
  color: var(--mdw-muted);
}

.mdw-upload-area,
.mdw-connection-actions,
.mdw-actions,
.mdw-mode-switch,
.mdw-tool-row,
.mdw-component-tools,
.mdw-toolbar-heading,
.mdw-deployment-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.mdw-upload-area {
  flex: 0 0 auto;
}

.mdw-limit,
.mdw-connection-status,
.mdw-save-state {
  color: var(--mdw-muted);
  font-size: 0.84rem;
}

.mdw-connection {
  margin-top: 1rem;
  padding: 1.1rem;
}

.mdw-connection h2 {
  font-size: 1.05rem;
}

.mdw-connection p {
  font-size: 0.9rem;
}

.mdw-repository-fields {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1.25fr) minmax(110px, 0.65fr) minmax(220px, 1.4fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.mdw-repository-fields label,
.mdw-component-dialog label,
.mdw-field-label {
  display: grid;
  gap: 0.3rem;
  color: var(--mdw-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.mdw-repository-fields input,
.mdw-front-matter textarea,
.mdw-component-dialog input,
.mdw-component-dialog textarea,
.mdw-component-dialog select {
  width: 100%;
  border: 1px solid var(--mdw-border);
  border-radius: 9px;
  background: color-mix(in srgb, var(--global-bg, #fff) 74%, var(--mdw-panel));
  color: var(--font-color, #4c4948);
  font: inherit;
}

.mdw-repository-fields input,
.mdw-component-dialog input,
.mdw-component-dialog select {
  min-height: 40px;
  padding: 0.5rem 0.65rem;
}

.mdw-repository-fields input:focus-visible,
.mdw-front-matter textarea:focus-visible,
.mdw-component-dialog input:focus-visible,
.mdw-component-dialog textarea:focus-visible,
.mdw-component-dialog select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--mdw-accent) 35%, transparent);
  outline-offset: 1px;
}

.mdw-connection-actions {
  margin-top: 0.85rem;
}

.mdw-connection-status {
  flex: 1 1 280px;
}

.mdw-connection-status[data-state="success"] { color: #218a55; }
.mdw-connection-status[data-state="warning"] { color: #b86e00; }
.mdw-connection-status[data-state="error"] { color: #d83b57; }

.mdw-help-link {
  color: var(--mdw-accent);
  font-size: 0.86rem;
}

.mdw-local-note {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--mdw-accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--mdw-accent) 9%, var(--mdw-panel));
  line-height: 1.7;
}

.mdw-local-note i {
  margin-right: 0.4rem;
  color: var(--mdw-accent);
}

.mdw-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.mdw-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--mdw-accent) 24%, transparent);
}

.mdw-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.mdw-button-primary {
  background: var(--mdw-accent);
  color: #fff;
}

.mdw-button-secondary {
  border-color: var(--mdw-border);
  background: var(--mdw-panel);
  color: var(--font-color, #4c4948);
}

.mdw-button-danger {
  border-color: color-mix(in srgb, #d83b57 48%, transparent);
  background: color-mix(in srgb, #d83b57 10%, var(--mdw-panel));
  color: #c5324c;
}

.mdw-button:focus-visible,
.mdw-document-item:focus-visible,
.mdw-mode-button:focus-visible,
.mdw-tool-button:focus-visible,
.mdw-butterfly-widget:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--mdw-accent) 45%, transparent);
  outline-offset: 2px;
}

.mdw-status {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: color-mix(in srgb, #2eaf6d 14%, var(--mdw-panel));
}

.mdw-status-error {
  background: color-mix(in srgb, #e85d75 15%, var(--mdw-panel));
}

.mdw-layout {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.mdw-library {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 1rem;
}

.mdw-library-heading,
.mdw-document-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.mdw-library-heading {
  align-items: center;
  margin-bottom: 0.75rem;
}

.mdw-library-heading h2 { font-size: 1.05rem; }

.mdw-count {
  min-width: 1.8rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--mdw-accent);
  color: #fff;
  text-align: center;
  font-size: 0.8rem;
}

.mdw-document-list {
  display: grid;
  gap: 0.5rem;
}

.mdw-document-item {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--font-color, #4c4948);
  text-align: left;
  cursor: pointer;
}

.mdw-document-item:hover { background: color-mix(in srgb, var(--mdw-accent) 8%, transparent); }
.mdw-document-item.is-active {
  border-color: color-mix(in srgb, var(--mdw-accent) 45%, transparent);
  background: color-mix(in srgb, var(--mdw-accent) 14%, transparent);
}

.mdw-document-item strong,
.mdw-document-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mdw-document-item span,
.mdw-library-empty {
  margin-top: 0.2rem;
  color: var(--mdw-muted);
  font-size: 0.8rem;
}

.mdw-stage {
  min-width: 0;
  min-height: 520px;
  padding: 1.25rem;
}

.mdw-empty-state {
  display: grid;
  min-height: 470px;
  place-content: center;
  justify-items: center;
  padding: 2rem;
  color: var(--mdw-muted);
  text-align: center;
}

.mdw-empty-state > i {
  margin-bottom: 1rem;
  color: var(--mdw-accent);
  font-size: 3.25rem;
}

.mdw-empty-state p { margin: 0.5rem 0 0; }

.mdw-document-header {
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--mdw-border);
}

.mdw-document-header > div:first-child {
  flex: 1 1 14rem;
  min-width: 0;
}

.mdw-document-header h2 { overflow-wrap: anywhere; }
.mdw-document-header p {
  margin-top: 0.35rem;
  color: var(--mdw-muted);
  font-size: 0.86rem;
}

.mdw-conflict {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, #e09a22 55%, var(--mdw-border));
  border-radius: 12px;
  background: color-mix(in srgb, #e09a22 10%, var(--mdw-panel));
}

.mdw-conflict p {
  margin-top: 0.25rem;
  color: var(--mdw-muted);
  font-size: 0.86rem;
}

.mdw-workbench-toolbar {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--mdw-border);
  border-radius: 12px 12px 0 0;
  background: var(--mdw-soft);
}

.mdw-toolbar-heading { justify-content: space-between; }
.mdw-mode-switch {
  width: fit-content;
  padding: 0.2rem;
  border-radius: 9px;
  background: color-mix(in srgb, var(--font-color, #4c4948) 7%, transparent);
}

.mdw-mode-button,
.mdw-tool-button {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--font-color, #4c4948);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.mdw-mode-button.is-active {
  background: var(--mdw-panel);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--font-color, #4c4948) 12%, transparent);
  color: var(--mdw-accent);
  font-weight: 700;
}

.mdw-tool-row > strong {
  min-width: 6.8rem;
  color: var(--mdw-muted);
  font-size: 0.78rem;
}

.mdw-component-tools { flex: 1 1 28rem; }
.mdw-tool-button {
  border-color: var(--mdw-border);
  background: var(--mdw-panel);
}
.mdw-tool-button:hover {
  border-color: color-mix(in srgb, var(--mdw-accent) 55%, transparent);
  color: var(--mdw-accent);
}

.mdw-shortcuts {
  color: var(--mdw-muted);
  font-size: 0.78rem;
}

.mdw-shortcuts summary { cursor: pointer; }
.mdw-shortcuts span { display: inline-block; margin: 0.4rem 0.7rem 0 0; }
.mdw-shortcuts kbd {
  padding: 0.08rem 0.3rem;
  border: 1px solid var(--mdw-border);
  border-radius: 4px;
  background: var(--mdw-panel);
}

.mdw-front-matter {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--mdw-border);
  border-top: 0;
  background: var(--mdw-panel);
}

.mdw-media {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--mdw-border);
  border-top: 0;
  background: var(--mdw-panel);
}

.mdw-media summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}

.mdw-media summary span,
.mdw-media-actions,
.mdw-media-empty {
  color: var(--mdw-muted);
  font-size: 0.8rem;
}

.mdw-media-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.mdw-asset-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.mdw-asset-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--mdw-border);
  border-radius: 9px;
  background: var(--mdw-soft);
}

.mdw-asset-icon,
.mdw-asset-preview {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--mdw-panel);
  color: var(--mdw-accent);
  object-fit: cover;
}

.mdw-asset-copy { min-width: 0; }
.mdw-asset-copy strong,
.mdw-asset-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mdw-asset-copy span { margin-top: 0.1rem; color: var(--mdw-muted); font-size: 0.76rem; }
.mdw-asset-actions { display: flex; gap: 0.4rem; }
.mdw-asset-actions .mdw-button { min-height: 34px; padding: 0.35rem 0.6rem; font-size: 0.78rem; }
.mdw-media-empty { margin: 0.75rem 0 0; }

.mdw-front-matter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}

.mdw-front-matter summary span,
.mdw-front-matter label {
  color: var(--mdw-muted);
  font-size: 0.8rem;
}

.mdw-front-matter label { display: block; margin-top: 0.7rem; }
.mdw-front-matter textarea {
  min-height: 150px;
  margin-top: 0.35rem;
  padding: 0.75rem;
  resize: vertical;
  font: 0.86rem/1.6 Consolas, Menlo, "PingFang SC", monospace;
}

.mdw-rich-editor { min-width: 0; }
.mdw-rich-editor .toastui-editor-defaultUI {
  border-color: var(--mdw-border);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.mdw-rich-editor .toastui-editor-toolbar,
.mdw-rich-editor .toastui-editor-defaultUI-toolbar,
.mdw-rich-editor .toastui-editor-md-container,
.mdw-rich-editor .toastui-editor-ww-container,
.mdw-rich-editor .toastui-editor-main-container {
  background: var(--mdw-panel);
  border-color: var(--mdw-border);
}

.mdw-rich-editor .toastui-editor-toolbar-icons { opacity: 0.82; }
.mdw-rich-editor .toastui-editor-contents,
.mdw-rich-editor .ProseMirror,
.mdw-rich-editor .toastui-editor-md-container .toastui-editor-md-preview {
  color: var(--font-color, #4c4948);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 16px;
  line-height: 1.85;
}

.mdw-rich-editor .toastui-editor-md-code,
.mdw-rich-editor .toastui-editor-md-code-block-line-background {
  background: color-mix(in srgb, var(--global-bg, #fff) 76%, var(--mdw-panel));
}

.mdw-rich-editor .toastui-editor-contents h1,
.mdw-rich-editor .toastui-editor-contents h2,
.mdw-rich-editor .toastui-editor-contents h3,
.mdw-rich-editor .toastui-editor-contents h4,
.mdw-rich-editor .toastui-editor-contents p,
.mdw-rich-editor .toastui-editor-contents li {
  color: var(--font-color, #4c4948);
}

.mdw-rich-editor .toastui-editor-contents blockquote {
  border-left-color: var(--mdw-accent);
  background: var(--mdw-soft);
}

.mdw-rich-editor .toastui-editor-contents pre {
  border-radius: 10px;
}

.mdw-butterfly-widget {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0.6rem 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--mdw-accent) 42%, var(--mdw-border));
  border-left: 4px solid var(--mdw-accent);
  border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--mdw-accent) 11%, var(--mdw-panel)), var(--mdw-panel));
  color: var(--font-color, #4c4948);
  cursor: pointer;
  user-select: none;
}

.mdw-butterfly-widget:hover { box-shadow: 0 5px 18px color-mix(in srgb, var(--mdw-accent) 17%, transparent); }
.mdw-butterfly-widget-badge {
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--mdw-accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}
.mdw-butterfly-widget-summary {
  overflow: hidden;
  color: var(--mdw-muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mdw-butterfly-widget-action { color: var(--mdw-accent); font-size: 0.78rem; font-weight: 700; }
.mdw-butterfly-widget-preview {
  grid-column: 1 / -1;
  padding-top: 0.65rem;
  border-top: 1px solid var(--mdw-border);
  pointer-events: none;
}

.mdw-deployment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--mdw-accent) 35%, var(--mdw-border));
  border-radius: 12px;
  background: var(--mdw-soft);
}

.mdw-deployment-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--mdw-accent);
  color: #fff;
}
.mdw-deployment h2 { font-size: 1rem; }
.mdw-deployment p { margin-top: 0.25rem; color: var(--mdw-muted); font-size: 0.86rem; }
.mdw-deployment-error {
  max-height: 150px;
  margin: 0.55rem 0 0;
  padding: 0.65rem 0.75rem;
  overflow: auto;
  border: 1px solid color-mix(in srgb, #d83b57 35%, var(--mdw-border));
  border-radius: 8px;
  background: color-mix(in srgb, #d83b57 9%, var(--mdw-panel));
  color: #c5324c;
  font: 0.76rem/1.55 Consolas, Menlo, "PingFang SC", monospace;
  white-space: pre-wrap;
}
.mdw-progress {
  height: 5px;
  margin-top: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--font-color, #4c4948) 10%, transparent);
}
.mdw-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mdw-accent);
  transition: width 0.35s ease;
}

.mdw-component-dialog {
  width: min(760px, calc(100vw - 2rem));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 1px solid var(--mdw-border);
  border-radius: 16px;
  background: var(--mdw-panel);
  color: var(--font-color, #4c4948);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.mdw-component-dialog::backdrop { background: rgba(15, 24, 38, 0.55); backdrop-filter: blur(3px); }
.mdw-component-dialog form { display: grid; gap: 1rem; max-height: inherit; padding: 1.2rem; overflow: auto; }
.mdw-component-dialog header,
.mdw-component-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.mdw-component-dialog h2 { margin: 0.15rem 0 0; font-size: 1.2rem; }
.mdw-dialog-eyebrow { color: var(--mdw-accent); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.mdw-dialog-close { border: 0; background: transparent; color: var(--mdw-muted); font-size: 1.7rem; cursor: pointer; }
.mdw-component-dialog textarea { min-height: 220px; padding: 0.75rem; resize: vertical; line-height: 1.6; }
.mdw-dialog-help { margin: 0; color: var(--mdw-muted); font-size: 0.8rem; }
.mdw-component-dialog footer span { flex: 1; }

.mdw-component-preview-section {
  padding: 0.8rem;
  border: 1px solid var(--mdw-border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--mdw-accent) 4%, var(--mdw-panel));
}
.mdw-component-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.65rem;
  font-size: 0.84rem;
}
.mdw-component-preview-heading span { color: var(--mdw-muted); font-size: 0.75rem; }
.mdw-component-preview { min-height: 54px; }
.mdw-component-render { color: var(--font-color, #4c4948); line-height: 1.65; }
.mdw-component-preview-body { white-space: pre-wrap; }
.mdw-preview-note { padding: 0.75rem 0.9rem; border-left: 4px solid var(--mdw-accent); border-radius: 8px; background: var(--mdw-panel); }
.mdw-preview-note.is-success { border-left-color: #2eaf6d; }
.mdw-preview-note.is-warning { border-left-color: #f0a020; }
.mdw-preview-note.is-danger { border-left-color: #d83b57; }
.mdw-preview-label { padding: 0.13rem 0.45rem; border-radius: 5px; background: color-mix(in srgb, var(--mdw-accent) 18%, var(--mdw-panel)); color: inherit; }
.mdw-preview-button { display: inline-flex; padding: 0.45rem 0.8rem; border: 1px solid var(--mdw-accent); border-radius: 8px; background: var(--mdw-accent); color: #fff; font-weight: 700; text-decoration: none; }
.mdw-preview-button.is-outline { background: transparent; color: var(--mdw-accent); }
.mdw-preview-button.is-block { display: flex; width: 100%; justify-content: center; }
.mdw-preview-button.is-larger { padding: 0.65rem 1rem; font-size: 1.05rem; }
.mdw-component-render.is-centered { text-align: center; }
.mdw-preview-disclosure { border: 1px solid var(--mdw-border); border-radius: 8px; overflow: hidden; }
.mdw-preview-disclosure summary { padding: 0.48rem 0.7rem; cursor: pointer; }
.mdw-preview-disclosure > :not(summary) { padding: 0.65rem 0.75rem; }
.mdw-preview-caption { margin-bottom: 0.45rem; color: var(--mdw-muted); font-size: 0.76rem; font-weight: 700; }
.mdw-preview-tabs { border: 1px solid var(--mdw-border); border-radius: 9px; overflow: hidden; }
.mdw-preview-tab-nav { display: flex; gap: 0.2rem; padding: 0.35rem; border-bottom: 1px solid var(--mdw-border); background: var(--mdw-soft); }
.mdw-preview-tab-nav button { padding: 0.35rem 0.65rem; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.mdw-preview-tab-nav button.is-active { background: var(--mdw-accent); color: #fff; }
.mdw-preview-tab-panels { padding: 0.7rem; }
.mdw-preview-timeline { display: grid; gap: 0.55rem; padding-left: 0.8rem; border-left: 3px solid var(--mdw-accent); }
.mdw-preview-timeline-item { position: relative; padding: 0.55rem 0.7rem; border: 1px solid var(--mdw-border); border-radius: 8px; background: var(--mdw-panel); }
.mdw-preview-timeline-item strong { display: block; margin-bottom: 0.2rem; }
.mdw-preview-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.55rem; }
.mdw-preview-gallery figure { margin: 0; overflow: hidden; border: 1px solid var(--mdw-border); border-radius: 8px; background: var(--mdw-panel); }
.mdw-preview-gallery figcaption { padding: 0.35rem 0.5rem; color: var(--mdw-muted); font-size: 0.72rem; }
.mdw-component-preview-image { display: block; max-width: 100%; object-fit: cover; }
.mdw-preview-gallery .mdw-component-preview-image { width: 100%; height: 100px; }
.mdw-preview-gallery-group { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0.2rem 0.65rem; align-items: center; padding: 0.55rem; border: 1px solid var(--mdw-border); border-radius: 9px; background: var(--mdw-panel); }
.mdw-preview-gallery-group img { grid-row: 1 / 3; width: 64px; height: 64px; border-radius: 7px; object-fit: cover; }
.mdw-preview-gallery-group span { color: var(--mdw-muted); font-size: 0.78rem; }
.mdw-preview-file-card { display: grid; gap: 0.15rem; padding: 0.7rem; border: 1px dashed var(--mdw-border); border-radius: 8px; background: var(--mdw-panel); }
.mdw-preview-file-card span { overflow-wrap: anywhere; color: var(--mdw-muted); font-size: 0.76rem; }
.mdw-preview-link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem; margin-bottom: 0.7rem; }
.mdw-preview-link-card { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 0.1rem 0.55rem; align-items: center; padding: 0.55rem; border: 1px solid var(--mdw-border); border-left-width: 3px; border-radius: 8px; background: var(--mdw-panel); }
.mdw-preview-link-card img { grid-row: 1 / 3; width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.mdw-preview-link-card span { overflow: hidden; color: var(--mdw-muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.mdw-preview-lightweight-note { margin-bottom: 0.35rem; color: var(--mdw-muted); font-size: 0.74rem; }
.mdw-preview-code { max-height: 180px; margin: 0; padding: 0.65rem; overflow: auto; border-radius: 8px; background: color-mix(in srgb, var(--global-bg, #fff) 74%, var(--mdw-panel)); font: 0.76rem/1.55 Consolas, Menlo, monospace; white-space: pre-wrap; }

.mdw-component-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.mdw-field { min-width: 0; }
.mdw-field-wide,
.mdw-repeater { grid-column: 1 / -1; }
.mdw-field textarea { min-height: 130px; font-family: inherit; }
.mdw-field-code textarea { font: 0.84rem/1.6 Consolas, Menlo, "PingFang SC", monospace; }
.mdw-field-help { margin: 0.2rem 0 0; color: var(--mdw-muted); font-size: 0.74rem; }

.mdw-checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 40px;
  align-self: end;
  color: var(--font-color, #4c4948);
  font-size: 0.86rem;
  font-weight: 600;
}

.mdw-checkbox-field input { width: 18px; min-height: 18px; accent-color: var(--mdw-accent); }
.mdw-asset-field-control { display: flex; gap: 0.45rem; }
.mdw-asset-field-control input { min-width: 0; flex: 1; }
.mdw-asset-field-control .mdw-button { flex: 0 0 auto; min-height: 40px; padding: 0.45rem 0.7rem; }

.mdw-repeater {
  padding: 0.75rem;
  border: 1px solid var(--mdw-border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--mdw-accent) 4%, var(--mdw-panel));
}

.mdw-repeater-heading,
.mdw-repeater-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.mdw-repeater-heading { margin-bottom: 0.65rem; }
.mdw-repeater-heading strong { font-size: 0.88rem; }
.mdw-repeater-items { display: grid; gap: 0.7rem; }
.mdw-repeater-item { padding: 0.7rem; border: 1px solid var(--mdw-border); border-radius: 9px; background: var(--mdw-panel); }
.mdw-repeater-item-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin-top: 0.65rem; }
.mdw-repeater-item-header span { color: var(--mdw-muted); font-size: 0.78rem; font-weight: 700; }
.mdw-repeater-controls { display: flex; gap: 0.25rem; }
.mdw-repeater-controls button,
.mdw-repeater-add {
  border: 1px solid var(--mdw-border);
  border-radius: 7px;
  background: var(--mdw-panel);
  color: var(--font-color, #4c4948);
  cursor: pointer;
}
.mdw-repeater-controls button { min-width: 30px; min-height: 30px; }
.mdw-repeater-add { min-height: 34px; padding: 0.35rem 0.65rem; color: var(--mdw-accent); font-weight: 700; }
.mdw-component-error { margin: 0; padding: 0.65rem 0.75rem; border-radius: 8px; background: color-mix(in srgb, #e85d75 14%, var(--mdw-panel)); color: #c5324c; font-size: 0.82rem; }
.mdw-component-source summary { color: var(--mdw-muted); cursor: pointer; font-size: 0.78rem; }
.mdw-component-source pre { max-height: 180px; margin: 0.55rem 0 0; padding: 0.7rem; overflow: auto; border-radius: 8px; background: color-mix(in srgb, var(--global-bg, #fff) 75%, var(--mdw-panel)); font-size: 0.76rem; white-space: pre-wrap; }

.mdw-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[data-theme="dark"] .mdw-rich-editor .toastui-editor-toolbar-icons { filter: invert(1) brightness(1.7); }
[data-theme="dark"] .mdw-rich-editor .toastui-editor-popup,
[data-theme="dark"] .mdw-rich-editor .toastui-editor-popup-body,
[data-theme="dark"] .mdw-rich-editor .toastui-editor-dropdown-toolbar {
  border-color: var(--mdw-border);
  background: var(--mdw-panel);
  color: var(--font-color);
}

@media (max-width: 900px) {
  .mdw-intro,
  .mdw-document-header,
  .mdw-conflict {
    align-items: stretch;
    flex-direction: column;
  }
  .mdw-layout { grid-template-columns: 1fr; }
  .mdw-library { position: static; max-height: none; }
  .mdw-document-list { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .mdw-repository-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mdw-deployment { grid-template-columns: auto minmax(0, 1fr); }
  .mdw-deployment-actions { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .mdw-intro,
  .mdw-library,
  .mdw-stage { padding: 1rem; }
  .mdw-upload-area,
  .mdw-actions,
  .mdw-deployment-actions { align-items: stretch; flex-direction: column; }
  .mdw-button { width: 100%; }
  .mdw-document-list,
  .mdw-repository-fields { grid-template-columns: 1fr; }
  .mdw-empty-state { min-height: 340px; padding: 1rem; }
  .mdw-front-matter summary { align-items: flex-start; flex-direction: column; }
  .mdw-media summary { align-items: flex-start; flex-direction: column; }
  .mdw-component-fields,
  .mdw-repeater-item-fields { grid-template-columns: 1fr; }
  .mdw-asset-item { grid-template-columns: auto minmax(0, 1fr); }
  .mdw-asset-actions { grid-column: 1 / -1; }
  .mdw-butterfly-widget { grid-template-columns: auto minmax(0, 1fr) auto; }
  .mdw-butterfly-widget-summary { grid-column: 1 / -1; }
  .mdw-deployment { grid-template-columns: 1fr; }
  .mdw-deployment-icon { display: none; }
}
