/* 课表登记 - 浅色清爽风格 */
:root {
  --bg: #F9FAFB;
  --text: #1F2937;
  --text-dim: #6B7280;
  --line: #E5E7EB;
  --primary: #1E3A8A;
  --primary-soft: #EEF2FF;
  --blue-cell: #7EA6F2;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--primary);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 16px;
  max-width: 720px;
  margin: 0 auto;
}
.brand { font-weight: 600; font-size: 16px; letter-spacing: .5px; }
.identity {
  background: rgba(255,255,255,.16);
  border: 0;
  color: #fff;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.identity.is-empty { background: rgba(255,255,255,.3); }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px 0;
}
.view[hidden] { display: none; }

/* 卡片 */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}
.hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-dim);
}
.meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}
.count { color: var(--primary); }

/* 表单 */
.field { display: block; margin-bottom: 12px; }
.field-label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
input[type="text"] {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
}
input[type="text"]:focus { border-color: var(--primary); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 18px;
  font-size: 15px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity .15s;
  flex: 1;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: #F3F4F6; color: var(--text); border-color: var(--line); }
.btn-block { width: 100%; }
.btn-link {
  background: none;
  border: 0;
  color: var(--primary);
  font-size: 14px;
  font-family: inherit;
  padding: 4px 0;
}
.row { display: flex; gap: 10px; margin-top: 4px; }

/* 顶栏下的小圆角标签 */
.pill {
  flex: none;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

/* 活动页头部 */
.activity-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.activity-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  word-break: break-all;
}
.creator-actions { margin-top: 14px; display: grid; gap: 8px; }

/* 列表 */
.list { display: grid; gap: 8px; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}
.list-item:active { background: #F3F4F6; }
.list-item-main { min-width: 0; }
.list-item-title {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-sub { font-size: 12px; color: var(--text-dim); }
.empty { margin: 0; font-size: 13px; color: var(--text-dim); }

/* 状态条 */
.status { margin: 10px 0 0; font-size: 13px; color: var(--text-dim); min-height: 18px; }
.status.is-error { color: var(--danger); }
.status.is-busy { color: var(--primary); }

.preview-wrap { margin-top: 12px; }
.preview-wrap img {
  display: block;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

/* 课表网格 */
.grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grid {
  border-collapse: collapse;
  width: 100%;
  min-width: 300px;
  table-layout: fixed;
}
.grid th, .grid td {
  border: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  padding: 0;
}
.grid th {
  background: #F3F4F6;
  color: var(--text-dim);
  font-weight: 500;
  height: 34px;
  font-size: 12px;
}
.grid th.seg-head { width: 58px; }
.grid td.seg {
  background: #F9FAFB;
  color: var(--text-dim);
  font-size: 12px;
  height: 44px;
}
.grid td.cell {
  height: 44px;
  cursor: pointer;
  user-select: none;
  transition: background .12s;
}
.grid td.cell.on { background: var(--blue-cell); }
.grid td.cell:active { opacity: .85; }
.grid.heat td.cell { cursor: default; }

/* 异常卡 */
.anomaly-list { display: grid; gap: 8px; }
.anomaly {
  background: var(--danger-soft);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.anomaly-head { font-size: 14px; color: var(--danger); font-weight: 600; }
.anomaly-body { font-size: 13px; color: var(--text); margin-top: 2px; }
.anomaly-ok {
  background: #F0FDF4;
  border-color: #BBF7D0;
  color: #166534;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}

/* 底部提交条 */
.footer-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(249,250,251,.94);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  z-index: 15;
}
.footer-bar .btn { max-width: 720px; margin: 0 auto; }
.footer-space { height: 76px; }

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 40;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  width: 100%;
  max-width: 420px;
  max-height: 86vh;
  overflow-y: auto;
}
.modal-title { margin: 0 0 4px; font-size: 17px; }
#modal-member .modal-card { max-width: 520px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: rgba(17,24,39,.9);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  z-index: 60;
  max-width: 80vw;
  text-align: center;
}
.toast[hidden] { display: none; }
