/* Integration-only layout fixes; the reviewed Finance runtime stays pinned. */
.fo45-card,
.fo45-metrics > article,
.fo45-row > *,
.fo45 nav > * {
  min-width: 0;
}

.fo45-hint,
.fo45-row small,
.fo45-dialog p {
  overflow-wrap: anywhere;
}

.fo45 input[type="file"],
.fo45 select {
  max-width: 100%;
}

@media (max-width: 760px) {
  .fo45-grid,
  .fo45-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A nested admin module must shrink inside the shared Atelier grid. Long
   opaque plan IDs remain readable, never clipped or used as minimum widths. */
.atelier-module--admin,
.atelier-module--admin [data-module-slot],
.g45,
.g45-head > *,
.g45-grid > *,
.g45-stats > *,
.g45-lists > *,
.g45-telemetry > *,
.g45-plans article > * {
  min-width: 0;
  max-width: 100%;
}

.g45 {
  box-sizing: border-box;
  width: 100%;
  overflow-wrap: anywhere;
}

.g45-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.g45-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g45-lists { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g45-telemetry { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 720px) {
  .g45-grid,
  .g45-stats,
  .g45-lists,
  .g45-telemetry { grid-template-columns: minmax(0, 1fr); }
}

/* Files lives between navigation and Vision. Size to its slot, not the viewport;
   the independently reviewed runtime and stylesheet remain byte-identical. */
.atelier-module--files {
  min-width: 0;
  padding: 0;
  container: files-slot / inline-size;
}
.atelier-module--files .files45 {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: clamp(16px, 3cqi, 32px);
}
.atelier-module--files .files45-head > *,
.atelier-module--files .files45-layout > *,
.atelier-module--files .files45-row > *,
.atelier-module--files .files45-tools input {
  min-width: 0;
}
.atelier-module--files .files45 h1 { font-size: clamp(30px, 4.3cqi, 52px); }
.atelier-module--files .files45-layout {
  grid-template-columns: 185px minmax(0, 1fr) minmax(220px, 280px);
}
.atelier-module--files .files45-row {
  grid-template-columns: 24px minmax(0, 1fr) 96px 64px;
  gap: 10px;
}
.atelier-module--files .files45-preview h2 { overflow-wrap: anywhere; }
@container files-slot (max-width: 1000px) {
  .files45-layout { grid-template-columns: 175px minmax(0, 1fr) !important; }
  .files45-preview { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--f-line); }
  .files45-preview pre { max-height: 240px; }
  .files45-head { align-items: flex-start; }
}
@container files-slot (max-width: 640px) {
  .files45-layout { display: block; min-height: 0; }
  .files45-head { flex-direction: column; gap: 14px; }
  .files45-tree { border-right: 0; border-bottom: 1px solid var(--f-line); overflow: auto; white-space: nowrap; }
  .files45-tree strong, .files45-tree button { display: inline-block; width: auto; }
  .files45-tools { flex-direction: column; align-items: stretch; }
  .atelier-module--files .files45-row { grid-template-columns: 24px minmax(0, 1fr) 64px; }
  .files45-row time { display: none; }
}

/* Keep Code's approved editorial palette within the dark shared shell. Host
   --nos-surface tokens are dark and cannot be paired with the module's ink.
   Component breakpoints use the available slot, not the outer viewport. */
.atelier-module--code {
  min-width: 0;
  padding: 0;
  container: code-slot / inline-size;
}
.atelier-module--code .code-chat-w16 {
  --cc-paper: #f5efe4;
  --cc-ink: #292621;
  --cc-muted: #625b51;
  --cc-line: #d5cabb;
  --cc-clay: #9c573c;
  width: 100%;
  min-width: 0;
  padding: clamp(12px, 2cqi, 28px);
  box-sizing: border-box;
}
.atelier-module--code .code-chat-w16__layout {
  grid-template-columns: 200px minmax(0, 1fr) 220px;
}
.atelier-module--code .code-chat-w16__header {
  padding: clamp(20px, 3cqi, 38px);
}
.atelier-module--code .code-chat-w16__header h1 {
  font-size: clamp(28px, 4cqi, 44px);
  line-height: 1.06;
}
.atelier-module--code .code-chat-w16__header > *,
.atelier-module--code .code-chat-w16__layout > *,
.atelier-module--code .code-chat-w16__composer > div > *,
.atelier-module--code .code-chat-w16__context {
  min-width: 0;
  overflow-wrap: anywhere;
}
.atelier-module--code .code-chat-w16__thread,
.atelier-module--code .code-chat-w16__conversation-head h2 {
  overflow-wrap: anywhere;
}
.atelier-module--code .code-chat-w16__boundary { flex-wrap: wrap; }
.atelier-module--code .code-chat-w16__quiet { flex-shrink: 0; white-space: nowrap; }
.atelier-module--code .code-chat-w16__composer > div { flex-wrap: wrap; }
.atelier-module--code .code-chat-w16__composer > div > span { max-width: 100%; }
.atelier-module--code .code-chat-w16__messages { scroll-behavior: auto; }
@container code-slot (max-width: 1080px) {
  .atelier-module--code .code-chat-w16__layout {
    grid-template-columns: 185px minmax(0, 1fr);
  }
  .code-chat-w16__states {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    border-left: 0;
    border-top: 1px solid var(--cc-line);
  }
  .code-chat-w16__states section { padding: 0; }
  .code-chat-w16__states section + section {
    padding: 0 0 0 24px;
    border-top: 0;
    border-left: 1px solid #56605b;
  }
}
@container code-slot (max-width: 640px) {
  .code-chat-w16__header { display: grid; gap: 16px; }
  .code-chat-w16__layout { display: block; min-height: 0; }
  .code-chat-w16__threads { border-right: 0; border-bottom: 1px solid var(--cc-line); }
  .code-chat-w16__threads nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(130px, 65%);
    overflow: auto;
  }
  .code-chat-w16__states { display: block; }
  .code-chat-w16__states section + section {
    margin-top: 20px;
    padding: 20px 0 0;
    border-left: 0;
    border-top: 1px solid #56605b;
  }
  .code-chat-w16__composer > div { display: flex; }
  .code-chat-w16__composer > div > span:last-child { margin-left: auto; }
  .code-chat-w16__conversation-head { padding-inline: 16px; }
  .code-chat-w16__boundary { margin-inline: 16px; }
  .code-chat-w16__messages { padding: 16px; }
  .code-chat-w16__composer { margin-inline: 16px; }
}
