/* =======================================================
   AT Revision Planner — App Styles
   ======================================================= */

/* -------------------------------------------------------
   Design Tokens
------------------------------------------------------- */
#at-rp-root.at-rp-wrapper {
  --rp-primary:        #4f46e5;
  --rp-primary-hover:  #4338ca;
  --rp-primary-light:  #eef2ff;
  --rp-danger:         #ef4444;
  --rp-danger-light:   #fef2f2;
  --rp-success:        #10b981;
  --rp-warn:           #f59e0b;
  --rp-bg:             #f8fafc;
  --rp-surface:        #ffffff;
  --rp-border:         #e2e8f0;
  --rp-border-strong:  #cbd5e1;
  --rp-text:           #1e293b;
  --rp-text-muted:     #64748b;
  --rp-text-xmuted:    #94a3b8;
  --rp-radius:         8px;
  --rp-radius-lg:      12px;
  --rp-shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --rp-shadow-lg:      0 8px 30px rgba(0,0,0,.12);
  --rp-font:           -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --rp-header-h:       60px;
  --rp-btn-h:          38px;
  --rp-btn-h-sm:       30px;
  --rp-btn-h-lg:       46px;
  --rp-btn-min-w:      0;
  --rp-control-h:      38px;
  --rp-control-h-sm:   30px;
  --rp-tab-h:          38px;
  --rp-icon-btn-h:     32px;
  --rp-cal-add-h:      24px;
}

/* -------------------------------------------------------
   Reset / Base inside root
------------------------------------------------------- */
#at-rp-root.at-rp-wrapper *,
#at-rp-root.at-rp-wrapper *::before,
#at-rp-root.at-rp-wrapper *::after {
  box-sizing: border-box;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope {
  isolation: isolate;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope :where(button, input, select, textarea) {
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope :where(.at-rp-btn, .at-rp-icon-btn, .at-rp-session__btn, .at-rp-break__btn, .at-rp-cal-add) {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope .at-rp-action-btn {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.2;
}

.at-rp {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--rp-bg);
  font-family: var(--rp-font);
  font-size: 15px;
  color: var(--rp-text);
  line-height: 1.5;
}

/* -------------------------------------------------------
   Header & Navigation
------------------------------------------------------- */
.at-rp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--rp-surface);
  border-bottom: 1px solid var(--rp-border);
  box-shadow: var(--rp-shadow);
  height: var(--rp-header-h);
}

.at-rp-header__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
}

.at-rp-header__logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--rp-primary);
  white-space: nowrap;
  margin-right: 8px;
}

.at-rp-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
}

