/**
 * 桌面首页共享布局：滚动区域、响应式栅格、课表行与 iframe。
 */
.main-wrapper {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  display: flex;
  min-width: 0;
  height: 60px;
  flex: 0 0 60px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 40px);
  -webkit-app-region: drag;
}

.breadcrumb,
.top-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  -webkit-app-region: no-drag;
}

.breadcrumb {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.breadcrumb i,
.breadcrumb svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--text-tertiary);
}

.breadcrumb span:last-child {
  overflow: hidden;
  color: var(--text-primary);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions { justify-content: flex-end; }

.clock {
  padding: 7px 11px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-ctrl);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: 1480px;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  margin: 0 auto;
  padding: 10px clamp(16px, 3vw, 40px) 24px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.bento-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: minmax(150px, auto);
  align-content: start;
  gap: 16px;
}

.span-8 { grid-column: span 8; }
.span-4 { grid-column: span 4; }

.schedule-track {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
  overflow: visible;
}

.s-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  transition: border-color 160ms ease, background 160ms ease;
}

.s-item:hover { border-color: var(--border-strong); }
.s-item.is-secondary { opacity: 0.82; }

.s-time {
  width: 48px;
  flex: 0 0 48px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.s-content {
  min-width: 0;
  flex: 1 1 auto;
}

.s-content h4 {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.s-content p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.btn-sm {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 7px 12px;
  color: var(--accent);
  background: var(--soft);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease;
}

.btn-sm:hover { border-color: var(--accent); }
.btn-sm:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.badge {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}


.dsh-class-list {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.dsh-class-row {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.dsh-class-index {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  color: var(--accent);
  background: var(--soft);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

.dsh-class-copy { min-width: 0; flex: 1 1 auto; }

.dsh-class-name {
  margin: 0 0 3px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.dsh-class-teacher {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.dsh-class-total {
  margin: 8px 2px 0;
  color: var(--text-secondary);
  font-size: 11px;
}

.dth-empty {
  margin: 0;
  padding: 14px;
  color: var(--text-secondary);
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.dth-empty a,
.dth-empty button {
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.dth-shell-frame,
.dsh-shell-frame {
  display: none;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  background: var(--bg-canvas);
  border: 0;
}

body.shell-framed #dthViewHome,
body.shell-framed #dshViewHome { display: none; }

body.shell-framed .dth-shell-frame,
body.shell-framed .dsh-shell-frame { display: block; }

@media (max-width: 1100px) {
  .top-bar { padding-inline: 20px; }
  .container { padding-inline: 20px; }
  .bento-grid { gap: 14px; }
}

@media (max-width: 900px) {
  .bento-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .span-8 { grid-column: span 6; }
  .span-4 { grid-column: span 3; }
}

@media (max-width: 620px) {
  .top-bar {
    height: 52px;
    flex-basis: 52px;
    padding-inline: 12px;
  }

  .clock { padding: 6px 8px; font-size: 11px; }
  .container { padding: 8px 12px 20px; }
  .bento-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .span-8,
  .span-4 { grid-column: 1 / -1; }
  .s-item { align-items: flex-start; gap: 8px; padding: 11px; }
  .s-time { width: 42px; flex-basis: 42px; }
  .s-item .btn-sm { white-space: normal; }
}

body.layout-compact .container { padding-bottom: 16px; }
body.layout-compact .bento-grid { gap: 12px; }

@media (max-height: 720px) {
  .top-bar { height: 52px; flex-basis: 52px; }
  .container { padding-top: 8px; padding-bottom: 16px; }
  .bento-grid { gap: 12px; }
}
