/* ===== 日程助手 · 基础变量 ===== */
:root {
    --brand: #0089ff;
    --brand-soft: #e8f3ff;
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1a1d24;
    --text-2: #62697a;
    --text-3: #99a0ae;
    --line: #eceef2;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(24, 34, 55, .04), 0 4px 16px rgba(24, 34, 55, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性要能压过 .summary / .toolbar 上的 display:flex，否则空态与加载态会漏出空壳 */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 14px 40px;
}

/* ===== 顶栏 ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 2px 12px;
    background: linear-gradient(var(--bg) 72%, rgba(244, 246, 249, 0));
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .2px;
}

.logo {
    width: 20px;
    height: 20px;
    border-radius: 7px;
    background: linear-gradient(135deg, #37a6ff, #0074e8);
    box-shadow: 0 2px 6px rgba(0, 137, 255, .35);
}

.user {
    font-size: 13px;
    color: var(--text-2);
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 日期栏 ===== */
.datebar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 8px 10px;
    margin-bottom: 12px;
}

.nav-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: none;
    border-radius: 10px;
    background: #f2f4f7;
    color: var(--text-2);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s;
}

.nav-btn:active { background: var(--brand-soft); color: var(--brand); }

.date-input {
    position: relative;
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    font-family: inherit;
    padding: 4px 0;
}

/* 让原生日期选择器的图标铺满整个输入区：既不额外占宽，点哪里都能唤起日历 */
.date-input::-webkit-calendar-picker-indicator {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.date-input:focus { outline: none; }

.ghost-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand);
    font-size: 13px;
    font-family: inherit;
    padding: 6px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: background .15s;
}

.ghost-btn:active { background: var(--brand-soft); }

/* ===== 汇总 ===== */
.summary {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #ffffff, #f7fbff);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 8px;
    margin-bottom: 12px;
}

.summary .stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-label { font-size: 12px; color: var(--text-3); }

.summary .divider {
    width: 1px;
    height: 28px;
    background: var(--line);
}

/* ===== 工具条 ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 10px;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
}

.switch input {
    appearance: none;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: #dfe3ea;
    position: relative;
    cursor: pointer;
    transition: background .18s;
    margin: 0;
}

.switch input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    transition: transform .18s;
}

.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }

/* ===== 列表 ===== */
.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    position: relative;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 14px 12px 18px;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--line);
}

.card.is-meeting::before { background: var(--brand); }
.card.is-ongoing::before { background: #00b578; }
.card.is-cancelled::before { background: #cbd2d9; }

.card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

/* 已取消：整体压暗 + 标题加删除线 + 左侧条转灰，和正常会议一眼可分 */
.card.is-cancelled { opacity: .72; }
.card.is-cancelled .card-title { text-decoration: line-through; }

/* 时间 + 徽章同一行，标题因此可以独占整行不被挤压 */
.card-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.card-time {
    font-size: 13px;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

/* 地点单独一行：标题 / 时间 / 地点三段分行，长地点自己折行、不和时间行里的徽章抢宽度 */
.card-place {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-2);
    word-break: break-word;
}

.card-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: #f2f4f7;
    color: var(--text-2);
    white-space: nowrap;
}

.badge.online { background: var(--brand-soft); color: #0071d4; }
.badge.ongoing { background: #e6f9f1; color: #00996a; }
.badge.ended { background: #f2f4f7; color: var(--text-3); }
.badge.cancelled { background: #fdecec; color: #c0392b; }

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--text-2);
}

.meta-item { display: inline-flex; align-items: center; gap: 4px; }

.meta-key { color: var(--text-3); }

.card-foot {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}

.attendees {
    font-size: 12.5px;
    color: var(--text-3);
    line-height: 1.55;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.join-btn {
    flex: 0 0 auto;
    border: none;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    padding: 7px 14px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.join-btn:active { opacity: .85; }

/* ===== 状态提示 ===== */
.state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 56px 20px;
    color: var(--text-3);
    font-size: 14px;
    text-align: center;
}

.state .title { font-size: 15px; color: var(--text-2); font-weight: 600; }
.state p { margin: 0; }

.state .hint {
    font-size: 12.5px;
    color: var(--text-3);
    line-height: 1.7;
    max-width: 300px;
}

.state .retry {
    margin-top: 4px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand);
    border-radius: 9px;
    padding: 8px 18px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}

.spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2.5px solid #e2e6ed;
    border-top-color: var(--brand);
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--brand-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

/* ===== 参会人筛选：横向滚动的 chip 行，人员由当天数据动态生成 ===== */
.attendee-bar {
    /* 负边距让滚动区延伸到屏幕两侧，滑动时不会被 .app 的 padding 截断 */
    margin: 0 -14px 8px;
    padding: 0 14px;
}

.attendee-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.attendee-scroll::-webkit-scrollbar { display: none; }

.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text-2);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    padding: 7px 12px;
    border-radius: 18px;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.chip:active { background: var(--brand-soft); }

.chip-count {
    font-size: 11px;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.chip.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 137, 255, .25);
}

.chip.active .chip-count { color: rgba(255, 255, 255, .85); }

/* 卡片里命中的姓名，让「为什么这条被留下」一眼可见 */
.attendee-hit {
    background: var(--brand-soft);
    color: #0071d4;
    border-radius: 4px;
    padding: 0 3px;
    font-weight: 600;
}

/* ===== 查询人员：多选（浅底描边，区别于参会人筛选的实心单选） + 显式触发查询 ===== */
.picker {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    margin-bottom: 12px;
}

.picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
}

.picker-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
}

.link-btn {
    border: none;
    background: transparent;
    color: var(--brand);
    font-size: 12.5px;
    font-family: inherit;
    padding: 2px 2px;
    cursor: pointer;
}

.picker-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.person-chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text-2);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.2;
    padding: 7px 13px;
    border-radius: 18px;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.person-chip:active { background: var(--brand-soft); }

.person-chip.active {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: #0071d4;
    font-weight: 600;
}

.primary-btn {
    width: 100%;
    margin-top: 11px;
    border: none;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    padding: 10px 0;
    cursor: pointer;
    transition: opacity .15s;
}

.primary-btn:active:not(:disabled) { opacity: .85; }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }

/* 部分人员查询失败时的局部提示，不影响其余人员的数据展示 */
.notice {
    background: #fff7e8;
    border: 1px solid #ffe4b8;
    color: #8a5a00;
    border-radius: 12px;
    padding: 9px 12px;
    margin-bottom: 12px;
    font-size: 12.5px;
    line-height: 1.65;
    word-break: break-word;
}

.notice-line + .notice-line { margin-top: 4px; }

.notice strong { font-weight: 600; }

@media (max-width: 380px) {
    .stat-value { font-size: 19px; }
    .card { padding: 12px 12px 10px 16px; }
}