.at-rp-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--rp-radius);
  background: transparent;
  color: var(--rp-text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope .at-rp-tab {
  display: inline-flex;
  margin: 0;
  min-width: 0;
  min-inline-size: 0;
  width: auto;
  height: auto;
  border: none;
  border-radius: var(--rp-radius);
  box-shadow: none;
  font-family: var(--rp-font);
  font-weight: 500;
  min-height: var(--rp-tab-h);
  line-height: 1.2;
  padding: 8px 14px;
  font-size: 14px;
}

.at-rp-tab:hover {
  background: var(--rp-primary-light);
  color: var(--rp-primary);
}

.at-rp-tab.at-rp-is-active {
  background: var(--rp-primary-light);
  color: var(--rp-primary);
  font-weight: 600;
}

.at-rp-tab__icon { font-size: 16px; }

.at-rp-header__user {
  font-size: 13px;
  color: var(--rp-text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.at-rp-header__user--guest { font-style: italic; }

/* -------------------------------------------------------
   Main content
------------------------------------------------------- */
.at-rp__main {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* -------------------------------------------------------
   View scaffold
------------------------------------------------------- */
.at-rp-view__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.at-rp-view__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--rp-text);
  margin: 0 0 4px;
}

.at-rp-view__subtitle {
  font-size: 14px;
  color: var(--rp-text-muted);
  margin: 0;
}

/* -------------------------------------------------------
   Buttons
------------------------------------------------------- */
.at-rp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--rp-border-strong);
  border-radius: var(--rp-radius);
  background: var(--rp-surface);
  color: var(--rp-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
  text-decoration: none;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope .at-rp-btn {
  display: inline-flex;
  margin: 0;
  min-height: var(--rp-btn-h);
  min-width: var(--rp-btn-min-w);
  min-inline-size: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  border: 1px solid var(--rp-border-strong);
  border-radius: var(--rp-radius);
  box-shadow: none;
  font-family: var(--rp-font);
  font-weight: 500;
  line-height: 1.2;
  padding: 9px 18px;
  font-size: 14px;
}

.at-rp-btn:hover {
  background: var(--rp-bg);
  color: var(--rp-text);
}

#at-rp-root .at-rp-btn:hover { color: var(--rp-text); }

.at-rp-btn--primary {
  background: var(--rp-primary);
  border-color: var(--rp-primary);
  color: #fff;
}

.at-rp-btn--primary:hover {
  background: var(--rp-primary-hover);
  border-color: var(--rp-primary-hover);
  color: #fff;
}

#at-rp-root .at-rp-btn--primary:hover { color: #fff; }

.at-rp-btn--outline {
  background: transparent;
  border-color: var(--rp-primary);
  color: var(--rp-primary);
}

.at-rp-btn--outline:hover {
  background: var(--rp-primary-light);
  color: var(--rp-primary);
}

#at-rp-root .at-rp-btn--outline:hover { color: var(--rp-primary); }

.at-rp-btn--danger {
  background: var(--rp-danger);
  border-color: var(--rp-danger);
  color: #fff;
}

.at-rp-btn--danger:hover {
  background: var(--rp-danger);
  opacity: 0.85;
  color: #fff;
}

#at-rp-root .at-rp-btn--danger:hover { color: #fff; }

.at-rp-btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope .at-rp-btn.at-rp-btn--sm {
  min-height: var(--rp-btn-h-sm);
  min-width: var(--rp-btn-min-w);
  min-inline-size: 0;
  width: auto;
  height: auto;
  padding: 6px 12px;
  font-size: 13px;
}

.at-rp-btn--lg {
  padding: 12px 28px;
  font-size: 16px;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope .at-rp-btn.at-rp-btn--lg {
  min-height: var(--rp-btn-h-lg);
  min-width: var(--rp-btn-min-w);
  min-inline-size: 0;
  width: auto;
  height: auto;
  padding: 12px 28px;
  font-size: 16px;
}

.at-rp-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.at-rp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
  background: transparent;
  color: var(--rp-text);
  cursor: pointer;
  font-size: 14px;
  transition: background .15s, border-color .15s, color .15s;
  padding: 0;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope .at-rp-icon-btn {
  width: var(--rp-icon-btn-h);
  height: var(--rp-icon-btn-h);
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
  box-shadow: none;
  font-family: var(--rp-font);
  min-height: var(--rp-icon-btn-h);
  line-height: 1;
  font-size: 14px;
}

.at-rp-icon-btn:hover {
  background: var(--rp-bg);
  border-color: var(--rp-border-strong);
  color: var(--rp-text);
}

.at-rp-icon-btn--danger {
  color: #dc2626;
  border-color: #fecaca;
}

.at-rp-icon-btn--danger:hover {
  background: var(--rp-danger-light);
  border-color: #fca5a5;
  color: #b91c1c;
}

.at-rp-icon-btn .at-rp-icon-svg {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}

.at-rp-icon-btn .at-rp-icon-svg--trash {
  width: 12px;
  height: 12px;
}

.at-rp-icon-btn .at-rp-icon-svg--edit {
  width: 12px;
  height: 12px;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope :where(.at-rp-icon-btn, .at-rp-session__btn, .at-rp-break__btn, .at-rp-avail__del) img.emoji {
  width: 1em;
  height: 1em;
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  border: 0;
  box-shadow: none;
  vertical-align: middle;
}

.at-rp-link {
  background: none;
  border: none;
  color: var(--rp-primary);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  min-width: 0;
  min-inline-size: 0;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
}

.at-rp-link:hover { color: var(--rp-primary-hover); }

/* -------------------------------------------------------
   Form elements
------------------------------------------------------- */
.at-rp-field { display: flex; flex-direction: column; gap: 6px; }
.at-rp-field-row { display: flex; gap: 12px; }
.at-rp-field-row .at-rp-field { flex: 1; }

.at-rp-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--rp-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.at-rp-input,
.at-rp-select {
  padding: 9px 12px;
  border: 1px solid var(--rp-border-strong);
  border-radius: var(--rp-radius);
  background: var(--rp-surface);
  font-size: 14px;
  color: var(--rp-text);
  font-family: var(--rp-font);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope :where(.at-rp-input, .at-rp-select) {
  min-height: var(--rp-control-h);
  line-height: 1.2;
  padding: 9px 12px;
  font-size: 14px;
}

.at-rp-input:focus,
.at-rp-select:focus {
  outline: none;
  border-color: var(--rp-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.at-rp-select--sm,
.at-rp-input--sm {
  padding: 6px 8px;
  font-size: 13px;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope :where(.at-rp-select--sm, .at-rp-input--sm) {
  min-height: var(--rp-control-h-sm);
  padding: 6px 8px;
  font-size: 13px;
}

.at-rp-textarea {
  resize: vertical;
  min-height: 72px;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope .at-rp-textarea {
  min-height: 72px;
  line-height: 1.4;
}

/* -------------------------------------------------------
   Badges & chips
------------------------------------------------------- */
.at-rp-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.at-rp-badge--high   { background: #fee2e2; color: #b91c1c; }
.at-rp-badge--medium { background: #fef9c3; color: #92400e; }
.at-rp-badge--low    { background: #dcfce7; color: #166534; }

.at-rp-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--rp-bg);
  border: 1px solid var(--rp-border);
  color: var(--rp-text-muted);
}

.at-rp-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* -------------------------------------------------------
   Empty state
------------------------------------------------------- */
.at-rp-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--rp-text-muted);
}

.at-rp-empty__icon {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

/* -------------------------------------------------------
   Notice
------------------------------------------------------- */
.at-rp-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--rp-primary-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--rp-radius);
  font-size: 14px;
  margin-bottom: 16px;
}

.at-rp-notice--warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.at-rp-help {
  font-size: 14px;
  color: var(--rp-text-muted);
  margin: 0 0 16px;
}

/* -------------------------------------------------------
   Toast
------------------------------------------------------- */
#at-rp-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.at-rp-toast {
  padding: 12px 20px;
  border-radius: var(--rp-radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--rp-shadow-lg);
  animation: at-rp-fadeUp .25s ease;
  max-width: 340px;
}

.at-rp-toast--success { background: #1e293b; color: #f8fafc; }
.at-rp-toast--error   { background: var(--rp-danger); color: #fff; }

.at-rp-toast__action {
  display: inline-block;
  margin-left: 12px;
  padding: 2px 10px;
  min-width: 0;
  min-inline-size: 0;
  width: auto;
  height: auto;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.at-rp-toast__action:hover { background: rgba(255,255,255,.3); }

@keyframes at-rp-fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------
   Loading / Spinner
------------------------------------------------------- */
.at-rp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.at-rp-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--rp-border);
  border-top-color: var(--rp-primary);
  border-radius: 50%;
  animation: at-rp-spin .7s linear infinite;
}

.at-rp-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
  color: var(--rp-text-muted);
  font-size: 14px;
}

@keyframes at-rp-spin {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------
   Modal / Overlay
------------------------------------------------------- */
.at-rp-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15,23,42,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: at-rp-fadeIn .15s ease;
}

@keyframes at-rp-fadeIn { from { opacity: 0; } to { opacity: 1; } }

.at-rp-modal {
  width: 100%;
  max-width: 520px;
  background: var(--rp-surface);
  border-radius: var(--rp-radius-lg);
  box-shadow: var(--rp-shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
  animation: at-rp-slideUp .2s ease;
}

.at-rp-modal--subject {
  max-height: 78vh;
}

.at-rp-modal--subject .at-rp-modal__body {
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--rp-primary) rgba(148, 163, 184, 0.28);
}

.at-rp-modal--subject .at-rp-subject-picker {
  max-height: 84px;
  padding: 5px;
  gap: 4px;
  margin-top: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--rp-primary) rgba(148, 163, 184, 0.2);
}

.at-rp-modal--subject .at-rp-subject-picker__item {
  padding: 3px 9px;
  font-size: 11px;
  line-height: 1.2;
}

.at-rp-modal--subject .at-rp-subject-picker::-webkit-scrollbar {
  width: 8px;
}

.at-rp-modal--subject .at-rp-subject-picker::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.14);
  border-radius: 999px;
}

.at-rp-modal--subject .at-rp-subject-picker::-webkit-scrollbar-thumb {
  background: var(--rp-primary);
  border-radius: 999px;
  border: 1px solid rgba(248, 250, 252, 0.95);
}

.at-rp-modal--subject .at-rp-modal__body::-webkit-scrollbar {
  width: 10px;
}

.at-rp-modal--subject .at-rp-modal__body::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
}

.at-rp-modal--subject .at-rp-modal__body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--rp-primary), var(--rp-primary-hover));
  border-radius: 999px;
  border: 2px solid rgba(248, 250, 252, 0.95);
}

