:root {
      --ink: #1f2937;
      --muted: #667085;
      --blue: #1f4e79;
      --blue-2: #305496;
      --line: #c8d1dc;
      --cream: #fff2cc;
      --white: #ffffff;
      --soft: #f6f8fb;
      --mint: #e2f0d9;
      --danger: #b42318;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: Arial, Helvetica, sans-serif;
      color: var(--ink);
      background: var(--soft);
    }

    .hidden { display: none !important; }

    .home {
      min-height: 100vh;
      display: grid;
      grid-template-rows: auto 1fr;
    }

    header.brand {
      display: grid;
      grid-template-columns: auto 1fr;
      align-items: center;
      gap: 16px;
      padding: 16px 28px;
      background: var(--white);
      border-bottom: 1px solid var(--line);
    }

    .logo {
      width: 220px;
      height: 66px;
      object-fit: contain;
      object-position: left center;
    }

    .brand-title h1 {
      margin: 0;
      font-size: 25px;
      color: var(--blue);
    }

    .brand-title p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 17px;
      font-style: italic;
    }

    .home main {
      padding: 24px 28px 34px;
      display: grid;
      gap: 16px;
      align-content: start;
    }

    .intro {
      display: grid;
      grid-template-columns: 1fr minmax(260px, 360px);
      gap: 18px;
      align-items: end;
    }

    .intro h2 {
      margin: 0;
      font-size: 23px;
    }

    .intro p {
      margin: 6px 0 0;
      color: var(--muted);
      line-height: 1.4;
      font-size: 14px;
    }

    .search,
    select,
    input,
    textarea {
      width: 100%;
      border: 2px solid #5b9bd5;
      background: #f7fbff;
      border-radius: 6px;
      padding: 8px;
      font: inherit;
      font-size: 13px;
      color: var(--ink);
    }

    .profiles {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 12px;
    }

    .card {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 12px;
      min-height: 64px;
      padding: 12px;
      border: 1px solid #dce3ee;
      border-radius: 8px;
      background: var(--white);
      color: var(--ink);
      text-decoration: none;
      box-shadow: 0 8px 20px rgba(32, 41, 56, 0.06);
      cursor: pointer;
    }

    .card:hover {
      border-color: var(--blue);
      background: #f7fbff;
    }

    .card.admin {
      border-color: #f0c95d;
      background: #fff8df;
    }

    .card.admin .avatar {
      background: var(--blue);
      color: white;
    }

    .avatar {
      width: 40px;
      height: 40px;
      border-radius: 999px;
      display: grid;
      place-items: center;
      background: #e7edf5;
      color: var(--blue);
      font-weight: 700;
    }

    .name {
      display: block;
      font-weight: 700;
      overflow-wrap: anywhere;
    }

    .role {
      display: block;
      margin-top: 2px;
      color: var(--muted);
      font-size: 12px;
    }

    .arrow {
      color: var(--blue);
      font-size: 22px;
      font-weight: 700;
    }

    .notice {
      border: 1px solid #b7dfc6;
      background: var(--mint);
      border-radius: 8px;
      padding: 10px 12px;
      color: #344054;
      font-size: 13px;
    }

    .notice.full-span {
      grid-column: 1 / -1;
    }

    .notice.danger {
      background: #fff1f2;
      border-color: #fecdd3;
      color: #991b1b;
    }

    .notice.warning {
      background: #fff7ed;
      border-color: #fed7aa;
      color: #9a3412;
    }

    .app {
      min-height: 100vh;
      display: grid;
      grid-template-rows: auto 240px;
      gap: 10px;
      padding: 8px;
      overflow: auto;
      position: relative;
    }

    .app.stats-mode {
      grid-template-rows: 1fr;
    }

    .app.stats-mode .side {
      display: none;
    }

    .app.stats-mode .ticker {
      display: none;
    }

    .app.form-modal-open::before {
      content: "";
      position: fixed;
      inset: 0;
      z-index: 30;
      background: rgba(15, 23, 42, 0.42);
    }

    .app.form-modal-open .side {
      position: fixed;
      z-index: 31;
      top: 46vh;
      left: 50%;
      transform: translate(-50%, -50%);
      width: min(560px, calc(100vw - 28px));
      max-height: none;
      overflow: visible;
      box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    }

    .app.form-modal-open .side {
      display: block;
    }

    .app.form-modal-open .records {
      display: none;
    }

    .app.form-modal-open .side > .hint {
      display: none;
    }

    .modal-overlay {
      position: fixed;
      inset: 0;
      z-index: 200;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(15, 23, 42, 0.72);
      overflow-y: auto;
    }

    .modal-overlay.active {
      display: flex;
    }


    #profileSetupModal.active {
      align-items: flex-start;
    }

    .day-card {
      width: min(430px, calc(100vw - 28px));
      border: 1px solid #d9e1ec;
      border-radius: 10px;
      background: white;
      box-shadow: 0 24px 70px rgba(15, 23, 42, 0.38);
      padding: 18px;
    }

    .day-card header {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 10px;
      align-items: start;
      margin-bottom: 16px;
    }

    .day-card h2 {
      margin: 0;
      font-size: 18px;
      color: var(--ink);
    }

    .day-card .count {
      margin-top: 4px;
      color: var(--muted);
      font-size: 13px;
    }

    .modal-close {
      border: 0;
      background: transparent;
      color: #667085;
      padding: 0;
      font-size: 22px;
      line-height: 1;
    }

    .profile-setup-card {
      width: min(1120px, calc(100vw - 28px));
      max-height: none;
      overflow: visible;
      border: 1px solid #d8e5f4;
      border-radius: 18px;
      background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
      box-shadow: 0 28px 80px rgba(15, 23, 42, 0.38);
      padding: 0;
      margin: 22px auto;
    }

    .profile-setup-card header {
      display: flex;
      justify-content: space-between;
      gap: 16px;
      align-items: flex-start;
      margin: 0;
      padding: 24px 26px 18px;
      border-bottom: 1px solid #dce9f7;
      background: #ffffff;
      border-radius: 18px 18px 0 0;
    }

    .profile-setup-card h2 {
      margin: 4px 0 6px;
      color: var(--ink);
      font-size: 26px;
    }

    .profile-setup-kicker {
      margin: 0;
      color: #007a59;
      font-weight: 900;
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: .04em;
    }

    .profile-setup-card form,
    .profile-setup-section {
      display: grid;
      gap: 14px;
    }

    .profile-setup-card form {
      padding: 18px 26px 24px;
      grid-template-columns: 1fr;
      border-bottom: 0;
    }

    .profile-setup-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      padding: 14px;
      border: 1px solid #dce9f7;
      border-radius: 14px;
      background: #ffffff;
    }

    .profile-setup-card label {
      display: grid;
      gap: 6px;
      align-content: start;
      min-height: 0;
      margin-bottom: 0;
      color: #0f3f6d;
      font-weight: 800;
      font-size: 13px;
    }

    .profile-setup-card input,
    .profile-setup-card select,
    .profile-setup-card textarea {
      width: 100%;
      border: 1px solid #bcd3ee;
      border-radius: 8px;
      padding: 10px 12px;
      color: var(--ink);
      background: #fff;
      font: inherit;
      font-weight: 700;
      min-height: 42px;
    }

    .profile-assignment-row,
    .profile-support-row {
      display: grid;
      grid-template-columns: 170px 1fr 190px auto;
      gap: 12px;
      align-items: start;
      padding: 14px;
      border: 1px solid #d8e5f4;
      border-radius: 14px;
      background: #ffffff;
      box-shadow: 0 10px 30px rgba(15, 64, 109, 0.07);
    }

    .profile-assignment-row + .profile-assignment-row,
    .profile-support-row + .profile-support-row {
      margin-top: 10px;
    }

    .profile-row-subjects {
      display: grid;
      gap: 7px;
    }

    .profile-check-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
      gap: 7px;
      padding: 8px;
      border: 1px solid #d8e5f4;
      border-radius: 10px;
      background: #f8fbff;
    }

    .profile-check-grid label,
    .profile-student-list label {
      display: flex;
      gap: 8px;
      align-items: center;
      color: #123a5f;
      font-size: 12px;
      font-weight: 800;
      min-height: 34px;
      border: 1px solid #d8e5f4;
      border-radius: 8px;
      background: #ffffff;
      padding: 7px 9px;
    }

    .profile-check-grid input,
    .profile-student-list input {
      width: auto;
    }

    .profile-student-list {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 8px;
      max-height: none;
      overflow: visible;
      padding: 10px;
      border: 1px solid #d8e5f4;
      border-radius: 10px;
      background: #fff;
    }

    .profile-setup-actions,
    .profile-admin-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
      justify-content: flex-end;
      padding-top: 14px;
      border-top: 1px solid #e5edf7;
    }

    .profile-setup-actions button,
    .profile-admin-actions button,
    .profile-setup-card .mini-action,
    .profile-config-top {
      border: 1px solid #bcd3ee;
      border-radius: 9px;
      background: #eef6ff;
      color: #0f4778;
      padding: 10px 14px;
      font-weight: 900;
      cursor: pointer;
    }

    .profile-setup-actions .primary,
    .profile-admin-actions .primary,
    .profile-setup-card .primary {
      background: #145586;
      border-color: #145586;
      color: #fff;
    }

    .profile-admin-panel {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 14px;
      align-items: end;
      margin: 0 0 16px;
      padding: 14px;
      border: 1px solid #cfe0f4;
      border-radius: 10px;
      background: #eef8ff;
    }

    .profile-admin-panel[hidden] {
      display: none !important;
    }

    .profile-admin-title {
      margin: 0;
      color: var(--ink);
    }

    .profile-admin-description {
      margin: 4px 0 0;
    }

    .profile-admin-controls {
      display: grid;
      grid-template-columns: 180px 240px;
      gap: 10px;
      align-items: end;
    }

    .profile-admin-controls label {
      display: grid;
      gap: 5px;
      font-size: 12px;
      color: #0f3f6d;
      font-weight: 900;
    }

    .profile-admin-controls select {
      border: 1px solid #bcd3ee;
      border-radius: 8px;
      padding: 9px 10px;
      font: inherit;
      font-weight: 800;
    }

    .admin-word-review-upload {
      grid-column: 1 / -1;
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 10px;
      border: 1px solid #c8ddf1;
      border-radius: 9px;
      background: #fff;
      padding: 12px;
    }

    .admin-word-review-controls {
      display: grid;
      grid-template-columns: minmax(180px, 1fr) auto auto auto;
      gap: 8px;
      align-items: end;
    }

    .admin-word-review-controls label {
      display: grid;
      gap: 5px;
      font-size: 12px;
      color: #0f3f6d;
      font-weight: 900;
    }

    .admin-word-review-controls input {
      min-width: 0;
      border: 1px solid #bcd3ee;
      border-radius: 8px;
      padding: 8px 10px;
      background: #f8fbff;
      font: inherit;
    }

    .admin-word-review-controls button {
      border: 1px solid #bcd3ee;
      border-radius: 8px;
      background: #eef6ff;
      color: #0f4778;
      padding: 9px 12px;
      font-weight: 900;
      cursor: pointer;
      min-height: 38px;
    }

    .admin-word-review-controls button.primary {
      background: #145586;
      border-color: #145586;
      color: #fff;
    }

    .admin-word-review-controls button:disabled {
      opacity: .55;
      cursor: not-allowed;
    }

    .admin-word-review-summary {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      color: #526579;
      font-size: 13px;
    }

    .admin-word-review-summary strong {
      color: #0f3f6d;
    }

    .pie-student-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 12px;
    }

    .pie-student-card,
    .pie-grade-pill {
      border: 1px solid #d8e5f4;
      border-radius: 12px;
      background: #fff;
      padding: 14px;
      box-shadow: 0 8px 18px rgba(13, 75, 124, 0.06);
    }

    .pie-student-card h3 {
      margin: 0 0 6px;
      color: var(--ink);
    }

    .pie-oa-chip {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 8px;
      width: 100%;
      border: 1px solid #d8e9fb;
      cursor: pointer;
      margin: 0;
      padding: 7px 9px;
      border-radius: 9px;
      background: #f7fbff;
      color: #0f4778;
      font-size: 12px;
      font-weight: 800;
      text-align: left;
    }

    .pie-oa-chip:hover {
      border-color: #8fc4f5;
      background: #edf7ff;
      transform: translateY(-1px);
    }

    .pie-oa-chip .pie-oa-code {
      align-self: start;
      border-radius: 999px;
      padding: 2px 7px;
      background: #0d4b7c;
      color: #fff;
      font-size: 11px;
      white-space: nowrap;
    }

    .pie-oa-chip .pie-oa-title {
      min-width: 0;
      color: #173f63;
      line-height: 1.25;
    }

    .pie-empty-chip {
      display: block;
      border: 1px dashed #c7d9ea;
      border-radius: 9px;
      padding: 9px 10px;
      background: #fbfdff;
      color: #6b7d90;
      font-size: 12px;
      font-weight: 800;
    }

    .pie-course-panel {
      display: grid;
      gap: 12px;
      margin-bottom: 14px;
      padding: 14px;
      border: 1px solid #d8e5f4;
      border-radius: 14px;
      background: linear-gradient(180deg, #f8fbff 0%, #eef7ff 100%);
      box-shadow: 0 10px 24px rgba(13, 75, 124, 0.06);
    }

    .pie-course-head {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 12px;
      align-items: start;
    }

    .pie-course-panel h3 {
      margin: 0;
      color: var(--ink);
      font-size: 20px;
    }

    .pie-course-stats {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 8px;
    }

    .pie-stat-pill {
      border: 1px solid #cfe0ef;
      border-radius: 999px;
      padding: 6px 10px;
      background: #fff;
      color: #0b416e;
      font-size: 12px;
      font-weight: 900;
      white-space: nowrap;
    }

    .pie-student-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 8px;
    }

    .pie-student-strip span {
      border-radius: 999px;
      padding: 5px 9px;
      background: #fff;
      color: #284b69;
      font-size: 12px;
      font-weight: 800;
    }

    .pie-oa-month-grid,
    .pie-grade-summary {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      gap: 12px;
    }

    .pie-oa-month-card {
      display: grid;
      gap: 10px;
      border: 1px solid #cfe0ef;
      border-radius: 12px;
      background: #fff;
      padding: 12px;
    }

    .pie-month-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding-bottom: 8px;
      border-bottom: 1px solid #e2ecf6;
    }

    .pie-month-title strong,
    .pie-grade-pill strong {
      color: var(--ink);
    }

    .pie-month-title span {
      color: #5a7187;
      font-size: 12px;
      font-weight: 850;
    }

    .pie-subject-list {
      display: grid;
      gap: 8px;
    }

    .pie-subject-card {
      border: 1px solid #e2ecf6;
      border-radius: 10px;
      background: #fbfdff;
      overflow: hidden;
    }

    .pie-subject-card summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 9px 10px;
      color: #0d4b7c;
      font-weight: 900;
      cursor: pointer;
      list-style: none;
    }

    .pie-subject-card summary::-webkit-details-marker {
      display: none;
    }

    .pie-subject-card summary::after {
      content: "Ver";
      border-radius: 999px;
      padding: 3px 8px;
      background: #eef6ff;
      color: #0d4b7c;
      font-size: 11px;
      font-weight: 900;
    }

    .pie-subject-card[open] summary::after {
      content: "Ocultar";
    }

    .pie-subject-card .pie-subject-oa-list {
      display: grid;
      gap: 6px;
      padding: 0 10px 10px;
    }

    @media (max-width: 760px) {
      .profile-setup-grid,
      .profile-assignment-row,
      .profile-support-row,
      .profile-admin-panel,
      .profile-admin-controls,
      .admin-word-review-controls,
      .pie-course-head,
      .pie-oa-month-grid,
      .pie-grade-summary {
        grid-template-columns: 1fr;
      }

      .pie-course-stats {
        justify-content: flex-start;
      }
    }

    @media (max-height: 760px) {
      .profile-setup-card {
        width: min(1180px, calc(100vw - 18px));
      }

      .profile-setup-card header {
        padding: 18px 22px 12px;
      }

      .profile-setup-card form {
        padding: 14px 22px 18px;
      }

      .profile-check-grid {
        grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
      }
    }

    .day-list {
      min-height: 64px;
      display: grid;
      gap: 7px;
      align-content: center;
      color: #667085;
      font-size: 13px;
      text-align: center;
    }

    .day-list.dialog-copy {
      min-height: auto;
      text-align: left;
    }

    .day-list .request-pill {
      text-align: left;
      border: 1px solid #b8d6f8;
      border-radius: 5px;
      background: #eef6ff;
      color: #17406c;
      padding: 7px 9px;
      font-size: 12px;
      line-height: 1.3;
    }

    .day-card .primary {
      width: 100%;
      margin-top: 16px;
      border-radius: 8px;
      padding: 10px 12px;
    }

    .day-card .danger-action {
      width: 100%;
      margin-top: 10px;
      border: 1px solid #f2b8b5;
      border-radius: 8px;
      background: #fff5f5;
      color: #b42318;
      padding: 10px 12px;
      font-weight: 900;
    }

