/* Final layout contract: shared gutters and calm controls; lesson geometry remains independent. */
html.atelier-theme body {
  --hb-layout-max: 1240px;
  --hb-layout-gutter: clamp(16px, 3vw, 36px);
  --hb-layout-gap: 20px;
  --hb-layout-line: #e2e8f0;
  --workspace-header-height: 76px;
}
html.atelier-theme body #app .shell .topbar {
  width: 100%;
  min-height: var(--workspace-header-height);
  padding-inline: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--hb-layout-line);
  background: #fff;
  box-shadow: none;
}
html.atelier-theme body #app .shell .topbar-inner {
  width: calc(100% - var(--hb-layout-gutter) * 2);
  max-width: var(--hb-layout-max);
  min-height: var(--workspace-header-height);
  margin-inline: auto;
  padding: 12px 0;
  gap: 20px;
}
html.atelier-theme body #app .shell .top-actions { min-width: 0; gap: 12px; margin-left: auto; }
html.atelier-theme body #app .shell .breadcrumb { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
html.atelier-theme body #app .shell .personal-entry { min-height: 44px; border-radius: 8px; padding: 6px 10px; }
html.atelier-theme body #app .shell .user-menu-popup { max-width: min(320px, calc(100vw - 32px)); border-radius: 8px; box-shadow: 0 8px 24px #25324612; }
html.atelier-theme body #app .shell .user-menu-popup :is(a,button) { min-height: 44px; }
html.atelier-theme body #app .shell .main[class]:not(.page-lesson):not(.page-admin):not(.page-login):not(.page-register) {
  width: calc(100% - var(--hb-layout-gutter) * 2) !important;
  max-width: var(--hb-layout-max) !important;
  min-width: 0;
  margin-inline: auto !important;
  padding: 28px 0 44px !important;
  background: transparent !important;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-admin {
  width: calc(100% - var(--hb-layout-gutter) * 2) !important;
  max-width: 1600px !important;
  margin-inline: auto !important;
  padding: 24px 0 44px !important;
}
html.atelier-theme body:has(#app .main.page-admin) #app .shell .topbar-inner { max-width: 1600px; }
html.atelier-theme body #app .shell.workspace-shell .main[class].page-admin > .page-head { display: none !important; }
html.atelier-theme body:has(#app .main.page-lesson) #app .shell .topbar-inner { max-width: 1040px; width: calc(100% - 48px); }
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson:has(.lesson-tools[data-open="false"]) { padding-bottom: 16px !important; }
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content.st-enter { animation: none !important; }
html.atelier-theme body #app .shell .main[class] :is(.page-head,.section-heading) {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 16px; margin: 0 0 24px; padding: 0;
}
html.atelier-theme body #app .shell .main[class]:not(.page-lesson) .page-head h1 { font-size: clamp(24px, 2.3vw, 30px); line-height: 1.4; }
html.atelier-theme body #app .shell .main[class] :is(h1,h2,h3,h4) > [data-i18n] { font: inherit; color: inherit; }
html.atelier-theme body #app .shell.workspace-shell .main[class].page-account .account-tile-copy strong [data-i18n] { font: inherit; color: inherit; }
html.atelier-theme body #app .shell .main[class]:not(.page-lesson):not(.page-admin) .btn {
  min-height: 42px; max-width: 100%; font-size: 14px; line-height: 1.5; border-radius: 6px;
  gap: 8px; white-space: normal; text-align: center;
}
html.atelier-theme body #app .shell .main[class]:not(.page-admin):not(.page-lesson) :is(input:not([type=checkbox],[type=radio],[type=range],[type=hidden],[type=file]),textarea,select,.hb-select-trigger) {
  min-width: 0; max-width: 100%; min-height: 44px; font-size: 14px; line-height: 1.6; border-radius: 6px;
}
html.atelier-theme body #app .shell .main[class] :is(.footer,.form-actions,.modal-actions,.flow-navigation) { flex-wrap: wrap; gap: 12px; min-width: 0; }
html.atelier-theme body #app .shell .main[class] .footer { margin-top: 32px; padding-top: 20px; line-height: 1.7; }
html.atelier-theme body #app .shell .main[class] .footer :is(a,button) { min-height: 40px; display: inline-flex; align-items: center; }
html.atelier-theme body #app .shell .main[class]:not(.page-lesson) .empty { max-width: 100%; min-height: 224px; padding: 40px 24px; border-radius: 8px; }
html.atelier-theme body #app .shell .main[class]:not(.page-lesson) .empty p { max-width: 560px; margin-inline: auto; overflow-wrap: anywhere; line-height: 1.8; }
html.atelier-theme body #app .shell .main[class] :is(.table-scroll,.learning-table-wrap,.admin-table-wrap,.teacher-roster-table-wrap) { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
html.atelier-theme body #app .shell .main[class]:is(.page-login,.page-register) {
  width: calc(100% - var(--hb-layout-gutter) * 2) !important; max-width: 680px !important;
  margin-inline: auto !important; padding: 28px 0 44px !important; background: transparent !important;
}
html.atelier-theme body #app .shell.workspace-shell .main[class] .auth-refined { width: min(100%, 456px); gap: 20px; }
html.atelier-theme body #app .shell.workspace-shell .main[class] .auth-flow-surface { padding: 28px; border-radius: 8px; border-color: var(--hb-layout-line); box-shadow: none; }
html.atelier-theme body #app .shell.workspace-shell .main[class] .auth-refined :is(.auth-flow-field>input,.auth-password-field,.hb-select-trigger) { border-radius: 6px !important; border-color: #dbe2ec; background: #fbfcfe; }
html.atelier-theme body #app .shell.workspace-shell .main[class] .auth-refined :is(.auth-flow-field>input,.hb-select-trigger):focus-visible,
html.atelier-theme body #app .shell.workspace-shell .main[class] .auth-refined .auth-password-field:focus-within { outline: 2px solid #8ea6cb !important; outline-offset: 2px; box-shadow: none !important; }
html.atelier-theme body #app .shell.workspace-shell .main[class] .auth-refined [aria-invalid="true"] { border-color: #b74141; }
html.atelier-theme body #app .shell.workspace-shell .main[class] :is(.auth-flow-art,.auth-flow-intro h1,.auth-flow-intro>p,.auth-flow-surface,.auth-flow-back,.auth-flow-art img) { animation: none !important; transition: none !important; transform: none !important; }
html.atelier-theme body #app .shell .main[class] .st-reveal { opacity: 1 !important; transform: none !important; translate: none !important; animation: none !important; transition: none !important; }
html.atelier-theme body #app .shell .main[class].page-entering { opacity: 1 !important; transform: none !important; translate: none !important; animation: none !important; }
html.atelier-theme body #app .shell .main[class].page-home :is(.generation-welcome,.generation-welcome>*,.generation-composer,.topic-suggestion,.suggestion-image,.generation-project,.generation-result) { animation: none !important; transition: none !important; transform: none !important; }
html.atelier-theme body #app .shell .main[class] .flow-workspace { min-width: 0; max-width: 880px; margin-inline: auto; }
html.atelier-theme body #app .shell .main[class] .flow-workspace.wide { max-width: 1080px; }
html.atelier-theme body #app .shell .main[class] .flow-surface .modal { max-width: 100%; min-width: 0; border-radius: 8px !important; box-shadow: none; }
html.atelier-theme body #modal-root .modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; padding: 24px; border-radius: 8px !important; }
html.atelier-theme body #modal-root .modal.wide { width: min(960px, calc(100vw - 32px)); }
@media (max-width: 760px) {
  html.atelier-theme body { --workspace-header-height: 64px; --hb-layout-gap: 16px; }
  html.atelier-theme body #app .shell .topbar-inner { gap: 12px; padding-block: 10px; }
  html.atelier-theme body:has(#app .main.page-lesson) #app .shell .topbar-inner { width: calc(100% - var(--hb-layout-gutter) * 2); }
  html.atelier-theme body #app .shell .breadcrumb { display: none; }
  html.atelier-theme body #app .shell .top-actions { gap: 8px; }
  html.atelier-theme body #app .shell .personal-entry-label { display: none; }
  html.atelier-theme body #app .shell .personal-entry { padding: 4px; }
  html.atelier-theme body #app .shell .st-kbd kbd { display: none; }
  html.atelier-theme body #app .shell .main[class]:not(.page-lesson):not(.page-admin),
  html.atelier-theme body #app .shell.workspace-shell .main[class].page-admin { padding: 20px 0 32px !important; }
  html.atelier-theme body #app .shell .main[class] .page-head { align-items: flex-start; gap: 12px; margin-bottom: 20px; }
  html.atelier-theme body #app .shell .main[class]:not(.page-lesson):not(.page-admin) .btn { min-height: 44px; }
  html.atelier-theme body #app .shell .main[class]:not(.page-admin):not(.page-lesson) :is(input:not([type=checkbox],[type=radio],[type=range],[type=hidden],[type=file]),textarea,select) { font-size: 16px; }
  html.atelier-theme body #app .shell.workspace-shell .main[class] .auth-flow-surface { padding: 24px 20px; }
  html.atelier-theme body #app .shell .main[class] .footer { margin-top: 24px; }
  html.atelier-theme body #modal-root .modal { max-height: calc(100dvh - 32px); padding: 20px 16px; }
}
