/* ============================================================
   GXU Toolbox Web —— 响应式样式
   移动端优先：底部 tabbar + 卡片流
   ≥768px：左侧固定侧栏 + 宽幅内容区（表格/课表放大）
   ============================================================ */

:root {
    --primary: #1667ff;
    --primary-weak: #e8f0ff;
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #1c2333;
    --text2: #5c6b8a;
    --text3: #98a5c0;
    --border: #e6eaf2;
    --danger: #e5484d;
    --ok: #18a058;
    --warn: #f0a020;
    --radius: 14px;
    --cellH: 52px;
    --sidebarW: 232px;
    --topbarH: 52px;
    --tabbarH: 56px;
    --shadow: 0 2px 10px rgba(28, 40, 80, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 顶部栏 ---------- */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 60;
    height: var(--topbarH);
    display: flex; align-items: center; gap: 10px;
    padding: 0 14px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 17px; font-weight: 700; flex: 1; }
.topbar-user { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
    border: 0; background: transparent; font-size: 20px; color: var(--text);
    width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
}
.icon-btn:active { background: var(--primary-weak); }

/* ---------- 侧栏 ---------- */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 70;
    width: var(--sidebarW);
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 14px 10px calc(20px + var(--tabbarH));
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform .25s ease;
}
.sidebar.open { transform: translateX(0); }
.sidebar .brand {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 18px; color: var(--primary);
    padding: 4px 10px 14px;
}
.brand-logo { width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; }
.top-logo { display: flex; align-items: center; width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; }
.nav-item .ico { width: 20px; display: flex; align-items: center; justify-content: center; }
.nav-item .ico svg { width: 20px; height: 20px; }
.tab-ico svg { width: 22px; height: 22px; }
.map-spot .ico { display: flex; align-items: center; justify-content: center; }
.map-spot .ico svg { width: 26px; height: 26px; color: var(--primary); }
.acc-ico svg { width: 22px; height: 22px; color: var(--primary); }
.big-ico svg { width: 46px; height: 46px; color: var(--text3); }
.nav-group-title {
    font-size: 12px; color: var(--text3); padding: 14px 10px 6px;
    letter-spacing: .05em;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--text); font-size: 14.5px; cursor: pointer;
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.nav-item .ico { width: 20px; text-align: center; }
.nav-item .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.nav-item .dot.off { background: var(--border); }
.mask {
    position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.4);
    display: none;
}
.mask.show { display: block; }

/* ---------- 内容区 ---------- */
.view {
    margin: 0 auto;
    padding: calc(var(--topbarH) + 12px) 14px calc(var(--tabbarH) + 24px);
    max-width: 760px;
    min-height: 100vh;
}
.view::-webkit-scrollbar { width: 0; }

/* ---------- 底部导航（移动端） ---------- */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    height: calc(var(--tabbarH) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; color: var(--text3); font-size: 11.5px;
}
.tabbar a.active { color: var(--primary); }
.tab-ico { font-size: 20px; line-height: 1; }

/* ---------- 通用组件 ---------- */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
    border: 1px solid var(--border);
}
.card-title { font-weight: 700; font-size: 15.5px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-title .right { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--text2); }
.sub { color: var(--text2); font-size: 13px; }
.tiny { color: var(--text3); font-size: 12px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 0; cursor: pointer; user-select: none;
    background: var(--primary); color: #fff;
    border-radius: 10px; padding: 9px 18px; font-size: 14.5px; font-weight: 600;
}
.btn:active { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.plain { background: var(--primary-weak); color: var(--primary); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text2); }
.btn.danger { background: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 5px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 10px;
    font-size: 15px; background: #fff; color: var(--text);
    font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak);
}
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    padding: 4px 12px; border-radius: 999px; font-size: 12.5px;
    background: var(--bg); color: var(--text2); border: 1px solid var(--border);
    cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--primary-weak); color: var(--primary); }