.at-rp-modal--subject .at-rp-modal__body::-webkit-scrollbar-thumb:hover {
  background: var(--rp-primary-hover);
}

@keyframes at-rp-slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.at-rp-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--rp-border);
  flex-shrink: 0;
}

#at-rp-root .at-rp-modal__head h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.at-rp-modal__body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.at-rp-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--rp-border);
  flex-shrink: 0;
}

/* -------------------------------------------------------
   Color Picker
------------------------------------------------------- */
.at-rp-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.at-rp-swatch {
  width: 28px;
  min-width: 28px;
  min-inline-size: 28px;
  height: 28px;
  margin: 0;
  flex: 0 0 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .1s, border-color .1s;
  padding: 0;
}

.at-rp-swatch:hover { transform: scale(1.15); }
.at-rp-swatch.at-rp-is-selected { border-color: var(--rp-text); }

/* -------------------------------------------------------
   Subjects View
------------------------------------------------------- */
.at-rp-subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.at-rp-subject-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  box-shadow: var(--rp-shadow);
  overflow: hidden;
  transition: box-shadow .15s;
}

.at-rp-subject-card:hover { box-shadow: var(--rp-shadow-lg); }

.at-rp-subject-card__stripe {
  width: 5px;
  flex-shrink: 0;
  background: var(--subject-color, #6b7280);
}

.at-rp-subject-card__body {
  flex: 1;
  padding: 14px 12px;
  min-width: 0;
}

.at-rp-subject-card__name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.at-rp-subject-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.at-rp-subject-card__exams {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--rp-border);
}

