* { box-sizing: border-box }
:root {
  color-scheme: light;
  --page: #fcfaf6;
  --shelf: #f0ebe4;
  --ink: #271d31;
  --muted: #6b6073;
  --rule: #e2d9e6;
  --purple: #49286f;
  --lilac: #efe7f8;
  --white: #fffefa;
  font: 16px/1.55 "DM Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}
[hidden] { display: none !important }
body { margin: 0 }
.shell { display: grid; grid-template-columns: minmax(218px, 260px) 1fr; min-height: 100dvh }
.shelf { background: var(--shelf); border-right: 1px solid var(--rule); padding: 25px 18px; min-width: 0 }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 750; letter-spacing: -.035em }
.brand img { border-radius: 10px }
.profile { margin: 32px 0 16px }
.profile-controls { display: flex; gap: 7px }
.profile select { min-width: 0; flex: 1 }
.profile label, .composer label:not(.file-picker) { display: block; margin-bottom: 5px; font-weight: 650; font-size: .88rem }
.new-course { width: 100%; text-align: left; background: var(--purple); color: white; border-color: transparent }
.new-course span { margin-right: 6px }
.archives { display: grid; gap: 14px; margin-top: 25px }
details > summary { cursor: pointer; color: var(--muted); font-size: .86rem; font-weight: 650 }
.links { display: grid; gap: 3px; margin: 7px 0 0 }
.links button { width: 100%; text-align: left; background: none; border-color: transparent; min-height: 37px; overflow-wrap: anywhere; font-size: .9rem }
.links button[aria-current=true] { background: var(--lilac); color: var(--purple); font-weight: 700 }
.links p { margin: 3px 0 3px 12px }
.activity-row { display: flex; gap: 4px; align-items: stretch }
.links .activity-row .activity-open { flex: 1; min-width: 0; min-height: 44px }
.links .activity-row .activity-delete { flex: none; width: 44px; min-height: 44px; padding: 0; text-align: center; color: #8a342e; border: 1px solid #dfc0bb }
.links details > summary::before { content: '▸'; display: inline-block; width: 1.1em; flex: none }
.links details[open] > summary::before { content: '▾' }
.links summary { list-style: none }
.links summary::-webkit-details-marker { display: none }
.links details { margin-top: 6px }
.links details > .activity-row { margin-top: 3px }
.links details:not([open]) > .activity-row { display: none }
#delete-activity { min-height: 44px }
.links summary { min-height: 44px; display: flex; align-items: center }
.workspace { min-width: 0 }
.top { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); padding: 10px clamp(16px, 4vw, 38px) }
.top span { font-weight: 680 }
.top button { font-size: .86rem; min-height: 38px }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px }
.sign-in { max-width: 440px; margin: 0 auto; padding: clamp(25px, 9vh, 90px) 17px }
.sign-in .brand { margin-bottom: 23px }
.sign-in h1 { font-size: clamp(43px, 10vw, 61px) }
.sign-in input { display: block; width: 100%; margin: 0 0 13px }
.paper { max-width: 806px; padding: clamp(23px, 5vw, 66px) clamp(16px, 5vw, 60px); margin: 0 auto }
h1 { margin: 0 0 16px; font: 400 clamp(42px, 6vw, 73px)/.99 "Instrument Serif", Georgia, serif; letter-spacing: -.055em; overflow-wrap: anywhere }
h2 { margin: 0 0 7px; font-size: 1.16rem }
p { margin: 0 0 15px }
button, select, input, textarea, .action-link, .file-picker { font: inherit; color: inherit; border: 1px solid var(--rule); background: var(--white); border-radius: 10px; min-height: 42px; padding: 7px 12px }
button, select, .file-picker, .action-link { cursor: pointer }
button:hover:enabled, .file-picker:hover, .action-link:hover { border-color: var(--purple) }
button:disabled { opacity: .55; cursor: default }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px }
#analyze:focus { outline: 2px solid var(--purple); outline-offset: 3px }
.file-picker:has(+ :focus-visible) { outline: 2px solid var(--purple); outline-offset: 3px }
.icon-button { font-size: 21px }
.primary { background: var(--purple); color: white; border-color: transparent; font-weight: 700 }
.action-link { display: inline-flex; text-decoration: none; align-items: center; margin-right: 6px }
textarea { display: block; width: 100%; resize: vertical; min-height: 74px }
textarea::placeholder, .muted, .meta { color: var(--muted) }
.small { font-size: .84rem }
.composer { margin-top: 20px; padding: clamp(12px, 3vw, 19px); border: 1px solid var(--rule); border-left: 3px solid #9e84b5; border-radius: 13px; background: var(--white) }
.modes .modes-note { order: 1; flex: 1 0 100%; margin: 0 }
.modes #homework-catalog { order: 2 }
.composer-actions, .modes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px }
.composer-actions { justify-content: space-between }
.composer .small { margin: 8px 0 0; overflow-wrap: anywhere }
.composer textarea { background: var(--page) }
.source-message { width: fit-content; max-width: min(100%, 440px); margin: 0 0 25px auto; padding: 10px 14px; background: var(--shelf); border-radius: 13px 13px 3px 13px; overflow-wrap: anywhere }
.source-message p { margin: 0; white-space: pre-wrap }
.source-message small { color: var(--muted) }
.meta { margin-bottom: 7px; font-size: .9rem; font-weight: 650 }
.summary, .lesson p { white-space: pre-wrap; overflow-wrap: anywhere }
.topics { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; padding: 0; margin: 15px 0 }
.topics li { background: var(--lilac); color: var(--purple); padding: 4px 10px; border-radius: 999px; font-size: .89rem }
.questions { padding-left: 24px; color: #723e2b }
.lesson { display: grid; gap: 13px; margin: 0 0 20px }
.example { background: var(--lilac); border-radius: 10px; padding: 13px 16px }
.example p { margin: 0 }
.notice { background: var(--lilac); padding: 9px 13px; border-radius: 8px; overflow-wrap: anywhere }
.notice.error, .error { color: #8b3026 }
.notice.error { background: #fbeceb; border-left: 4px solid #8b3026 }
dialog { background: var(--page); border: 1px solid var(--rule); border-radius: 13px; color: var(--ink); width: min(calc(100% - 30px), 435px); padding: 23px }
dialog::backdrop { background: #2b193c55 }
dialog input { display: block; width: 100%; margin: 3px 0 11px }
.composer-actions { position: relative }
.file-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px }
.file-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; overflow-wrap: anywhere }
#lesson-count { display: block; width: 100%; max-width: 10rem }
.proposal-lessons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; margin-top: 14px }
.lesson-card { min-width: 0; padding: 12px; border: 1px solid var(--rule); border-left: 3px solid #9e84b5; border-radius: 13px; background: var(--white) }
.lesson-card h3 { margin: 0 0 8px }
.lesson-card label { display: block; margin-bottom: 4px; font-weight: 650; font-size: .88rem }
.lesson-card input, .lesson-card select { display: block; width: 100%; max-width: 100%; margin: 0 0 10px }
.lesson-card .pieces { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px }
.lesson-card .piece { min-width: 0; padding: 8px; border: 1px solid var(--rule); border-radius: 9px; overflow-wrap: anywhere }
.lesson-card .piece img { display: block; max-width: 100%; max-height: 96px; margin-bottom: 6px; border-radius: 6px }
.lesson-card .piece-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px }
.lesson-card [data-reason] { margin: 8px 0 0 }
.lesson-card .why { margin: 4px 0 8px }
.lot-progress { margin: 0 0 16px; padding: 12px; border: 1px solid var(--rule); border-left: 3px solid #9e84b5; border-radius: 13px; background: var(--white) }
.lot-progress-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px }
.lot-progress h2 { margin: 0 }
.lot-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px }
.lot-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; overflow-wrap: anywhere }
.lot-list .lot-title { font-weight: 650; min-width: 0 }
.lot-list .lot-state { color: var(--muted); font-size: .88rem; padding: 1px 9px; border: 1px solid var(--rule); border-radius: 999px }
.lot-list .lot-state-attente { color: #5b5560; background: #f3f0f5; border-color: #cfc8d4 }
.lot-list .lot-state-lecture { color: #1d4f7a; background: #e4f0fa; border-color: #7fb0d8 }
.lot-list .lot-state-prete { color: #1b5e2f; background: #e2f4e6; border-color: #7cc08c }
.lot-list .lot-state-arelancer { color: #8a2a12; background: #fdeadf; border: 2px solid #d9764f; font-weight: 650 }
.badge-new { display: inline-block; padding: 1px 9px; border: 1px solid #c9a227; border-radius: 999px; background: #fff3c4; color: #5c4600; font-size: .9rem; font-weight: 650 }
.proposal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); border: 0 }
@media (max-width: 710px) {
  .shell { display: block }
  .shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; padding: 13px 14px; border-right: 0; border-bottom: 1px solid var(--rule) }
  .profile, .archives { margin: 0 }
  .profile { grid-row: span 2 }
  .archives { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px }
  .archives > details { grid-column: 1 / -1 }
  .top { min-height: 53px }
}
@media (max-width: 360px) {
  .shelf { gap: 8px; padding-inline: 10px }
  .brand { gap: 6px; font-size: 17px }
  .brand img { width: 30px; height: 30px }
  .paper { padding-inline: 13px }
}

.archive-nav { width: 100%; text-align: left; color: var(--ink); font-weight: 650; background: transparent; border-color: transparent }
.archive-nav[aria-current=page] { color: var(--purple); font-weight: 700; background: var(--lilac) }
.catalog-heading, .catalog-folder-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px }
.catalog-search, .composer select, .composer input, dialog select, dialog textarea { display: block; width: 100%; margin: 6px 0 15px }
.catalog-search { margin: 20px 0 }
.catalog-layout { display: grid; grid-template-columns: minmax(135px, 185px) minmax(0, 1fr); gap: 18px; align-items: start }
.catalog-folders { border-right: 1px solid var(--rule); padding-right: 12px }
.catalog-folders button { display: block; width: 100%; text-align: left }
#folder-list button { background: transparent; border-color: transparent }
#folder-list button[aria-pressed=true] { background: var(--lilac); color: var(--purple); font-weight: 700 }
#folder-list .subfolder { padding-left: 26px }
#add-folder { margin-top: 10px }
.catalog-content { min-width: 0; background: var(--white); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden }
.catalog-folder-heading { background: #f2edf4; padding: 12px 14px }
.catalog-folder-heading h2 { margin: 0; overflow-wrap: anywhere }
.catalog-folder-heading .modes { margin: 0 }
.catalog-folder-heading button { min-height: 38px; font-size: .85rem }
.course-row { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--rule); border-left: 4px solid #977bae; border-radius: 0; padding: 12px 14px; overflow-wrap: anywhere }
.course-row strong, .course-row small { display: block }
.course-row small { color: var(--muted) }
.course-entry { display: grid; grid-template-columns: minmax(0, 1fr) 50px; align-items: stretch; border-top: 1px solid var(--rule); border-left: 4px solid #977bae }
.course-entry .course-row { border: 0; min-width: 0 }
.course-select { display: grid; place-items: center; cursor: pointer }
.course-select input { width: 21px; height: 21px; min-height: 0; margin: 0; padding: 0; accent-color: var(--purple); cursor: pointer }
.selection-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding: 12px 14px; border-radius: 10px; color: white; background: #30243b }
.selection-bar .modes { margin: 0 }
.selection-bar button { color: var(--purple); font-weight: 700 }
.selected-courses { list-style: none; margin: 0 0 15px; padding: 0; max-height: 35vh; overflow: auto }
.selected-courses li { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere }
.selected-courses li > div { min-width: 0 }
.selected-courses button { min-height: 38px; font-size: .88rem }
.selection-status { color: #723e2b; margin: 3px 0 6px }
#selection-dialog label { display: block; font-weight: 650; font-size: .88rem }
#selection-loading { margin-top: 12px }
#activity-source-list { padding-left: 22px }
#activity-source-list li { margin: 6px 0 }
.catalog-empty { margin: 14px }
.danger { color: #8a342e; border-color: #dfc0bb }
.danger-confirm { color: white; background: #8a342e; border-color: #8a342e; font-weight: 700 }
.back-catalog { margin-bottom: 20px }
.homework-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px }
.homework-grid .composer { margin-top: 18px; min-width: 0 }
.homework-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px }
#homework .homework-photo-actions label { margin: 0; display: inline-flex; align-items: center }
#homework-photo-name { margin-top: 8px; overflow-wrap: anywhere }
#homework select, #homework input[type=number] { display: block; width: 100%; margin: 5px 0 14px }
#homework .composer label { margin-top: 12px }
.homework-assignment { border-top: 1px solid var(--rule); padding: 4px 0 12px; overflow-wrap: anywhere }
.homework-assignment p { margin: 5px 0 }
.homework-course-detail button { min-height: 36px; font-size: .85rem }
#homework-match { margin-top: 10px }
#homework-error { margin-top: 12px }
.loading { display: flex; align-items: center; gap: 12px; padding: 12px 15px; margin-bottom: 15px; border: 1px solid var(--rule); background: var(--white); border-radius: 10px; font-weight: 650 }
.spinner { width: 22px; height: 22px; border: 3px solid #d8c7e6; border-top-color: var(--purple); border-radius: 50%; flex: none; animation: spin .9s linear infinite }
@keyframes spin { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none } }
@media (max-width: 560px) {
  .homework-grid { grid-template-columns: 1fr; gap: 0 }
  .catalog-layout { grid-template-columns: 1fr }
  .catalog-folders { border-right: 0; padding: 0 }
  #folder-list { display: flex; flex-wrap: wrap; gap: 4px }
  #folder-list button { width: auto }
  #folder-list .subfolder { padding-left: 12px }
  #add-folder { width: auto }
}
