/* Final material contract for legacy and lazy-loaded menus.
 * Important declarations here override old inline/late visual rules only.
 * No display, dimensions, overflow, position, zoom or interaction rules are reset.
 */
.mg-frame-host { position: relative; }
[data-mg-surface="window"] {
  background: var(--mg-surface-window) !important;
  color: var(--mg-text-main);
  border-color: var(--mg-bronze) !important;
  border-image: none !important;
  border-radius: .4rem !important;
  box-shadow: var(--material-shadow-soft) !important;
}
[data-mg-surface="header"] {
  background: var(--mg-surface-chrome) !important;
  color: var(--mg-text-main);
  border-color: var(--mg-border-muted) !important;
  box-shadow: none !important;
}
[data-mg-surface="panel"] {
  background: var(--mg-surface-panel) !important;
  color: var(--mg-text-main);
  border-color: var(--mg-border-muted) !important;
  box-shadow: none !important;
}
[data-mg-surface="recessed"] {
  background: var(--mg-surface-recessed) !important;
  color: var(--mg-text-main);
  border-color: var(--mg-border-muted) !important;
  box-shadow: inset 0 1px 4px var(--mg-shadow-soft) !important;
}
[data-mg-surface="document"], [data-mg-surface="document-window"] {
  background: var(--mg-surface-document) !important;
  color: var(--mg-ink);
  border-color: var(--mg-border-muted) !important;
  box-shadow: var(--material-shadow-soft) !important;
}
[data-mg-surface="window"] > .mg-frame-art,
[data-mg-surface="document-window"] > .mg-frame-art { border-radius: .4rem; }
/* Companion windows use the same artwork at half the visual weight.
   Matching corner/edge scaling keeps their joins intact without resizing content. */
:is(.bottom-info-panel,.bottom-chat-panel,.notes-panel) > .mg-frame-art {
  --mg-frame-corner-size: .75rem;
  --mg-frame-edge-size: .225rem;
}
/* Recessed fields never get the raw high-contrast material behind their text. */
:is(input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea) {
  background: var(--mg-surface-recessed);
  color: var(--mg-text-main); border-color: var(--mg-border-muted);
}
#notesPanel .notes-editor textarea { background: var(--mg-surface-document); color: var(--mg-ink); }
.courier-dialog select option { background: var(--mg-graphite); color: var(--mg-text-main); }
:is(.camp-firewood-panel,.courier-body,.location-scene-drawer-card) :is(h2,h3,h4,label,strong) { color: var(--mg-text-main); }
:is(.camp-firewood-panel,.courier-body,.location-scene-drawer-card) p { color: var(--mg-text-muted); }
.bottom-chat-message-text { color: var(--mg-text-main); }
.bottom-info-panel-head { border-color: var(--mg-border-muted); }
.camp-firewood-panel fieldset { border-color: var(--mg-border-muted); }
.camp-firewood-panel input[type=checkbox] { accent-color: var(--mg-amber); }
.camp-firewood-panel .ingredient { background: var(--mg-surface-recessed); color: var(--mg-text-main); }
/* Keep transparent parts of button art clear of old brown fill rectangles. */
.ui-btn { background-clip: padding-box; }
#travelConfirmOverlay .travel-confirm-window {
  border-width: 1px;
  max-width: calc(100vw - 3rem);
}
#travelConfirmTitle { font-family: var(--font-accent); color: var(--mg-text-main); }
#travelConfirmDescription { color: var(--mg-text-muted); }

/* Shared processing workbench: keep its grid, sizing and station-specific controls. */
.processing-window-shell .processing-queue-toggle {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-shadow: none;
  color: var(--mg-text-main);
}
.processing-window-shell .processing-queue-toggle:is(:hover,:focus-visible) {
  background: transparent;
  color: var(--mg-amber);
}
.processing-window-shell .processing-queue-toggle strong { color: inherit; }
.processing-window-shell :is(h3,h4,strong,label) { color: var(--mg-text-main); }
.processing-window-shell :is(small,dt,.processing-recipe-copy small) { color: var(--mg-text-muted); }
.processing-window-shell :is(.processing-workbench-sidebar,.processing-workbench-recipes,.processing-detail-section) { border-color: var(--mg-border-muted); }
.processing-window-shell .processing-recipe-list-row {
  background: transparent; border-color: transparent; box-shadow: none;
}
.processing-window-shell .processing-recipe-list-row:not(:last-child)::before {
  content: '';
  position: absolute;
  left: .5rem;
  right: .5rem;
  bottom: 0;
  height: 4px;
  pointer-events: none;
  /* The supplied image has generous transparent margins; preserve its ratio
     and show its central strip instead of compressing the whole PNG to 4px. */
  background: var(--mg-image-divider-subtle) center / 100% auto no-repeat,
    linear-gradient(90deg,transparent,var(--mg-border-muted),transparent) center / 100% 1px no-repeat;
  opacity: .6;
}
.processing-window-shell .processing-recipe-button {
  background: transparent !important; border-color: transparent !important;
  box-shadow: none !important; color: var(--mg-text-main);
}
.processing-recipe-list-row.is-selected .ui-selection::after {
  background: var(--mg-image-selection-selected) center / 100% 100% no-repeat,
    linear-gradient(90deg,transparent,var(--mg-amber),transparent);
  opacity: 1; transform: scaleX(1);
}
.processing-window-shell .processing-favorite {
  background: transparent; border-color: transparent; box-shadow: none; color: var(--mg-brass);
}
.processing-window-shell .processing-favorite:hover { color: var(--mg-amber); }
.processing-window-shell :is(button,input,select):focus-visible {
  outline: 2px solid var(--mg-amber); outline-offset: 2px;
}
.processing-window-shell :is(.processing-progress-track,.processing-queue-progress) {
  background: var(--mg-graphite-deep); border-color: var(--mg-border-muted);
}
.processing-window-shell :is(.processing-progress-track,.processing-queue-progress) > span {
  background: var(--mg-bronze);
}

.processing-workbench:has(> .processing-view-options) { grid-template-rows: auto minmax(0,1fr); }
.processing-view-options { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; padding: .65rem 1rem; background: var(--mg-surface-chrome); border-bottom: 1px solid var(--mg-border-muted); }
.processing-view-options label { display: flex; align-items: center; gap: .55rem; cursor: pointer; }
.processing-view-options small { display: block; margin-top: .2rem; font-size: .75rem; color: var(--mg-text-muted); }

/* Keep farming actions proportional to their labels and button artwork. */
.farming-window .city-scene-tool-btn {
 width: fit-content; max-width: 100%; min-width: 9rem;
 justify-self: start; align-self: start; flex: 0 1 auto;
}

/* Collection access is a compact action, not a full-width banner. */
button[data-market-collection] {
 width: fit-content; max-width: 100%; min-width: 0;
 justify-self: start; align-self: start; flex: 0 1 auto;
 padding-inline: 1.75rem;
}
