/* Scoped styles for the standalone dialog; the bundled shell owns #root. */
.mmw-iw-dialog,
.mmw-iw-compatibility {
  --iw-bg: #fffdf9;
  --iw-fg: #332b27;
  --iw-muted: #6c625b;
  --iw-border: #d9cec4;
  --iw-soft: #f6f0e9;
  --iw-accent: #9b452c;
  --iw-error: #a72626;
  --iw-warning-bg: #fff5dc;
  --iw-warning-fg: #704512;
  --iw-success-bg: #eaf6ec;
  --iw-success-fg: #265b33;
  color: var(--iw-fg);
  background: var(--iw-bg);
  font: 14px/1.6 ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
.dark .mmw-iw-dialog,
.dark .mmw-iw-compatibility {
  --iw-bg: #25211f;
  --iw-fg: #f3ece6;
  --iw-muted: #c0b2a8;
  --iw-border: #62544b;
  --iw-soft: #312a26;
  --iw-accent: #eeaa8e;
  --iw-error: #ffaaaa;
  --iw-warning-bg: #3c301d;
  --iw-warning-fg: #f2c787;
  --iw-success-bg: #20382a;
  --iw-success-fg: #a7dcb7;
  color-scheme: dark;
}
.mmw-iw-dialog {
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--iw-border);
  border-radius: 14px;
  box-shadow: 0 18px 70px #0005;
  overflow: auto;
  overscroll-behavior: contain;
}
.mmw-iw-dialog::backdrop { background: #15100c99; }
.mmw-iw-dialog *, .mmw-iw-compatibility * { box-sizing: border-box; }
.mmw-iw-form { padding: 24px; }
.mmw-iw-header, .mmw-iw-footer, .mmw-iw-refresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mmw-iw-header h2 { margin: 0; font-size: 22px; line-height: 1.4; font-weight: 700; }
.mmw-iw-description { margin: 10px 0 20px; color: var(--iw-muted); }
.mmw-iw-selectors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mmw-iw-field { min-width: 0; }
.mmw-iw-label { display: block; margin-bottom: 7px; font-weight: 600; }
.mmw-iw-input {
  display: block;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--iw-border);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--iw-fg);
  background: var(--iw-bg);
  font: inherit;
}
.mmw-iw-entries { resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.mmw-iw-hint { margin: 7px 0 0; color: var(--iw-muted); font-size: 13px; }
.mmw-iw-refresh-row { margin: 14px 0; }
.mmw-iw-refresh-row p { margin: 0; }
.mmw-iw-editor { min-width: 0; margin: 18px 0 0; padding: 16px; border: 1px solid var(--iw-border); border-radius: 9px; }
.mmw-iw-editor legend { padding: 0 5px; }
.mmw-iw-editor .mmw-iw-field { margin-top: 16px; }
.mmw-iw-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.mmw-iw-toggle input { width: 18px; height: 18px; accent-color: var(--iw-accent); flex-shrink: 0; }
.mmw-iw-guidance { margin-top: 18px; padding: 12px 14px; background: var(--iw-soft); border-radius: 7px; color: var(--iw-muted); }
.mmw-iw-guidance p { margin: 0; }
.mmw-iw-guidance p + p { margin-top: 7px; }
.mmw-iw-warning, .mmw-iw-alert { margin: 14px 0; padding: 12px 14px; border-radius: 7px; overflow-wrap: anywhere; white-space: pre-wrap; }
.mmw-iw-warning, .mmw-iw-alert[data-kind='warning'] { color: var(--iw-warning-fg); background: var(--iw-warning-bg); }
.mmw-iw-alert { color: var(--iw-error); border: 1px solid currentColor; }
.mmw-iw-alert[data-kind='success'] { background: var(--iw-success-bg); color: var(--iw-success-fg); }
.mmw-iw-validation { margin: 7px 0 0; color: var(--iw-error); font-size: 13px; }
.mmw-iw-footer { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--iw-border); }
.mmw-iw-button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--iw-border);
  border-radius: 7px;
  color: var(--iw-fg);
  background: var(--iw-bg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.mmw-iw-button:hover:not(:disabled) { background: var(--iw-soft); }
.mmw-iw-primary { background: var(--iw-accent); border-color: var(--iw-accent); color: var(--iw-bg); }
.mmw-iw-primary:hover:not(:disabled) { background: var(--iw-accent); filter: brightness(1.1); }
.mmw-iw-close { padding-inline: 12px; }
.mmw-iw-dialog :disabled { cursor: not-allowed; opacity: .6; }
.mmw-iw-dialog fieldset:disabled { opacity: .65; }
.mmw-iw-dialog :focus-visible, .mmw-iw-nav:focus-visible, .mmw-iw-compatibility :focus-visible {
  outline: 3px solid #bc694c;
  outline-offset: 3px;
}
.mmw-iw-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #896e6073;
  border-radius: 6px;
  background: #fff9f1;
  color: #713a2a;
  font: 600 13px/1.4 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.mmw-iw-nav:hover { background: #f2dfce; }
.dark .mmw-iw-nav { background: #342a25; color: #f4c7b7; border-color: #ffffff40; }
.dark .mmw-iw-nav:hover { background: #49372e; }
.mmw-iw-nav-sidebar { width: 100%; justify-content: flex-start; margin-top: 8px; }
.mmw-iw-nav-topbar { flex-shrink: 0; margin-left: 12px; }
.mmw-iw-nav-overflow { width: 100%; justify-content: flex-start; }
.mmw-iw-nav-mobile { display: none; }
.mmw-iw-compatibility { position: fixed; bottom: 16px; right: 16px; z-index: 100; max-width: min(520px, calc(100vw - 32px)); border: 1px solid var(--iw-border); border-radius: 8px; padding: 16px; box-shadow: 0 6px 24px #0003; }
.mmw-iw-compatibility button { display: block; margin-top: 10px; }
@media (max-width: 767px) {
  .mmw-iw-nav-topbar { display: none; }
  .mmw-iw-nav-mobile {
    display: inline-flex;
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 51;
    min-height: 44px;
    box-shadow: 0 3px 14px #0003;
  }
}
@media (max-width: 560px) {
  .mmw-iw-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 10px; }
  .mmw-iw-form { padding: 18px 14px; }
  .mmw-iw-header h2 { font-size: 20px; }
  .mmw-iw-selectors { grid-template-columns: 1fr; gap: 12px; }
  .mmw-iw-editor { padding: 12px; }
  .mmw-iw-input { font-size: 16px; }
  .mmw-iw-footer { flex-direction: column; align-items: stretch; gap: 8px; }
  .mmw-iw-footer .mmw-iw-hint:empty { display: none; }
  .mmw-iw-primary { width: 100%; min-height: 44px; }
}
