.study-session-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-drawer) + 8);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  background: rgba(2, 4, 12, 0.74);
  backdrop-filter: blur(11px);
  animation: study-session-backdrop-in 180ms ease-out both;
}

.study-session-drawer [hidden] { display: none !important; }

.study-session-drawer {
  --study-accent: #8b5cf6;
  --study-accent-rgb: 139, 92, 246;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(710px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.48);
  border-radius: 14px;
  background:
    radial-gradient(circle at 24% 0%, rgba(var(--study-accent-rgb), 0.1), transparent 34%),
    linear-gradient(155deg, rgba(13, 16, 32, 0.99), rgba(5, 8, 17, 0.99));
  color: #f8fafc;
  box-shadow: 0 0 34px rgba(var(--study-accent-rgb), 0.14), 0 30px 90px rgba(0, 0, 0, 0.58);
  animation: study-session-drawer-in 240ms cubic-bezier(.22, .75, .2, 1) both;
}

.study-session-drawer--revisao { --study-accent: #3b82f6; --study-accent-rgb: 59, 130, 246; }
.study-session-drawer--questoes { --study-accent: #e247c8; --study-accent-rgb: 226, 71, 200; }

.study-session-header {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 46px;
  align-items: center;
  gap: 12px;
  padding: 18px 25px 14px;
}

.study-session-header::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 84px;
  height: 5px;
  border-radius: 0 0 99px 99px;
  background: linear-gradient(90deg, #7c3aed, var(--study-accent));
  box-shadow: 0 0 18px rgba(var(--study-accent-rgb), 0.6);
  transform: translateX(-50%);
}

.study-session-heading-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid var(--study-accent);
  border-radius: 50%;
  color: #c4b5fd;
  background: rgba(var(--study-accent-rgb), 0.12);
  box-shadow: 0 0 22px rgba(var(--study-accent-rgb), 0.34), inset 0 0 16px rgba(var(--study-accent-rgb), 0.12);
}

.study-session-heading-icon svg { width: 28px; height: 28px; }
.study-session-heading { min-width: 0; }
.study-session-heading h2 { margin: 0; font-size: 24px; font-weight: 540; line-height: 1.15; }
.study-session-heading p { margin: 4px 0 0; color: #aeb8ca; font-size: 14px; line-height: 1.4; }

.study-session-type {
  --study-selector-accent: var(--study-accent);
  --study-selector-accent-rgb: var(--study-accent-rgb);
  position: relative;
  width: 190px;
  color: #ddd6fe;
}

.study-session-type--teoria {
  --study-selector-accent: #22c55e;
  --study-selector-accent-rgb: 34, 197, 94;
}

.study-session-type--simulado {
  --study-selector-accent: #facc15;
  --study-selector-accent-rgb: 250, 204, 21;
}

.study-session-type-trigger {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr) 16px;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(var(--study-selector-accent-rgb), 0.68);
  border-radius: 9px;
  background: rgba(var(--study-selector-accent-rgb), 0.15);
  box-shadow: inset 0 0 18px rgba(var(--study-selector-accent-rgb), 0.08);
  color: inherit;
  font-size: 16px;
  font-weight: 450;
  text-align: left;
  cursor: pointer;
}
.study-session-type-trigger:hover,
.study-session-type[data-expanded="true"] .study-session-type-trigger {
  border-color: rgba(var(--study-selector-accent-rgb), 0.9);
  background: rgba(var(--study-selector-accent-rgb), 0.2);
}
.study-session-type-trigger:focus-visible {
  outline: 2px solid rgba(var(--study-selector-accent-rgb), 0.4);
  outline-offset: 2px;
}
.study-session-type-trigger:disabled { cursor: default; opacity: 1; }
.study-session-type-icon { display: grid; width: 23px; height: 23px; place-items: center; }
.study-session-type-icon svg { width: 23px; height: 23px; }
.study-session-type-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-session-type-chevron { display: grid; width: 16px; height: 22px; place-items: center; justify-self: end; color: var(--study-selector-accent); pointer-events: none; }
.study-session-type-chevron svg { width: 18px; height: 18px; }
.study-session-type-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  display: grid;
  gap: 3px;
  padding: 5px;
  border: 1px solid rgba(var(--study-selector-accent-rgb), 0.52);
  border-radius: 9px;
  background: #090d1b;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48), 0 0 22px rgba(var(--study-selector-accent-rgb), 0.12);
}
.study-session-type-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 450;
  text-align: left;
  cursor: pointer;
}
.study-session-type-option[data-study-type="teoria"] { --study-option-accent: #22c55e; }
.study-session-type-option[data-study-type="revisao"] { --study-option-accent: #3b82f6; }
.study-session-type-option[data-study-type="questoes"] { --study-option-accent: #e247c8; }
.study-session-type-option[data-study-type="simulado"] { --study-option-accent: #facc15; }
.study-session-type-option:hover,
.study-session-type-option:focus-visible,
.study-session-type-option.is-selected {
  background: color-mix(in srgb, var(--study-option-accent), transparent 86%);
  color: #f8fafc;
}
.study-session-type-option:focus-visible { outline: 1px solid color-mix(in srgb, var(--study-option-accent), transparent 38%); }
.study-session-type-option-icon,
.study-session-type-option-check { display: grid; place-items: center; }
.study-session-type-option-icon svg { width: 20px; height: 20px; color: var(--study-option-accent); }
.study-session-type-option-check svg { width: 16px; height: 16px; color: var(--study-option-accent); }

.study-session-close {
  display: grid;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 9px;
  background: rgba(7, 10, 19, 0.54);
  color: #f8fafc;
  font-size: 31px;
  font-weight: 250;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.study-session-close:hover,
.study-session-close:focus-visible { border-color: rgba(var(--study-accent-rgb), 0.64); color: var(--study-accent); box-shadow: 0 0 18px rgba(var(--study-accent-rgb), 0.18); }

.study-session-body {
  display: grid;
  /* Rows never shrink below their content: the body scrolls instead. Without this, sections with min-height: 0
     (the subject block on phones) were squeezed to a few px and their content overflowed onto the next section. */
  grid-auto-rows: max-content;
  min-height: 0;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 25px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.5) transparent;
}

.study-session-time-card {
  position: relative;
  display: grid;
  min-height: 160px;
  place-items: center;
  align-content: center;
  overflow: hidden;
  border: 1px solid rgba(var(--study-accent-rgb), 0.72);
  border-radius: 9px;
  background:
    radial-gradient(ellipse at 50% 105%, rgba(var(--study-accent-rgb), 0.34), transparent 56%),
    radial-gradient(circle at 20% 20%, rgba(var(--study-accent-rgb), 0.12) 0 1px, transparent 1.5px),
    linear-gradient(160deg, rgba(24, 10, 58, 0.74), rgba(7, 10, 19, 0.92));
  background-size: auto, 42px 42px, auto;
  box-shadow: inset 0 0 28px rgba(var(--study-accent-rgb), 0.13), 0 0 20px rgba(var(--study-accent-rgb), 0.15);
}
.study-session-time-card::after {
  content: "";
  position: absolute;
  inset: auto 3% -82% 3%;
  height: 118%;
  border: 1px solid rgba(var(--study-accent-rgb), 0.22);
  border-radius: 50%;
  box-shadow: 0 -12px 40px rgba(var(--study-accent-rgb), 0.12);
  pointer-events: none;
}
.study-session-time-icon { z-index: 1; display: grid; width: 28px; height: 28px; place-items: center; color: var(--study-accent); }
.study-session-time-icon svg { width: 28px; height: 28px; }
.study-session-time-card > small { z-index: 1; margin-top: 4px; color: #d2d7e2; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; }
.study-session-time-card > strong { z-index: 1; margin-top: 3px; color: #fff; font-size: clamp(40px, 4.5vw, 51px); font-weight: 430; line-height: 1.05; letter-spacing: 0; }
.study-session-time-card > button { z-index: 1; display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 7px; border: 0; background: transparent; color: #c084fc; font-size: 14px; cursor: pointer; }
.study-session-time-card > button svg { width: 17px; height: 17px; }
.study-session-time-editor { z-index: 2; display: grid; gap: 4px; width: min(220px, 80%); text-align: center; }
.study-session-time-editor span { color: #aeb8ca; font-size: 10px; }
.study-session-time-editor input { min-height: 38px; text-align: center; font-size: 19px; }
.study-session-time-card.is-editing > .study-session-time-icon,
.study-session-time-card.is-editing > small,
.study-session-time-card.is-editing > strong,
.study-session-time-card.is-editing > button { display: none; }
.study-session-time-card.is-editing .study-session-time-editor { display: grid; }

.study-session-date { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.study-session-date-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.study-session-date button,
.study-session-date-input {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 9px;
  background: rgba(7, 10, 19, 0.52);
  color: #cbd5e1;
  font-size: 14px;
}
.study-session-date button { cursor: pointer; }
.study-session-date button svg,
.study-session-date-input svg { width: 20px; height: 20px; }
.study-session-date button.active { border-color: rgba(139, 92, 246, 0.75); background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; box-shadow: 0 0 18px rgba(139, 92, 246, 0.2); }
.study-session-date-input { width: 218px; padding: 0 12px; }
.study-session-date-input:not(.active) { display: none; }
.study-session-date-input input { width: 100%; min-height: 44px; padding: 0; border: 0; background: transparent; color: #cbd5e1; font-size: 14px; }

.study-session-subject {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  min-height: 115px;
  padding: 12px 14px;
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: 9px;
  background: rgba(7, 10, 19, 0.38);
}
.study-session-subject-icon,
.study-session-section-icon {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.4), rgba(76, 29, 149, 0.26));
  color: #c4b5fd;
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.14);
}
.study-session-subject-icon { align-self: center; width: 76px; height: 76px; }
.study-session-subject-icon svg { width: 44px; height: 44px; }
.study-session-subject.is-searching { position: relative; z-index: 4; }
.study-session-subject-search { position: relative; z-index: 1; display: grid; align-content: center; gap: 8px; min-width: 0; isolation: isolate; }
.study-session-search-field { display: grid; grid-template-columns: 25px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 46px; padding: 0 12px; border: 1px solid rgba(139, 92, 246, 0.22); border-radius: 8px; background: rgba(4, 8, 18, 0.56); color: #94a3b8; }
.study-session-search-field:focus-within { border-color: rgba(139, 92, 246, 0.62); box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.09); }
.study-session-search-field svg { width: 22px; height: 22px; }
.study-session-search-field input { min-width: 0; min-height: 44px; padding: 0; border: 0; outline: 0; background: transparent; color: #f8fafc; font-size: 14px; }
.study-session-search-field input:disabled { opacity: .45; }

/* O contorno de foco pertence ao wrapper, não aos controles internos. */
.study-session-drawer .study-session-date-input input:focus,
.study-session-drawer .study-session-date-input input:focus-visible,
.study-session-drawer .study-session-search-field input:focus,
.study-session-drawer .study-session-search-field input:focus-visible {
  border: 0;
  outline: 0;
  box-shadow: none;
}

.study-session-search-results { position: absolute; z-index: 12; right: 0; left: 0; max-height: 220px; overflow-y: auto; padding: 6px; border: 1px solid rgba(139, 92, 246, .34); border-radius: 9px; background: #090d1b; box-shadow: 0 18px 42px rgba(0,0,0,.48); }
.study-session-search-results[data-study-discipline-results] { top: calc(50% + 4px); }
.study-session-search-results[data-study-content-results] { top: calc(100% + 5px); }
.study-session-search-results button { display: grid; width: 100%; gap: 2px; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: #f8fafc; text-align: left; cursor: pointer; }
.study-session-search-results button:hover,
.study-session-search-results button:focus-visible { background: rgba(139, 92, 246, .14); }
.study-session-search-results button span { color: #94a3b8; font-size: 11px; }
.study-session-search-empty { padding: 10px; color: #94a3b8; font-size: 12px; }

.study-session-subject-selected { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; min-width: 0; }
.study-session-subject.is-searching .study-session-subject-selected { display: none; }
.study-session-subject.is-selected .study-session-subject-search { display: none; }
.study-session-subject-copy { min-width: 0; }
.study-session-subject-copy strong { display: block; overflow: hidden; color: #f8fafc; font-size: 20px; font-weight: 480; text-overflow: ellipsis; white-space: nowrap; }
.study-session-subject-copy span {
  display: -webkit-box;
  min-height: 2.8em; /* reserva sempre duas linhas */
  margin-top: 8px;
  overflow: hidden;
  color: #b7c0d0;
  font-size: 14.5px;
  font-weight: 480;
  line-height: 1.4;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.study-session-subject-actions { display: grid; justify-items: end; gap: 8px; }
.study-session-theory-done { display: flex; align-items: center; gap: 7px; color: #d7ddea; font-size: 14px; cursor: pointer; }
.study-session-theory-done input,
.study-session-check input,
.study-session-review-options input,
.study-session-mood-options input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.study-session-theory-done i,
.study-session-check i,
.study-session-review-options i { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid rgba(139, 92, 246, .36); border-radius: 5px; background: rgba(7,10,19,.68); color: transparent; }
.study-session-theory-done input:checked + i,
.study-session-check input:checked + i,
.study-session-review-options input:checked + i { border-color: #8b5cf6; background: linear-gradient(145deg, #8b5cf6, #6d28d9); color: #fff; box-shadow: 0 0 12px rgba(139,92,246,.3); }
.study-session-theory-done i svg,
.study-session-check i svg,
.study-session-review-options i svg { width: 16px; height: 16px; }
.study-session-change-subject { display: inline-flex; min-height: 39px; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid rgba(139,92,246,.56); border-radius: 7px; background: rgba(7,10,19,.5); color: #d8b4fe; font-size: 14px; cursor: pointer; }
.study-session-change-subject svg { width: 16px; height: 16px; }

.study-session-section { border: 1px solid rgba(139, 92, 246, 0.18); border-radius: 9px; background: rgba(7, 10, 19, 0.38); }
.study-session-section h3 { margin: 0; color: #dce3ef; font-size: 12px; font-weight: 450; letter-spacing: .02em; text-transform: uppercase; }
.study-session-questions { padding: 10px 14px 12px; }
.study-session-question-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 6px; }
.study-session-question-grid label > span { display: flex; align-items: center; gap: 7px; color: #cbd5e1; font-size: 14px; }
.study-session-question-grid label > span svg { width: 22px; height: 22px; color: #c084fc; }
.study-session-question-grid input { width: 100%; min-height: 44px; margin-top: 4px; text-align: center; font-size: 18px; }
.study-session-question-result { min-height: 0; margin: 5px 0 0; color: #94a3b8; font-size: 11px; text-align: center; }
.study-session-question-result.invalid { color: #fb7185; }

.study-session-reviews { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; padding: 9px 13px; }
.study-session-review-main { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.study-session-review-main > svg { width: 33px; height: 33px; padding: 6px; border-radius: 50%; background: rgba(124,58,237,.28); color: #c4b5fd; }
.study-session-review-main > strong { font-size: 15px; font-weight: 480; }
.study-session-check { position: relative; cursor: pointer; }
.study-session-review-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
/* A cycle turned off in Configurações: visibly inert, with a line saying why (spans both grid columns). */
.study-session-review-options label.is-disabled { opacity: .45; cursor: not-allowed; }
.study-session-review-options label.is-disabled input { cursor: not-allowed; }
.study-session-review-hint { grid-column: 1 / -1; margin: 0; color: #94a3b8; font-size: 11px; line-height: 1.4; }
.study-session-review-options label { position: relative; display: flex; min-height: 44px; align-items: center; justify-content: center; gap: 7px; border: 1px solid rgba(139,92,246,.22); border-radius: 7px; color: #cbd5e1; font-size: 14px; cursor: pointer; }

.study-session-mood,
.study-session-notes { display: grid; grid-template-columns: 55px minmax(0, 1fr); align-items: center; gap: 12px; padding: 9px 13px; }
.study-session-section-icon { width: 44px; height: 44px; }
.study-session-section-icon svg { width: 25px; height: 25px; }
.study-session-mood h3 { margin-bottom: 5px; font-size: 14px; font-weight: 440; text-transform: none; }
.study-session-mood-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.study-session-mood-options label { position: relative; display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgba(100,116,139,.4); border-radius: 50%; color: #f43f5e; cursor: pointer; transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.study-session-mood-options label:nth-child(2) { color: #f97316; }
.study-session-mood-options label:nth-child(3) { color: #facc15; }
.study-session-mood-options label:nth-child(4) { color: #a3e635; }
.study-session-mood-options label:nth-child(5) { color: #14b8a6; }
.study-session-mood-options label:hover { transform: translateY(-2px); }
.study-session-mood-options label:has(input:checked) { border-color: #a855f7; box-shadow: 0 0 0 3px rgba(139,92,246,.13), 0 0 22px rgba(139,92,246,.38); transform: scale(1.05); }
.study-session-mood-options i { display: grid; width: 29px; height: 29px; place-items: center; }
.study-session-mood-options svg { width: 29px; height: 29px; }
.study-session-notes label { min-width: 0; }
.study-session-notes label > span { display: block; margin-bottom: 5px; color: #eef2f8; font-size: 14px; }
.study-session-notes label small { color: #7f8aa0; font-weight: 350; }
.study-session-notes textarea { width: 100%; min-height: 51px; resize: vertical; font-size: 14px; }

.study-session-footer { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(230px, 1fr); gap: 12px; padding: 10px 25px 14px; background: linear-gradient(180deg, rgba(5,8,17,.4), rgba(5,8,17,.97)); }
.study-session-footer button { min-height: 48px; border-radius: 8px; font-size: 16px; font-weight: 450; transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease; }
.study-session-footer .primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(100deg, #7c3aed, #6d28d9 60%, #a21caf); box-shadow: 0 0 22px rgba(139,92,246,.22); }
.study-session-footer .primary svg { width: 21px; height: 21px; }
.study-session-footer .ghost:hover,
.study-session-footer .ghost:focus-visible { border-color: rgba(139, 92, 246, 0.5); background: rgba(139, 92, 246, 0.1); color: #f8fafc; transform: translateY(-1px); }
.study-session-footer .primary:hover,
.study-session-footer .primary:focus-visible { box-shadow: 0 0 28px rgba(139, 92, 246, 0.34); filter: brightness(1.07); transform: translateY(-1px); }
.study-session-footer button:active { transform: translateY(0); }

.study-session-drawer--revisao [data-study-theory-done],
.study-session-drawer--questoes [data-study-theory-done],
.study-session-drawer--simulado [data-study-theory-done] { display: none; }

/* Editing a review log has no reviews to create. Editing a theory log must show them: the save path reconciles the
   pending reviews with these checkboxes (unchecked pending ones are dropped, missing ones are created, done ones stay).
   Correção (2026-10-02, achado do dono): a regra vale só enquanto o registro editado continua revisão; trocado para
   teoria no próprio drawer, as opções de revisão voltam, como em qualquer teoria. */
.study-session-drawer--revisao[data-study-context="edit-review"] .study-session-reviews { display: none; }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@keyframes study-session-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes study-session-drawer-in { from { opacity: 0; transform: translateY(20px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes study-session-subject-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.study-session-subject.is-selected .study-session-subject-selected,
.study-session-subject.is-searching .study-session-subject-search { animation: study-session-subject-in 220ms ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .study-session-backdrop,
  .study-session-drawer,
  .study-session-subject.is-selected .study-session-subject-selected,
  .study-session-subject.is-searching .study-session-subject-search { animation: none !important; }
}

@media (max-width: 760px) {
  .study-session-backdrop { padding: 8px; }
  .study-session-drawer { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .study-session-header { grid-template-columns: 46px minmax(0, 1fr) 42px; gap: 10px; padding: 20px 16px 14px; }
  .study-session-heading-icon { width: 44px; height: 44px; }
  .study-session-heading-icon svg { width: 25px; height: 25px; }
  .study-session-heading h2 { font-size: 20px; }
  .study-session-heading p { font-size: 12px; }
  .study-session-type { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-self: stretch; }
  .study-session-close { grid-column: 3; grid-row: 1; width: 42px; height: 42px; }
  .study-session-body { padding: 0 16px 12px; }
  .study-session-time-card { min-height: 170px; }
  .study-session-date { grid-template-columns: 1fr; }
  .study-session-date-input { width: 100%; }
  .study-session-subject { grid-template-columns: 1fr; min-height: 0; }
  .study-session-subject-icon { width: 76px; height: 76px; justify-self: center; }
  .study-session-subject-icon svg { width: 48px; height: 48px; }
  .study-session-subject-selected { grid-template-columns: 1fr; text-align: center; }
  .study-session-subject-actions { justify-items: center; }
  .study-session-question-grid { gap: 10px; }
  .study-session-reviews { grid-template-columns: 1fr; }
  .study-session-review-main { justify-content: center; }
  .study-session-mood,
  .study-session-notes { grid-template-columns: 1fr; }
  .study-session-section-icon { display: none; }
  .study-session-mood-options { gap: 8px; }
  .study-session-mood-options label { width: 44px; height: 44px; }
  .study-session-footer { grid-template-columns: 1fr 1.4fr; padding: 10px 16px 14px; }
}

/* ==========================================================================
   Tema claro — Drawer de sessão (registrar / editar estudo)
   Escopado em html[data-theme="light"]; o tema escuro não é afetado. Só cor, via tokens de design-system.css.
   O acento por tipo (--study-accent-rgb) continua valendo nos dois temas.
   ========================================================================== */
html[data-theme="light"] .study-session-backdrop { background: var(--drawer-backdrop); }
html[data-theme="light"] .study-session-drawer {
  border-color: rgba(var(--study-accent-rgb), 0.42);
  background:
    radial-gradient(circle at 24% 0%, rgba(var(--study-accent-rgb), 0.08), transparent 34%),
    linear-gradient(155deg, var(--drawer-1), var(--drawer-2));
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(var(--study-accent-rgb), 0.06), 0 30px 80px rgba(57, 44, 89, 0.26);
}
html[data-theme="light"] .study-session-header::before { box-shadow: none; }
html[data-theme="light"] .study-session-heading-icon {
  color: rgb(var(--study-accent-rgb));
  background: rgba(var(--study-accent-rgb), 0.12);
  box-shadow: inset 0 0 14px rgba(var(--study-accent-rgb), 0.1);
}
html[data-theme="light"] .study-session-heading p,
html[data-theme="light"] .study-session-time-editor span,
html[data-theme="light"] .study-session-subject-copy span,
html[data-theme="light"] .study-session-search-results button span,
html[data-theme="light"] .study-session-search-empty,
html[data-theme="light"] .study-session-question-result,
html[data-theme="light"] .study-session-notes label small { color: var(--muted); }
html[data-theme="light"] .study-session-type { color: var(--ink); }
html[data-theme="light"] .study-session-type-trigger { background: rgba(var(--study-selector-accent-rgb), 0.12); box-shadow: none; }
html[data-theme="light"] .study-session-type-menu { background: var(--panel); box-shadow: 0 18px 38px rgba(57, 44, 89, 0.2); }
html[data-theme="light"] .study-session-type-option { color: var(--text-secondary); }
html[data-theme="light"] .study-session-type-option:hover,
html[data-theme="light"] .study-session-type-option:focus-visible,
html[data-theme="light"] .study-session-type-option.is-selected { color: var(--ink); }
html[data-theme="light"] .study-session-close { border-color: var(--card-border); background: var(--surface-soft); color: var(--ink); }
html[data-theme="light"] .study-session-close:hover,
html[data-theme="light"] .study-session-close:focus-visible { box-shadow: none; }

/* Cartão de tempo */
html[data-theme="light"] .study-session-time-card {
  border-color: rgba(var(--study-accent-rgb), 0.5);
  background:
    radial-gradient(ellipse at 50% 108%, rgba(var(--study-accent-rgb), 0.2), transparent 58%),
    linear-gradient(145deg, var(--card-1), rgba(var(--study-accent-rgb), 0.06));
  box-shadow: inset 0 0 22px rgba(var(--study-accent-rgb), 0.06), 0 8px 22px rgba(var(--study-accent-rgb), 0.12);
}
html[data-theme="light"] .study-session-time-card::after { border-color: rgba(var(--study-accent-rgb), 0.16); box-shadow: none; }
html[data-theme="light"] .study-session-time-card > small { color: var(--muted); }
html[data-theme="light"] .study-session-time-card > strong { color: var(--ink); }
html[data-theme="light"] .study-session-time-card > button { color: var(--primary); }

/* Data, assunto, busca e seções */
html[data-theme="light"] .study-session-date button,
html[data-theme="light"] .study-session-date-input { border-color: var(--card-border); background: var(--surface-soft); color: var(--text-secondary); }
html[data-theme="light"] .study-session-date button.active { border-color: rgba(124, 58, 237, 0.75); background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; box-shadow: 0 6px 16px rgba(124, 58, 237, 0.24); }
html[data-theme="light"] .study-session-date-input input { color: var(--ink); }
html[data-theme="light"] .study-session-subject,
html[data-theme="light"] .study-session-section { border-color: var(--card-border); background: var(--surface-soft); }
html[data-theme="light"] .study-session-subject-icon,
html[data-theme="light"] .study-session-section-icon { background: var(--primary-2); color: var(--primary); box-shadow: none; }
html[data-theme="light"] .study-session-subject-copy strong,
html[data-theme="light"] .study-session-search-field input,
html[data-theme="light"] .study-session-search-results button { color: var(--ink); }
html[data-theme="light"] .study-session-section h3,
html[data-theme="light"] .study-session-notes label > span { color: var(--ink); }
html[data-theme="light"] .study-session-search-field { border-color: var(--input-border); background: var(--input-bg); color: var(--muted); }
html[data-theme="light"] .study-session-search-field:focus-within { border-color: rgba(124, 58, 237, 0.6); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12); }
html[data-theme="light"] .study-session-search-results { border-color: var(--card-border); background: var(--panel); box-shadow: 0 18px 38px rgba(57, 44, 89, 0.2); }
html[data-theme="light"] .study-session-search-results button:hover,
html[data-theme="light"] .study-session-search-results button:focus-visible { background: var(--primary-2); }
html[data-theme="light"] .study-session-theory-done,
html[data-theme="light"] .study-session-question-grid label > span,
html[data-theme="light"] .study-session-review-options label { color: var(--text-secondary); }
html[data-theme="light"] .study-session-theory-done i,
html[data-theme="light"] .study-session-check i,
html[data-theme="light"] .study-session-review-options i { border-color: rgba(124, 58, 237, 0.4); background: var(--input-bg); }
html[data-theme="light"] .study-session-change-subject { border-color: rgba(124, 58, 237, 0.5); background: var(--surface-soft); color: var(--primary); }
html[data-theme="light"] .study-session-question-grid label > span svg { color: var(--primary); }
html[data-theme="light"] .study-session-question-result.invalid { color: var(--danger); }
html[data-theme="light"] .study-session-review-main > svg { background: var(--primary-2); color: var(--primary); }
html[data-theme="light"] .study-session-review-options label { border-color: var(--card-border); }
html[data-theme="light"] .study-session-mood-options label { border-color: rgba(57, 44, 89, 0.24); }
html[data-theme="light"] .study-session-mood-options label:has(input:checked) { border-color: rgba(124, 58, 237, 0.8); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14); }
html[data-theme="light"] .study-session-footer { background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), var(--drawer-footer-bg)); }
html[data-theme="light"] .study-session-footer .primary { box-shadow: 0 8px 20px rgba(124, 58, 237, 0.26); }
html[data-theme="light"] .study-session-footer .ghost:hover,
html[data-theme="light"] .study-session-footer .ghost:focus-visible { border-color: rgba(124, 58, 237, 0.5); background: var(--primary-2); color: var(--primary); }
html[data-theme="light"] .study-session-footer .primary:hover,
html[data-theme="light"] .study-session-footer .primary:focus-visible { box-shadow: 0 10px 24px rgba(124, 58, 237, 0.34); }

/* Saving feedback: a spinner in the button while the save and re-render run. A faixa que percorria o topo do drawer
   saiu (pedido do dono em 2026-10-02): parecia defeito e repetia o "Salvando…" do botão. */
.study-session-drawer.is-saving { position: relative; }
.study-session-drawer.is-saving > :not(.study-session-footer) { pointer-events: none; }
.study-session-footer .primary:disabled { cursor: progress; opacity: 1; filter: none; transform: none; }
.study-session-saving-spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.28); border-top-color: #fff; border-radius: 50%;
  animation: study-session-saving-spin 640ms linear infinite;
}
@keyframes study-session-saving-spin { to { transform: rotate(360deg); } }

/* Success hand-off: the bar completes and turns green, the button resolves into a drawn checkmark with a soft
   ring pulse, then the drawer settles away — the moment the student's data lands gets its own small celebration
   before the confirmation continues in the status toast (renderStatus's notice-rich). */
.study-session-drawer.is-saved { position: relative; }
.study-session-drawer.is-saved::before {
  content: ""; position: absolute; top: 0; left: 0; z-index: 3; height: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #22c55e, #4ade80); box-shadow: 0 0 14px rgba(74, 222, 128, .6);
  animation: study-session-saved-bar 620ms ease both;
}
.study-session-drawer.is-saved { box-shadow: 0 0 0 1px rgba(74, 222, 128, .32), 0 0 40px rgba(74, 222, 128, .16), 0 30px 90px rgba(0, 0, 0, .58); transition: box-shadow 260ms ease; }
.study-session-footer .primary.is-saved-state { background: linear-gradient(100deg, #16a34a, #15803d 60%, #059669); box-shadow: 0 0 22px rgba(34, 197, 94, .3); }
.study-session-footer .primary.is-saved-state:disabled { cursor: default; opacity: 1; filter: none; }
.study-session-success-check { position: relative; display: inline-grid; place-items: center; width: 20px; height: 20px; }
.study-session-success-check svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.study-session-success-check svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: study-session-check-draw 320ms 60ms cubic-bezier(.65, 0, .35, 1) forwards; }
.study-session-success-check::after {
  content: ""; position: absolute; inset: -9px; border: 1.5px solid rgba(74, 222, 128, .65); border-radius: 50%;
  animation: study-session-check-ring 560ms ease-out 60ms both;
}
.study-session-backdrop--closing { animation: study-session-backdrop-out 200ms ease-in both; }
.study-session-drawer--closing { animation: study-session-drawer-out 210ms cubic-bezier(.4, 0, 1, 1) both; pointer-events: none; }
@keyframes study-session-saved-bar { from { width: 0; } to { width: 100%; } }
@keyframes study-session-check-draw { to { stroke-dashoffset: 0; } }
@keyframes study-session-check-ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.55); opacity: 0; } }
@keyframes study-session-backdrop-out { to { opacity: 0; } }
@keyframes study-session-drawer-out { to { opacity: 0; transform: translateY(-10px) scale(.97); } }
@media (prefers-reduced-motion: reduce) {
  .study-session-saving-spinner { animation-duration: 1.6s; }
  .study-session-drawer.is-saved::before { width: 100%; animation: none; }
  .study-session-success-check svg path { animation: none; stroke-dashoffset: 0; }
  .study-session-success-check::after { animation: none; opacity: 0; }
  .study-session-backdrop--closing, .study-session-drawer--closing { animation: none; opacity: 0; }
}

/* Categorias personalizadas de sessão (work/custom-session-categories-mvp-spec-2026-09-27.md). */
.study-session-type-separator { height: 1px; margin: 3px 4px; background: rgba(148, 163, 184, 0.18); }
.study-session-type-option--new { --study-option-accent: #94a3b8; }
html[data-theme="light"] .study-session-type-separator { background: rgba(15, 23, 42, 0.1); }

/* Mini drawer de criar/editar categoria: empilha sobre o drawer de sessão (ou aparece sozinho, a partir de
   Configurações). Reaproveita .modal-backdrop/.modal (styles.css) como base pro visual (cartão, borda, sombra),
   mas precisa VENCER o z-index genérico — e não só o de .modal-backdrop (uma classe, especificidade 0,1,0):
   quando o drawer pai foi aberto com `document.body.classList.add("focus-registering")` (ex.: openFreeStudyModal),
   `body.focus-registering .modal-backdrop { z-index: 45; }` (styles.css) empata em especificidade (0,2,0) com um
   seletor de duas classes, e como styles.css carrega depois deste arquivo, essa regra vencia o empate — medido no
   navegador: mini drawer em z-index 45 atrás do drawer de sessão (128), parecendo que o clique não fazia nada.
   `!important` evita depender de future novas regras de estado do body com a mesma especificidade. */
.study-session-new-category-backdrop { z-index: calc(var(--z-drawer) + 16) !important; }
.modal.study-session-new-category-modal { width: min(380px, 100%); display: grid; gap: 12px; }
.study-session-new-category-modal h2 { margin: 0; font-size: 17px; }
.free-category-field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.free-category-field input[type="text"],
.free-category-field select { padding: 9px 11px; border-radius: 8px; border: 1px solid var(--card-border); background: var(--surface-soft); color: var(--ink); font-size: 14px; }
.free-category-error { margin: 0; color: #f87171; font-size: 13px; }
.free-category-locked-type { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-soft); color: var(--ink); }
.free-category-locked-type svg { width: 18px; height: 18px; }
