/* ============================================================================
   app.css —— 布局壳 + 多端适配层
   在 Semantic UI 之上做增强，不替换它：
     · Semantic UI 继续负责组件（按钮 / 标签 / 消息 / 表格 / 表单 / 统计）
     · 这一层负责：顶栏、手机底部标签栏、侧边抽屉、表格→卡片、触控尺寸、安全区
   加载顺序：semantic.min.css → app.css（所以这里的规则能覆盖 Semantic 的默认值）
   ========================================================================== */

:root {
  --brand: #07C160;
  --brand-dark: #048F45;
  --brand-soft: #E9F9F0;
  --ink-1: #111827;
  --ink-2: #374151;
  --ink-3: #6B7280;
  --ink-4: #9CA3AF;
  --line: #E6E8EC;
  --bg: #F4F6F8;

  --bar-h: 56px;
  --tab-h: 58px;
  --page-max: 1120px;
  --radius: 14px;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ---------------------------------------------------------------- 基础 --- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light;      /* 告诉微信/iOS 别自作主张反色，否则配色会花 */
}

/* 全局缩放旋钮：Semantic 所有组件的尺寸都用 rem，所以根字号一动，
   按钮、菜单项、输入框、表格单元格会整体等比放大。
   Semantic 默认是 14px 且没有断点调整 —— 手机上就是这么显得小的。
   桌面 15px（比默认略大），手机 16px。 */
html { font-size: 15px; }

@media (max-width: 767px) {
  html { font-size: 16px; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-1);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* 顶栏是 Semantic 的 ui top fixed menu，会脱离文档流。
     app.js 启动后会量出真实高度覆盖这里；这段只是 JS 跑起来之前的占位，
     避免首屏内容窜到顶栏底下（Semantic 默认菜单项高约 2.86rem）。 */
  padding-top: 46px;
}

a { color: var(--brand-dark); }

/* 内容容器：不要覆盖 Semantic 的 .ui.container！
   它自己会按断点处理宽度和居中（手机 margin-left/right 各 1em，桌面固定宽度居中），
   之前这里用 margin:auto !important 覆盖了它，把手机端的左右留白抹成了 0，
   内容就贴到屏幕边上了。这里只补上下间距。 */
.app-main { padding: 18px 6px 34px; }

@media (max-width: 767px) {
  .app-main { padding: 12px 6px 28px; }
}

/* ------------------------------------------------------- 显示/隐藏工具 --- */

@media (max-width: 767px) { .only-desktop { display: none !important; } }
@media (min-width: 768px) { .only-mobile { display: none !important; } }

/* ------------------------------------------- 表格 → 手机上的卡片式列表 --- */

