/* ============================================================
   学习通签到助手 v2 - 浅蓝主题
   ============================================================ */
:root {
    --bg:        #eaf3fb;
    --bg-card:   #ffffff;
    --bg-soft:   #f5f9fd;
    --fg:        #1f2937;
    --fg-soft:   #4b5563;
    --muted:     #6b7280;
    --line:      #d8e3ee;
    --line-soft: #e8eef4;
    --primary:   #2563eb;
    --primary-d: #1d4ed8;
    --primary-bg:#dbe9fb;
    --ok:        #16a34a;
    --err:       #dc2626;
    --warn:      #d97706;
    --radius:    12px;
    --radius-s:  8px;
    --shadow:    0 1px 3px rgba(15,40,80,.04), 0 6px 18px rgba(15,40,80,.06);
    --shadow-h:  0 4px 10px rgba(15,40,80,.08), 0 18px 40px rgba(15,40,80,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    color: var(--fg);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.55;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.hidden { display: none !important; }

button {
    font: inherit;
    padding: 8px 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--fg);
    border-radius: var(--radius-s);
    cursor: pointer;
    transition: 0.15s;
}
button:hover { border-color: #b7c5d4; background: var(--bg-soft); }
button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
button.primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
button.danger { color: var(--err); border-color: #f1c2c2; }
button.danger:hover { background: #fff1f1; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
    font: inherit;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: #fff;
    width: 100%;
    color: var(--fg);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: var(--primary);
}
label { display: block; margin: 10px 0; font-size: 13px; color: var(--fg-soft); }
label input, label select, label textarea { margin-top: 5px; }

/* ============ 顶栏 ============ */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 50;
}
.topbar .logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 16px;
    margin-right: 12px;
}
.topbar .brand { font-weight: 600; font-size: 15px; margin-right: 32px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
    padding: 8px 14px;
    color: var(--fg-soft);
    border-radius: var(--radius-s);
    font-size: 14px;
}
.topbar nav a:hover { background: var(--bg-soft); color: var(--fg); text-decoration: none; }
.topbar nav a.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.topbar .user-area { display: flex; align-items: center; gap: 10px; }
.topbar .user-area .uname { color: var(--fg-soft); }

@media (max-width: 720px) {
    .topbar { padding: 0 14px; }
    .topbar .brand { margin-right: 12px; font-size: 14px; }
    .topbar nav a { padding: 6px 10px; font-size: 13px; }
}

/* ============ 内容区 ============ */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px 80px; }

/* ============ 首页:双栏 ============ */
.home-grid {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 880px) {
    .home-grid { grid-template-columns: 1fr; }
}

