body.auth-required > :not(script):not(#auth-shell) { display: none !important; }
    #auth-shell { font-family: Inter, sans-serif; }
    html { font-size: 90%; }
    :focus-visible { outline: 3px solid #79a944; outline-offset: 2px; }
    button, select { cursor: pointer; min-height: 44px; }
    button:not(:disabled):hover { filter: brightness(.97); }
    button:disabled { cursor: not-allowed; opacity: .65; }
    button:active:not(:disabled) { transform: translateY(1px); }
    #app-sidebar { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }

    /* The biodata form is portaled to body so the fixed sidebar and topbar cannot cover it. */
    .student-form-overlay {
      position: fixed;
      inset: 0;
      z-index: 1000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 1rem;
      background: rgb(15 23 42 / 58%);
    }
    .student-form-overlay.is-open { display: flex; }
    .student-form-dialog {
      width: min(100%, 64rem);
      max-height: calc(100vh - 2rem);
      max-height: calc(100dvh - 2rem);
      overflow: auto;
      overscroll-behavior: contain;
      border: 1px solid #e2e8f0;
      border-radius: 1rem;
      background: #fff;
      box-shadow: 0 24px 60px rgb(15 23 42 / 24%);
    }
    @media (max-width: 640px) {
      .student-form-overlay { padding: .5rem; }
      .student-form-dialog { max-height: calc(100vh - 1rem); max-height: calc(100dvh - 1rem); border-radius: .75rem; }
    }

    /* Keep assessment controls and sub-tabs in view while only the active form scrolls. */
    body.assessment-mode > #app-shell {
      height: 100vh;
      height: 100dvh;
      min-height: 0;
      overflow: hidden;
    }
    body.assessment-mode #main-content-area {
      height: 100vh;
      height: 100dvh;
      min-height: 0;
      overflow: hidden;
    }
    body.assessment-mode #app-topbar { flex: 0 0 auto; }
    body.assessment-mode #tab-assessment:not(.hidden) {
      display: flex;
      flex: 1 1 auto;
      flex-direction: column;
      width: 100%;
      max-width: none;
      min-height: 0;
      margin: 0;
      overflow: hidden;
    }
    body.assessment-mode #assessment-workspace {
      display: flex;
      flex: 1 1 auto;
      flex-direction: column;
      min-height: 0;
      gap: 1rem;
    }
    body.assessment-mode #assessment-workspace > * + * { margin-top: 0; }
    body.assessment-mode #assessment-workspace > :not(.assessment-subpanel) { flex: 0 0 auto; }
    body.assessment-mode #assessment-workspace > .assessment-subpanel:not(.hidden) {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior: contain;
      padding: 0 .25rem .75rem 0;
    }
    .assessment-selector-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: .5rem;
    }
    .assessment-selector-row > :first-child { min-width: 0; }
    .tumbuh-development-table { table-layout: fixed; }
    .tumbuh-rating-group {
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      gap: .375rem;
      min-width: max-content;
    }
    .tumbuh-rating-button {
      flex: 0 0 auto;
      min-width: 2.5rem;
      padding: .55rem .625rem;
    }
    .tumbuh-analysis-input {
      display: block;
      width: 100%;
      min-height: 3.5rem;
      padding: .55rem .7rem;
      border: 1px solid #cbd5e1;
      border-radius: .625rem;
      background: #f8fafc;
      color: #334155;
      font-size: .75rem;
      line-height: 1.4;
      resize: none;
      cursor: default;
    }
    .tumbuh-analysis-input::placeholder { color: #64748b; opacity: 1; }
    .tumbuh-analysis-input:focus { outline: 2px solid #365c78; outline-offset: 1px; }
    @media (max-width: 900px) {
      .assessment-selector-row { grid-template-columns: minmax(0, 1fr); }
      .assessment-selector-row > :last-child { justify-self: start; }
    }
    @media (max-height: 720px) {
      body.assessment-mode #tab-assessment { padding-top: .75rem; padding-bottom: .75rem; }
      body.assessment-mode #assessment-workspace { gap: .5rem; }
      body.assessment-mode #assessment-scale-legend { padding: .5rem; gap: .5rem; }
      body.assessment-mode #assessment-scale-legend > div { padding: .4rem; }
      body.assessment-mode #assessment-scale-legend p {
        display: block;
        font-size: .7rem;
        line-height: 1.3;
      }
    }
    @media (max-height: 700px) {
      #app-sidebar > div:last-child { padding: .5rem 1rem; }
      #app-sidebar > div:last-child > div:first-child { display: none; }
    }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
      }
    }
    /* Custom Scrollbar */
    ::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }
    ::-webkit-scrollbar-track {
      background: #f1f5f9;
    }
    ::-webkit-scrollbar-thumb {
      background: #cbd5e1;
      border-radius: 9999px;
    }
    ::-webkit-scrollbar-thumb:hover {
      background: #94a3b8;
    }

    /* Official A4 Paper Sheet Styling for Screen Preview */
    .rapor-sheet-wrapper {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 24px;
      padding: 24px 12px 64px 12px;
    }

    .rapor-page {
      width: 210mm;
      min-height: 297mm;
      background: #ffffff;
      color: #0f172a;
      padding: 12mm 16mm;
      box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.14), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
      border: 1px solid #e2e8f0;
      box-sizing: border-box;
      font-family: 'Times New Roman', Times, serif;
      position: relative;
      page-break-after: always;
      break-after: page;
    }

    .rapor-page:last-child {
      page-break-after: auto;
      break-after: auto;
    }
    .zoom-btn { min-width: 44px; }

    @media (max-width: 640px) {
      #tab-dashboard .dashboard-empty-message { width: min(20rem, calc(100vw - 80px)) !important; max-width: none !important; margin-left: 0 !important; margin-right: 0 !important; text-align: left !important; }
      #tab-dashboard .dashboard-empty-icon { margin-left: 0 !important; margin-right: auto !important; }
    }

    @media (max-width: 640px) {
      .rapor-sheet-wrapper { align-items: stretch; gap: 16px; padding: 12px 10px 32px; }
      .rapor-page {
        width: calc(100vw - 40px);
        min-height: auto;
        padding: 7mm 6mm;
        margin-inline: auto;
        overflow-wrap: anywhere;
      }
      .rapor-table { table-layout: fixed; }
      .rapor-table th, .rapor-table td { overflow-wrap: anywhere; }
    }

    /* Official Report Tables */
    .rapor-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 10pt;
      line-height: 1.25;
    }
    .rapor-table th,
    .rapor-table td {
      border: 1px solid #1e293b;
      padding: 3.5px 6px;
      vertical-align: middle;
    }
    .rapor-table th {
      background-color: #f1f5f9 !important;
      font-weight: bold;
      text-align: center;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .rapor-section-row td {
      background-color: #f8fafc !important;
      font-weight: bold;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }

    /* Larger table type and row spacing, close to the printed reference */
    .rapor-table-compact {
      font-size: 13pt;
      line-height: 1.15;
    }
    .rapor-table-compact th,
    .rapor-table-compact td {
      padding: 5px 6px;
    }

    /* Print Media Rules */
    @media print {
      @page {
        size: A4 portrait;
        margin: 0;
      }
      html, body {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 210mm !important;
      }
      #app-sidebar,
      #app-topbar,
      #mobile-drawer-backdrop,
      #print-controls,
      #toast-container,
      #confirm-modal,
      .no-print {
        display: none !important;
      }
      #main-content-area {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
      }
      #tab-print {
        display: block !important;
        padding: 0 !important;
      }
      #rapor-zoom-container {
        transform: none !important;
        width: 100% !important;
      }
      .rapor-sheet-wrapper {
        padding: 0 !important;
        gap: 0 !important;
        display: block !important;
      }
      .rapor-page {
        width: 210mm !important;
        min-height: 296mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 11mm 15mm !important;
        box-shadow: none !important;
        border: none !important;
        overflow: hidden !important;
      }
    }
