    /* =============== MODAL HISTÓRICO =============== */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(4px);
      z-index: 999;
      align-items: center;
      justify-content: center;
    }

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

    .modal-content {
      background: linear-gradient(135deg, rgba(57, 36, 86, 0.95), rgba(26, 15, 38, 0.98));
      border: 1px solid rgba(244, 201, 74, 0.2);
      border-radius: var(--radius-lg);
      padding: var(--sp-7);
      max-width: 600px;
      width: 90%;
      max-height: 70vh;
      overflow-y: auto;
      box-shadow: var(--shadow-lg);
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: var(--sp-6);
      padding-bottom: var(--sp-4);
      border-bottom: 1px solid rgba(244, 201, 74, 0.16);
    }

    .modal-header h2 {
      font-family: var(--serif);
      font-size: var(--text-xl);
      color: var(--gold-light);
    }

    .modal-close {
      width: 36px;
      height: 36px;
      border: 1px solid var(--card-border-hover);
      background: rgba(255, 255, 255, 0.04);
      color: var(--cream);
      border-radius: var(--radius-sm);
      font-size: var(--text-lg);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s var(--ease);
    }

    .modal-close:hover {
      background: rgba(255, 255, 255, 0.08);
    }

    #history-list-modal {
      display: flex;
      flex-direction: column;
      gap: var(--sp-5);
    }

    .history-more {
      align-self: center;
      font-family: inherit;
      cursor: pointer;
      border-radius: var(--radius-md);
      border: 1px solid var(--gold);
      background: transparent;
      color: var(--gold-light);
      padding: var(--sp-2) var(--sp-4);
      font-size: var(--text-sm);
      font-weight: 600;
    }

    .history-more:disabled {
      opacity: 0.6;
      cursor: default;
    }

    .subjects-window-note {
      font-size: var(--text-xs);
      color: var(--cream-soft);
      text-align: center;
      margin-top: var(--sp-2);
    }

    /* Desempenho por Matéria — barras horizontais + tendência, dentro de
       um card do carrossel (não mais um modal) — por isso o contêiner
       interno rola verticalmente se houver muitas matérias cadastradas. */
    #subjects-body {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: var(--sp-3);
    }

    #subjects-list {
      display: flex;
      flex-direction: column;
      gap: var(--sp-2);
      flex-shrink: 0;
    }

    .subject-bar-row {
      display: grid;
      grid-template-columns: minmax(70px, 100px) 1fr 48px;
      align-items: center;
      gap: var(--sp-3);
      background: none;
      border: none;
      padding: var(--sp-1) 0;
      text-align: left;
      cursor: pointer;
    }

    .subject-bar-label {
      font-size: var(--text-xs);
      color: var(--cream-soft);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .subject-bar-row.active .subject-bar-label {
      color: var(--gold-light);
      font-weight: 700;
    }

    .subject-bar-track {
      height: 10px;
      border-radius: var(--radius-pill);
      background: rgba(255, 255, 255, 0.06);
      overflow: hidden;
    }

    .subject-bar-fill {
      height: 100%;
      border-radius: var(--radius-pill);
      background: linear-gradient(90deg, var(--gold-deep), var(--gold));
      transition: width 0.4s var(--ease), background 0.2s var(--ease);
    }

    .subject-bar-row.active .subject-bar-fill {
      background: linear-gradient(90deg, var(--yes), #d7eec4);
    }

    .subject-bar-value {
      font-size: var(--text-2xs);
      font-weight: 700;
      color: var(--gold-light);
      text-align: right;
    }

    #subjects-trend-wrap {
      flex-shrink: 0;
      padding-top: var(--sp-3);
      border-top: 1px dashed var(--card-border);
    }

    #subjects-trend-title {
      font-size: var(--text-xs);
      color: var(--cream-faint);
      text-transform: uppercase;
      letter-spacing: 0.02em;
      margin-bottom: var(--sp-3);
    }

    #subjects-trend-chart {
      width: 100%;
      height: 90px;
      overflow: visible;
    }

    .h-day-group {
      display: flex;
      flex-direction: column;
      gap: var(--sp-2);
    }

    .h-date-header {
      display: flex;
      align-items: baseline;
      gap: var(--sp-2);
      font-family: var(--serif);
      font-weight: 700;
      color: var(--gold-light);
      font-size: var(--text-base);
      padding-bottom: var(--sp-1);
      border-bottom: 1px solid rgba(244, 201, 74, 0.14);
    }

    .h-count {
      font-family: var(--sans);
      font-size: var(--text-xs);
      font-weight: 500;
      color: var(--cream-faint);
      text-transform: none;
    }

    .h-entry {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--sp-3);
      padding: var(--sp-3) var(--sp-4);
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--card-border);
      border-radius: var(--radius-md);
      font-size: var(--text-sm);
      transition: background 0.2s var(--ease);
    }

    .h-entry:hover {
      background: rgba(255, 255, 255, 0.06);
    }

    .h-mood {
      font-size: var(--text-lg);
    }

    .h-detail {
      color: var(--cream-soft);
      flex: 1;
      min-width: 140px;
    }

    .h-tags {
      display: flex;
      flex-wrap: wrap;
      gap: var(--sp-1);
      width: 100%;
      order: 3;
    }

    .h-tag {
      font-size: var(--text-2xs);
      font-weight: 600;
      color: var(--gold-light);
      background: var(--amber-soft);
      border: 1px solid var(--card-border);
      border-radius: var(--radius-pill);
      padding: 2px var(--sp-2);
    }

    .h-delete {
      width: 28px;
      height: 28px;
      flex-shrink: 0;
      border-radius: 50%;
      border: 1px solid var(--card-border-hover);
      background: rgba(255, 255, 255, 0.04);
      color: var(--cream-soft);
      font-size: var(--text-sm);
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s var(--ease), color 0.2s var(--ease);
    }

    .h-delete:hover {
      background: rgba(217, 140, 140, 0.25);
      color: var(--no);
    }

    /* Relatório Semanal */
    .wr-stats {
      display: flex;
      gap: var(--sp-5);
      flex-wrap: wrap;
      margin-bottom: var(--sp-5);
    }

    .wr-stat {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .wr-num {
      font-family: var(--serif);
      font-size: var(--text-xl);
      font-weight: 700;
      color: var(--gold-light);
    }

    .wr-label {
      font-size: var(--text-xs);
      color: var(--cream-faint);
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }

    .wr-line {
      font-size: var(--text-sm);
      color: var(--cream-soft);
      margin-bottom: var(--sp-2);
      display: flex;
      align-items: center;
      gap: var(--sp-2);
      flex-wrap: wrap;
    }

    .wr-message {
      margin-top: var(--sp-4);
      padding-top: var(--sp-4);
      border-top: 1px solid rgba(244, 201, 74, 0.14);
      font-family: var(--serif);
      font-size: var(--text-base);
      color: var(--gold-light);
    }

    /* Ansiedade — emoji grande (1/3) + gráfico mensal (2/3) */
    #anxiety-body {
      display: flex;
      gap: var(--sp-4);
      flex: 1;
      min-height: 0;
      align-items: stretch;
    }

    #anxiety-avg {
      flex: 1 1 33%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: var(--sp-2);
      text-align: center;
      border-right: 1px solid rgba(244, 201, 74, 0.14);
      padding-right: var(--sp-3);
    }

    #anxiety-avg-emoji {
      font-size: clamp(2.4rem, 5vw, 3.2rem);
      line-height: 1;
    }

    #anxiety-avg-label {
      font-size: var(--text-2xs);
      color: var(--cream-faint);
      text-transform: uppercase;
      letter-spacing: 0.03em;
      max-width: 120px;
    }

    #anxiety-chart-wrap {
      flex: 2 1 67%;
      min-width: 0;
      display: flex;
      align-items: center;
    }

    #anxiety-chart {
      width: 100%;
      height: 100%;
      max-height: 130px;
      overflow: visible;
    }

    .ax-axis {
      stroke: rgba(255, 255, 255, 0.12);
      stroke-width: 1;
    }

    .ax-line {
      stroke: var(--gold);
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .ax-dot {
      fill: var(--gold-light);
    }

    .ax-today {
      stroke: rgba(251, 245, 232, 0.25);
      stroke-width: 1;
      stroke-dasharray: 3 3;
    }

    @media (max-width: 480px) {
      #anxiety-body {
        flex-direction: column;
      }

      #anxiety-avg {
        border-right: none;
        border-bottom: 1px solid rgba(244, 201, 74, 0.14);
        padding-right: 0;
        padding-bottom: var(--sp-3);
        flex: none;
      }

      #anxiety-chart-wrap {
        flex: 1;
      }
    }

    .empty-msg {
      color: var(--cream-faint);
      font-size: 0.9rem;
      text-align: center;
      padding: 32px 0;
    }

