
    .ico-print { color: #7a8794; }
    header button, header label, header a { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
    header .hover\:bg-slate-800:hover, header .hover\:bg-slate-700:hover { background-color: var(--brand-soft) !important; border-color: var(--studio-border-strong, var(--line)) !important; color: var(--brand-deep) !important; }
    header .hover\:text-white:hover { color: var(--brand-deep) !important; }
    header #btnExportExcel { background-color: var(--brand) !important; border: 1px solid var(--brand-deep) !important; color: #fff !important; }
    header #btnExportExcel:hover { background-color: var(--brand-deep) !important; }
    header #btnExportExcel .hdr-ico { color: #fff; }
    main .hover\:bg-slate-800:hover, main .hover\:bg-slate-700:hover { background-color: var(--brand-soft) !important; color: var(--brand-deep) !important; }
    main button, main label.cursor-pointer { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
    .hdr-ico { width: 15px; height: 15px; flex: none; }
    .ico-students { color: var(--brand); }
    .ico-save { color: var(--brand-deep); }
    .ico-load { color: var(--accent); }
    header button.bg-indigo-500 .ico-students { color: #fff; }
    header .hdr-icobtn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--studio-surface-soft, #f8fafc); color: var(--brand-deep); cursor: pointer; padding: 0; font-size: 1.15rem; font-weight: 800; }
    header #btnPrintView,
    header #btnExportExcel,
    header #btnExportJSON,
    header #btnOpenJSONDirect,
    header #btnFullscreen,
    header #btnBackupHelp,
    header #btnCloseCarnet,
    header #btnUndo,
    header #btnRedo,
    header #btnSettings {
      min-height: 34px;
      height: 34px;
      box-sizing: border-box;
    }
    header.test-topbar button:not(:disabled),
    header.test-topbar [role="button"]:not(:disabled) {
      transition: transform .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease;
    }
    header.test-topbar button:not(:disabled):hover {
      transform: translateY(-1px) !important;
      box-shadow: 0 5px 12px rgba(15, 23, 42, .13) !important;
      filter: brightness(1.025);
    }
    header.test-topbar button:not(:disabled):active {
      transform: translateY(0) scale(.97) !important;
      filter: none;
    }
    [data-weight-box] {
      transition: transform .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
    }
    [data-weight-box]:hover {
      transform: translateY(-1px) scale(1.03);
      box-shadow: 0 5px 12px rgba(99, 102, 241, .14);
    }
    #weightControls {
      width: 246px;
      min-height: 30px;
      flex: 0 0 246px;
      overflow: visible;
    }
    #weightControls.hidden {
      display: inline-flex !important;
      visibility: hidden;
      opacity: 0;
      pointer-events: none;
    }
    #weightControls:not(.hidden) {
      visibility: visible;
      animation: weightControlsIn .22s cubic-bezier(.2, .75, .25, 1) both;
    }
    #weightControls.is-closing {
      animation: weightControlsOut .18s ease-in both;
      pointer-events: none;
    }
    #weightControls button {
      padding: .36rem .68rem !important;
      border: 1px solid var(--line) !important;
      border-radius: 8px !important;
      background: var(--studio-surface-soft, #f8fafc) !important;
      color: var(--brand-deep) !important;
      font-weight: 700 !important;
      transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
    }
    #weightControls button:hover {
      transform: translateY(-1px);
      background: var(--brand-soft) !important;
      border-color: var(--brand) !important;
      box-shadow: 0 4px 10px rgba(15,23,42,.09);
    }
    #weightControls:not(.hidden) button:nth-child(1) { animation: weightOptionIn .28s ease-out .02s both; }
    #weightControls:not(.hidden) button:nth-child(2) { animation: weightOptionIn .28s ease-out .07s both; }
    @keyframes weightControlsIn {
      from { opacity: 0; transform: translateX(-10px); }
      to { opacity: 1; transform: translateX(0); }
    }
    @keyframes weightControlsOut {
      from { opacity: 1; transform: translateX(0); }
      to { opacity: 0; transform: translateX(-10px); }
    }
    @keyframes weightOptionIn {
      from { opacity: 0; transform: translateX(-8px); }
      to { opacity: 1; transform: translateX(0); }
    }

    #viewQuickObs :is(.qo-category, .qo-choice, .qo-selected-chip, .qo-selected-chip button, #qoSidePanel button, #qoSidePanel textarea) {
      transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, opacity .15s ease;
    }
    #viewQuickObs .qo-category:hover,
    #viewQuickObs .qo-choice:hover,
    #viewQuickObs .qo-selected-chip:hover { transform: translateY(-1px); }
    #viewQuickObs .qo-category:active,
    #viewQuickObs .qo-choice:active,
    #viewQuickObs .qo-selected-chip button:active { transform: scale(.97); }
    #viewQuickObs .qo-category[aria-pressed="true"] {
      box-shadow: inset 0 -2px 0 var(--brand);
    }
    #viewQuickObs .qo-choice:has(input:checked) {
      animation: observationChoicePulse .26s ease-out;
      border-color: var(--brand);
      background: var(--brand-soft);
    }
    #viewQuickObs .qo-selected-chip { animation: observationChipIn .22s ease-out both; }
    @keyframes observationChoicePulse {
      0% { transform: scale(1); }
      45% { transform: scale(1.025); box-shadow: 0 0 0 3px var(--brand-soft); }
      100% { transform: scale(1); }
    }
    @keyframes observationChipIn {
      from { opacity: 0; transform: translateY(4px) scale(.96); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }
    .competency-mod-warning {
      width: 18px;
      height: 18px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 0;
      border-radius: 4px;
      background: transparent;
      color: #dc2626;
      cursor: pointer;
      transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
    }
    .competency-mod-warning svg { width: 16px; height: 16px; fill: #fee2e2; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .competency-mod-warning:hover { transform: translateY(-1px) scale(1.06); filter: saturate(1.25); box-shadow: 0 3px 9px rgba(220, 38, 38, .16); }
    .competency-mod-warning:focus-visible { outline: 2px solid #ef4444; outline-offset: 2px; }
    .is-attention-flash { animation: competencyAttentionFlash .52s ease-in-out 3 !important; }
    @keyframes competencyAttentionFlash {
      0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 0%, transparent); filter: none; }
      50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 32%, transparent); filter: brightness(1.08); }
    }
    html.reduce-motion header.test-topbar button,
    html.reduce-motion [data-weight-box],
    html.reduce-motion #weightControls,
    html.reduce-motion #weightControls button,
    html.reduce-motion #viewQuickObs .qo-category,
    html.reduce-motion #viewQuickObs .qo-choice,
    html.reduce-motion #viewQuickObs .qo-selected-chip,
    html.reduce-motion .is-attention-flash {
      animation: none !important;
      transition-duration: .01ms !important;
    }
    header .hdr-icobtn:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--studio-border-strong, var(--line)); }
    header .hdr-icobtn:disabled { opacity: .35; cursor: default; }
    header #btnCloseCarnet:disabled {
      background: var(--studio-surface-soft, #f1f5f9) !important;
      color: var(--muted) !important;
      border-color: var(--studio-border, var(--line)) !important;
      box-shadow: none !important;
      opacity: .72;
      cursor: default;
      transform: none !important;
      filter: none !important;
    }
    header #btnCloseCarnet.hdr-close-button:not(:disabled) {
      background: var(--studio-surface) !important;
      color: var(--studio-text-muted) !important;
      border: 1px solid var(--studio-border-strong, var(--line)) !important;
      box-shadow: none !important;
      opacity: 1;
    }
    header .hdr-icobtn svg { width: 16px; height: 16px; }
    .hdr-sep { width: 1px; height: 22px; background: var(--line); margin: 0 .15rem; }
    #settingsPanel { position: absolute; right: 0; top: calc(100% + 8px); width: 270px; z-index: 60; background: #fffefa; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 30px rgba(40, 48, 42, .16); padding: .85rem .9rem; font-size: 12.5px; }
    #settingsPanel.hidden { display: none; }
    #settingsPanel .sp-title { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
    #settingsPanel .sp-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .25rem 0; font-weight: 600; }
    #settingsPanel .sp-color-columns-toggle { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0; padding: .35rem 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); cursor: pointer; }
    #settingsPanel .sp-color-columns-toggle .sp-toggle-copy { min-width: 0; display: flex; flex-direction: column; }
    #settingsPanel .sp-color-columns-toggle .sp-toggle-label { font-size: 12.5px; font-weight: 600; line-height: 1.25; color: var(--ink); }
    #settingsPanel .sp-color-columns-toggle small { margin-top: .12rem; color: var(--studio-text-muted, var(--muted)); font-size: 11px; font-weight: 400; line-height: 1.3; }
    #settingsPanel .sp-switch { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; width: 38px; height: 22px; }
    #settingsPanel .sp-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
    #settingsPanel .sp-switch-track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--studio-surface-soft, #f8fafc); border: 1px solid var(--studio-border-strong, #cbd5e1); transition: background .16s ease, border-color .16s ease, box-shadow .16s ease; }
    #settingsPanel .sp-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 999px; background: var(--studio-text-muted, #64748b); transition: transform .16s ease, background .16s ease; }
    #settingsPanel .sp-switch input:checked + .sp-switch-track { background: color-mix(in srgb, var(--brand-soft) 65%, var(--studio-surface, #fff)); border-color: color-mix(in srgb, var(--brand) 55%, transparent); box-shadow: inset 0 -1.5px 0 color-mix(in srgb, var(--brand) 40%, transparent); }
    #settingsPanel .sp-switch input:checked + .sp-switch-track::after { transform: translateX(16px); background: var(--brand); }
    #settingsPanel .sp-color-columns-toggle:hover .sp-switch-track { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
    #settingsPanel .sp-switch input:focus-visible + .sp-switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }
    #settingsPanel .sp-seg { display: inline-flex; background: transparent; border: 0; padding: 0; gap: .35rem; }
    #settingsPanel .sp-seg button { border: 0; background: transparent; padding: .2rem .65rem; border-radius: 7px; font-weight: 700; color: var(--muted); cursor: pointer; }
    #settingsPanel .sp-seg button.is-on { background: var(--brand); color: #fff; }
    #settingsPanel .sp-check { display: flex; align-items: center; gap: .5rem; padding: .22rem 0; cursor: pointer; font-weight: 500; }
    #settingsPanel .sp-check input { accent-color: var(--brand); width: 14px; height: 14px; }
    html.ts-xs { font-size: 14.5px; }
    html.ts-sm { font-size: 15.25px; }
    html.ts-lg { font-size: 16.75px; }
    html.ts-xl { font-size: 17.5px; }
    @media screen {
      html.theme-dark {
        color-scheme: dark;
      }
      html.theme-dark body { background: var(--paper); color: var(--ink); }
      html.theme-dark header { background: var(--surface) !important; color: var(--ink) !important; }
      html.theme-dark header :is(.text-white, .text-slate-300, .text-slate-200, .text-amber-300, .text-indigo-200, .text-indigo-300) { color: var(--ink) !important; }
      html.theme-dark header :is(.bg-slate-800, .bg-slate-800\/95, .hdr-icobtn) { background: var(--studio-surface-soft, #1e293b) !important; color: var(--ink) !important; }
      html.theme-dark header :is(.bg-indigo-500, .bg-indigo-600), html.theme-dark header #btnExportExcel { color: #fff !important; }
      html.theme-dark header #headerStudentCount { background: var(--brand) !important; color: #fff !important; }
      html.theme-dark header #btnNavGlobalReport.bg-amber-400 { background: var(--brand-soft) !important; color: var(--ink) !important; border-color: var(--line); }
      html.theme-dark :is(#subjectTabsContainer, #subjectSubTabsContainer) button { background: var(--studio-surface-soft, #1e293b) !important; color: var(--ink) !important; border-color: var(--line) !important; }
      html.theme-dark :is(#subjectTabsContainer, #subjectSubTabsContainer) button:is(.bg-indigo-600, [aria-pressed="true"]) { background: var(--brand) !important; color: #fff !important; }
      html.theme-dark #subjectSubTabsContainer { background: var(--surface); border-color: var(--line); }
      html.theme-dark #subjectSubTabsContainer .sub-tabs-label { color: var(--muted); }
      html.theme-dark :is(#settingsPanel, .grade-picker) { background: var(--surface); color: var(--ink); border-color: var(--line); }
      html.theme-dark :is(#settingsPanel .sp-seg, .grade-picker-auto, .sort-btn) { background: var(--studio-surface-soft, #1e293b); color: var(--ink); border-color: var(--line); }
      html.theme-dark #settingsPanel .sp-seg button.is-on { background: var(--brand); color: #fff; }
      html.theme-dark [id^="modal"] > .bg-white { background: var(--surface) !important; color: var(--ink); border-color: var(--line) !important; }
      html.theme-dark [id^="modal"] :is(.bg-slate-50, .bg-slate-100) { background: var(--studio-surface-soft, #1e293b) !important; }
      html.theme-dark [id^="modal"] :is(.text-slate-900, .text-slate-800, .text-slate-700, .text-slate-600, .text-slate-500, .text-slate-400, .text-indigo-700),
      html.theme-dark #modalUnsavedObservation #unsavedObservationMessage { color: var(--ink) !important; }
      html.theme-dark [id^="modal"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { background: var(--paper) !important; color: var(--ink) !important; border-color: var(--line) !important; }
      html.theme-dark [id^="modal"] :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
      html.theme-dark [id^="modal"] :is(.border-slate-100, .border-slate-200, .border-slate-300) { border-color: var(--line) !important; }
      html.theme-dark .cb-phrase-item:not(.is-selected) { background: var(--studio-surface-soft, #1e293b); color: var(--ink); border-color: var(--line); }
      html.theme-dark :is(.gradebook-toolbar, .global-report-toolbar, .student-manager-card, .studio-hero-card, #emptyRosterNotice:not(.hidden)) { background: var(--surface) !important; color: var(--ink); border-color: var(--line) !important; }
      html.theme-dark main :is(.bg-white, .bg-slate-50, .bg-slate-100, .bg-slate-900) { background-color: var(--surface) !important; color: var(--ink) !important; }
      html.theme-dark main :is(.text-slate-900, .text-slate-800, .text-slate-700, .text-slate-600, .text-slate-500, .text-indigo-950, .text-indigo-700, .text-indigo-600) { color: var(--ink) !important; }
      html.theme-dark main :is(.bg-indigo-50, .bg-indigo-950) { background-color: var(--brand-soft) !important; color: var(--ink) !important; }
      html.theme-dark main :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea), html.theme-dark #modalAddAssignment input {
        background-color: var(--paper) !important; color: var(--ink) !important; border-color: var(--line) !important;
      }
      html.theme-dark main :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
      html.theme-dark main table :is(th, td) { border-color: var(--line) !important; }
      html.theme-dark main table thead th, html.theme-dark main table thead th:first-child,
      html.theme-dark main table :is(.bg-slate-800, .bg-slate-900) { background: var(--studio-surface-soft, #1e293b) !important; color: var(--ink) !important; }
      html.theme-dark main table thead button, html.theme-dark #btnResetEqualWeights { background: var(--studio-surface-soft, #1e293b) !important; color: var(--ink) !important; border-color: var(--line) !important; }
      html.theme-dark #gradebookBody tr:nth-child(even) { background-color: var(--studio-surface-soft, #1e293b); }
      html.theme-dark #gradebookBody tr:nth-child(odd) { background-color: var(--surface) !important; }
      html.theme-dark #gradebookBody input.asg-raw { color: var(--ink) !important; }
      html.theme-dark #kpiClassAverage { color: var(--brand-deep) !important; }
      html.theme-dark main table tbody tr:hover, html.theme-dark.design-studio #gradebookBody tr:hover td { background-color: var(--brand-soft) !important; }
    }
    body.compact #gradebookBody td { padding-top: .25rem !important; padding-bottom: .25rem !important; }
    #gradebookBody input.asg-raw { color: #8a9188 !important; font-weight: 600; width: 3.6rem; }
    .grade-pill-selected {
      background: var(--brand) !important;
      color: #fff !important;
      border: 2px solid var(--brand) !important;
      font-weight: 800;
      transform: scale(1.14);
      position: relative;
      z-index: 1;
      box-shadow: 0 0 0 3px var(--brand-soft), 0 3px 8px rgba(15, 23, 42, .22);
      transition: transform .12s ease, box-shadow .12s ease;
    }
    .grade-pill-selected span { opacity: 1 !important; }
    .grade-pill-dim { opacity: .45; }
    .grade-pill-dim:hover { opacity: 1; }
    .adj-star { margin-left: 1px; font-weight: 900; color: #a15c2f; }
    @media (min-width: 1440px) { .site-layout { max-width: none; } }
    #qoLinkedPartsBox { column-gap: .75rem; row-gap: .4rem; }
    #qoLinkedParts { display: flex; flex-wrap: wrap; gap: .4rem .8rem; }
    #qoLinkedParts label { gap: .4rem; }
    #subjectTabsContainer button { justify-content: center; text-align: center; font-size: 13px; line-height: 1.25; }
    #subjectTabsContainer button span { white-space: normal; overflow: visible; text-overflow: clip; }
    #subjectSubTabsContainer button { font-size: 12px; }
    #btnBackToGradebookFromBareme, #btnBackToGradebookFromTrace, #btnBackToGradebookFromStudents {
      background: var(--studio-surface-soft, #f8fafc) !important; color: var(--brand-deep) !important; border: 1px solid var(--studio-border-strong, var(--line)) !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
    }
    #btnBackToGradebookFromBareme:hover, #btnBackToGradebookFromTrace:hover, #btnBackToGradebookFromStudents:hover { background: var(--brand-soft) !important; }
    #gradebookHeaderRow .asg-title-view { display: inline-flex; align-items: flex-start; justify-content: center; gap: 5px; max-width: 9.5rem; padding: 3px 5px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: inherit; font: inherit; font-weight: 700; text-transform: uppercase; letter-spacing: inherit; line-height: 1.25; text-align: center; cursor: pointer; transition: background-color .12s ease, border-color .12s ease, transform .12s ease, box-shadow .12s ease; }
    #gradebookHeaderRow .asg-title-view:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(15,23,42,.08); }
    #gradebookHeaderRow .asg-title-text { overflow-wrap: anywhere; }
    #gradebookHeaderRow .asg-title-view:focus-visible { outline: 2px solid rgba(255,255,255,.5); outline-offset: 1px; }
    .gb-assignment-column-header { position: relative; }
    .gb-assignment-column-header > div:first-child { min-width: 0; padding-right: 1.35rem !important; box-sizing: border-box; }
    .gb-assignment-column-header > div:first-child .asg-title-view { flex: 1 1 auto; min-width: 0; max-width: 100%; }
    .assignment-delete-button { position: absolute; top: .3rem; right: .35rem; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; }
    .column-color-trigger { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; padding: 3px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; transition: transform .14s ease, background-color .14s ease, border-color .14s ease; }
    .column-color-trigger svg { width: 16px; height: 16px; }
    .column-color-trigger:hover,
    .column-color-trigger[aria-expanded="true"] { transform: translateY(-1px); border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.1); }
    .column-color-popover { position: absolute; z-index: 95; top: calc(100% - 4px); right: 12px; width: 168px; padding: .65rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, #fff); color: var(--ink); text-align: left; text-transform: none; letter-spacing: normal; box-shadow: 0 14px 34px rgba(15,23,42,.2); }
    .column-color-popover label { display: grid; gap: .35rem; color: var(--ink); font-size: 10.5px; font-weight: 700; }
    .column-color-popover input[type="color"] { width: 100%; height: 34px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--studio-surface-soft, #f8fafc); cursor: pointer; }
    .column-color-popover button { width: 100%; margin-top: .55rem; padding: .38rem .5rem; border: 1px solid var(--line); border-radius: 7px; background: var(--studio-surface-soft, #f8fafc); color: var(--brand-deep); font-size: 10.5px; font-weight: 700; cursor: pointer; }
    .column-color-popover button:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
    .column-color-popover button:disabled { opacity: .4; cursor: default; }
    #gradebookScrollContainer thead th.gb-colored-column {
      background: color-mix(in srgb, var(--assignment-column-color) 9%, var(--studio-surface-soft, #f8fafc)) !important;
    }
    #gradebookScrollContainer tbody td.gb-colored-column {
      background: color-mix(in srgb, var(--assignment-column-color) 7%, var(--studio-surface, #fff)) !important;
    }
    #gradebookScrollContainer tbody tr:hover td.gb-colored-column {
      background: color-mix(in srgb, var(--assignment-column-color) 12%, var(--studio-surface, #fff)) !important;
    }
    html.theme-dark #gradebookScrollContainer thead th.gb-colored-column {
      background: color-mix(in srgb, var(--assignment-column-color) 16%, var(--studio-surface-soft, #1e293b)) !important;
    }
    html.theme-dark #gradebookScrollContainer tbody td.gb-colored-column {
      background: color-mix(in srgb, var(--assignment-column-color) 13%, var(--surface, #111827)) !important;
    }
    html.theme-dark #gradebookScrollContainer tbody tr:hover td.gb-colored-column {
      background: color-mix(in srgb, var(--assignment-column-color) 19%, var(--surface, #111827)) !important;
    }
    #gradebookBody .final-grade-trigger { width: 3.5rem; flex: none; }
    .grade-picker { position: fixed; z-index: 90; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; width: min(210px, calc(100vw - 16px)); padding: 6px; background: #fffefa; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(40, 52, 46, .22); animation: pickerIn .1s ease-out; }
    .grade-picker-btn { min-width: 0; padding: 5px 1px; border-radius: 7px; font-size: 10px; font-weight: 800; white-space: nowrap; cursor: pointer; transition: transform .1s ease; }
    .grade-picker-btn:hover { transform: scale(1.06); }
    .grade-picker-btn.is-current { outline: 2px solid var(--brand-deep); outline-offset: 1px; }
    .grade-picker-auto { grid-column: span 3; padding: 4px 0; border-radius: 7px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--studio-surface-soft, #f1f5f9); cursor: pointer; }
    .grade-picker-auto:hover { background: var(--brand-soft); color: var(--brand-deep); }
    .mouse-bar { position: fixed; z-index: 90; display: flex; flex-wrap: wrap; align-items: center; gap: 3px; max-width: calc(100vw - 16px); padding: 5px; background: var(--surface, #ffffff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); animation: pickerIn .1s ease-out; }
    .mouse-bar button { padding: 5px 10px; border-radius: 7px; font-size: 11px; font-weight: 700; color: var(--brand-deep); background: var(--studio-surface-soft, #f1f5f9); cursor: pointer; white-space: nowrap; }
    .mouse-bar button:hover { background: var(--brand-soft); }
    .mouse-bar button.is-current { outline: 2px solid var(--brand-deep); outline-offset: 1px; }
    .gb-sort-btn { display: inline-flex; vertical-align: middle; margin-left: .35rem; padding: 2px; border-radius: 6px; color: var(--muted); cursor: pointer; }
    .gb-sort-btn:hover, .gb-sort-btn.is-active { color: #fff; background: rgba(255, 255, 255, .14); }
    .gb-sort-btn svg { width: 13px; height: 13px; }
    html.theme-dark .mouse-bar { background: var(--surface); border-color: var(--line); }
    html.theme-dark .mouse-bar button { background: var(--studio-surface-soft, #1e293b); color: var(--ink); }
    html.theme-dark .mouse-bar button:hover { background: var(--brand-soft); color: var(--brand-deep); }
    @media print {
      body.print-gradebook main > section:not(#viewGradebook),
      body.print-gradebook #emptyRosterNotice,
      body.print-gradebook #gradebookHeaderRow th:nth-last-child(3),
      body.print-gradebook #gradebookBody td:nth-last-child(3),
      body.print-gradebook #gradebookHeaderRow th:nth-last-child(1),
      body.print-gradebook #gradebookBody td:nth-last-child(1),
      body.print-bareme main > section:not(#viewBareme),
      body.print-bareme #viewBareme .no-print { display: none !important; }
      body.print-gradebook main, body.print-bareme main { padding: 0 !important; max-width: 100% !important; }
      body.print-gradebook .gradebook-toolbar, body.print-bareme .studio-hero-card { border: 0 !important; box-shadow: none !important; padding: 0 0 6px !important; background: #fff !important; }
      body.print-gradebook #gradebookScrollContainer { overflow: visible !important; }
      body.print-gradebook table { min-width: 0 !important; width: 100%; font-size: 10px; }
      body.print-gradebook thead tr, body.print-gradebook thead th, body.print-gradebook #gradebookBody tr, body.print-gradebook #gradebookBody td { background: #fff !important; color: #222 !important; position: static !important; }
      body.print-gradebook #gradebookScrollContainer :is(th, td).gb-colored-column { background: #fff !important; }
      body.print-gradebook thead th { border-bottom: 2px solid #555; text-transform: none; letter-spacing: 0; }
      body.print-gradebook #gradebookBody td { border-bottom: 1px solid #ccc; }
      body.print-gradebook tr { break-inside: avoid; }
      body.print-gradebook input { border: 0 !important; background: transparent !important; }
      body.print-gradebook .weight-tools { display: none !important; }
      body.print-bareme #viewBareme .bg-slate-900 { background: #fff !important; color: #222 !important; border: 1px solid #ccc; }
      body.print-bareme #viewBareme .bg-slate-900 * { color: #222 !important; }
      body.print-bareme tr { break-inside: avoid; }
      #printMeta { display: none; }
      body.print-gradebook #printMeta, body.print-bareme #printMeta { display: block; font-size: 11px; color: #555; margin: 0 0 6px; }
    }
    @keyframes pickerIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
    .asg-pct { font-size: 12px; font-weight: 800; color: var(--ink); min-width: 2.6rem; text-align: left; }
    body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; }
    .search-box { position: relative; display: inline-flex; align-items: center; }
    .search-box svg { position: absolute; left: 8px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
    .search-box input { padding: .38rem .6rem .38rem 1.75rem; border: 1px solid var(--line); border-radius: 10px; background: #fffefa; font-size: 12px; width: 190px; max-width: 100%; }
    .sort-btn { padding: .35rem .65rem; border: 1px solid var(--line); border-radius: 10px; background: #f5f4ef; color: var(--brand-deep); font-size: 12px; font-weight: 600; cursor: pointer; }
    .sort-btn:hover { background: var(--brand-soft); }
    .student-name-field { flex: 1 1 11rem; min-width: 0; max-width: 100%; }
    .student-add-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: center; gap: .5rem; }
    .student-add-row input { width: 100%; }
    .student-remove, main .student-remove:hover { color: #923d3c !important; background: #faeae8 !important; border: 1px solid #efceca !important; }
    main .student-remove:hover { background: #f5dcd9 !important; }
    .trace-print { color: var(--muted); padding: .35rem; border-radius: 8px; border: 1px solid var(--studio-border-strong, var(--line)); background: var(--studio-surface-soft, #f8fafc); }
    .trace-print:hover { background: var(--brand-soft); color: var(--brand-deep); }
    .print-menu-anchor { position: relative; }
    .print-menu-chevron { opacity: .65; font-size: 9px; }
    .print-menu { position: absolute; top: calc(100% + 7px); left: 0; z-index: 100; width: min(330px, calc(100vw - 24px)); padding: 6px; border: 1px solid var(--studio-border-strong, var(--line)); border-radius: 14px; background: var(--surface, #fff); color: var(--ink); box-shadow: 0 18px 45px rgba(15, 23, 42, .24); animation: pickerIn .12s ease-out; }
    .print-menu-heading { padding: 7px 9px 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
    .print-menu-warning { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; margin: 4px 3px 6px; padding: 9px; border: 1px solid #f59e0b; border-radius: 10px; background: #fffbeb; color: #78350f; box-shadow: 0 6px 18px rgba(245, 158, 11, .12); opacity: 1; transform: translateY(0); transition: opacity .4s ease, transform .4s ease; }
    .print-menu-warning.is-leaving { opacity: 0; transform: translateY(-3px); }
    .print-menu-warning-icon { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; border-radius: 8px; background: #fef3c7; color: #b45309; }
    .print-menu-warning-icon svg { width: 17px; height: 17px; }
    .print-menu-warning strong, .print-menu-warning small { display: block; }
    .print-menu-warning strong { font-size: 11.5px; }
    .print-menu-warning small { margin-top: 2px; font-size: 10px; line-height: 1.35; color: #92400e; }
    .print-menu button { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; width: 100%; padding: 8px 9px; border-radius: 10px; text-align: left; cursor: pointer; }
    .print-menu button:hover, .print-menu button:focus-visible { background: var(--brand-soft); outline: none; }
    .print-menu button.is-contextual { background: color-mix(in srgb, var(--brand-soft) 58%, transparent); }
    .print-menu button:disabled { opacity: .45; cursor: not-allowed; background: transparent; }
    .print-menu-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: var(--studio-surface-soft, #f8fafc); color: var(--brand-deep); }
    .print-menu-icon svg { width: 17px; height: 17px; }
    .print-menu-copy { min-width: 0; }
    .print-menu-copy strong { display: block; color: var(--ink); font-size: 12px; line-height: 1.25; }
    .print-menu-copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; font-weight: 500; line-height: 1.35; }
    .observable-print-dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow: auto; border: 1px solid var(--studio-border-strong, var(--line)); border-radius: 18px; background: var(--surface, #fff); color: var(--ink); box-shadow: 0 24px 80px rgba(15, 23, 42, .28); }
    .observable-print-dialog::backdrop { background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
    .print-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
    .print-dialog-heading-copy { min-width: 0; }
    .print-dialog-kicker { color: var(--brand-deep); font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
    .print-dialog-heading h2 { margin-top: 2px; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
    .print-dialog-heading p { margin-top: 4px; max-width: 520px; color: var(--muted); font-size: 12px; line-height: 1.45; }
    .print-dialog-close { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; background: var(--studio-surface-soft, #f1f5f9); color: var(--muted); font-weight: 800; cursor: pointer; }
    .print-dialog-close:hover { color: var(--ink); background: var(--brand-soft); }
    .observable-print-form { display: grid; gap: 18px; padding: 18px 22px; }
    .observable-print-form section > label, .print-field-label, .print-section-label { display: block; margin-bottom: 7px; color: var(--ink); font-size: 12px; font-weight: 800; }
    .print-section-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
    .print-section-label button { color: var(--brand-deep); font-size: 10.5px; font-weight: 750; cursor: pointer; }
    .print-section-shortcuts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; }
    .print-section-shortcuts button:disabled { opacity: .45; cursor: not-allowed; }
    #observablePrintAssignment, #baremePrintSubject { width: 100%; padding: 9px 11px; border: 1px solid var(--studio-border-strong, var(--line)); border-radius: 10px; background: var(--surface, #fff); color: var(--ink); font-size: 12px; font-weight: 650; }
    .print-dialog-hint { margin-top: 5px; color: var(--muted); font-size: 10.5px; }
    .print-student-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-height: 190px; overflow: auto; padding: 1px; }
    .print-student-choice { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--studio-surface-soft, #f8fafc); color: var(--ink); font-size: 11px; cursor: pointer; }
    .print-student-choice:has(input:checked) { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); background: var(--brand-soft); }
    .print-student-choice input { flex: 0 0 auto; accent-color: var(--brand); }
    .print-student-choice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .print-format-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .print-format-options label { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--studio-surface-soft, #f8fafc); cursor: pointer; }
    .print-format-options label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
    .print-format-options input { margin-top: 2px; accent-color: var(--brand); }
    .print-format-options strong, .print-format-options small { display: block; }
    .print-format-options strong { color: var(--ink); font-size: 11.5px; }
    .print-format-options small { margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1.35; }
    .summary-print-options { grid-template-columns: 1fr 1fr; }
    .bareme-format-reveal { max-height: 0; margin-top: -18px; overflow: hidden; opacity: 0; transform: translateY(-7px); pointer-events: none; transition: max-height .28s ease, margin .28s ease, opacity .2s ease, transform .28s ease; }
    .bareme-format-reveal.is-visible { max-height: 145px; margin-top: 0; opacity: 1; transform: translateY(0); pointer-events: auto; }
    .print-dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--studio-surface-soft, #f8fafc); }
    #observablePrintSummary, #summaryPrintSummary, #baremePrintSummary { color: var(--muted); font-size: 10.5px; }
    .print-dialog-footer > div { display: flex; align-items: center; gap: 7px; margin-left: auto; }
    .print-dialog-secondary, .print-dialog-primary { padding: 8px 12px; border-radius: 9px; font-size: 11.5px; font-weight: 750; cursor: pointer; }
    .print-dialog-secondary { border: 1px solid var(--line); background: var(--surface, #fff); color: var(--ink); }
    .print-dialog-primary { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff; }
    .print-dialog-primary svg { width: 15px; height: 15px; }
    #observablePrintSheet, #baremeBatchPrintSheet { display: none; }
    @page observable-grids { size: landscape; margin: 8mm; }
    @page individual-sheet { size: portrait; margin: 10mm; }
    @media print {
      body.print-observation-grid main > section:not(#viewQuickObs),
      body.print-observation-grid #viewQuickObs > :not(#observationPrintGrid),
      body.print-observation-grid #observationPrintGrid > :not(:first-child):not(.observation-matrix):not(#qoChecklistContainer):not(p) { display: none !important; }
      body.print-observation-grid #observationPrintGrid > :first-child,
      body.print-observation-grid #observationPrintGrid > :first-child * { color: #222 !important; background: #fff !important; }
      body.print-observation-grid .observation-matrix { overflow: visible !important; }
      body.print-observation-grid .rubric-matrix-table { min-width: 0; }
      body.print-observation-grid .rubric-matrix-table tr { break-inside: avoid; }
      body.print-observation-grid #qoChecklistContainer .qo-checklist-card { break-inside: avoid; border: 1px solid #94a3b8 !important; background: #fff !important; box-shadow: none !important; margin-bottom: 8px !important; }
      body.print-observation-grid #qoChecklistContainer .qo-checklist-card-head { background: #f8fafc !important; border-bottom: 1px solid #cbd5e1 !important; color: #111827 !important; }
      body.print-observation-grid #qoChecklistContainer button[aria-pressed="true"] { border: 2px solid #111827 !important; background: #f1f5f9 !important; color: #111827 !important; font-weight: 900 !important; }
      body.print-observation-grid #viewQuickObs:not(.hidden) { display: block; }
      body.print-observation-grid .rubric-stmt-btn[class*="stmt-checked-"] { border: 2px solid #222 !important; }
      body.print-observation-grid .rubric-stmt-btn[class*="stmt-checked-"] .rubric-stmt-check { color: #222 !important; background: #fff !important; border-color: #222 !important; }
      body.print-observation-grid.print-observation-blank .rubric-stmt-btn[class*="stmt-checked-"] { border: 1px solid #cbd5e1 !important; background: #fff !important; font-weight: 400 !important; }
      body.print-observation-grid.print-observation-blank .rubric-stmt-btn[class*="stmt-checked-"] .rubric-stmt-check { color: transparent !important; border-color: #cbd5e1 !important; }
      body.print-observation-grid.print-observation-blank #qoChecklistContainer button[aria-pressed="true"] { border: 1px solid #cbd5e1 !important; background: #fff !important; color: #334155 !important; font-weight: 700 !important; box-shadow: none !important; }
      body.print-observation-grid.print-observation-blank #sgCurrentStudentName { font-size: 0; }
      body.print-observation-grid.print-observation-blank #sgCurrentStudentName::after { content: "\00a0"; display: inline-block; min-width: 18rem; border-bottom: 1px solid #222; font-size: 12px; }
      body.print-observable-batch > *:not(#observablePrintSheet) { display: none !important; }
      body.print-bareme-batch > *:not(#baremeBatchPrintSheet) { display: none !important; }
      body.print-observable-batch #observablePrintSheet { display: block !important; page: observable-grids; color: #111827; font-family: inherit; }
      body.print-bareme-batch #baremeBatchPrintSheet { display: block !important; page: observable-grids; color: #111827; font-family: inherit; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-page { min-height: 194mm; break-after: page; display: flex; flex-direction: column; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-page:last-child { break-after: auto; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8mm; padding-bottom: 3mm; border-bottom: 2px solid #334155; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-head h1 { margin: 0; font-size: 17px; line-height: 1.15; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-head p { margin: 1.5mm 0 0; color: #475569; font-size: 10px; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-result { min-width: 50mm; text-align: right; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-result strong { font-size: 15px; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-table { width: 100%; margin-top: 3mm; border-collapse: collapse; table-layout: fixed; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-table th, :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-table td { border: 1px solid #94a3b8; padding: 1.7mm; vertical-align: top; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-table thead th { background: #f1f5f9 !important; color: #111827; font-size: 9px; text-align: center; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-table tbody th { width: 17%; background: #f8fafc !important; font-size: 9px; line-height: 1.25; text-align: left; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-table td { font-size: 8.5px; line-height: 1.28; }
      #baremeBatchPrintSheet .observable-print-table tbody th { font-size: 9.5px; line-height: 1.28; }
      #baremeBatchPrintSheet .observable-print-table td { font-size: 9.5px; line-height: 1.34; padding: 2mm; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-sub { font-size: 8px; font-weight: 500; color: #475569; margin-top: 1px; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-statement { display: flex; align-items: flex-start; gap: 1.5mm; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-check { width: 3mm; height: 3mm; flex: 0 0 auto; margin-top: .2mm; border: 1px solid #64748b; border-radius: 50%; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .is-selected { background: #e2e8f0 !important; outline: 1.4px solid #0f172a; outline-offset: -1.4px; font-weight: 700; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .is-selected .observable-print-check { background: #0f172a !important; border-color: #0f172a; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-weight { display: block; margin-top: 1mm; color: #334155; font-size: 8px; font-weight: 750; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; margin-top: 3mm; font-size: 9px; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-note { min-height: 12mm; padding: 2mm; border: 1px solid #94a3b8; border-radius: 4px; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-note strong { display: block; margin-bottom: 1mm; }
      :is(#observablePrintSheet, #baremeBatchPrintSheet) .observable-print-foot { margin-top: auto; padding-top: 2mm; color: #64748b; font-size: 8px; text-align: right; }
      body.print-student-sheet #studentIndividualPrintSheet { page: individual-sheet; }
      body.print-student-sheet #studentIndividualPrintSheet .sis-print-page { break-after: page; }
      body.print-student-sheet #studentIndividualPrintSheet .sis-print-page:last-child { break-after: auto; }
    }
    @media (max-width: 560px) {
      .print-format-options, .summary-print-options { grid-template-columns: 1fr; }
      .print-student-choices { grid-template-columns: 1fr; }
      .print-dialog-footer { align-items: flex-start; flex-direction: column; }
      .print-dialog-footer > div { width: 100%; justify-content: flex-end; }
    }
    #toastNotification { z-index: 125; }
    .qo-mode-segment { gap: .38rem; padding: 0; border: 0; background: transparent; box-shadow: none; }
    #qoToolModeBar > div:first-child { flex: 1 1 auto; min-width: 0; }
    #qoModeSegment { flex: 0 1 auto; min-width: 0; }
    #qoModeSegment .qo-mode-choice, #qoModeSegment > button:not(.qo-custom-rubric-action) {
      border: 1px solid var(--studio-border, var(--line));
      border-radius: 999px;
      background: var(--studio-surface-soft, #f8fafc);
      box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    }
    .qo-personal-rubric-wrap {
      display: inline-flex; align-items: stretch; max-width: min(18rem, 100%); height: 26px;
      border: 1px solid var(--studio-border, var(--line)); border-radius: 999px; overflow: hidden;
      background: var(--studio-surface-soft, #f8fafc);
    }
    #qoModeSegment .qo-personal-rubric-button {
      min-width: 0; max-width: 15.5rem; height: 24px; overflow: hidden; padding: 0 .55rem;
      border: 0; border-radius: 0; background: transparent; box-shadow: none; text-overflow: ellipsis; white-space: nowrap;
      color: var(--studio-text-muted, #475569); font-family: inherit; font-size: .75rem; font-weight: 600; line-height: 16px; letter-spacing: normal;
    }
    #qoModeSegment .qo-personal-rubric-button.is-active { background: #4f46e5; color: #fff; }
    .qo-personal-rubric-edit {
      flex: 0 0 1.65rem; width: 1.65rem; border-left: 1px solid var(--studio-border, var(--line));
      color: var(--brand-deep); font-size: .78rem; font-weight: 800; cursor: pointer;
    }
    .qo-personal-rubric-edit:hover, .qo-personal-rubric-edit:focus-visible { background: var(--brand-soft); outline: none; }
    #qoModeSegment .qo-custom-rubric-action {
      box-sizing: border-box !important; min-height: 26px !important; height: 26px !important; padding: 0 .72rem !important; border: 1px dashed color-mix(in srgb, var(--brand) 58%, var(--line));
      border-radius: 999px; background: transparent; color: var(--brand-deep); font-size: .75rem; font-weight: 600; line-height: 16px; cursor: pointer;
    }
    #qoModeSegment .qo-custom-rubric-action:hover, #qoModeSegment .qo-custom-rubric-action:focus-visible {
      background: var(--brand-soft); border-style: solid; outline: none;
    }
    .qo-weight-badge { background: var(--brand-soft) !important; color: var(--brand-deep) !important; border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent); }
    .custom-rubric-dialog {
      width: min(1180px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow: hidden;
      border: 1px solid var(--studio-border-strong, var(--line)); border-radius: 18px;
      background: var(--surface, #fff); color: var(--ink); box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
    }
    .custom-rubric-dialog::backdrop { background: rgba(15, 23, 42, .58); backdrop-filter: blur(3px); }
    .custom-rubric-dialog[open] { display: flex; flex-direction: column; }
    .custom-rubric-dialog-head { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
    .custom-rubric-dialog-head h2 { margin-top: .15rem; font-size: 1.15rem; font-weight: 800; }
    .custom-rubric-dialog-head p { margin-top: .25rem; color: var(--muted); font-size: .76rem; line-height: 1.45; }
    .custom-rubric-editor { min-height: 0; overflow: auto; padding: 1rem 1.25rem; }
    .custom-rubric-title-field { display: grid; gap: .3rem; max-width: 42rem; }
    .custom-rubric-title-field span, .custom-rubric-count > span { color: var(--ink); font-size: .72rem; font-weight: 800; }
    .custom-rubric-title-field input, .custom-rubric-table input, .custom-rubric-table textarea {
      width: 100%; border: 1px solid var(--studio-border-strong, var(--line)); border-radius: 8px; background: var(--surface, #fff); color: var(--ink);
      font: inherit; outline: none;
    }
    .custom-rubric-title-field input { padding: .55rem .65rem; font-size: .8rem; font-weight: 700; }
    .custom-rubric-table input { padding: .38rem .45rem; font-size: .72rem; }
    .custom-rubric-table textarea { min-height: 5.5rem; padding: .5rem; resize: vertical; font-size: .7rem; line-height: 1.4; }
    .custom-rubric-title-field input:focus, .custom-rubric-table input:focus, .custom-rubric-table textarea:focus {
      border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent);
    }
    .custom-rubric-counts { display: flex; flex-wrap: wrap; gap: .65rem; margin: .85rem 0; }
    .custom-rubric-count { display: flex; align-items: center; gap: .55rem; }
    .custom-rubric-count-buttons { display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--studio-surface-soft, #f8fafc); }
    .custom-rubric-count-buttons button { width: 1.8rem; height: 1.8rem; color: var(--brand-deep); font-size: 1rem; font-weight: 800; cursor: pointer; }
    .custom-rubric-count-buttons button:disabled { opacity: .35; cursor: not-allowed; }
    .custom-rubric-count-buttons output { min-width: 1.9rem; text-align: center; font-size: .76rem; font-weight: 800; }
    .custom-rubric-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
    .custom-rubric-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
    .custom-rubric-table th, .custom-rubric-table td { padding: .5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; }
    .custom-rubric-table tr > :last-child { border-right: 0; }
    .custom-rubric-table tbody tr:last-child > * { border-bottom: 0; }
    .custom-rubric-table thead th { background: var(--brand-soft); color: var(--brand-deep); font-size: .72rem; text-align: left; }
    .custom-rubric-table thead th:first-child, .custom-rubric-table tbody th { width: 190px; }
    .custom-rubric-table thead label, .custom-rubric-table tbody label { display: flex; align-items: center; gap: .25rem; margin-top: .35rem; color: var(--muted); font-size: .68rem; font-weight: 700; }
    .custom-rubric-table thead label input, .custom-rubric-table tbody label input { width: 4rem; text-align: center; }
    .custom-rubric-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.25rem; border-top: 1px solid var(--line); background: var(--studio-surface-soft, #f8fafc); }
    .custom-rubric-footer > div:first-child { display: grid; gap: .2rem; }
    .custom-rubric-total { width: fit-content; padding: .2rem .45rem; border: 1px solid var(--line); border-radius: 999px; font-size: .7rem; font-weight: 800; }
    .custom-rubric-total.is-valid { background: #dcfce7; color: #166534; border-color: #86efac; }
    .custom-rubric-total.is-invalid { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
    .custom-rubric-validation { color: var(--muted); font-size: .68rem; }
    .custom-rubric-validation.is-valid { color: #166534; }
    .custom-rubric-validation.is-invalid { color: #9f1239; }
    .custom-rubric-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
    .custom-rubric-delete {
      margin-right: auto; padding: .45rem .7rem; border: 1px solid #fecaca; border-radius: 8px;
      background: #fff1f2; color: #b91c1c; font-size: .72rem; font-weight: 800; cursor: pointer;
    }
    .custom-rubric-delete:hover, .custom-rubric-delete:focus-visible { background: #ffe4e6; outline: 2px solid #fecaca; }
    .custom-rubric-actions button:disabled { opacity: .45; cursor: not-allowed; }
    @media (max-width: 700px) {
      .custom-rubric-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
      .custom-rubric-dialog-head, .custom-rubric-editor, .custom-rubric-footer { padding-left: .85rem; padding-right: .85rem; }
      .custom-rubric-footer { align-items: stretch; flex-direction: column; }
      .custom-rubric-actions { width: 100%; justify-content: flex-end; }
    }
    @media print { #viewHome { display: none !important; } }
    .comp-comment { margin-top: .75rem; border: 1px solid var(--line); border-radius: 12px; background: #fffefa; padding: .65rem .75rem; }
    .comp-comment-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; font-size: 12px; font-weight: 700; color: var(--brand-deep); }
    .comp-comment textarea { width: 100%; min-height: 86px; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .6rem; font-size: 13px; line-height: 1.5; background: #fff; resize: vertical; }
    .comp-comment .cc-btn { padding: .22rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #f5f4ef; font-size: 11.5px; font-weight: 600; color: var(--brand-deep); cursor: pointer; margin-left: .3rem; }
    .comp-comment .cc-tag { font-weight: 500; color: var(--muted); font-size: 11px; }

    /* Chiffres tabulaires stricts pour alignement professionnel */
    .tabular-nums, input.asg-raw, .asg-pct, [id^="cell_avg_"], [id^="cell_final_"], [id^="kpi"], .final-grade-trigger {
      font-variant-numeric: tabular-nums;
      letter-spacing: -0.015em;
    }

    /* Marqueurs rapides sur cellule : sobres, typographiques, monochromes (ton sur ton) */
    .score-cell-wrap {
      position: relative;
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
    }
    .score-cell-top {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      position: relative;
    }
    .cell-flag-trigger {
      width: 18px;
      height: 18px;
      border-radius: 5px;
      border: 1px solid transparent;
      background: transparent;
      color: #8b938d;
      font-size: 10px;
      font-weight: 700;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      opacity: 0;
      transition: opacity .12s ease, background-color .12s ease, border-color .12s ease, color .12s ease;
      padding: 0;
    }
    td:hover .cell-flag-trigger,
    .score-cell-wrap:focus-within .cell-flag-trigger {
      opacity: 1;
    }
    .cell-flag-trigger:hover {
      background: #f1f1ec;
      border-color: #d8dad2;
      color: #46524b;
    }
    .cell-flags-row {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 2px;
      max-width: 110px;
    }
    .cell-flag-chip {
      display: inline-flex;
      align-items: center;
      padding: 1px 4px;
      border-radius: 4px;
      border: 1px solid #d5d7cf;
      background: #f2f2ed;
      color: #4a554f;
      font-size: 9px;
      font-weight: 700;
      letter-spacing: .035em;
      text-transform: uppercase;
      line-height: 1.25;
      cursor: pointer;
      user-select: none;
    }
    .cell-flag-chip:hover {
      background: #e7e8e0;
      border-color: #c2c6bc;
      color: #293330;
    }
    .flag-picker {
      position: fixed;
      z-index: 95;
      width: min(440px, calc(100vw - 16px));
      padding: 7px;
      background: #fffefa;
      border: 1px solid var(--line);
      border-radius: 11px;
      box-shadow: 0 12px 32px rgba(35, 45, 40, .18);
      animation: pickerIn .1s ease-out;
    }
    .flag-picker-title {
      font-size: 10px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: .05em;
      color: var(--muted);
      padding: 2px 4px 5px;
      border-bottom: 1px solid var(--line);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .flag-picker-list {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
    .flag-picker-group-title { padding: 4px 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
    #viewBareme .observation-matrix { max-width: none; }
    #viewBareme .rubric-matrix-table { min-width: 640px; }
    #viewBareme .rubric-matrix-table thead th { font-size: 12px; line-height: 1.3; padding: 0.6rem 0.5rem; }
    #viewBareme .rubric-matrix-table tbody td:first-child { padding: 0.65rem 0.65rem; vertical-align: middle; }
    #viewBareme .bareme-row-title { font-size: 13px; font-weight: 700; line-height: 1.32; }
    #viewBareme .bareme-row-sub { font-size: 11.5px; font-weight: 500; line-height: 1.3; margin-top: 0.2rem; color: var(--studio-text-muted, #64748b); }
    #viewBareme .rubric-matrix-table tbody td:not(:first-child) { padding: 0.45rem; height: 1px; vertical-align: stretch; }
    #viewBareme .rubric-stmt-btn { height: 100%; padding: 0.6rem 0.65rem; gap: 0.45rem; font-size: 13px; line-height: 1.42; align-items: flex-start; }
    #viewBareme .rubric-stmt-text { line-height: 1.42; }
    #viewBareme .rubric-stmt-check { margin-top: 0.15rem; }
    .flag-picker-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      width: 100%;
      padding: 5px 7px;
      border-radius: 7px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--ink);
      font-size: 11.5px;
      font-weight: 600;
      text-align: left;
      cursor: pointer;
    }
    .flag-picker-item:hover {
      background: var(--studio-surface-soft, #f8fafc);
    }
    .flag-picker-item.is-active {
      background: var(--brand-soft);
      border-color: var(--studio-border-strong, var(--line));
      color: var(--brand-deep);
    }
    .flag-picker-code {
      font-size: 9.5px;
      font-weight: 800;
      letter-spacing: .04em;
      padding: 1px 5px;
      border-radius: 4px;
      border: 1px solid var(--studio-border-strong, var(--line));
      background: var(--studio-surface-soft, #f8fafc);
      color: var(--muted);
      min-width: 38px;
      text-align: center;
    }
    .flag-picker-item.is-active .flag-picker-code {
      background: var(--brand);
      border-color: var(--brand);
      color: #ffffff;
    }

    /* Multi-niveau : filtre de niveau et cellules non ciblées */
    .gb-level-seg {
      display: inline-flex;
      align-items: center;
      flex-wrap: wrap;
      background: #f2f2ec;
      border: 1px solid var(--line);
      border-radius: 9px;
      padding: 2px;
      gap: 2px;
    }
    .gb-level-seg button {
      padding: 4px 9px;
      border-radius: 7px;
      font-size: 11px;
      font-weight: 700;
      color: var(--muted);
      background: transparent;
      border: 0;
      cursor: pointer;
      transition: all .14s ease;
      white-space: nowrap;
    }
    .gb-level-seg button:hover {
      color: var(--ink);
    }
    .gb-level-seg button.is-active {
      background: #fffefa;
      color: var(--ink);
      box-shadow: 0 1px 2px rgba(35, 45, 40, .08);
    }
    main table thead .gb-level-seg button.is-active {
      background: var(--brand) !important;
      color: #fff !important;
    }
    .cell-not-targeted {
      background: repeating-linear-gradient(
        -45deg,
        rgba(229, 229, 221, 0.35),
        rgba(229, 229, 221, 0.35) 5px,
        rgba(244, 243, 238, 0.55) 5px,
        rgba(244, 243, 238, 0.55) 10px
      );
      color: var(--muted);
      user-select: none;
    }
    @media screen {
    .theme-dark .gb-level-seg {
      background: var(--studio-surface-soft, #1e293b);
      border-color: var(--line);
    }
    .theme-dark .gb-level-seg button.is-active {
      background: var(--surface);
      color: var(--ink);
    }
    html.theme-dark main table thead .gb-level-seg button.is-active {
      background: var(--brand) !important;
      color: #fff !important;
    }
    .theme-dark .cell-not-targeted {
      background: repeating-linear-gradient(
        -45deg,
        rgba(43, 53, 50, 0.35),
        rgba(43, 53, 50, 0.35) 5px,
        rgba(31, 38, 36, 0.55) 5px,
        rgba(31, 38, 36, 0.55) 10px
      );
      color: var(--muted);
    }
    }

    /* Bulletin global : Sélecteur pondération 20/20/60, seuil 60%, flèches sobres & impression 1 page */
    .annual-weight-seg {
      display: inline-flex;
      align-items: center;
      background: #f1f1ec;
      border: 1px solid var(--line);
      border-radius: 9px;
      padding: 2px;
      gap: 2px;
    }
    .annual-weight-seg button {
      padding: .25rem .65rem;
      border-radius: 7px;
      font-size: 11px;
      font-weight: 700;
      color: #5b6660;
      background: transparent;
      border: 0;
      cursor: pointer;
    }
    .annual-weight-seg button.is-active {
      background: var(--brand);
      color: #fff;
    }
    .bar-track-wrap {
      position: relative;
      width: 100%;
      height: 11px;
      background: #eeeee8;
      border-radius: 999px;
      overflow: visible;
      border: 1px solid rgba(215, 216, 208, .75);
    }
    .bar-fill-inner {
      height: 100%;
      border-radius: 999px;
      transition: width .22s ease;
    }
    .bar-threshold-60 {
      position: absolute;
      left: 60%;
      top: -3px;
      bottom: -3px;
      width: 1.5px;
      background: #6c756f;
      opacity: .55;
      pointer-events: none;
    }
    .trend-badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 7px;
      border-radius: 6px;
      font-size: 11px;
      font-weight: 700;
      border: 1px solid #dcded7;
      background: #f6f6f2;
      color: #46524b;
      font-variant-numeric: tabular-nums;
    }
    .trend-badge.trend-up {
      background: var(--brand-soft);
      border-color: var(--studio-border-strong, var(--line));
      color: var(--brand-deep);
    }
    .trend-badge.trend-down {
      background: #f6ecea;
      border-color: #dfc6c2;
      color: #78423d;
    }
    .trend-badge svg {
      width: 12px;
      height: 12px;
      flex: none;
    }

    /* Bouton et modale Banque de commentaires */
    .comment-cell-wrap {
      display: flex;
      align-items: center;
      gap: 4px;
      min-width: 210px;
    }
    .btn-open-cb {
      flex: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 26px;
      height: 26px;
      border-radius: 7px;
      border: 1px solid var(--line);
      background: var(--studio-surface-soft, #f8fafc);
      color: var(--muted);
      cursor: pointer;
    }
    .btn-open-cb:hover {
      background: var(--brand-soft);
      border-color: var(--studio-border-strong, var(--line));
      color: var(--brand-deep);
    }
    .cb-tab-btn {
      padding: .35rem .7rem;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: #f7f7f2;
      color: #56615b;
      font-size: 11.5px;
      font-weight: 700;
      cursor: pointer;
    }
    .cb-tab-btn.is-active {
      background: var(--brand);
      border-color: var(--brand);
      color: #fff;
    }
    .cb-phrase-item {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 8px;
      width: 100%;
      padding: .5rem .65rem;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: #fffefa;
      color: var(--ink);
      font-size: 12px;
      line-height: 1.45;
      text-align: left;
      cursor: pointer;
    }
    .cb-phrase-item:hover {
      background: var(--studio-surface-soft, #f8fafc);
      border-color: var(--studio-border-strong, var(--line));
    }
    .cb-phrase-item.is-selected {
      background: var(--brand-soft);
      border-color: var(--brand);
      color: var(--brand-deep);
      font-weight: 600;
    }
    @media screen {
    .theme-dark .cb-phrase-item.is-selected {
      background: var(--brand-soft);
      border-color: var(--brand);
      color: var(--ink);
    }
    }

    /* Impression 1 page Portrait pour le Bulletin Global */
    @page globalreport { size: portrait; margin: 9mm; }
    @media print {
      body.print-global-report {
        background: #fff !important;
        color: #1e2623 !important;
      }
      body.print-global-report header,
      body.print-global-report .no-print,
      body.print-global-report #competencyPositioning,
      body.print-global-report #grCompetencyLevelSummary,
      body.print-global-report main > section:not(#viewGlobalReport) {
        display: none !important;
      }
      body.print-global-report main {
        padding: 0 !important;
        max-width: 100% !important;
      }
      body.print-global-report #viewGlobalReport {
        display: block !important;
        page: globalreport;
      }
      body.print-global-report #grReportContent {
        font-size: 10.5px !important;
      }
      body.print-global-report #grReportContent > * {
        break-inside: avoid;
        margin-bottom: 8px !important;
        padding: 10px 12px !important;
        box-shadow: none !important;
        border: 1px solid #cfd4ce !important;
      }
      body.print-global-report #grReportContent table th,
      body.print-global-report #grReportContent table td {
        padding: 4px 6px !important;
        font-size: 10px !important;
      }
      body.print-global-report .bar-fill-inner,
      body.print-global-report .trend-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
      }
    }
    @media print { html.theme-dark { filter: none !important; } .no-print { display: none !important; } }
  