.at-rp-chip--exam {
  background: #fefce8;
  border-color: #fde68a;
  color: #78350f;
  font-weight: 500;
}

.at-rp-subject-card__add-exams {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rp-border);
}

.at-rp-btn--exam-cta {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
  font-weight: 500;
}

.at-rp-btn--exam-cta:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
}

.at-rp-subject-card__actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px;
  gap: 4px;
  border-left: 1px solid var(--rp-border);
  flex-shrink: 0;
}

/* -------------------------------------------------------
   Settings Panel
------------------------------------------------------- */
.at-rp-settings-panel {
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  padding: 20px;
  margin-top: 8px;
}

.at-rp-settings-panel__title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
}

.at-rp-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.at-rp-guest-notice {
  font-size: 13px;
  color: var(--rp-text-muted);
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--rp-bg);
  border-radius: var(--rp-radius);
  border: 1px solid var(--rp-border);
}

#at-rp-root .at-rp-guest-notice a { color: var(--rp-primary); text-decoration: underline; }
#at-rp-root .at-rp-guest-notice a:hover { color: var(--rp-primary-hover); }

/* -------------------------------------------------------
   Calendar View
------------------------------------------------------- */
.at-rp-week-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.at-rp-week-label { font-weight: 500; }

.at-rp-calendar-wrap {
  overflow-x: auto;
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  background: var(--rp-surface);
}

.at-rp-calendar {
  display: flex;
  min-width: 640px;
}

.at-rp-cal-time-col {
  flex-shrink: 0;
  width: 44px;
  display: flex;
  flex-direction: column;
}

