/*
 * V3.6 visual layer
 *
 * Loaded after the established component and responsive styles. Keeping the
 * upgrade in one scoped layer makes the first V3 release easy to review and
 * roll back without changing the existing workflow implementation.
 */

.ui-v3 {
  --page: #f4f7f6;
  --panel: #ffffff;
  --panel-strong: #f8fbfa;
  --ink: #10211d;
  --muted: #60706b;
  --line: #d9e4e0;
  --green: #0f766e;
  --blue: #2554c7;
  --amber: #b66708;
  --red: #d33c36;
  --warning-ink: #8a4b08;
  --danger-ink: #b42318;
  --focus-ring: #1d4ed8;
  --teal-soft: #e7f5f1;
  --blue-soft: #eaf0ff;
  --amber-soft: #fff4df;
  --surface-raised: #ffffff;
  --surface-muted: #f7faf9;
  --radius-control: 10px;
  --radius-card: 16px;
  --shadow: 0 1px 2px rgba(16, 33, 29, 0.04), 0 10px 28px rgba(16, 33, 29, 0.07);
  --shadow-soft: 0 8px 22px rgba(16, 33, 29, 0.055);
  --chrome-bg: rgba(248, 251, 250, 0.92);
  background:
    radial-gradient(circle at 86% -8%, rgba(37, 84, 199, 0.08), transparent 30rem),
    linear-gradient(180deg, #eef5f2 0, #f7f9f8 320px, var(--page) 100%);
}

.ui-v3 ::selection {
  background: rgba(15, 118, 110, 0.9);
}

.ui-v3 :is(button, a, summary, .tab, input, select, textarea):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.ui-v3 :is(input, select, textarea) {
  min-height: 44px;
  border-radius: var(--radius-control);
  border-color: #cfddd8;
  background: rgba(255, 255, 255, 0.98);
}

.ui-v3 :is(input, select, textarea):focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

.ui-v3 :is(.primary-button, .ghost-button, .danger-button) {
  min-height: 44px;
  border-radius: var(--radius-control);
  font-weight: 750;
}

.ui-v3 .primary-button {
  border-color: transparent;
  background: linear-gradient(135deg, #0f766e, #165fb1);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.16);
}

.ui-v3 .ghost-button {
  border-color: #cad8d3;
  background: rgba(255, 255, 255, 0.92);
}

.ui-v3 .danger-button,
.ui-v3 .form-message.error,
.ui-v3 .kpis .risk strong {
  color: var(--danger-ink);
}

.ui-v3 .danger-button {
  color: #fff;
  background: var(--danger-ink);
}

.ui-v3 .login-view {
  min-height: 100dvh;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 18% 12%, rgba(15, 118, 110, 0.11), transparent 25rem),
    radial-gradient(circle at 88% 82%, rgba(37, 84, 199, 0.1), transparent 28rem);
}

.ui-v3 .login-card {
  width: min(500px, 100%);
  gap: 18px;
  border-color: rgba(15, 118, 110, 0.2);
  border-radius: 22px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 30px 80px rgba(16, 33, 29, 0.14);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.ui-v3 .login-brand-row {
  padding-bottom: 4px;
}

.ui-v3 .login-brand-row .eyebrow {
  margin: 0;
  letter-spacing: 0.04em;
}

.ui-v3 .login-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ui-v3 .login-product {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.ui-v3 .login-product > img {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.2);
}

.ui-v3 .login-product h1 {
  min-width: 0;
  font-size: clamp(24px, 4.7vw, 29px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.ui-v3 .login-title-row .version-pill {
  flex: 0 0 auto;
}

.ui-v3 .login-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.ui-v3 .login-card > .primary-button {
  margin-top: 2px;
  min-height: 48px;
}

.ui-v3 .version-pill,
.ui-v3 .brand em {
  min-height: 32px;
  border-color: rgba(37, 84, 199, 0.18);
  color: #2049ab;
  background: #edf2ff;
  font-size: 14px;
  font-weight: 900;
}

.ui-v3 .main-view {
  grid-template-columns: 256px minmax(0, 1fr);
}

.ui-v3 .sidebar {
  border-right-color: rgba(15, 118, 110, 0.14);
  padding: 20px 18px;
  background: rgba(247, 251, 249, 0.94);
}

.ui-v3 .brand {
  grid-template-columns: 40px minmax(0, 1fr) auto;
  min-height: 52px;
  margin-bottom: 26px;
  font-weight: 800;
}

.ui-v3 .brand span {
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 11px;
  background: transparent;
  box-shadow: 0 9px 20px rgba(15, 118, 110, 0.18);
}

.ui-v3 .brand span img {
  display: block;
  width: 100%;
  height: 100%;
}

.ui-v3 .nav-group-label {
  margin: 16px 10px 4px;
  color: #6b7975;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.ui-v3 .tabs {
  gap: 6px;
}

.ui-v3 .tab {
  min-height: 50px;
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 750;
}

.ui-v3 .tab span {
  border-radius: 9px;
}

.ui-v3 .tab small {
  font-weight: 600;
}

.ui-v3 .tab.active {
  border-color: rgba(15, 118, 110, 0.2);
  color: #0b645e;
  background: linear-gradient(135deg, rgba(231, 245, 241, 0.96), rgba(234, 240, 255, 0.9));
  box-shadow: inset 3px 0 0 var(--green), var(--shadow-soft);
}

.ui-v3 .content-shell {
  padding: 0 28px 40px;
}

.ui-v3 .topbar {
  min-height: 76px;
  margin-bottom: 22px;
  padding: max(14px, var(--safe-top)) 0 14px;
  border-bottom-color: rgba(15, 118, 110, 0.13);
}

.ui-v3 .topbar h1 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.ui-v3 .eyebrow,
.ui-v3 label span,
.ui-v3 .page-subtitle {
  font-weight: 650;
}

.ui-v3 .topbar-right {
  gap: 12px;
}

.ui-v3 .workflow-actions {
  gap: 16px;
  border-color: rgba(15, 118, 110, 0.13);
  border-radius: 13px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.76);
}

.ui-v3 .workflow-primary-actions {
  gap: 6px;
}

.ui-v3 .workflow-export-actions {
  padding-left: 16px;
  border-left-color: rgba(15, 118, 110, 0.24);
}

.ui-v3 .workflow-actions [data-workflow-action="export"] {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #2858c6, #0b8a91);
  box-shadow: 0 7px 16px rgba(30, 94, 204, 0.19);
}

.ui-v3 .workflow-actions button {
  min-height: 38px;
  border-color: transparent;
  border-radius: 9px;
  color: #33423e;
  background: transparent;
  font-weight: 750;
}

.ui-v3 .workflow-actions .primary-button {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #165fb1);
  box-shadow: 0 7px 16px rgba(15, 118, 110, 0.16);
}

.ui-v3 .workflow-actions button:not(.primary-button):hover,
.ui-v3 .workflow-actions button:not(.primary-button).active {
  border-color: rgba(15, 118, 110, 0.18);
  color: #0b645e;
  background: var(--teal-soft);
}

.ui-v3 .workflow-actions button strong {
  font-weight: 800;
}

.ui-v3 .user-chip span {
  border-color: rgba(15, 118, 110, 0.1);
  background: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

.ui-v3 .mobile-user-chip-slot {
  display: none;
}

.ui-v3 .mobile-export-slot {
  display: none;
}

.ui-v3 .ipad-workbench-brand {
  display: none;
}

.ui-v3 .ipad-workflow-slot {
  display: none;
}

/* 基础阅读层级：只抬升辅助文字和常规控件文字，不触碰标题、统计数字和主操作。 */
@media (min-width: 521px) {
  .ui-v3 :is(.eyebrow, label > span, .page-subtitle, .more-filters summary, .workflow-actions button, .user-chip span) {
    font-size: 14px;
  }

  .ui-v3 :is(
    .form-message,
    .field-help,
    .range-hint,
    .range-hint strong,
    .filter-chip,
    .status-badge,
    .meta,
    .calendar-weekday,
    .calendar-day header,
    .calendar-course,
    .calendar-course small,
    .day-heading,
    .course-main p,
    .table-wrap th,
    .table-wrap td,
    .empty,
    .muted
  ) {
    font-size: 13px;
  }

  .ui-v3 :is(.range-hint span, .filter-count, .calendar-course small) {
    font-size: 12px;
  }
}

.ui-v3 :is(.login-card, .controls, .kpis article, .panel-card, .board, .insight-card) {
  border-color: var(--line);
  border-radius: var(--radius-card);
}

.ui-v3 .controls {
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.ui-v3 .more-filters summary {
  color: #2049ab;
  font-weight: 750;
}

.ui-v3 .range-hint {
  min-height: 44px;
  border-radius: var(--radius-control);
  color: #53635e;
  background: #f2f8f6;
  font-weight: 650;
}

.ui-v3 .filter-chip {
  min-height: 34px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: none;
}

.ui-v3 .filter-chip button {
  width: 28px;
  height: 28px;
}

.ui-v3 .page {
  margin-top: 18px;
}

.ui-v3 #homePage.active {
  gap: 18px;
}

.ui-v3 .kpis,
.ui-v3 .insight-strip {
  gap: 14px;
}

.ui-v3 .kpis article {
  min-height: 124px;
  border-left-width: 4px;
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.ui-v3 .kpis span,
.ui-v3 .kpis small,
.ui-v3 .insight-card span,
.ui-v3 .insight-card small {
  font-weight: 650;
}

.ui-v3 .kpis strong {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* 电脑端的近期课程说明与触控端保持一致的可读层级。 */
.ui-v3 :is(#nextCourseInsight, #secondNextCourseInsight) small {
  font-size: 15px;
  font-weight: 850;
}

.ui-v3 .insight-card {
  min-height: 122px;
  padding: 19px;
  box-shadow: var(--shadow-soft);
}

.ui-v3 .insight-card strong {
  font-weight: 800;
}

.ui-v3 .board {
  box-shadow: var(--shadow-soft);
}

.ui-v3 .board-header {
  padding: 22px 24px;
  border-bottom-color: rgba(15, 118, 110, 0.12);
  background: rgba(250, 252, 251, 0.96);
}

.ui-v3 .board-header h2,
.ui-v3 .panel-title h2,
.ui-v3 .schedule-title h2 {
  font-weight: 800;
  letter-spacing: -0.015em;
}

.ui-v3 .view-tools,
.ui-v3 .segmented,
.ui-v3 .view-mode-group,
.ui-v3 .visual-dashboard-card,
.ui-v3 .action-row {
  border-radius: 12px;
}

.ui-v3 .view-toggle {
  border-radius: 9px;
  font-weight: 750;
}

.ui-v3 .status-badge.warning,
.ui-v3 .warning,
.ui-v3 [data-tone="warning"] {
  color: var(--warning-ink);
}

.ui-v3 .modal-card {
  border-radius: 18px;
}

.ui-v3 .modal-close {
  min-width: 42px;
  min-height: 42px;
  border-radius: 10px;
}

@media (min-width: 801px) and (max-width: 1280px) {
  /* 13–14 寸 MacBook：近期课程时间完整保持一行，不被卡片边缘裁切。 */
  .ui-v3 #homePage .kpis .desktop-upcoming-time {
    margin: 0;
    max-width: 100%;
    overflow: visible;
    font-size: 28px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    line-height: 1.15;
    text-overflow: clip;
    white-space: nowrap;
  }
}

@media (min-width: 1281px) {
  /* 24 寸及以上的大屏：五张首页卡片一行展示，近期课程按日期、时间、课程名分层。 */
  .ui-v3 #homePage .kpis {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .ui-v3 #homePage :is(#nextCourseInsight, #secondNextCourseInsight) {
    display: grid;
    align-content: start;
    min-height: 154px;
    gap: 4px;
  }

  .ui-v3 .desktop-upcoming-title {
    margin-bottom: 2px;
  }

  .ui-v3 .desktop-upcoming-date,
  .ui-v3 .desktop-upcoming-time,
  .ui-v3 .desktop-upcoming-course {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-v3 .desktop-upcoming-date {
    color: var(--muted);
    font-size: 16px;
    font-weight: 850;
  }

  .ui-v3 #homePage .kpis .desktop-upcoming-time {
    margin: 0;
    font-size: clamp(19px, 1.35vw, 24px);
    line-height: 1.2;
  }

  .ui-v3 .desktop-upcoming-course {
    color: var(--muted);
    font-size: 15px;
    font-weight: 850;
  }

  /* 大屏页眉的三行页面标题留出呼吸空间，不再贴齐内容区左边缘。 */
  .ui-v3 .topbar-page-heading {
    padding-left: 16px;
  }

  .ui-v3 .workflow-actions {
    max-width: min(820px, 58vw);
  }
}

@media (min-width: 1181px) and (max-width: 1512px) {
  /* 中等大屏仍保持两组结构：前四项均分，导出独立且与其留有间隔。 */
  .ui-v3 .workflow-actions {
    display: flex;
    grid-template-columns: none;
    gap: 16px;
  }

  .ui-v3 .workflow-primary-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(92px, 1fr));
    flex: 1 1 auto;
    gap: 6px;
    min-width: 0;
  }
}

@media (min-width: 801px) and (max-width: 1280px) {
  .ui-v3 .main-view {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .ui-v3 .sidebar {
    padding: 16px 12px;
  }

  .ui-v3 .content-shell {
    padding-right: 18px;
    padding-left: 18px;
  }

  .ui-v3 .topbar {
    margin-right: -2px;
    margin-left: -2px;
  }

  .ui-v3 .workflow-actions button {
    padding-right: 9px;
    padding-left: 9px;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ui-v3 .ipad-workflow-slot .workflow-primary-actions {
    display: contents;
  }
}

@media (max-width: 800px) {
  .ui-v3 {
    background: #f5f8f7;
  }

  .ui-v3 .login-view {
    padding: max(18px, var(--safe-top)) 14px max(18px, var(--safe-bottom));
  }

  .ui-v3 .login-card {
    max-width: 460px;
    border-radius: 18px;
    padding: 28px 22px;
  }

  .ui-v3 .main-view {
    grid-template-columns: 1fr;
  }

  .ui-v3 .sidebar {
    overflow: hidden;
    padding: 7px 8px calc(7px + var(--safe-bottom));
    border-top-color: rgba(15, 118, 110, 0.16);
    background: rgba(251, 253, 252, 0.96);
    box-shadow: 0 -10px 30px rgba(16, 33, 29, 0.11);
  }

  .ui-v3 .tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(72px, 1fr);
    grid-template-columns: none;
    gap: 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .ui-v3 .tab {
    min-height: 58px;
    border-radius: 11px;
    padding: 5px 4px;
  }

  .ui-v3 .tab.active {
    box-shadow: inset 0 -3px 0 var(--green);
  }

  .ui-v3 .content-shell {
    padding: 0 12px calc(94px + var(--safe-bottom));
  }

  .ui-v3 .topbar {
    min-height: 0;
    margin: 0 -12px 14px;
    padding: max(13px, var(--safe-top)) 12px 12px;
  }

  .ui-v3 .topbar h1 {
    font-size: 25px;
  }

  .ui-v3 .workflow-actions {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    padding: 5px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .ui-v3 .workflow-actions button {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    min-height: 42px;
    padding: 0 13px;
    scroll-snap-align: start;
  }

  .ui-v3 .user-chip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ui-v3 .user-chip #roleLabel {
    grid-column: auto;
  }

  .ui-v3 .user-chip :is(span, button) {
    min-height: 42px;
  }

  .ui-v3 .controls {
    padding: 14px;
  }

  .ui-v3 .kpis article,
  .ui-v3 .insight-card {
    min-height: 110px;
  }

  .ui-v3 .filter-chip button,
  .ui-v3 .icon-button,
  .ui-v3 .mini-button {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 520px) {
  .ui-v3 .mobile-user-chip-slot {
    display: block;
    margin-top: 16px;
    padding: 16px 0 calc(12px + var(--safe-bottom));
    border-top: 1px solid rgba(15, 118, 110, 0.14);
  }

  /* 手机端无需重复展示部署方式；iPad 与电脑端仍保留该状态标识。 */
  .ui-v3 .user-chip #deploymentModeLabel {
    display: none;
  }

  /* 手机底部账户区只保留账号与普通退出，不提供关闭局域网服务的入口。 */
  .ui-v3 .user-chip #shutdownButton {
    display: none !important;
  }

  /* 手机端保留完整筛选：每个字段独占一行，避免快捷条件掩盖当前范围。 */
  .ui-v3 .main-filters .mobile-hidden-filter {
    display: grid;
  }

  /* 手机首页先聚焦孩子与时间；机构、状态仍可在大屏/iPad 使用。 */
  .ui-v3 .main-filters .mobile-collapsed-filter {
    display: none;
  }

  .ui-v3 .main-filters {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .ui-v3 .main-filters > :is(label, .range-hint) {
    grid-column: 1 / -1;
    width: 100%;
  }

  .ui-v3 .login-product {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 13px;
  }

  .ui-v3 .login-product > img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .ui-v3 .login-product h1 {
    font-size: 23px;
  }

  .ui-v3 .login-subtitle {
    font-size: 13px;
  }

  .ui-v3 .user-chip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ui-v3 .user-chip #roleLabel {
    grid-column: auto;
  }

  /* 手机页眉与 iPad 使用同一品牌识别：图标、系统名、版本号与导出。 */
  .ui-v3 .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand export";
    align-items: center;
    gap: 12px;
  }

  .ui-v3 .topbar-page-heading {
    display: none;
  }

  .ui-v3 .ipad-workbench-brand {
    display: grid;
    grid-area: brand;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  .ui-v3 .ipad-workbench-logo,
  .ui-v3 .ipad-workbench-logo img {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .ui-v3 .ipad-workbench-copy {
    min-width: 0;
  }

  .ui-v3 .ipad-workbench-title-line {
    gap: 6px;
  }

  .ui-v3 .ipad-workbench-title-line strong {
    font-size: clamp(18px, 5.2vw, 22px);
    letter-spacing: -0.035em;
  }

  .ui-v3 .ipad-workbench-version {
    min-height: 26px;
    padding: 0 8px;
    font-size: 12px;
  }

  .ui-v3 .ipad-workbench-copy > span {
    display: none;
  }

  .ui-v3 .topbar-right {
    display: none;
  }

  .ui-v3 .mobile-export-slot {
    display: flex;
    grid-area: export;
    align-items: center;
    justify-content: flex-end;
  }

  .ui-v3 .mobile-export-slot [data-workflow-action="export"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid rgba(20, 105, 166, 0.32);
    border-radius: 12px;
    padding: 0 14px;
    color: #0b5e91;
    background: linear-gradient(135deg, rgba(225, 247, 247, 0.98), rgba(232, 240, 255, 0.98));
    box-shadow: 0 7px 16px rgba(17, 97, 156, 0.11);
    font-size: 15px;
    font-weight: 900;
    white-space: nowrap;
  }

  .ui-v3 .ipad-workflow-slot {
    display: block;
    margin: 0 0 18px;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: none;
    overflow: visible;
    gap: 10px;
    padding: 0;
    background: transparent;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions button {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 0 10px;
    font-size: 16px;
    justify-content: center;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions :is([data-workflow-action="add"], [data-workflow-action="timeblock"]) {
    min-height: 64px;
    font-size: 18px;
    font-weight: 900;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions [data-workflow-action="timeblock"] {
    border-color: rgba(14, 116, 111, 0.42);
    color: #075e59;
    background: linear-gradient(135deg, rgba(218, 247, 242, 0.98), rgba(228, 240, 255, 0.98));
    box-shadow: 0 8px 18px rgba(14, 116, 111, 0.1);
  }

  .ui-v3 .content-shell > .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .ui-v3 .content-shell > .quick-actions button {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 0 8px;
    font-size: 18px;
    font-weight: 850;
    justify-content: center;
  }

  .ui-v3 .content-shell > .view-status-bar .view-status-actions .ghost-button {
    min-height: 52px;
    font-size: 19px;
    font-weight: 900;
  }

  /* 手机课程清单：时间保持一行，强化课程、节数和详情入口的阅读层级。 */
  .ui-v3 #scheduleList .course-card .time {
    width: max-content;
    max-width: 100%;
    font-size: 20px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .ui-v3 #scheduleList .course-card .course-main strong {
    font-size: 19px;
    line-height: 1.35;
  }

  .ui-v3 #scheduleList .day-heading span:last-child {
    font-size: 16px;
    font-weight: 950;
  }

  .ui-v3 #scheduleList .course-card .row-actions [data-course-details] {
    min-height: 54px;
    font-size: 17px;
    font-weight: 900;
  }

  .ui-v3 #homePage .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ui-v3 #homePage .kpis article:nth-child(3) {
    grid-column: 1 / -1;
  }

  .ui-v3 #homePage :is(#nextCourseInsight, #secondNextCourseInsight) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  .ui-v3 *,
  .ui-v3 *::before,
  .ui-v3 *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* iPad and similar touch tablets use the phone-style bottom navigation,
   while keeping the tablet-sized content and management pages. */
@media (min-width: 801px) and (max-width: 1200px) and (pointer: coarse),
  (min-width: 801px) and (max-width: 1024px) and (hover: none) {
  .ui-v3 {
    background: #f5f8f7;
  }

  .ui-v3 .main-view {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .ui-v3 .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    height: auto;
    overflow: hidden;
    border-top: 1px solid rgba(15, 118, 110, 0.16);
    border-right: 0;
    border-bottom: 0;
    padding: 8px 12px calc(8px + var(--safe-bottom));
    background: rgba(251, 253, 252, 0.96);
    box-shadow: 0 -12px 34px rgba(16, 24, 40, 0.12);
  }

  .ui-v3 .brand,
  .ui-v3 .nav-group-label,
  .ui-v3 .tab small {
    display: none;
  }

  .ui-v3 .tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(96px, 1fr);
    grid-template-columns: none;
    gap: 6px;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .ui-v3 .tabs::-webkit-scrollbar {
    display: none;
  }

  .ui-v3 .tab[data-page="statsPage"],
  .ui-v3 .tab[data-page="analyticsPage"] {
    display: none !important;
  }

  .ui-v3 .tab {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 4px;
    min-width: 0;
    min-height: 62px;
    padding: 6px 4px;
    border-radius: 11px;
    text-align: center;
    font-size: 12px;
  }

  .ui-v3 .tab span {
    grid-row: auto;
    width: 30px;
    height: 30px;
  }

  .ui-v3 .tab strong {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-v3 .tab.active {
    box-shadow: inset 0 -3px 0 var(--green);
  }

  .ui-v3 .content-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
    padding-bottom: calc(108px + var(--safe-bottom));
  }

  .ui-v3 .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
    grid-template-areas: "brand account";
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 10px;
  }

  .ui-v3 .ipad-workbench-brand {
    display: grid;
    grid-area: brand;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    min-width: 0;
  }

  .ui-v3 .ipad-workbench-logo {
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(22, 113, 93, 0.18);
  }

  .ui-v3 .ipad-workbench-logo img {
    display: block;
    width: 56px;
    height: 56px;
  }

  .ui-v3 .ipad-workbench-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
  }

  .ui-v3 .ipad-workbench-title-line {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
  }

  .ui-v3 .ipad-workbench-title-line strong {
    overflow: hidden;
    color: var(--ink);
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 900;
    letter-spacing: -0.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ui-v3 .ipad-workbench-version {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border: 1px solid rgba(37, 84, 199, 0.2);
    border-radius: 999px;
    padding: 0 10px;
    color: #2554c7;
    background: rgba(236, 241, 255, 0.92);
    font-size: 14px;
    font-weight: 900;
  }

  .ui-v3 .ipad-workbench-copy > span {
    color: var(--muted);
    font-size: 16px;
    font-weight: 700;
  }

  .ui-v3 .topbar-page-heading {
    display: none;
  }

  .ui-v3 .ipad-user-chip-slot {
    display: block;
    grid-area: account;
    width: 100%;
    min-width: 0;
  }

  .ui-v3 .topbar-right {
    display: contents;
  }

  .ui-v3 .ipad-workflow-slot {
    display: block;
    margin: 0 0 22px;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: none;
    gap: 10px;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions button {
    justify-content: center;
    min-width: 0;
    min-height: 54px;
    padding-right: 14px;
    padding-left: 14px;
    font-size: 16px;
  }

  /* 第一排是高频录入入口：更大、更高、颜色更集中。 */
  .ui-v3 .ipad-workflow-slot .workflow-actions [data-workflow-action="add"],
  .ui-v3 .ipad-workflow-slot .workflow-actions [data-workflow-action="timeblock"] {
    min-height: 68px;
    font-size: clamp(18px, 2.05vw, 22px);
    font-weight: 900;
    letter-spacing: 0.01em;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions [data-workflow-action="timeblock"] {
    border-color: rgba(14, 116, 111, 0.42);
    color: #075e59;
    background: linear-gradient(135deg, rgba(218, 247, 242, 0.98), rgba(228, 240, 255, 0.98));
    box-shadow: 0 8px 18px rgba(14, 116, 111, 0.1);
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions [data-workflow-action="scheduled"],
  .ui-v3 .ipad-workflow-slot .workflow-actions [data-workflow-action="overdue"] {
    min-height: 52px;
    font-size: 18px;
    font-weight: 850;
  }

  .ui-v3 .ipad-workflow-slot .workflow-actions button strong {
    min-width: 25px;
    height: 25px;
    font-size: 13px;
  }

  /* iPad 账户操作固定在顶栏右上；仅保留账号和退出。 */
  .ui-v3 .mobile-user-chip-slot {
    display: none;
  }

  .ui-v3 .user-chip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    justify-content: end;
    gap: 8px;
  }

  .ui-v3 .user-chip > * {
    min-width: 0;
    justify-content: center;
    text-align: center;
  }

  .ui-v3 .user-chip #roleLabel {
    grid-column: auto;
  }

  /* 页眉右侧三个操作采用同一阅读尺度，形成完整的账户操作组。 */
  .ui-v3 .user-chip :is([data-workflow-action="export"], #roleLabel, #logoutButton) {
    min-height: 44px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 900;
  }

  .ui-v3 .user-chip #roleLabel,
  .ui-v3 .user-chip #logoutButton {
    padding-right: 15px;
    padding-left: 15px;
  }

  .ui-v3 .user-chip [data-workflow-action="export"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid rgba(20, 105, 166, 0.32);
    border-radius: 12px;
    padding: 0 15px;
    color: #0b5e91;
    background: linear-gradient(135deg, rgba(225, 247, 247, 0.98), rgba(232, 240, 255, 0.98));
    box-shadow: 0 7px 16px rgba(17, 97, 156, 0.11);
    font-size: 16px;
    font-weight: 900;
    white-space: nowrap;
  }

  .ui-v3 .user-chip [data-workflow-action="export"]:hover {
    border-color: rgba(20, 105, 166, 0.6);
    color: #06466f;
    background: linear-gradient(135deg, #d7f4f0, #ddeaff);
  }

  .ui-v3 .user-chip #deploymentModeLabel,
  .ui-v3 .user-chip #shutdownButton {
    display: none !important;
  }

  /* 平板首页遵循手机的阅读顺序：筛选后先看日历/清单，再看统计。 */
  .ui-v3 #homePage .schedule-board {
    order: 1;
  }

  .ui-v3 #homePage .kpis {
    order: 2;
  }
}