/* ===== 公告轮播 ===== */
.banner-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    height: 260px;
    position: relative;
}
.banner-slide {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    opacity: 0; transition: opacity .5s;
    display: flex; align-items: flex-end;
}
.banner-slide.active { opacity: 1; }
.banner-slide .b-cap {
    width: 100%;
    background: linear-gradient(0deg, rgba(0,0,0,.65) 10%, transparent 100%);
    color: #fff; padding: 18px 22px;
}
.banner-slide .b-cap h3 { margin: 0 0 4px; font-size: 18px; }
.banner-slide .b-cap p { margin: 0; font-size: 13px; opacity: .9; }
.banner-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: var(--muted);
    background: linear-gradient(135deg, #dbe9fb, #f5f9fd);
}
.banner-dots {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 6px; z-index: 2;
}
.banner-dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,.5); cursor: pointer;
}
.banner-dots span.active { background: #fff; }

/* ===== 侧栏公告 ===== */
.notice-box {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    height: 260px;
    overflow-y: auto;
}
.notice-box h3 {
    margin: 0 0 12px;
    font-size: 15px;
    display: flex; align-items: center; gap: 8px;
}
.notice-box h3::before {
    content: '📢';
}
.notice-item {
    border-top: 1px solid var(--line-soft);
    padding: 10px 0;
}
.notice-item:first-of-type { border-top: 0; padding-top: 4px; }
.notice-item h4 { margin: 0 0 4px; font-size: 13px; }
.notice-item p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ============ 主功能区(向导) ============ */
.wizard {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
}
.wizard h2 { margin: 0 0 4px; font-size: 19px; }
.wizard .lead { color: var(--muted); margin: 0 0 22px; }

.steps {
    display: flex; gap: 0;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--line-soft);
}
.steps .step {
    padding: 12px 0;
    flex: 1;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    position: relative;
}
.steps .step .n {
    display: inline-block;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--line-soft);
    color: var(--muted);
    line-height: 22px;
    font-weight: 600;
    margin-right: 6px;
    font-size: 12px;
}
.steps .step.done .n { background: var(--ok); color: #fff; }
.steps .step.active { color: var(--primary); border-bottom-color: var(--primary); }
.steps .step.active .n { background: var(--primary); color: #fff; }

.step-pane { display: none; }
.step-pane.active { display: block; }
.step-pane h3 { margin: 0 0 14px; font-size: 16px; }

.form-row {
    display: grid; gap: 14px;
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 540px) {
    .form-row { grid-template-columns: 1fr; }
}

.checks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 6px 0 20px;
}
.checks label {
    display: flex; gap: 8px; align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: var(--bg-soft);
    cursor: pointer;
    margin: 0;
    font-size: 13px;
    color: var(--fg);
    transition: .12s;
}
.checks label:hover { background: #fff; border-color: var(--primary); }
.checks label.checked { background: var(--primary-bg); border-color: var(--primary); color: var(--primary-d); font-weight: 500; }
.checks input[type=checkbox] { width: auto; margin: 0; }

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}
.course-grid .c-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    padding: 12px 14px;
    cursor: pointer;
    background: var(--bg-soft);
    transition: .12s;
}
.course-grid .c-item:hover { background: #fff; }
.course-grid .c-item.checked {
    background: var(--primary-bg);
    border-color: var(--primary);
}
.course-grid .c-item h4 { margin: 0 0 4px; font-size: 13px; }
.course-grid .c-item p  { margin: 0; font-size: 11px; color: var(--muted); }

.wizard-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}