.at-rp-cal-time-body {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.at-rp-time-label {
  height: 64px;   /* Must match HOUR_H in app.js */
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding-top: 3px;
  padding-right: 6px;
  justify-content: flex-end;
  font-size: 10px;
  font-weight: 500;
  color: var(--rp-text-xmuted);
  user-select: none;
}

.at-rp-cal-col {
  flex: 1;
  min-width: 90px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--rp-border);
}

.at-rp-cal-col.at-rp-is-today .at-rp-cal-head {
  background: var(--rp-primary-light);
  border-bottom-color: var(--rp-primary);
}

.at-rp-cal-col.at-rp-is-today .at-rp-cal-day { color: var(--rp-primary); }

.at-rp-cal-body.at-rp-is-over {
  background: rgba(79, 70, 229, 0.07);
  outline: 2px dashed var(--rp-primary);
  outline-offset: -2px;
}

.at-rp-cal-head {
  height: 72px;
  flex-shrink: 0;
  padding: 6px 6px 4px;
  text-align: center;
  border-bottom: 1px solid var(--rp-border);
  background: var(--rp-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.at-rp-cal-head--time {
  height: 72px;
  flex-shrink: 0;
  background: var(--rp-surface);
  border-bottom: 1px solid var(--rp-border);
}

.at-rp-cal-dow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--rp-text-muted);
  letter-spacing: .05em;
}

.at-rp-cal-day {
  display: block;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--rp-text);
}

.at-rp-is-today .at-rp-cal-day { color: var(--rp-primary); }

.at-rp-cal-body {
  position: relative;
  flex-shrink: 0;
  border-right: 1px solid var(--rp-border);
}

.at-rp-grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rp-border);
  pointer-events: none;
  z-index: 0;
}

.at-rp-cal-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  height: 24px;
  border: 1px solid var(--rp-border-strong);
  border-radius: var(--rp-radius);
  background: var(--rp-bg);
  color: var(--rp-text-muted);
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  flex-shrink: 0;
}

#at-rp-root.at-rp-wrapper .at-rp.at-rp-scope .at-rp-cal-add {
  min-width: 0;
  min-inline-size: 0;
  width: auto;
  margin: 0;
  min-height: var(--rp-cal-add-h);
  height: var(--rp-cal-add-h);
  border: 1px solid var(--rp-border-strong);
  border-radius: var(--rp-radius);
  box-shadow: none;
  font-family: var(--rp-font);
  line-height: 1;
  padding: 3px 10px;
  font-size: 16px;
}

.at-rp-cal-add:hover {
  background: var(--rp-primary);
  border-color: var(--rp-primary);
  color: #fff;
}

