/* ==========================================================================
   Dimigo 1-2 Dashboard Styles (Optimized for 60fps + Lightweight Motion)
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background-color: var(--bg-page);
}

body {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  /* background-attachment: fixed 제거 -> 스크롤 전체 리페인트 방지 */
  background-color: var(--bg-page);
  background-image: linear-gradient(180deg, #eaf5ee 0%, #f4f8f5 320px, #f4f8f5 100%);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---------- Lightweight GPU-Only Keyframes ---------- */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes softFade {
  from {
    opacity: 0;
    transform: translate3d(0, 4px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translate3d(0, 8px, 0) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes pulseRing {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(2.1);
  }
  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}

.animate-swap {
  animation: softFade 180ms var(--ease-base) both;
}

/* ---------- Header (backdrop-filter 제거로 스크롤 렉 방지) ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 248, 245, 0.96);
  border-bottom: 1px solid var(--border-light);
}

.header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  min-height: var(--header-height);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #34a065 0%, #24784a 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(46, 139, 87, 0.2);
  flex-shrink: 0;
  transition: transform var(--ease-fast);
}

.brand-mark:hover {
  transform: scale(1.04);
}

.brand-text h1 {
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.class-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--color-primary-soft);
  border: 1px solid var(--color-primary-border);
  color: var(--color-primary-strong);
  font-size: var(--text-xs);
  font-weight: 700;
}

.brand-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.live-clock {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.clock-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

.clock-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-primary);
  animation: pulseRing 2.4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.data-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.data-source-badge.is-live {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-border);
  color: var(--color-primary-strong);
}

.data-source-badge.is-sample {
  background: var(--color-warning-soft);
  border-color: var(--color-warning-border);
  color: var(--color-warning);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  transition: background-color var(--ease-fast), border-color var(--ease-fast), transform var(--ease-fast);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--color-primary-border);
}

.btn-outline:active,
.btn-primary:active,
.icon-btn:active,
.segment-btn:active,
.weekday-pill:active,
.month-event-pill:active {
  transform: scale(0.97);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--text-on-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--ease-fast), transform var(--ease-fast);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color var(--ease-fast), color var(--ease-fast);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--color-primary-strong);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  transition: background-color var(--ease-fast), border-color var(--ease-fast), color var(--ease-fast), transform var(--ease-fast);
}

.icon-btn:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-border);
  color: var(--color-primary-strong);
}

/* ---------- Main Layout ---------- */
.app-main {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ---------- D-Day Section ---------- */
.dday-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  animation: fadeSlideUp 280ms var(--ease-base) both;
}

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.dday-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

.dday-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-2);
  contain: layout style;
  transition: transform var(--ease-fast), border-color var(--ease-fast);
}

.dday-card:hover {
  transform: translate3d(0, -2px, 0);
  border-color: var(--color-primary-border);
}

.dday-card.is-highlight {
  background: linear-gradient(135deg, #eaf7ef 0%, #ffffff 72%);
  border-color: var(--color-primary-border);
}

.dday-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.dday-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.dday-tag.is-exam {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.dday-tag.is-custom {
  background: var(--color-info-soft);
  color: var(--color-info);
}

.dday-remove {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  transition: background-color var(--ease-fast), color var(--ease-fast);
}

.dday-remove:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.dday-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-primary-strong);
  line-height: 1.15;
}

.dday-card.is-urgent .dday-value {
  color: var(--color-danger);
}

.dday-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dday-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.dday-empty {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ---------- Dashboard Grid (PC 2-Column) ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ---------- Card Base ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  contain: layout style;
  animation: fadeSlideUp 320ms var(--ease-base) both;
}

.right-column .card:first-child {
  animation-delay: 50ms;
}

.right-column .card:last-child {
  animation-delay: 100ms;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.card-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-title {
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.date-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.date-nav-label {
  min-width: 112px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
}

/* ---------- Segmented Tabs ---------- */
.segment-control {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  gap: 4px;
}

.segment-control.full-width {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
}

.segment-btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color var(--ease-fast), color var(--ease-fast), transform var(--ease-fast);
}

.segment-btn:hover {
  color: var(--text-primary);
}

.segment-btn.is-active {
  background: var(--bg-card);
  color: var(--color-primary-strong);
  box-shadow: var(--shadow-xs);
}

/* ---------- Calendar Card ---------- */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
  margin-bottom: var(--space-2);
}

.calendar-weekday {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 0;
}

.calendar-weekday.is-sun {
  color: var(--color-weekend-sun);
}

.calendar-weekday.is-sat {
  color: var(--color-weekend-sat);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-cell {
  min-height: 76px;
  padding: 7px 6px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  transition: background-color var(--ease-fast), border-color var(--ease-fast), transform var(--ease-fast);
  overflow: hidden;
}

.cal-cell:hover {
  background: var(--bg-hover);
  border-color: var(--color-primary-border);
}

.cal-cell:active {
  transform: scale(0.98);
}

.cal-cell.is-other-month {
  opacity: 0.36;
  background: transparent;
}

.cal-cell.is-today {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-border);
}

.cal-cell.is-selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-ring);
  background: #ffffff;
}

