/* Final visual refinements intentionally override earlier component rules. */
:root {
  --line: #dce4ee;
  --panel-soft: #f7f9fc;
  --page: #f2f6fa;
  --shadow: 0 18px 44px rgba(17, 25, 35, 0.1);
  --shadow-soft: 0 8px 20px rgba(17, 25, 35, 0.055);
  --radius-lg: 14px;
  --radius-md: 10px;
}

body:not(.dark):not(.theme-graphite):not(.theme-nightfall):not(.theme-amethyst):not(.theme-forest):not(.theme-burgundy):not(.theme-obsidian):not(.theme-deepsea):not(.theme-copper) {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(242, 246, 250, 0.88)),
    var(--page);
}

.shell {
  border-color: color-mix(in srgb, var(--line) 76%, white);
  box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.brand-panel {
  padding: 16px 18px;
  background: transparent;
}

.brand-panel::after {
  display: none;
}

.logo-mark {
  width: 68px;
  height: 68px;
  margin: 0;
  filter: drop-shadow(0 8px 14px rgba(17, 25, 35, 0.18));
}

.brand-panel h1 {
  font-size: clamp(1.55rem, 2.15vw, 2.1rem);
  line-height: 1.12;
}

.brand-panel p {
  max-width: 28ch;
  font-size: 0.94rem;
  line-height: 1.48;
}

.status-strip {
  gap: 7px;
  margin-top: 26px;
}

.status-strip span {
  padding: 6px 9px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.74rem;
  font-weight: 800;
}

.card,
.admin-section,
.table-wrap,
.teacher-dashboard-header,
.teacher-welcome,
.clock-hero,
.clock-face,
.teacher-announcement,
.teacher-status-badge,
.today-status,
.today-timeline,
.smart-notice,
.profile-completion-card,
.teacher-badge-card,
.profile-card,
.settings-card,
.settings-row,
.profile-item,
.profile-info-panel,
.help-center,
.teacher-news-item,
.notification-center-card,
.monthly-report-title,
.history-entry,
.report-summary-card,
.snapshot-card,
.self-service-card,
.admin-overview-card,
.admin-command-panel,
.admin-command-item,
.approval-card,
.admin-attendance-card,
.admin-teacher-card,
.registration-rule-card,
.registration-photo-card,
.registration-finish-card,
.email-preview,
.checkbox-row {
  border-color: color-mix(in srgb, var(--line) 86%, transparent);
  box-shadow: none !important;
}

.card,
.admin-section {
  background: color-mix(in srgb, var(--panel) 96%, var(--panel-soft));
}

.card::before,
.admin-section::before {
  opacity: 0.36;
}

.card.success-pop,
.welcome-splash-panel.clocked {
  box-shadow: 0 10px 24px rgba(32, 122, 75, 0.11) !important;
}

button {
  border-radius: 9px;
  box-shadow: none;
  font-weight: 800;
}

button:hover {
  box-shadow: none;
  transform: translateY(-1px);
}

.secondary,
.ghost {
  border-color: color-mix(in srgb, var(--line) 90%, transparent);
  background: color-mix(in srgb, var(--panel) 86%, var(--panel-soft));
}

.hint,
.message,
.registration-rule-card span,
.registration-photo-card span,
.registration-finish-card span,
.dashboard-header-copy p,
.settings-copy span,
.profile-photo-copy span,
.teacher-news-copy span,
.profile-item span,
.help-grid span,
.monthly-report-title span,
.admin-section-title p,
.admin-command-item span,
.admin-overview-card span {
  font-size: 0.84rem;
  line-height: 1.42;
}

.topbar h2,
.card > h2,
.dashboard-header-copy h2,
.teacher-welcome .welcome-copy h2,
.profile-title strong,
.settings-title strong,
.admin-section-title h3,
.registration-step-head h3 {
  letter-spacing: 0;
  line-height: 1.16;
}

.topbar h2,
.card > h2,
.dashboard-header-copy h2,
.teacher-welcome .welcome-copy h2 {
  font-size: clamp(1.22rem, 2.1vw, 1.62rem);
}

.status-chip,
.pill,
.admin-nav-badge,
.missed-request-status,
.dashboard-header-chip,
.hero-mode-pill,
.hero-cutoff,
.clock-status-pill {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.15;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 15%, transparent) !important;
}

