:root {
    --primary: #4f7cff;
    --primary-dark: #3b63d6;
    --bg: #f2f4f8;
    --card: #ffffff;
    --text: #1f2430;
    --muted: #8a93a6;
    --border: #e6e9f0;
    --danger: #e5484d;
    --success: #2fb37a;
    --warn: #f0a500;
    --radius: 14px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- 顶部栏 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--primary);
    color: #fff;
    padding-top: env(safe-area-inset-top, 0px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.topbar-inner {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-user { font-size: 13px; opacity: .9; }

/* ---------- 内容区 ---------- */
.content {
    padding: 14px 14px calc(84px + var(--safe-bottom));
    max-width: 720px;
    margin: 0 auto;
}

/* ---------- 闪存消息 ---------- */
.flash {
    max-width: 720px;
    margin: 10px auto 0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
}
.flash-success { background: #e3f7ee; color: #1c7a54; }
.flash-error   { background: #fde8e8; color: #b0272b; }
.flash-info    { background: #e7effe; color: #2f5bd0; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(20, 30, 60, .05);
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-title {
    font-size: 14px;
    color: var(--muted);
    margin: 18px 4px 8px;
    font-weight: 600;
}

/* ---------- 上课记录条目 ---------- */
.session-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--card);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(20, 30, 60, .05);
}
.session-bar { width: 5px; align-self: stretch; border-radius: 4px; background: var(--primary); }
.session-main { flex: 1; min-width: 0; }
.session-subject { font-weight: 600; font-size: 16px; }
.session-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.session-right { text-align: right; white-space: nowrap; }
.session-fee { font-weight: 700; font-size: 15px; }

/* ---------- 状态徽章 ---------- */
.badge {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}
.st-done    { background: #e3f7ee; color: #1c7a54; }
.st-extra   { background: #fff2d9; color: #a9760a; }
.st-planned { background: #e7effe; color: #2f5bd0; }
.st-leave   { background: #f0f1f5; color: #8a93a6; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 6px;
}
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=tel], select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, .15);
}
textarea { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 10px; }
.form-row > .form-group { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 13px 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
}
.btn:active { background: var(--primary-dark); }
.btn-secondary { background: #eef1f7; color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-sm { width: auto; padding: 7px 14px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; margin-top: 6px; }
.btn-row .btn { flex: 1; }

/* ---------- 列表通用 ---------- */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    background: var(--card);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(20, 30, 60, .05);
}
.list-main { min-width: 0; }
.list-title { font-weight: 600; }
.list-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.empty {
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* ---------- 汇总统计 ---------- */
.stat-row { display: flex; gap: 10px; margin-bottom: 12px; }
.stat {
    flex: 1;
    background: var(--card);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(20, 30, 60, .05);
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table td.num, .table th.num { text-align: right; }

/* ---------- 底部导航 ---------- */
.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #fff;
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .04);
}
.tab {
    flex: 1;
    text-align: center;
    padding: 7px 0 6px;
    color: var(--muted);
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.tab.active { color: var(--primary); }
.tab-ico { font-size: 20px; line-height: 1; }
.tab-add {
    flex: 0 0 auto;
    position: relative;
    top: -14px;
}
.tab-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px; height: 50px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 30px;
    font-weight: 300;
    box-shadow: 0 4px 12px rgba(79, 124, 255, .4);
}

/* ---------- 登录页 ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #4f7cff, #6f5bff);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
}
.auth-logo { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* 分段筛选 */
.segment {
    display: flex;
    background: #e9edf5;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 14px;
    overflow-x: auto;
}
.segment a {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}
.segment a.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.month-nav a { padding: 6px 14px; background: #fff; border-radius: 10px; font-weight: 600; }
.month-nav .month-label { font-size: 17px; font-weight: 700; }

.link-list a.list-item { color: var(--text); }
.chev::after { content: '›'; color: var(--muted); font-size: 20px; margin-left: 8px; }

/* ---------- 今日课程一键操作 ---------- */
.occ { margin-bottom: 10px; }
.occ-actions {
    border-radius: 0 0 14px 14px;
    overflow: hidden;
    border-top: 1px solid var(--border);
}
.occ-btn-row { display: flex; gap: 1px; background: var(--border); }
.occ-af { flex: 1; display: flex; }
.btn-act {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
    padding: 11px 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    text-align: center;
}
.btn-act:active { background: #f0f2f7; }
.btn-act-done { color: var(--success); }
.btn-act-cancel { color: var(--danger); }
.btn-act-postpone { color: var(--warn); }
.occ-postpone-form {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #fbfcfe;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.occ-postpone-form.open { display: flex; }

/* ---------- 每周上课时段 ---------- */
.sched-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.sched-row select { flex: 0 0 40%; }
.sched-row input[type=time] { flex: 1; }
.sched-del {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--danger);
    width: 40px;
    height: 44px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
}
.sched-del:active { background: #fde8e8; }
.occ-postpone-form label { font-size: 14px; color: var(--muted); white-space: nowrap; }
.occ-postpone-form input[type=date] { flex: 1; min-width: 130px; }
.occ-postpone-form .btn { width: auto; }
