:root {
  --bg-gradient: linear-gradient(140deg, #eaf6ff, #f7fbff);
  --mesh-color: rgba(15, 138, 141, 0.04);
  --page-pad: 20px;
}

[v-cloak] {
  display: none;
}

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  background: var(--bg-gradient);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  overflow-x: hidden;
}

#app {
  min-height: 100%;
}

body[data-app-booted="1"] .boot-status {
  display: none;
}

.boot-status {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-size: 14px;
  color: #4c5967;
  background: var(--bg-gradient);
  z-index: 10;
}

body[data-app-load-timeout="1"] .boot-status {
  color: #c45656;
}

.background-mesh {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(var(--mesh-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--mesh-color) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: -1;
}

.app-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--page-pad) 28px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.app-container > .el-container {
  min-width: 0;
  min-height: 100vh;
}

.app-container .el-main {
  min-width: 0;
  padding: 0;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: auto !important;
  min-height: 80px;
  padding: 14px 20px !important;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  margin-bottom: 20px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo .el-icon {
  flex: 0 0 auto;
}

.titles {
  min-width: 0;
}

.titles h1 {
  margin: 0;
  font-size: 20px;
  color: #0f2432;
  letter-spacing: 0.5px;
}

.titles .subtitle {
  display: block;
  font-size: 12px;
  color: #88929b;
  overflow-wrap: anywhere;
}

.user-action {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
  max-width: 100%;
  min-width: 0;
}

.user-action .el-dropdown-link {
  max-width: 100%;
  min-width: 0;
}

.user-name {
  display: inline-flex;
  align-items: center;
  max-width: min(42vw, 260px);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.announcement-entry-badge,
.announcement-entry-button {
  flex: 0 0 auto;
}

.announcement-entry-badge {
  line-height: 1;
}

.announcement-entry-badge .el-badge__content.is-dot {
  right: 5px;
  top: 4px;
}

.auth-box-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 108px);
  padding: 24px 0;
}

.auth-card {
  width: min(400px, 100%);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.05) !important;
}

.dashboard-container,
.dashboard-container .el-tabs,
.dashboard-container .el-tabs__content,
.el-card,
.el-card__body {
  min-width: 0;
}

.dashboard-container .el-tabs--border-card {
  border-radius: 12px;
  border: none;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
}

.dashboard-container .el-tabs--border-card > .el-tabs__header {
  background: rgba(250, 252, 255, 0.8);
  border-radius: 12px 12px 0 0;
}

.dashboard-container .el-tabs__nav-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}

.dashboard-container .el-tabs__nav {
  white-space: nowrap;
}

.dashboard-container .el-row {
  row-gap: 20px;
}

.dashboard-container .el-col {
  min-width: 0;
}

.el-card {
  border-radius: 10px;
  border-color: #ebeef5;
}

.el-card__header {
  background: #fcfdfe;
  border-bottom: 1px solid #ebeef5;
  border-radius: 10px 10px 0 0;
  padding: 15px 20px;
}

.card-header {
  flex-wrap: wrap;
}

.section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.section-toggle-title {
  font-size: 16px;
  font-weight: 600;
}

.mobile-collapse-summary {
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #606266;
  font-size: 12px;
}

.section-summary-text {
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapse-chevron {
  font-size: 16px;
  transition: transform 0.18s ease;
}

.collapse-chevron.is-open {
  transform: rotate(180deg);
}

.collapse-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #606266;
  line-height: 1;
}

.code-input-row .el-input {
  min-width: 0;
}

.code-input-row .el-button,
.platform-actions .el-button,
.log-actions .el-button,
.qqbot-actions .el-button,
.rule-card-actions .el-button,
.event-card-actions .el-button,
.dialog-footer .el-button {
  margin-left: 0 !important;
}