.rtable-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 767px) {
  /* Semantic 的 .ui.table 在窄屏会横向滚动，长表格很难看；
     这里把它拆成一条条带字段名的小卡片 */
  .ui.table.rtable,
  .ui.table.rtable tbody,
  .ui.table.rtable tr,
  .ui.table.rtable td {
    display: block;
    width: 100% !important;
    border: none !important;
  }

  .ui.table.rtable thead { display: none; }

  .ui.table.rtable tr {
    background: #fff !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  }

  .ui.table.rtable td {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 13px !important;
    border-bottom: 1px solid #F3F4F6 !important;
    font-size: 0.933rem;
    text-align: left !important;
  }

  .ui.table.rtable td:last-child { border-bottom: none !important; }

  .ui.table.rtable td::before {
    content: attr(data-label);
    flex: 0 0 5.5em;
    color: var(--ink-3);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.9;
  }

  .ui.table.rtable td[data-label=""]::before { content: none; }

  .ui.table.rtable td .cell-actions { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
  .ui.table.rtable td .cell-actions form { margin: 0; }
}

.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cell-actions form { margin: 0; }

/* --------------------------------------------------------- 自定义组件 --- */

/* 统计卡片 */
.stat-card.grey { border-left-color: var(--ink-4); }
.stat-card.blue { border-left-color: #3B82F6; }

.stat-card .l { color: var(--ink-3); font-size: 0.8rem; margin-top: 2px; }

@media (max-width: 767px) {
.stat-card .n { font-size: 1.4rem; }
}

/* 首页功能入口 */
.entry:active { background: #FAFAFB; }
.hero h1 { color: #fff; margin: 0 0 4px; font-size: 1.333rem; font-weight: 700; }
.hero .hero-tags { margin-top: 10px; }
@media (max-width: 767px) {
.hero h1 { font-size: 1.2rem; }
}

/* 待办卡片 */
/* 分段筛选（全部 / 待完成 / 已完成） */
.seg {
  display: inline-flex;
  background: #EBEEF1;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.seg a {
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 0.867rem;
  color: var(--ink-2);
}

.seg a.active {
  background: #fff;
  color: var(--brand-dark);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}

/* 空状态 */
.empty i.icon { font-size: 2.267rem !important; color: #D8DCE1 !important; display: block; margin-bottom: 10px !important; }

/* 标签输入区的已知标签快捷按钮 */
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* Semantic 组件的几处统一调整 */
.ui.segment { border-radius: var(--radius) !important; box-shadow: 0 1px 2px rgba(16, 24, 40, .04) !important; border: 1px solid var(--line) !important; }
.ui.message { border-radius: 12px !important; }
.ui.table { border-radius: var(--radius) !important; }
.ui.form .field > label { color: var(--ink-2) !important; font-size: 0.867rem !important; }
.ui.header .sub.header { font-size: 0.867rem !important; }

/* 手机上加大触控区域 + 防止 iOS 聚焦时自动放大（字号必须 ≥16px） */
@media (max-width: 767px) {
  .ui.button { min-height: 40px; }
  .ui.mini.button, .ui.tiny.button { min-height: 34px; padding: 7px 11px !important; font-size: 0.8rem !important; }

@media (max-width: 767px) {
  .ui.mini.button, .ui.tiny.button { min-height: 40px; padding: 9px 14px !important; font-size: 0.88rem !important; }
}
  input, select, textarea, .ui.input > input { font-size: 1.067rem !important; }
  .ui.form .field { margin-bottom: 14px !important; }
  .ui.form input[type="text"], .ui.form input[type="password"], .ui.form select, .ui.form textarea { min-height: 42px; }
}

/* 表单里的小提示 */
.hint { color: var(--ink-3); font-size: 0.8rem; margin-top: 5px; }
.muted { color: var(--ink-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* 登录/注册这类居中页：桌面垂直居中，手机自然流式并留出键盘空间 */


.auth-icon i.icon { font-size: 1.6rem !important; margin: 0 !important; }
/* 表格里的学号/姓名等窄列，桌面端别被撑开 */
.nowrap { white-space: nowrap; }
.break-all { word-break: break-all; }

/* 表格里的复选框：用原生控件 + accent-color，比 Semantic 的 checkbox 组件轻得多 */
.row-check,
[data-check-all] {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
  vertical-align: middle;
  cursor: pointer;
}

@media (max-width: 767px) {
  .row-check,
  [data-check-all] { width: 20px; height: 20px; }
}

/* 超宽屏幕（≥1440px）给后台表格多一点呼吸空间 */
@media (min-width: 1441px) {
  :root { --page-max: 1240px; }
}

/* ----------------------------------------------------------- 课表网格 --- */

/* 手机上靠横向滚动看全 7 天，桌面上整屏铺开 */
.sched-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .05);
  padding-bottom: 4px;
}

.sched {
  display: grid;
  min-width: 700px;
  position: relative;
}

.sched-corner,
.sched-day {
  background: #FAFAFB;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 3;
  line-height: 1.25;
}

.sched-corner {
  left: 0;
  z-index: 4;
  font-size: 0.733rem;
  color: var(--ink-3);
}

.sched-day-name { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.sched-day-date { font-size: 0.667rem; color: var(--ink-4); }

.sched-day.is-today { background: var(--brand-soft); }
.sched-day.is-today .sched-day-name { color: var(--brand-dark); }

.sched-period {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #FCFCFD;
  position: sticky;
  left: 0;
  z-index: 2;
  line-height: 1.2;
}

.sched-period b { font-size: 0.8rem; color: var(--ink-2); }
.sched-period span { font-size: 0.6rem; color: var(--ink-4); }

.sched-cell {
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  background: #fff;
}

.sched-cell.is-today { background: #F7FDF9; }

.sched-course {
  position: relative;
  z-index: 1;
  margin: 2px;
  border-radius: 8px;
  padding: 4px 6px;
  color: #fff;
  overflow: hidden;
  font-size: 0.733rem;
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 1px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .18);
}

.sched-course-name {
  font-weight: 600;
  font-size: 0.767rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sched-course-sub {
  opacity: .9;
  font-size: 0.667rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .sched { min-width: 640px; }
  .sched-course-name { font-size: 0.733rem; }
}

/* 课程颜色小圆点（后台列表 / 编辑页用） */
.course-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 5px;
}