.dashboard-grid,
.teacher-dashboard-shell,
.profile-layout,
.settings-layout,
.teacher-history-layout,
.admin-workspace,
.admin-overview-grid {
  gap: 16px;
}

.maintenance-coming-soon-images img,
.feature-update-media img {
  box-shadow: none;
}

@media (max-width: 860px) {
  .logo-mark {
    width: 68px;
    height: 68px;
    margin: 0;
  }

  .brand-panel {
    min-height: 90px;
    padding: 12px;
  }

  .brand-panel > div {
    width: auto;
    min-height: 68px;
    padding: 0;
    border-radius: 0;
  }

  .brand-panel h1 {
    font-size: clamp(1.38rem, 7vw, 1.78rem);
  }

  .card,
  .admin-section {
    padding: 18px;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 18px, 1120px);
  }

  main,
  body.admin-dashboard main,
  body.teacher-dashboard main {
    padding: 16px;
  }

  body.teacher-dashboard .topbar {
    width: calc(100% + 32px);
    margin: -16px -16px 16px;
    padding-inline: 16px;
  }

  .card,
  .admin-section {
    padding: 16px;
  }

  .hint,
  .message,
  .dashboard-header-copy p,
  .settings-copy span,
  .profile-photo-copy span,
  .teacher-news-copy span,
  .profile-item span {
    font-size: 0.8rem;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .clock-hero .actions {
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(17, 25, 35, 0.1) !important;
  }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
:focus-visible { outline: 3px solid #2196f3 !important; outline-offset: 3px; }

@media (max-width: 860px) {
  body.teacher-dashboard .dashboard.home-view #teacherCard .mini-calendar .calendar-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 108px;
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    padding: 0 2px 6px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .mini-calendar .compact-recent-day {
    box-sizing: border-box;
    width: 108px;
    min-width: 108px;
    max-width: 108px;
    min-height: 128px;
    padding: 10px;
    gap: 6px;
    align-content: start;
    overflow: hidden;
    scroll-snap-align: start;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .mini-calendar .calendar-status {
    max-width: 100%;
    min-height: 22px;
    padding: 0 6px;
    font-size: 0.62rem;
    line-height: 1.1;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .mini-calendar .calendar-time {
    max-width: 100%;
    font-size: 0.66rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 720px) {
  .system-health, .help-grid, .onboarding-checklist > div, .maintenance-status-grid { grid-template-columns: 1fr; }
}

@media print {
  .brand-panel, .topbar, .bottom-nav, .admin-tab-nav, button, .tutorial-shade, .tutorial-dialog, .tutorial-focus-ring { display: none !important; }
  body, .page, .shell, main, #adminPanel { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  .admin-section { break-inside: avoid; }
  .admin-print-brand { display: flex !important; }
  .admin-tab-panel.hidden { display: none !important; }
  body.badge-printing > *:not(.badge-print-only) { display: none !important; }
  body.badge-printing .badge-print-only { display: grid !important; min-height: 100vh; place-items: center; }
  body.badge-printing .badge-print-only img { display: block; max-width: 100%; max-height: 96vh; object-fit: contain; }
}

.badge-print-only { display: none; }

.tutorial-shade {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.tutorial-shade.show,
.tutorial-dialog.show {
  display: block;
}

.tutorial-shade-piece {
  position: fixed;
  display: block;
  background: rgba(3, 12, 28, 0.72);
  pointer-events: auto;
}

.tutorial-highlight {
  filter: none !important;
}

.tutorial-focus-ring {
  position: fixed;
  z-index: 1002;
  display: none;
  border: 4px solid #fff;
  border-radius: 18px;
  box-shadow: 0 0 0 4px #2196f3, 0 0 28px 9px rgba(33, 150, 243, 0.72);
  pointer-events: auto;
  animation: tutorialPulse 1.6s ease-in-out infinite;
}

.tutorial-focus-ring.show {
  display: block;
}

.tutorial-focus-ring span {
  position: absolute;
  left: 12px;
  top: -19px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #2196f3;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.25);
}

@keyframes tutorialPulse {
  0%, 100% { box-shadow: 0 0 0 4px #2196f3, 0 0 24px 7px rgba(33, 150, 243, 0.55); }
  50% { box-shadow: 0 0 0 7px #64b5f6, 0 0 34px 12px rgba(33, 150, 243, 0.78); }
}

.tutorial-dialog {
  position: fixed;
  z-index: 1003;
  display: none;
  width: min(390px, calc(100vw - 28px));
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  outline: 1px solid rgba(255, 255, 255, 0.2);
}

.tutorial-step-label {
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tutorial-progress-track {
  height: 5px;
  margin: 10px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-soft);
}

.tutorial-progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 180ms ease;
}

.tutorial-dialog h3 {
  margin: 7px 0 8px;
  font-size: 1.25rem;
}

.tutorial-dialog p {
  margin: 0 0 18px;
  color: var(--muted);
}

.tutorial-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tutorial-actions button {
  min-width: auto;
}

.tutorial-actions .tutorial-skip {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.tutorial-actions .tutorial-next {
  margin-left: auto;
}

html.tutorial-open,
body.tutorial-open {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body.visitor-tutorial-open {
  overflow: auto;
  overscroll-behavior: auto;
  touch-action: auto;
}

body.visitor-tutorial-open .tutorial-shade,
body.visitor-tutorial-open .tutorial-shade-piece,
body.visitor-tutorial-open .tutorial-focus-ring {
  pointer-events: none;
}

@media (max-width: 720px) {
  #teacherHistoryCard .monthly-report {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  #teacherHistoryCard .monthly-report-title {
    padding: 10px;
  }

  #teacherHistoryCard .history-filter-bar,
  #teacherHistoryCard .report-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
  }

  #teacherHistoryCard .report-tools label,
  #teacherHistoryCard .report-tools button:nth-last-child(-n + 2) {
    grid-column: auto;
  }

  #teacherHistoryCard .report-tools button {
    width: 100%;
  }

  #teacherHistoryCard .calendar-title {
    align-items: start;
  }

  #teacherHistoryCard .calendar-month-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  #teacherHistoryCard .calendar-month-actions button {
    min-height: 32px;
    padding: 0 6px;
    font-size: 0.7rem;
  }

  #teacherHistoryCard .calendar-weekdays {
    gap: 4px;
  }

  #teacherHistoryCard .calendar-weekdays span {
    font-size: 0.62rem;
  }

  #teacherHistoryCard .calendar-strip {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  #teacherHistoryCard .calendar-day {
    min-width: 0;
    min-height: 68px;
    padding: 6px 4px;
    border-radius: 9px;
    gap: 3px;
    text-align: center;
    justify-items: center;
  }

  #teacherHistoryCard .calendar-day.today:not(.compact-recent-day)::before {
    content: "";
    top: 4px;
    right: 4px;
    width: 7px;
    min-height: 7px;
    padding: 0;
  }

  #teacherHistoryCard .calendar-day span {
    font-size: 0.52rem;
  }

  #teacherHistoryCard .calendar-day strong {
    font-size: 0.96rem;
  }

  #teacherHistoryCard .calendar-status {
    width: 8px;
    min-height: 8px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  #teacherHistoryCard .calendar-streak-label,
  #teacherHistoryCard .calendar-term-label,
  #teacherHistoryCard .calendar-legend {
    display: none;
  }

  #teacherHistoryCard .calendar-selected-detail {
    padding: 10px;
    border-radius: 12px;
  }

  #teacherHistoryCard .calendar-detail-grid,
  #teacherHistoryCard .history-detail-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  #teacherHistoryCard .report-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  #teacherHistoryCard .report-summary-card {
    min-height: 58px;
    padding: 8px 6px;
  }

  #teacherHistoryCard .history-entry summary {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
  }

  #teacherHistoryCard .history-entry summary > .pill {
    grid-column: 2;
    justify-self: start;
  }

  #teacherHistoryCard .history-correction-inline {
    grid-column: 1 / -1;
    width: 100%;
  }

  #teacherHistoryCard .history-date-badge {
    width: 42px;
    border-radius: 11px;
  }

  #teacherHistoryCard .history-main strong {
    font-size: 0.92rem;
  }

  #teacherHistoryCard .history-main span {
    font-size: 0.76rem;
  }

  .tutorial-dialog {
    left: 14px;
    right: 14px;
    width: auto;
  }

  .tutorial-focus-ring span {
    top: -16px;
    font-size: 0.62rem;
  }
}