/* ============ 状态查询(任务列表) ============ */
.task-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-bottom: 14px;
}
.task-card .head {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
}
.task-card h4 { margin: 0; font-size: 15px; flex: 1; min-width: 0; }
.task-card .body { margin: 12px 0 0; }
.task-card .meta {
    color: var(--muted); font-size: 12px;
    margin-top: 4px;
}
.task-card .actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.task-card .types {
    display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.task-card .type-tag {
    background: var(--bg-soft);
    color: var(--fg-soft);
    padding: 3px 8px; border-radius: 999px; font-size: 11px;
    border: 1px solid var(--line-soft);
}

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500;
}
.badge.running  { background: #dcfce7; color: var(--ok); }
.badge.pending  { background: #fef3c7; color: var(--warn); }
.badge.done     { background: var(--line-soft); color: var(--muted); }
.badge.cancelled{ background: #fee2e2; color: var(--err); }
.badge.qr-bound { background: #dcfce7; color: var(--ok); }
.badge.qr-unbound { background: #fee2e2; color: var(--err); }

/* ============ Dialog ============ */
dialog {
    border: 0; border-radius: var(--radius);
    padding: 24px; max-width: 480px; width: 92%;
    box-shadow: var(--shadow-h);
    color: var(--fg);
}
dialog::backdrop { background: rgba(15,40,80,.4); }
dialog h3 { margin: 0 0 6px; }
dialog h4 { margin: 14px 0 6px; font-size: 14px; color: var(--fg-soft); font-weight: 500; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.hint { margin-top: 10px; font-size: 13px; min-height: 18px; color: var(--muted); }
.hint.err { color: var(--err); }
.hint.ok  { color: var(--ok); }

/* ============ 登录注册卡片 ============ */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: calc(100vh - 60px); padding: 24px;
}
.auth-card {
    background: var(--bg-card);
    padding: 32px 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-h);
    width: 100%; max-width: 400px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card .auth-switch {
    margin-top: 16px; text-align: center; font-size: 13px; color: var(--muted);
}

/* ============ 照片库 ============ */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}
.photo-grid .p {
    border: 2px solid var(--line);
    border-radius: var(--radius-s);
    overflow: hidden;
    background: var(--bg-soft);
    position: relative;
    aspect-ratio: 1/1;
}
.photo-grid .p.default { border-color: var(--ok); }
.photo-grid .p img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .p .acts {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,.6);
    display: flex; gap: 4px; padding: 4px;
    opacity: 0; transition: .12s;
}
.photo-grid .p:hover .acts { opacity: 1; }
.photo-grid .p .acts button {
    flex: 1; padding: 4px; font-size: 11px;
    background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4);
}

/* ============ 管理员后台 ============ */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat-card .v { font-size: 24px; font-weight: 600; color: var(--primary); }
.stat-card .k { font-size: 12px; color: var(--muted); margin-top: 4px; }

table.data {
    width: 100%; border-collapse: collapse;
    background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow);
    font-size: 13px;
}
table.data th, table.data td {
    padding: 10px 14px;
    border-top: 1px solid var(--line-soft);
    text-align: left;
}
table.data th {
    background: var(--bg-soft);
    color: var(--muted);
    font-weight: 500; font-size: 12px;
    border-top: 0;
}
table.data .status-success { color: var(--ok); font-weight: 500; }
table.data .status-failed  { color: var(--err); }

.section { margin-bottom: 28px; }
.section-head {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 17px; flex: 1; }


/* ============================================================
   MapPicker — 地图选点弹层
   ============================================================ */
#mapPickerHost { position: fixed; inset: 0; z-index: 9999; display: none; }
#mapPickerHost.open { display: block; }
#mapPickerHost .mp-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); backdrop-filter: blur(2px); }
#mapPickerHost .mp-panel {
    position: absolute; inset: 4% 4%;
    background: #fff; border-radius: 14px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
@media (min-width: 1100px) {
    #mapPickerHost .mp-panel {
        inset: 50% 50% auto auto;
        transform: translate(50%, -50%);
        width: 960px; height: 640px; max-width: 92vw; max-height: 88vh;
    }
}
#mapPickerHost .mp-head { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
#mapPickerHost .mp-head h3 { margin: 0; font-size: 16px; }
#mapPickerHost .mp-close { border: 0; background: transparent; font-size: 26px; width: 32px; height: 32px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0; }
#mapPickerHost .mp-close:hover { color: var(--fg); }
#mapPickerHost .mp-search { position: relative; padding: 10px 14px; border-bottom: 1px solid var(--line); }
#mapPickerHost .mp-search input { width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
#mapPickerHost #mpSuggest { position: absolute; left: 14px; right: 14px; top: 100%; background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; z-index: 5; box-shadow: 0 8px 16px rgba(0,0,0,.06); }
#mapPickerHost #mpSuggest li { padding: 9px 14px; cursor: pointer; border-top: 1px solid #f3f4f6; }
#mapPickerHost #mpSuggest li:first-child { border-top: 0; }
#mapPickerHost #mpSuggest li:hover { background: #f8fafc; }
#mapPickerHost #mpSuggest li.mp-empty { color: var(--muted); cursor: default; padding: 16px; text-align: center; }
#mapPickerHost .mp-sug-name { font-weight: 500; font-size: 14px; }
#mapPickerHost .mp-sug-addr { font-size: 12px; color: var(--muted); margin-top: 2px; }
#mapPickerHost .mp-map { flex: 1; min-height: 280px; background: #eef0f3; }
#mapPickerHost .mp-locate { position: absolute; right: 22px; bottom: 132px; width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 1px solid var(--line); font-size: 18px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.12); z-index: 3; }
#mapPickerHost .mp-locate:hover { background: #f5f5f7; }
#mapPickerHost .mp-locate:disabled { opacity: .5; cursor: wait; }
#mapPickerHost .mp-foot { border-top: 1px solid var(--line); padding: 12px 18px; display: flex; align-items: center; gap: 16px; background: #fafbfc; }
#mapPickerHost .mp-info { flex: 1; min-width: 0; }
#mapPickerHost .mp-info-line { display: flex; gap: 10px; font-size: 13px; line-height: 1.5; align-items: baseline; }
#mapPickerHost .mp-label { color: var(--muted); width: 36px; flex: 0 0 36px; font-size: 12px; }
#mapPickerHost .mp-coord, #mapPickerHost .mp-addr { word-break: break-all; }
#mapPickerHost .mp-actions { display: flex; gap: 10px; flex-shrink: 0; }
#mapPickerHost .mp-confirm:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 640px) {
    #mapPickerHost .mp-foot { flex-direction: column; align-items: stretch; }
    #mapPickerHost .mp-actions { justify-content: flex-end; }
    #mapPickerHost .mp-locate { bottom: 168px; }
}