/* -------------------------------------------------------
   Session Chips
------------------------------------------------------- */
.at-rp-session {
  position: absolute;
  left: 2px;
  right: 2px;
  padding: 4px 6px;
  border-left: 3px solid var(--sc, #6b7280);
  background: color-mix(in srgb, var(--sc, #6b7280) 15%, white);
  border-radius: 0 var(--rp-radius) var(--rp-radius) 0;
  cursor: grab;
  overflow: hidden;
  z-index: 1;
  transition: opacity .15s, box-shadow .15s;
  box-sizing: border-box;
}

.at-rp-session:hover { box-shadow: var(--rp-shadow-lg); }
.at-rp-session.at-rp-is-dragging { opacity: .35; pointer-events: none; }

.at-rp-session__content {
  cursor: pointer;
  padding-right: 44px;
}

.at-rp-session__content:focus-visible {
  outline: 2px solid var(--rp-primary);
  outline-offset: 1px;
  border-radius: 4px;
}

/* Snap ghost — shows landing position during drag */
.at-rp-ghost {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 0 var(--rp-radius) var(--rp-radius) 0;
  border: 2px dashed var(--sc, #6b7280);
  background: color-mix(in srgb, var(--sc, #6b7280) 20%, transparent);
  pointer-events: none;
  z-index: 5;
  box-sizing: border-box;
  transition: top .06s ease, height .06s ease;
}

.at-rp-btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.at-rp-session__time {
  font-size: 10px;
  font-weight: 600;
  color: var(--rp-text-muted);
  text-transform: uppercase;
}

.at-rp-session__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--rp-text);
  line-height: 1.3;
  word-break: break-word;
}

.at-rp-session__note {
  font-size: 11px;
  color: var(--rp-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.at-rp-session__btns {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  gap: 2px;
}

.at-rp-session:hover .at-rp-session__btns { display: flex; }

.at-rp-session__btn {
  width: 20px;
  min-width: 20px;
  min-inline-size: 20px;
  height: 20px;
  border: none;
  background: rgba(255,255,255,.85);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  flex: 0 0 20px;
  transition: background .1s;
}

.at-rp-session__btn:hover { background: #e2e8f0; }
.at-rp-session__btn--del { color: #ef4444; }
.at-rp-session__btn--del:hover { background: #fecaca; color: #dc2626; }

/* Exam blocks — locked (non-draggable), hatched background */
.at-rp-session--exam {
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--sc, #6b7280) 12%, white),
    color-mix(in srgb, var(--sc, #6b7280) 12%, white) 5px,
    color-mix(in srgb, var(--sc, #6b7280) 24%, white) 5px,
    color-mix(in srgb, var(--sc, #6b7280) 24%, white) 10px
  );
  border-left: 4px solid var(--sc, #6b7280);
  border: 2px solid color-mix(in srgb, var(--sc, #6b7280) 70%, #111827);
  cursor: default;
}
.at-rp-session--exam .at-rp-session__name {
  font-weight: 800;
  color: #7f1d1d;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.at-rp-session--exam .at-rp-session__time {
  color: #7f1d1d;
  font-weight: 700;
}

.at-rp-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rp-border);
}

.at-rp-detail-row:last-child {
  border-bottom: none;
}

.at-rp-detail-label {
  color: var(--rp-text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.at-rp-detail-value {
  color: var(--rp-text);
  text-align: right;
}

.at-rp-detail-link {
  color: var(--rp-primary);
  font-weight: 600;
  text-decoration: underline;
}

/* -------------------------------------------------------
   Login required notice
------------------------------------------------------- */
.at-rp-login-required {
  min-height: 62vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.at-rp-login-required__card {
  width: 100%;
  max-width: 560px;
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  box-shadow: var(--rp-shadow-lg);
  padding: 28px 24px;
  text-align: center;
}

.at-rp-login-required__icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 10px;
}

#at-rp-root .at-rp-login-required__title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--rp-text);
}

.at-rp-login-required__text {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--rp-text-muted);
}

/* Break blocks — different styling from sessions */
.at-rp-break {
  position: absolute;
  left: 2px;
  right: 2px;
  padding: 4px 6px;
  border-left: 3px solid #10b981;
  background: color-mix(in srgb, #10b981 15%, white);
  border-radius: 0 var(--rp-radius) var(--rp-radius) 0;
  cursor: default;
  overflow: hidden;
  z-index: 1;
  transition: opacity .15s, box-shadow .15s;
  box-sizing: border-box;
}

.at-rp-break:hover { box-shadow: var(--rp-shadow-lg); }

.at-rp-break__time {
  font-size: 10px;
  font-weight: 600;
  color: var(--rp-text-muted);
  text-transform: uppercase;
}

.at-rp-break__activity {
  font-size: 12px;
  font-weight: 600;
  color: var(--rp-text);
  line-height: 1.3;
  word-break: break-word;
}

.at-rp-break__btns {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  gap: 2px;
}

.at-rp-break:hover .at-rp-break__btns { display: flex; }

.at-rp-break__btn {
  width: 20px;
  min-width: 20px;
  min-inline-size: 20px;
  height: 20px;
  border: none;
  background: rgba(255,255,255,.85);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  flex: 0 0 20px;
  transition: background .1s;
}

.at-rp-break__btn:hover { background: #e2e8f0; }
.at-rp-break__btn--del { color: #ef4444; }
.at-rp-break__btn--del:hover { background: #fecaca; color: #dc2626; }

/* Exam subject checklist inside the modal */
.at-rp-exam-subject-list { margin-top: 12px; }

.at-rp-exam-checks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
}

.at-rp-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 4px;
  transition: background .1s;
  user-select: none;
}
.at-rp-check-row:hover { background: var(--rp-primary-light); }
.at-rp-check-row input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.at-rp-text-muted { color: var(--rp-text-muted); font-size: 12px; margin-left: auto; }

/* -------------------------------------------------------
   Subject Autocomplete
------------------------------------------------------- */
.at-rp-autocomplete {
  position: relative;
}

.at-rp-autocomplete__list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 300;
  background: #fff;
  border: 1px solid var(--rp-border-strong);
  border-radius: var(--rp-radius);
  box-shadow: var(--rp-shadow-lg);
  overflow: hidden;
}

.at-rp-autocomplete__item {
  padding: 9px 12px;
  font-size: 14px;
  color: var(--rp-text);
  cursor: pointer;
  transition: background .1s;
}

.at-rp-autocomplete__item:hover {
  background: var(--rp-primary-light);
  color: var(--rp-primary);
}

/* -------------------------------------------------------
   Subject Picker
------------------------------------------------------- */
.at-rp-modal__divider {
  height: 1px;
  background: var(--rp-border);
  margin: 4px 0;
}

.at-rp-subject-picker-wrap {
  margin-top: 8px;
}

.at-rp-picker-hint {
  font-size: 14px;
  color: var(--rp-text-muted);
  margin: 8px 0;
}

.at-rp-subject-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
  margin-top: 8px;
}

.at-rp-subject-picker__item {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  background: var(--rp-bg);
  border: 1px solid var(--rp-border);
  color: var(--rp-text);
  transition: background .1s, border-color .1s;
}

.at-rp-subject-picker__item:hover {
  background: var(--rp-primary-light);
  border-color: var(--rp-primary);
  color: var(--rp-primary);
}

.at-rp-subject-picker__item.at-rp-is-selected {
  background: var(--rp-primary);
  border-color: var(--rp-primary);
  color: #fff;
  font-weight: 600;
}

/* -------------------------------------------------------
   AI Wizard
------------------------------------------------------- */
.at-rp-wizard {
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius-lg);
  overflow: hidden;
}

.at-rp-wizard__steps {
  display: flex;
  align-items: center;
  padding: 20px 28px;
  background: var(--rp-bg);
  border-bottom: 1px solid var(--rp-border);
  gap: 0;
}

.at-rp-wizard__step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--rp-text-muted);
}

.at-rp-wizard__step.at-rp-is-active { color: var(--rp-primary); }
.at-rp-wizard__step.at-rp-is-done   { color: var(--rp-success); }

.at-rp-wizard__step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.at-rp-is-active .at-rp-wizard__step-num { background: var(--rp-primary); color: #fff; border-color: var(--rp-primary); }
.at-rp-is-done .at-rp-wizard__step-num   { background: var(--rp-success); color: #fff; border-color: var(--rp-success); }

.at-rp-wizard__step-lbl { font-size: 13px; font-weight: 600; }

.at-rp-wizard__step-line {
  flex: 1;
  height: 2px;
  background: var(--rp-border);
  margin: 0 10px;
}

.at-rp-wizard__body {
  padding: 28px;
}

.at-rp-wizard-step-body__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
}

.at-rp-wizard__foot {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* -------------------------------------------------------
   Availability slots
------------------------------------------------------- */
.at-rp-avail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.at-rp-avail__row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: start;
}

.at-rp-avail__day {
  font-size: 14px;
  font-weight: 600;
  color: var(--rp-text);
  padding-top: 8px;
}

.at-rp-avail__controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.at-rp-avail__controls .at-rp-select--sm { width: 90px; }

.at-rp-avail__to { font-size: 13px; color: var(--rp-text-muted); }

.at-rp-avail__chips {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.at-rp-avail__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  background: var(--rp-primary-light);
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--rp-primary);
}

.at-rp-ai-priority-select {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
  margin-left: auto;
  padding: 4px 20px 4px 8px;
  font-size: 12px;
}

.at-rp-ai-priority-heading {
  margin: 8px 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--rp-text-muted);
}

.at-rp-ai-priority-select--low {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.at-rp-ai-priority-select--medium {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.at-rp-ai-priority-select--high {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.at-rp-avail__del {
  background: none;
  border: none;
  color: var(--rp-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  padding: 0;
  margin: 0;
  min-width: 0;
  min-inline-size: 0;
  width: auto;
  height: auto;
  line-height: 1;
  opacity: .7;
  transition: opacity .1s;
}

.at-rp-avail__del:hover { opacity: 1; }

/* -------------------------------------------------------
   Subject summary (AI step 2)
------------------------------------------------------- */
.at-rp-subject-summary {
  margin-top: 8px;
  padding: 16px;
  background: var(--rp-bg);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
}

.at-rp-subject-summary__list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

.at-rp-subject-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

/* -------------------------------------------------------
   Summary card (AI step 3)
------------------------------------------------------- */
.at-rp-summary-card {
  background: var(--rp-bg);
  border: 1px solid var(--rp-border);
  border-radius: var(--rp-radius);
  padding: 16px;
  margin-bottom: 20px;
}

.at-rp-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rp-border);
  gap: 12px;
}

.at-rp-summary-row:last-child { border-bottom: none; }
.at-rp-summary-row span { color: var(--rp-text-muted); }

/* -------------------------------------------------------
   AI Result States
------------------------------------------------------- */
.at-rp-ai-success {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--rp-radius);
  margin-top: 16px;
  flex-wrap: wrap;
}

.at-rp-ai-success__icon { font-size: 24px; flex-shrink: 0; }

#at-rp-root .at-rp-ai-success p { font-size: 14px; color: var(--rp-text-muted); margin: 4px 0 0; }

.at-rp-error {
  padding: 14px 16px;
  background: var(--rp-danger-light);
  border: 1px solid #fca5a5;
  border-radius: var(--rp-radius);
  color: #b91c1c;
  font-size: 14px;
  margin-top: 16px;
}

/* -------------------------------------------------------
   Print View
------------------------------------------------------- */
.at-rp-print-area { /* on screen: plain scroll */ }

.at-rp-print-area__title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 24px;
}

.at-rp-print-week { margin-bottom: 32px; }

.at-rp-print-week__title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--rp-primary);
  color: var(--rp-primary);
}

.at-rp-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.at-rp-print-table th,
.at-rp-print-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rp-border);
  vertical-align: middle;
}

.at-rp-print-table th {
  background: var(--rp-bg);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--rp-text-muted);
  letter-spacing: .04em;
}

.at-rp-print-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* -------------------------------------------------------
   Responsive — tablet
------------------------------------------------------- */
@media (max-width: 900px) {
  .at-rp-calendar-wrap { max-height: 70vh; }

  .at-rp-tab__label { display: none; }
  .at-rp-tab { padding: 8px 10px; }

  .at-rp-avail__row { grid-template-columns: 80px 1fr; }
}

/* -------------------------------------------------------
   Responsive — mobile
------------------------------------------------------- */
@media (max-width: 600px) {
  .at-rp__main { padding: 16px 12px 48px; }

  .at-rp-header__logo { font-size: 14px; }

  .at-rp-view__header { flex-direction: column; }
  .at-rp-view__header .at-rp-btn { align-self: stretch; justify-content: center; }

  .at-rp-subject-grid { grid-template-columns: 1fr; }

  .at-rp-calendar { min-width: 560px; }
  .at-rp-cal-col { min-width: 70px; }

  .at-rp-wizard__body { padding: 16px; }

  .at-rp-avail__row { grid-template-columns: 1fr; }
  .at-rp-avail__day { padding-top: 0; }

  .at-rp-modal { max-height: 98vh; }
  .at-rp-modal__body { padding: 14px; }

  .at-rp-settings-grid { grid-template-columns: 1fr; }

  #at-rp-toast { left: 14px; right: 14px; bottom: 14px; }
  .at-rp-toast { max-width: 100%; }
}

/* -------------------------------------------------------
   Print media
------------------------------------------------------- */
@media print {
  .at-rp-header,
  .at-rp-tabs,
  .at-rp-view__header .at-rp-btn,
  .at-rp-week-nav { display: none; }

  .at-rp { background: white; }
  .at-rp__main { max-width: 100%; padding: 0; }

  .at-rp-print-table th,
  .at-rp-print-table td { font-size: 11pt; }

  .at-rp-print-week { page-break-inside: avoid; }
}