@media (min-width: 1024px) {
  body.teacher-dashboard {
    min-height: 100vh;
  }

  body.teacher-dashboard .page {
    width: min(1240px, calc(100% - 40px));
    padding: 20px 0 18px;
  }

  body.teacher-dashboard .shell {
    min-height: auto;
    border-radius: 18px;
  }

  body.teacher-dashboard main {
    padding: 18px 24px 22px;
  }

  body.teacher-dashboard .topbar {
    min-height: 60px;
    margin-bottom: 14px;
    padding-bottom: 8px;
  }

  body.teacher-dashboard .bottom-nav:not(.hidden) {
    top: 22px;
    width: min(560px, calc(100vw - 560px));
    padding: 5px;
    border-radius: 16px;
  }

  body.teacher-dashboard .bottom-nav button {
    min-height: 42px;
    padding: 5px 8px;
  }

  body.teacher-dashboard .dashboard {
    padding-bottom: 18px;
  }

  body.teacher-dashboard .teacher-dashboard-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: 16px;
  }

  body.teacher-dashboard .dashboard-header-logo {
    width: 50px;
    height: 50px;
    border-radius: 14px;
  }

  body.teacher-dashboard .dashboard-header-copy h2 {
    font-size: 1.55rem;
  }

  body.teacher-dashboard .dashboard-header-copy p {
    max-width: 56ch;
  }

  body.teacher-dashboard .dashboard-header-actions {
    grid-template-columns: repeat(2, minmax(108px, auto));
    gap: 8px;
  }

  body.teacher-dashboard .dashboard-header-chip {
    min-height: 48px;
    padding: 8px 10px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.74fr);
    grid-template-areas:
      "welcome welcome"
      "clock statusBadge"
      "clock todayStatus"
      "clock timeline"
      "clock notices";
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .teacher-welcome,
  body.teacher-dashboard .dashboard.home-view #teacherCard .clock-hero,
  body.teacher-dashboard .dashboard.home-view #teacherCard .teacher-announcement,
  body.teacher-dashboard .dashboard.home-view #teacherCard .teacher-status-badge,
  body.teacher-dashboard .dashboard.home-view #teacherCard .today-status,
  body.teacher-dashboard .dashboard.home-view #teacherCard .today-timeline,
  body.teacher-dashboard .dashboard.home-view #teacherCard .smart-notices {
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(17, 25, 35, 0.06);
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .teacher-welcome {
    padding: 13px 14px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .welcome-copy h2 {
    font-size: 1.45rem;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .clock-hero {
    padding: 14px;
    gap: 10px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .clock-face {
    min-height: 168px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .clock-face strong {
    font-size: clamp(2.55rem, 4.2vw, 3.55rem);
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .clock-actions button {
    min-height: 44px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .teacher-status-badge,
  body.teacher-dashboard .dashboard.home-view #teacherCard .today-status,
  body.teacher-dashboard .dashboard.home-view #teacherCard .smart-notice {
    padding: 10px 12px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .today-timeline {
    padding: 10px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .timeline-step {
    min-height: 64px;
    padding: 8px 10px;
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard .missed-clock-note summary {
    padding: 10px 12px;
  }

  body.teacher-dashboard .creator-footer {
    margin: 8px auto 0;
    padding: 4px 12px 10px;
  }

  body.teacher-dashboard .creator-logo-button {
    min-height: 56px;
    padding: 7px 10px;
  }

  body.teacher-dashboard .creator-logo {
    width: min(230px, 28vw);
    max-height: 70px;
    object-fit: contain;
  }
}

@media (min-width: 1280px) {
  body.teacher-dashboard .page {
    width: min(1180px, calc(100% - 56px));
  }

  body.teacher-dashboard .dashboard.home-view #teacherCard {
    grid-template-columns: minmax(0, 1.02fr) minmax(330px, 0.72fr);
  }
}
@media (max-width: 720px) {
  .tempo-assistant,
  #dashboardBottomNav,
  #notificationCenter {
    contain: layout paint style;
    will-change: transform;
  }
  .tempo-assistant,
  #notificationCenter {
    position: fixed;
  }
  .dashboard-card img,
  .teacher-card img,
  .announcement-card img {
    content-visibility: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
