/* style.css —— 工作生活 App 样式 */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #8e8e93;
  --line: #e5e5ea;
  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 15px; }

/* ---------- 布局 ---------- */
#app { display: flex; min-height: 100vh; }

#sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 17px; font-weight: 700; padding: 6px 10px 14px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  border: none; background: transparent;
  padding: 11px 12px; border-radius: 10px;
  font-size: 15px; color: var(--text);
}
.nav-btn:hover { background: var(--bg); }
.nav-btn.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-btn .ico { font-size: 18px; }

#main { flex: 1; padding: 22px; max-width: 920px; }
#tabbar { display: none; }

.sync-pill {
  margin-top: auto; padding: 10px 12px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line);
}
.sync-pill .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c7c7cc; margin-right: 6px; }
.sync-pill.on .dot { background: var(--ok); }

/* ---------- 通用 ---------- */
.page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.btn {
  border: none; border-radius: 10px; padding: 8px 14px; font-size: 14px;
  background: var(--brand); color: #fff; font-weight: 600;
}
.btn:hover { opacity: .92; }
.btn.ghost { background: var(--bg); color: var(--text); font-weight: 500; }
.btn.danger { background: #fee2e2; color: var(--danger); }
.btn.small { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.btn.warn { background: #fef3c7; color: var(--warn); }

input[type=text], input[type=number], input[type=date], input[type=time], input[type=url], textarea, select {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; min-height: 64px; }

.form-row { display: flex; gap: 8px; margin-bottom: 10px; }
.form-row > * { flex: 1; }
.form-row > .grow2 { flex: 2; }
.form-row > .nogrow { flex: 0 0 auto; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--bg); color: var(--muted); }
.tag.p1 { background: #fee2e2; color: var(--danger); }
.tag.p2 { background: #fef3c7; color: var(--warn); }
.tag.p3 { background: #dcfce7; color: var(--ok); }

.item { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: none; }
.item .grow { flex: 1; min-width: 0; }
.item .title { word-break: break-word; }
.item .sub { color: var(--muted); font-size: 12px; }
.item.done .title { text-decoration: line-through; color: var(--muted); }

.checkbox { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--brand); }

.empty { color: var(--muted); text-align: center; padding: 22px 0; font-size: 14px; }

/* 主页大卡片 */
.hero { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.hero .date { font-size: 14px; opacity: .85; }
.hero h1 { margin: 6px 0 2px; font-size: 24px; }
.hero p { margin: 0; font-size: 13px; opacity: .85; }

.summary-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 640px) { .summary-cards { grid-template-columns: 1fr 1fr; } }
.scard { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; cursor: pointer; }
.scard:hover { outline: 2px solid var(--brand-soft); }
.scard .t { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.scard .n { font-size: 26px; font-weight: 700; color: var(--brand); }
.scard .d { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* 课表 */
.schedule-grid { display: grid; grid-template-columns: 56px repeat(7, 1fr); gap: 4px; }
.schedule-grid .cell {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  min-height: 46px; padding: 4px; font-size: 12px; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px;
}
.schedule-grid .cell.hd { background: var(--brand-soft); text-align: center; font-weight: 600; cursor: default; display: flex; align-items: center; justify-content: center; color: var(--brand); }
.schedule-grid .cell.today { border-color: var(--brand); }
.schedule-grid .cell .cls { background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 3px 5px; font-size: 11px; line-height: 1.2; }

/* 饮食/游戏卡片 */
.stat-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stat-row:last-child { border-bottom: none; }
.stat-row .val { font-weight: 700; font-size: 18px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal.open { display: flex; }
.modal-card { background: #fff; border-radius: var(--radius); padding: 20px; width: 100%; max-width: 420px; max-height: 86vh; overflow: auto; }
.modal-card h3 { margin: 0 0 14px; }

/* 移动端底部导航 */
@media (max-width: 720px) {
  #sidebar { display: none; }
  #main { padding: 16px 14px 86px; max-width: none; }
  #tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    background: var(--card); border-top: 1px solid var(--line);
    justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 40;
  }
  .tab-btn { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--muted); padding: 4px 6px; }
  .tab-btn .ico { font-size: 20px; }
  .tab-btn.active { color: var(--brand); }
  .schedule-grid { grid-template-columns: 44px repeat(7, 1fr); }
  .schedule-grid .cell { min-height: 38px; font-size: 10px; padding: 2px; }
  .schedule-grid .cell .cls { font-size: 9px; padding: 2px 3px; }
}