.log-actions {
  flex-wrap: wrap;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-scroll > .el-table {
  min-width: 620px;
}

.assignment-table > .el-table {
  min-width: 560px;
}

.rule-table > .el-table {
  min-width: 680px;
}

.user-table > .el-table {
  min-width: 860px;
}

.announcement-admin-table > .el-table {
  min-width: 760px;
}

.log-table > .el-table {
  min-width: 760px;
}

.table-scroll .el-table .cell {
  line-height: 1.45;
}

.event-pagination {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.rule-card-list {
  display: none;
}

.group-rule-panel {
  padding: 12px 16px 16px;
  background: #f8fafc;
  border: 1px solid #ebeef5;
  border-radius: 8px;
}

.group-rule-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.group-rule-panel-title {
  min-width: 0;
  color: #303133;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.assignment-card-list {
  display: none;
}

.announcement-admin-card-list {
  display: none;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  color: #909399;
  font-size: 12px;
  line-height: 1.3;
}

.rule-target-text {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #303133;
  line-height: 1.45;
}

.announcement-dialog-body {
  min-height: 120px;
}

.announcement-list {
  display: grid;
  gap: 14px;
  max-height: min(540px, calc(100vh - 220px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.announcement-item {
  border: 1px solid #ebeef5;
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px 14px 18px;
  position: relative;
  overflow: hidden;
}

.announcement-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
}

.announcement-item--feature {
  border-color: #e1f3d8;
}

.announcement-item--feature::before {
  background: #67c23a;
}

.announcement-item--bugfix {
  border-color: #faecd8;
}

.announcement-item--bugfix::before {
  background: #e6a23c;
}

.announcement-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.announcement-item h3 {
  min-width: 0;
  margin: 0;
  color: #303133;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.announcement-item time,
.announcement-card-head span {
  flex: 0 0 auto;
  color: #909399;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.announcement-item p,
.announcement-admin-mobile-card p,
.event-description-view {
  margin: 0;
  color: #606266;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.event-description-view {
  max-height: min(540px, calc(100vh - 220px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.announcement-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.announcement-card-head strong {
  min-width: 0;
  color: #303133;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.announcement-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.account-actions-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.account-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #ebeef5;
}

.account-action-row:first-child {
  padding-top: 4px;
}

.account-action-row:last-child {
  padding-bottom: 4px;
  border-bottom: 0;
}

.account-action-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.account-action-title {
  font-size: 14px;
  font-weight: 600;
  color: #303133;
}

.account-action-desc {
  font-size: 12px;
  color: #909399;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qqbot-copy-button {
  transition: color 0.18s ease, transform 0.18s ease;
}

.qqbot-copy-button.is-copied {
  color: #67c23a;
  transform: scale(1.08);
}

.qqbot-copy-button.is-copied .el-icon {
  animation: qqbot-copy-check 0.36s ease;
}

@keyframes qqbot-copy-check {
  0% {
    transform: scale(0.72) rotate(-12deg);
    opacity: 0.3;
  }
  60% {
    transform: scale(1.18) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 960px) {
  .dashboard-container .el-col {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  :root {
    --page-pad: 12px;
  }

  .header {
    min-height: 72px;
    margin-bottom: 12px;
    padding: 12px 16px !important;
  }

  .mobile-collapse-summary {
    display: inline-flex;
  }

  .platform-status-card:not(.is-expanded) > .el-card__body {
    display: none;
  }

  .dashboard-container .el-tabs--border-card > .el-tabs__content {
    padding: 12px;
  }

  .el-card__header {
    padding: 12px 14px;
  }

  .el-card__body {
    padding: 14px;
  }

  .auth-box-container {
    align-items: flex-start;
    min-height: calc(100vh - 96px);
    padding: 16px 0;
  }

  .card-header {
    align-items: stretch !important;
    flex-direction: column;
  }

  .card-header > div {
    width: 100%;
  }

  .card-header .el-select,
  .card-header > .el-button {
    width: 100% !important;
  }

  .platform-actions .el-button,
  .log-actions .el-button {
    flex: 1 1 160px;
    white-space: normal;
  }

  .sync-config-row .el-input-number {
    width: 148px;
  }

  .rule-table {
    display: none;
  }

  .group-rule-panel {
    padding: 10px;
  }

  .group-rule-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .group-rule-panel-head .el-button {
    width: 100%;
  }

  .announcement-admin-table {
    display: none;
  }

  .assignment-table {
    display: none;
  }

  .announcement-admin-card-list {
    display: grid;
    gap: 12px;
    max-height: min(520px, calc(100vh - 260px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .announcement-admin-mobile-card,
  .announcement-mobile-empty {
    border: 1px solid #ebeef5;
    border-radius: 8px;
    background: #fff;
  }

  .announcement-admin-mobile-card {
    padding: 12px;
  }

  .assignment-card-list {
    display: grid;
    gap: 10px;
    max-height: min(500px, calc(100vh - 280px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .assignment-mobile-card {
    border: 1px solid #ebeef5;
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
  }

  .assignment-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(118px, max-content);
    align-items: start;
    gap: 12px;
  }

  .assignment-title-wrap,
  .assignment-deadline-wrap,
  .assignment-card-meta {
    min-width: 0;
  }

  .assignment-deadline-wrap {
    text-align: right;
  }

  .assignment-deadline-wrap strong {
    display: block;
    color: #303133;
    font-size: 13px;
    line-height: 1.35;
    white-space: nowrap;
  }

  .assignment-mobile-card .assignment-title-link {
    display: inline-flex;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.35;
  }

  .assignment-mobile-card .assignment-title-link .el-link__inner,
  .assignment-title-text {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .assignment-title-text {
    color: #303133;
    font-size: 14px;
    line-height: 1.35;
  }

  .assignment-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f2f5;
  }

  .assignment-card-meta .field-label {
    margin-bottom: 0;
  }

  .event-card-actions {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
  }

  .event-card-actions .el-button {
    flex: 0 1 72px;
  }

  .assignment-course-text {
    min-width: 0;
    overflow: hidden;
    color: #606266;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .assignment-mobile-empty {
    border: 1px dashed #dcdfe6;
    border-radius: 8px;
    background: #fff;
  }

  .rule-card-list {
    display: grid;
    gap: 12px;
    max-height: min(520px, calc(100vh - 260px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .rule-mobile-card {
    border: 1px solid #ebeef5;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
  }

  .rule-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f2f5;
  }

  .rule-lead-time-field {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
  }

  .rule-lead-time-field .field-label {
    margin-bottom: 0;
  }

  .rule-card-grid {
    display: grid;
    grid-template-columns: minmax(86px, max-content) minmax(0, 1fr);
    align-items: start;
    column-gap: 12px;
    row-gap: 8px;
    padding: 10px 0 12px;
  }

  .rule-channel-field,
  .rule-target-field {
    min-width: 0;
  }

  .rule-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .rule-card-actions .el-button {
    flex: 1 1 80px;
  }

  .announcement-card-actions .el-button {
    flex: 1 1 88px;
  }

  .announcement-item-head {
    display: block;
  }

  .announcement-item time {
    display: block;
    margin-top: 4px;
  }
}

@media (max-width: 560px) {
  .header {
    align-items: flex-start;
    flex-direction: row;
    gap: 10px;
  }

  .logo {
    flex: 1 1 auto;
  }

  .titles h1 {
    font-size: 18px;
  }

  .titles .subtitle {
    font-size: 11px;
  }

  .user-action .el-dropdown-link {
    width: auto;
    justify-content: flex-end;
  }

  .user-action {
    gap: 8px;
  }

  .user-name {
    max-width: 96px;
  }

  .announcement-entry-button {
    width: 32px;
    height: 32px;
  }

  .auth-card .el-card__body {
    padding: 18px 16px;
  }

  .code-input-row {
    flex-direction: column;
    gap: 8px !important;
  }

  .code-input-row .el-button {
    width: 100%;
    white-space: normal;
  }

  .sync-config-row {
    align-items: stretch !important;
  }

  .sync-config-row .el-input-number,
  .sync-config-row .el-button {
    width: 100%;
  }

  .qqbot-actions .el-button {
    flex: 1 1 130px;
    white-space: normal;
  }

  .assignment-card-main {
    grid-template-columns: minmax(0, 1fr) minmax(112px, max-content);
    gap: 10px;
  }

  .el-dialog {
    width: calc(100vw - 24px) !important;
    margin: 12px auto !important;
  }

  .el-dialog__header {
    padding: 16px 16px 8px;
  }

  .el-dialog__body {
    max-height: calc(100vh - 152px);
    overflow-y: auto;
    padding: 12px 16px;
  }

  .el-dialog__footer {
    padding: 8px 16px 16px;
  }

  .el-dialog .el-form-item {
    display: block;
  }

  .el-dialog .el-form-item__label {
    display: block;
    width: auto !important;
    height: auto;
    margin-bottom: 6px;
    text-align: left;
  }

  .el-dialog .el-form-item__content {
    margin-left: 0 !important;
    width: 100%;
  }

  .el-dialog .el-input-number,
  .el-dialog .el-select {
    width: 100% !important;
  }

  .dialog-footer {
    align-items: stretch;
  }

  .dialog-footer .el-button {
    flex: 1 1 120px;
    min-height: 34px;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  :root {
    --page-pad: 10px;
  }

  .header {
    padding: 12px !important;
  }

  .dashboard-container .el-tabs__item {
    padding: 0 12px;
  }

  .titles .subtitle {
    display: none;
  }

  .logo {
    gap: 8px;
  }

  .user-name {
    max-width: 72px;
  }

  .user-name .el-tag {
    display: none;
  }

  .el-card__body {
    padding: 12px;
  }
}

/* BJFU schedule grid */
.bjfu-schedule .bjfu-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.bjfu-schedule .bjfu-grid th,
.bjfu-schedule .bjfu-grid td {
  border: 1px solid #ebeef5;
  padding: 4px;
  vertical-align: top;
  font-size: 12px;
  text-align: center;
  min-height: 48px;
  height: 48px;
}
.bjfu-schedule .bjfu-grid thead th {
  background: #f5f7fa;
  font-weight: 600;
  font-size: 13px;
}
.bjfu-schedule .bjfu-grid tbody th {
  background: #fafafa;
  font-weight: 500;
  color: #606266;
}
.bjfu-schedule .bjfu-cell {
  background: #ecf5ff;
  border-left: 3px solid #409eff;
  padding: 6px 4px;
  text-align: left;
}
.bjfu-schedule .bjfu-cell .cn {
  font-weight: 600;
  color: #303133;
  font-size: 12px;
  line-height: 1.3;
  margin-bottom: 2px;
}
.bjfu-schedule .bjfu-cell .meta {
  font-size: 11px;
  color: #606266;
  line-height: 1.3;
}
@media (max-width: 768px) {
  .bjfu-schedule .bjfu-grid th,
  .bjfu-schedule .bjfu-grid td {
    font-size: 10px;
    padding: 2px;
  }
  .bjfu-schedule .bjfu-cell .cn { font-size: 11px; }
  .bjfu-schedule .bjfu-cell .meta { font-size: 9px; }
}