.tag.ok { background: #e7f7ee; color: var(--ok); }
.tag.warn { background: #fdf3e3; color: var(--warn); }
.tag.err { background: #fdebec; color: var(--danger); }

/* 列表行 */
.list-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 2px; border-bottom: 1px solid var(--border);
}
.t-avatar {
    flex-shrink: 0; width: 46px; height: 46px; border-radius: 10px;
    overflow: hidden; border: 1px solid var(--border); background: var(--primary-weak);
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.t-avatar img { width: 100%; height: 100%; object-fit: cover; }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 12.5px; color: var(--text2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }

.empty { text-align: center; color: var(--text3); padding: 34px 0; font-size: 14px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* 页面头部（标题+副标题） */
.page-head { margin: 4px 0 14px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head p { margin: 4px 0 0; color: var(--text2); font-size: 13.5px; }

/* 加载 */
.page-loading { text-align: center; padding: 80px 0; color: var(--text3); }
.spinner {
    width: 30px; height: 30px; margin: 0 auto 10px;
    border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-more { text-align: center; color: var(--text3); padding: 14px; font-size: 13px; }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: calc(var(--tabbarH) + 30px);
    transform: translateX(-50%) translateY(20px);
    background: rgba(28, 35, 51, .92); color: #fff;
    padding: 10px 18px; border-radius: 10px; font-size: 14px;
    opacity: 0; pointer-events: none; transition: all .25s ease;
    z-index: 100; max-width: 84vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(213, 48, 49, .95); }
.toast.ok { background: rgba(24, 160, 88, .95); }

/* Modal */
.modal {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(15, 20, 35, .5);
    display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal[hidden] { display: none; }
.modal-card {
    background: var(--card); border-radius: 16px;
    width: 100%; max-width: 560px; max-height: 84vh;
    overflow-y: auto; padding: 18px;
}
.modal-title { font-weight: 700; font-size: 17px; margin-bottom: 12px; padding-right: 30px; position: relative; }
.modal-close {
    position: absolute; right: 0; top: 0; border: 0; background: transparent;
    font-size: 20px; color: var(--text3); cursor: pointer; padding: 4px;
}

/* ---------- 课表格子 ---------- */
.tt-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tt-toolbar .week-label { font-weight: 700; font-size: 15px; min-width: 86px; text-align: center; }
.tt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
.tt {
    display: grid;
    grid-template-columns: 34px repeat(7, minmax(64px, 1fr));
    min-width: 520px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    overflow: hidden;
}
.tt-head { display: contents; }
.tt-head .hcell {
    text-align: center; padding: 7px 0; font-size: 12.5px; color: var(--text2);
    background: #fafbfe; border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
}
.tt-head .hcell.today { color: var(--primary); font-weight: 700; background: var(--primary-weak); }
.tt-times { display: flex; flex-direction: column; }
.tt-times .tspan {
    height: var(--cellH); display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-size: 10px; color: var(--text3); border-right: 1px solid var(--border);
    line-height: 1.3;
}
.tt-times .tspan.now { background: var(--primary-weak); color: var(--primary); font-weight: 700; }
.tt-day { position: relative; border-right: 1px dashed var(--border); min-height: calc(var(--cellH) * 13); }
.tt-day:last-child { border-right: 0; }
.tt-day .slot-line { height: var(--cellH); border-bottom: 1px dashed var(--border); }
.tt-course {
    position: absolute; left: 3px; right: 3px;
    border-radius: 8px; padding: 5px 6px;
    color: #fff; font-size: 11px; line-height: 1.35;
    overflow: hidden; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.tt-course .c-name { font-weight: 700; font-size: 11.5px; }
.tt-course .c-meta { opacity: .92; font-size: 10.5px; }
.practice-list .list-item .badge {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 12px; font-weight: 700;
}

/* 今日课程 */
.today-course {
    display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border);
    align-items: center;
}
.today-course:last-child { border-bottom: 0; }
.tc-time { flex-shrink: 0; width: 52px; text-align: center; }
.tc-time .t { font-size: 13px; font-weight: 700; color: var(--primary); }
.tc-time .n { font-size: 11px; color: var(--text3); }
.tc-main { flex: 1; min-width: 0; }
.tc-main .name { font-weight: 600; }
.tc-main .meta { font-size: 12.5px; color: var(--text2); }
.tc-done { opacity: .45; }

/* GPA 大数字 */
.gpa-hero { text-align: center; padding: 10px 0 4px; }
.gpa-hero .num { font-size: 44px; font-weight: 800; color: var(--primary); line-height: 1.1; }
.gpa-hero .cap { color: var(--text2); font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-grid .stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.stat-grid .stat .v { font-size: 20px; font-weight: 800; color: var(--primary); }
.stat-grid .stat .k { font-size: 12px; color: var(--text2); }

/* 表格（PC 宽屏） */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.tbl th { color: var(--text2); font-weight: 600; background: #fafbfe; }
table.tbl tr:last-child td { border-bottom: 0; }

/* 账号卡片 */
.acc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.acc-ico {
    width: 40px; height: 40px; border-radius: 11px; background: var(--primary-weak);
    display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.acc-state { margin-left: auto; }
.captcha-img { height: 42px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }

/* 评教 */
.eva-q { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.eva-q .q-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.eva-opts { display: flex; gap: 8px; flex-wrap: wrap; }

/* 节假日 */
.holiday-card { border-left: 4px solid var(--primary); }

/* 地图 */
.map-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.map-spot {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px; text-align: center; cursor: pointer;
}
.map-spot:active { background: var(--primary-weak); }
.map-spot .ico { font-size: 22px; }
.map-spot .nm { font-size: 13px; margin-top: 4px; }

/* ============================================================
   ≥768px：PC 端布局
   ============================================================ */
@media (min-width: 768px) {
    .topbar { left: var(--sidebarW); }
    #menuBtn { display: none; }
    .sidebar { transform: translateX(0) !important; }
    .mask { display: none !important; }
    .tabbar { display: none; }
    .view {
        margin-left: var(--sidebarW);
        max-width: 1080px;
        padding: calc(var(--topbarH) + 20px) 26px 40px;
    }
    :root { --cellH: 58px; }
    .tt { grid-template-columns: 46px repeat(7, minmax(96px, 1fr)); min-width: 740px; }
    .tt-course { padding: 7px 8px; }
    .tt-course .c-name { font-size: 12.5px; }
    .tt-course .c-meta { font-size: 11.5px; }
    .card { padding: 20px; }
    .map-grid { grid-template-columns: repeat(4, 1fr); }
    .modal-card { padding: 24px; }
    /* PC 上两栏并排：主内容 + 侧卡 */
    .cols { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
    .cols .side { position: sticky; top: calc(var(--topbarH) + 16px); }
}
@media (max-width: 767.98px) {
    .cols { display: block; }
    .cols .side { margin-bottom: 14px; }
}
@media (max-width: 380px) {
    :root { --cellH: 46px; }
    .tt { grid-template-columns: 30px repeat(7, minmax(54px, 1fr)); min-width: 430px; }
}
