:root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #1f2329;
    --muted: #646a73;
    --border: #e5e7eb;
    --primary: #1677ff;
    --danger: #d14343;
}

* { box-sizing: border-box; }

body.page {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
}

.shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

.shell.narrow { max-width: 720px; }

/* 登录页：钉钉内嵌框为「扫码 + 本机账号」双栏，需更宽容器避免右侧头像被裁切 */
.shell.login-shell-wide {
    max-width: 960px;
}

.shell-wide { max-width: 1280px; }

.topnav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.topnav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

.topnav-links {
    display: flex;
    gap: 10px;
    flex: 1;
}

.topnav-links a {
    text-decoration: none;
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
}

.topnav-links a.active {
    background: #eef4ff;
    color: var(--primary);
}

.topnav-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin: 12px 0;
}

.login-card { margin-top: 28px; }

.login-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 12px;
}

@media (min-width: 900px) {
    .login-split {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.login-pane {
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 12px;
    background: #fafbff;
}

.pane-title {
    margin: 0 0 8px;
    font-size: 16px;
}

.pwd-form {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.pwd-form label {
    margin-top: 4px;
}

/* 与用户名框一致：显式包含 password，避免浏览器默认样式导致高度/边框不一致 */
.pwd-form input[type="text"],
.pwd-form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    min-height: 46px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font: inherit;
    background: #fff;
    color: var(--text);
}

.pwd-form input[type="text"]:focus,
.pwd-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.15);
}

.sync-panel {
    margin: 12px 0 20px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fafbff;
}

.sync-panel h3 { margin: 0 0 10px; font-size: 16px; }

.sync-progress {
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    margin: 8px 0;
}

.sync-progress > i {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #69b1ff);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.sync-log {
    margin-top: 10px;
    max-height: 280px;
    overflow: auto;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0b1220;
    color: #e5e7eb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.sync-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }

.login-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); }

.login-title { font-size: 22px; margin: 0; }

.qr { min-height: 380px; }

.login-dd-pane {
    margin-top: 12px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 12px;
    background: #fafbff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.login-dd-pane .qr {
    min-height: 480px;
    min-width: 720px;
}

.muted { color: var(--muted); }

.small { font-size: 13px; }

.err { color: var(--danger); margin-top: 10px; white-space: pre-wrap; }

.hero h2 { margin: 8px 0 6px; }

.section { margin-top: 18px; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
}

.section-head h3 { margin: 0; font-size: 18px; }

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
}

.tile {
    grid-column: span 12;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--card);
    display: flex;
    flex-direction: column;
}

@media (min-width: 720px) {
    .tile { grid-column: span 6; }
}

@media (min-width: 1024px) {
    .tile { grid-column: span 4; }
}

.thumb {
    aspect-ratio: 16 / 9;
    background: #0b1220;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tile-body { padding: 12px; }

.tile-title { font-weight: 650; }

.clip-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.layout .main { max-width: 980px; margin: 0 auto; }

.player-wrap video {
    width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    background: #000;
}

.comment-box textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 10px;
    font: inherit;
}

.comments { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }

.comment {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
}

.comment-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }

.comment-body { white-space: pre-wrap; }

.btn {
    display: inline-block;
    border: 1px solid var(--border);
    background: var(--primary);
    color: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
}

.btn-danger { background: var(--danger); border-color: var(--danger); }

.btn.small, .btn-ghost.small, .btn-danger.small { padding: 6px 8px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }

th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }

th { background: #fafafa; font-size: 13px; color: var(--muted); }

form.inline { display: grid; gap: 10px; }

.row { display: grid; gap: 10px; }

@media (min-width: 900px) {
    form.inline.cols-2 { grid-template-columns: 1fr 1fr; align-items: end; }
}

label { font-size: 13px; color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="email"], select, textarea {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font: inherit;
}

.flash { margin: 10px 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: #fff; }

.flash.ok { border-color: #b7eb8f; background: #f6ffed; }

.flash.err { border-color: #ffccc7; background: #fff2f0; }

.admin-nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 16px; }

.users-dept-card { padding: 0; overflow: hidden; }

.users-dept-layout {
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

@media (min-width: 768px) {
    .users-dept-layout {
        flex-direction: row;
        align-items: stretch;
    }
    .dept-aside {
        width: 280px;
        flex-shrink: 0;
        border-right: 1px solid var(--border);
    }
}

.dept-aside {
    background: #fafbfc;
    padding: 14px 12px;
}

.dept-aside-title {
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--muted);
    font-weight: 600;
}

.dept-tree-nav {
    max-height: 60vh;
    overflow: auto;
}

.dept-tree-root,
.dept-tree-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dept-tree-root { padding-left: 0; }

.dept-tree-children {
    margin-left: 12px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

.dept-tree-item {
    margin: 4px 0;
}

.dept-tree-link {
    display: block;
    padding: 6px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
}

.dept-tree-link:hover {
    background: #eef4ff;
}

.dept-tree-link.active {
    background: #e6f0ff;
    color: var(--primary);
    font-weight: 600;
}

.users-main {
    flex: 1;
    padding: 16px;
    min-width: 0;
}

.users-main-title {
    margin: 0 0 8px;
    font-size: 16px;
}

.upload-progress-panel {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fafbfc;
}

.upload-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 14px;
}

.upload-progress-bar-wrap {
    height: 10px;
    border-radius: 6px;
    background: #e8eaef;
    overflow: hidden;
}

.upload-progress-bar-inner {
    height: 100%;
    width: 0%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--primary), #69b1ff);
    transition: width 0.12s ease-out;
}

.upload-progress-meta {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