.cal-day-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-day-num {
  font-size: var(--text-sm);
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-cell.is-today .cal-day-num {
  background: var(--color-primary);
  color: #ffffff;
}

.cal-cell.is-sun .cal-day-num,
.cal-cell.is-holiday .cal-day-num {
  color: var(--color-weekend-sun);
}

.cal-cell.is-sat .cal-day-num {
  color: var(--color-weekend-sat);
}

.cal-cell.is-today.is-sun .cal-day-num,
.cal-cell.is-today.is-sat .cal-day-num,
.cal-cell.is-today.is-holiday .cal-day-num {
  color: #ffffff;
}

.cal-event-chip {
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-event-chip.is-holiday {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.cal-event-chip.is-exam {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

.cal-event-chip.is-custom {
  background: var(--color-info-soft);
  color: var(--color-info);
  border: 1px dashed rgba(43, 122, 120, 0.45);
}

.cal-event-more {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  padding-left: 2px;
}

/* Selected Day & Monthly Schedule Panel */
.schedule-detail-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.schedule-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.schedule-detail-date {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary-strong);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
}

.schedule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.schedule-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.schedule-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
}

.schedule-dot.is-holiday {
  background: var(--color-danger);
}

.schedule-dot.is-exam {
  background: var(--color-warning);
}

.schedule-dot.is-custom {
  background: var(--color-info);
}

.schedule-item.is-custom {
  background: #f5fbfb;
  border-color: rgba(43, 122, 120, 0.28);
}

.schedule-item-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.schedule-badge-custom {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-info-soft);
  color: var(--color-info);
}

.schedule-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.schedule-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

.month-events-wrap {
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.month-events-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.month-events-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.month-event-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  transition: border-color var(--ease-fast), background-color var(--ease-fast), transform var(--ease-fast);
}

.month-event-pill:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-border);
  color: var(--color-primary-strong);
}

.month-event-pill strong {
  color: var(--color-primary-strong);
  font-weight: 700;
}

.month-event-pill.is-custom {
  background: var(--color-info-soft);
  border-color: rgba(43, 122, 120, 0.35);
  color: var(--color-info);
}

.month-event-pill.is-custom strong {
  color: var(--color-info);
}

.dday-card {
  cursor: pointer;
}

/* ---------- Meal Card ---------- */
.meal-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--color-primary-softer);
  border: 1px solid var(--border-light);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.kcal-badge {
  font-weight: 700;
  color: var(--color-primary-strong);
  background: var(--bg-card);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-primary-border);
}

.meal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  transition: border-color var(--ease-fast), background-color var(--ease-fast), transform var(--ease-fast);
}

.meal-item:hover {
  background: var(--bg-hover);
  border-color: var(--color-primary-border);
  transform: translate3d(2px, 0, 0);
}

.meal-dish-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.meal-allergy {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  flex-shrink: 0;
}

.meal-corners {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meal-corner-box {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--color-primary-softer);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meal-corner-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary-strong);
}

.meal-corner-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meal-corner-chip {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 3px 9px;
}

.meal-extra {
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-3);
}

.meal-nutrition-box {
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.7;
  animation: softFade 160ms var(--ease-base) both;
}

.empty-state {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-default);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ---------- Timetable Card ---------- */
.weekday-pills {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.weekday-pill {
  padding: 7px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
  transition: background-color var(--ease-fast), border-color var(--ease-fast), color var(--ease-fast), transform var(--ease-fast);
}

.weekday-pill:hover {
  border-color: var(--color-primary-border);
  background: var(--bg-hover);
}

.weekday-pill.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.weekday-pill.is-today-mark {
  position: relative;
}

.weekday-pill.is-today-mark::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-primary);
}

.weekday-pill.is-active.is-today-mark::after {
  background: #ffffff;
}

.timetable-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.period-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  transition: background-color var(--ease-fast), border-color var(--ease-fast), transform var(--ease-fast);
}

.period-row:hover {
  background: var(--bg-hover);
  transform: translate3d(2px, 0, 0);
}

.period-row.is-current {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-ring);
}

.period-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
}

.period-row.is-current .period-badge {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.period-subject {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-now-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #ffffff;
}

/* Weekly Timetable Table */
.weekly-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.weekly-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--text-xs);
}

.weekly-table th,
.weekly-table td {
  padding: 9px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
}

.weekly-table th:last-child,
.weekly-table td:last-child {
  border-right: none;
}

.weekly-table tr:last-child td {
  border-bottom: none;
}

.weekly-table thead th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-secondary);
  padding: 10px 4px;
}

.weekly-table thead th.is-today-col {
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.weekly-table tbody th {
  width: 44px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 700;
}

.weekly-table td {
  font-weight: 600;
  color: var(--text-primary);
  word-break: keep-all;
  line-height: 1.3;
}

.weekly-table td.is-today-col {
  background: var(--color-primary-softer);
}

.weekly-table td.is-current-cell {
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 700;
}

/* ---------- Modal (backdrop-filter 제거로 경량화) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 38, 28, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: softFade 150ms ease-out both;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  animation: modalPop 200ms var(--ease-base) both;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  font-size: var(--text-sm);
  transition: border-color var(--ease-fast), background-color var(--ease-fast);
}

.form-input:focus {
  background: var(--bg-card);
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary-ring);
}

.guide-box {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-primary-softer);
  border: 1px solid var(--color-primary-border);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.65;
}

.guide-box strong {
  color: var(--color-primary-strong);
}

.guide-box ol {
  margin-left: 18px;
  margin-top: 6px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.status-message {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.status-message.is-ok {
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.status-message.is-err {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

/* ---------- Footer ---------- */
.app-footer {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 1060px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dday-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: var(--space-3) var(--space-4);
  }

  .app-main {
    padding: var(--space-4);
    gap: var(--space-4);
  }

  .card {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
  }

  .dday-grid {
    grid-template-columns: 1fr;
  }

  .cal-cell {
    min-height: 56px;
    padding: 4px;
  }

  .cal-event-chip {
    font-size: 10px;
    padding: 1px 3px;
  }

  .live-clock {
    display: none;
  }
}

/* ---------- Reduced Motion Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
