/* ============================================================
   数字调查系统 · 全局样式（清爽浅蓝主题）
   ============================================================ */
:root {
    --primary: #2B7DE9;
    --primary-deep: #1D6AD1;
    --primary-soft: #EAF2FE;
    --bg: #F2F7FD;
    --card: #FFFFFF;
    --text: #22303F;
    --muted: #6B7C93;
    --border: #E3ECF7;
    --danger: #D9534F;
    --success: #21A675;
    --warning: #E8A33D;
    --shadow: 0 6px 24px rgba(30, 78, 140, .08);
    --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
}

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

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶部导航 ---------- */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: .5px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    display: block;
    object-fit: contain;
}

.brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(135deg, #4F9BFF, #2B7DE9);
    box-shadow: 0 2px 8px rgba(43, 125, 233, .4);
}

.nav { display: flex; align-items: center; gap: 18px; font-size: 15px; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--primary); }
.nav-quiet { font-size: 14px; }
.nav-user {
    color: var(--text);
    font-size: 14px;
    background: var(--primary-soft);
    padding: 4px 12px;
    border-radius: 999px;
}

.main { padding-top: 32px; padding-bottom: 64px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 42px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: .18s;
    white-space: nowrap;
}
.btn:hover { background: var(--primary-deep); color: #fff; }

/* 顶部导航里的主按钮：避免 .nav a 的灰色文字覆盖按钮白字 */
.nav a.btn {
    background: var(--primary-deep);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(29, 106, 209, .28);
}
.nav a.btn:hover { background: #175BB8; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
.btn-ghost {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-danger { background: #fff; border-color: #F3C9C7; color: var(--danger); }
.btn-danger:hover { background: #FFF5F4; color: var(--danger); border-color: var(--danger); }
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 14px;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 28px;
}

.card + .card { margin-top: 20px; }

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.card-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.card-sub { color: var(--muted); font-size: 14px; margin: 0; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-title { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: .5px; }
.page-desc { color: var(--muted); margin: 6px 0 0; font-size: 15px; }

/* 首页价值卖点 */
.hero-values { margin-top: 18px; max-width: 780px; }
.hero-points {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 42px;
}
.hero-point {
    position: relative;
    padding-left: 19px;
    color: #38536F;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.65;
    letter-spacing: .2px;
}
.hero-point::before {
    content: "";
    position: absolute;
    left: 0;
    top: .52em;
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: linear-gradient(135deg, #4F9BFF, #2B7DE9);
    box-shadow: 0 2px 7px rgba(43, 125, 233, .3);
}
.hero-cta {
    margin: 20px 0 0;
    padding-left: 17px;
    border-left: 3px solid var(--primary);
    color: var(--primary-deep);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.65;
    letter-spacing: .3px;
}

@media (max-width: 760px) {
    .hero-points { grid-template-columns: 1fr; gap: 9px; }
    .hero-cta { font-size: 18px; }
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 20px; }
.field label,
.field .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

.input, .textarea, .select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    padding: 10px 13px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 125, 233, .12);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.input-color { width: 64px; height: 42px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.checkbox-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.form-grid .full { grid-column: 1 / -1; }

.alert {
    border-radius: 9px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}
.alert-error { background: #FFF4F3; border: 1px solid #F7D3D0; color: #B33A35; }
.alert-success { background: #EFFAF5; border: 1px solid #CBEBDD; color: #157A55; }
.alert-info { background: var(--primary-soft); border: 1px solid #CFE2FC; color: #1F5DAE; }

/* ---------- 徽标 ---------- */
.badge {
    display: inline-block;
    font-size: 12px;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 999px;
    background: #F1F5FA;
    color: var(--muted);
    vertical-align: middle;
}
.badge-draft { background: #F1F5FA; color: #6B7C93; }
.badge-published { background: #E8F7F1; color: #158A5F; }
.badge-link { background: #EEF4FF; color: #3B6FB6; }
.badge-closed { background: #FFF3E6; color: #A96A16; }

/* ---------- 列表 ---------- */
.survey-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }

.survey-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .18s, box-shadow .18s;
}
.survey-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(30, 78, 140, .13); }
.survey-card h3 { font-size: 17px; margin: 0; line-height: 1.5; }
.survey-card p { color: var(--muted); font-size: 14px; margin: 0; min-height: 44px; }
.survey-meta { display: flex; gap: 14px; color: var(--muted); font-size: 13px; }
.survey-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px dashed var(--border); }

.empty {
    background: #fff;
    border: 1px dashed #C9DCF3;
    border-radius: var(--radius);
    padding: 56px 24px;
    text-align: center;
    color: var(--muted);
}
.empty h3 { font-size: 17px; color: var(--text); margin: 0 0 8px; }

/* ---------- 我的问卷行 ---------- */
.survey-rows { display: flex; flex-direction: column; gap: 14px; }
.survey-row {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}
.survey-row-main h3 { margin: 0 0 6px; font-size: 17px; }
.survey-row-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 13px; align-items: center; }
.survey-row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.link-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F7FAFF;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--muted);
    max-width: 100%;
}
.link-box code { color: var(--primary-deep); word-break: break-all; font-family: Consolas, monospace; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; background: #FAFCFF; }
.table tr:last-child td { border-bottom: none; }

/* ---------- 题目/统计 ---------- */
.q-title { font-size: 16px; font-weight: 600; margin: 0 0 12px; line-height: 1.6; }
.q-required { color: var(--danger); margin-left: 4px; }

.stat-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.stat-label { width: 220px; font-size: 14px; color: var(--text); word-break: break-word; }
.stat-bar { flex: 1; height: 12px; background: #EEF3FA; border-radius: 999px; overflow: hidden; min-width: 80px; }
.stat-bar span { display: block; height: 100%; background: linear-gradient(90deg, #66A8FF, #2B7DE9); border-radius: 999px; }
.stat-value { width: 96px; text-align: right; font-size: 13px; color: var(--muted); }

.text-answers { margin: 0; padding-left: 18px; }
.text-answers li { margin-bottom: 8px; font-size: 14px; color: var(--text); }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tabs a, .tabs span {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--border);
}
.tabs .active { color: var(--primary); border-color: #BFD9FA; background: var(--primary-soft); font-weight: 600; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); padding: 22px 0 28px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- 登录/注册 ---------- */
.auth-wrap { max-width: 470px; margin: 28px auto 56px; }
.auth-card { padding: 34px 36px 28px; }
.auth-title { font-size: 25px; font-weight: 700; margin: 0 0 6px; }
.auth-foot { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.btn-block { width: 100%; height: 46px; font-size: 16px; }

/* ---------- 选项编辑行 ---------- */
.opt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.opt-row .input { flex: 1; }

/* ---------- Banner 上传与预览 ---------- */
.banner-uploader {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 10px;
}
.banner-uploader-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 240px;
    border: 1.5px dashed #A8C9F0;
    border-radius: 10px;
    background: linear-gradient(180deg, #F7FBFF 0%, #EEF6FF 100%);
    overflow: hidden;
    cursor: pointer;
    text-align: center;
}
.banner-uploader-media:hover { border-color: var(--primary); }
.banner-uploader-media.has-banner {
    border-style: solid;
    border-color: var(--border);
    background: #F4F9FF;
}
.banner-uploader-media img {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.banner-uploader-media.has-banner img { display: block; }
.banner-uploader-media.has-banner .banner-uploader-empty { display: none; }
.banner-uploader-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 26px 16px;
    color: var(--muted);
    font-size: 13px;
}
.banner-uploader-plus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 4px;
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
    font-size: 28px;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(43, 125, 233, .16);
}
.banner-uploader-empty strong { color: var(--text); font-size: 15px; font-weight: 600; }
.banner-uploader-sub { max-width: 520px; line-height: 1.5; }
.banner-uploader-action {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(22, 44, 74, .74);
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    opacity: 0;
    transition: opacity .15s;
    pointer-events: none;
}
.banner-uploader-media:hover .banner-uploader-action { opacity: 1; }
.banner-uploader-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}
.banner-uploader-foot .btn { flex: none; }
.banner-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Banner 预览（旧版，保留兼容） ---------- */
.banner-preview {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #F4F9FF;
    margin-bottom: 6px;
}
.banner-preview img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: cover; }
.banner-preview-text {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: #fff;
}

/* ---------- 统计概览 ---------- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}
.summary-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
}
.summary-value { font-size: 28px; font-weight: 700; line-height: 1.3; color: var(--primary-deep); }
.summary-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.score-badge {
    text-align: center;
    background: var(--primary-soft);
    border: 1px solid #D2E4FC;
    border-radius: 12px;
    padding: 10px 20px;
    min-width: 108px;
}
.score-badge strong { display: block; font-size: 26px; color: var(--primary-deep); line-height: 1.2; }
.score-badge span { font-size: 12px; color: var(--muted); }

/* ---------- 感谢页 ---------- */
.thank-card { text-align: center; }
.thank-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #E8F7F1;
    color: #158A5F;
    font-size: 30px;
    font-weight: 700;
    line-height: 62px;
}


/* ---------- 富文本编辑器 ---------- */
.rich-editor-shell {
    border: 1px solid #cfdcea;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.rich-editor-shell:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43, 125, 233, .12);
}
.rich-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    background: #f7fbff;
    border-bottom: 1px solid #e2ebf5;
}
.rich-btn {
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: #34495e;
    font-size: 13px;
    line-height: 24px;
    cursor: pointer;
}
.rich-btn:hover {
    background: #e8f2ff;
    border-color: #c8dcf4;
}
.rich-btn-bold { font-weight: 700; }
.rich-btn-italic { font-style: italic; }
.rich-btn-underline { text-decoration: underline; }
.rich-btn-strike { text-decoration: line-through; }
.rich-color {
    width: 20px;
    min-width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #cfdcea;
}
.rich-color:hover { border-color: #fff; box-shadow: 0 0 0 2px var(--primary); }
.rich-align, .rich-list { min-width: 26px; padding: 0 4px; }
.rich-clear { color: #7f8c9b; }
.rich-sep {
    width: 1px;
    height: 18px;
    margin: 0 3px;
    background: #dbe6f2;
}
.rich-editor {
    min-height: 44px;
    padding: 9px 12px;
    outline: none;
    color: var(--text);
    font-size: 15px;
    line-height: 1.75;
    overflow-wrap: break-word;
}
.rich-editor-single { white-space: pre-wrap; }
.rich-editor-multi { min-height: 132px; }
.rich-editor-compact { min-height: 58px; }
.rich-editor:empty:before,
.rich-editor.is-empty:before {
    content: attr(data-rich-placeholder);
    color: #9aa8b8;
    pointer-events: none;
}
.rich-editor p, .rich-editor div { margin: 0 0 6px; }
.rich-editor ul, .rich-editor ol { margin: 4px 0 6px 20px; padding: 0; }
.rich-editor li { margin: 2px 0; }
.rich-counter { color: #8b98a8; font-size: 12px; }
.rich-counter.over { color: var(--danger); font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
    .form-grid { grid-template-columns: 1fr; }
    .survey-row { grid-template-columns: 1fr; }
    .survey-row-actions { justify-content: flex-start; }
    .stat-label { width: 120px; }
    .topbar-inner { height: 64px; }
    .brand { font-size: 21px; gap: 10px; }
    .brand-logo { width: 36px; height: 36px; }
    .nav { gap: 12px; font-size: 14px; }
    .main { padding-top: 22px; }
}
@media (max-width: 520px) {
    .card { padding: 20px 18px; }
    .page-title { font-size: 22px; }
    .nav-user { display: none; }
    .btn { padding: 0 16px; }
    .brand { font-size: 18px; }
    .brand-logo { width: 30px; height: 30px; }
    .topbar-inner { height: auto; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; row-gap: 4px; }
    .brand { flex: 1 0 100%; }
    .nav { width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 8px 14px; }
}
