*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #FAF9F4;
    --primary:  #8FB9B8;
    --primary-dark: #7aa5a3;
    --secondary: #D9E7E6;
    --card:     #FFFFFF;
    --text:     #333333;
    --muted:    #777777;
    --border:   #E8ECEB;
    --shadow:   0 2px 16px rgba(0,0,0,.05);
    --shadow-hover: 0 6px 24px rgba(0,0,0,.08);
    --radius:   14px;
    --radius-sm: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ── 顶栏 ─────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 40px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark);
    letter-spacing: -.3px;
}

.user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
}

.user b { color: var(--text); }

.btn-outline {
    color: var(--primary-dark);
    background: transparent;
    border: 1px solid var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: all .25s ease;
}
.btn-outline:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

/* ── 内容区 ─────────────────────────────────────────── */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 40px 80px;
}

/* ── 消息提示 ─────────────────────────────────────────── */
.msg {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 24px;
}
.msg-ok   { background: #EDF7F6; color: #3d7a75; }
.msg-warn { background: #FDF6EC; color: #9a6a2a; }

/* ── 工具栏 ─────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.toolbar-left { display: flex; gap: 10px; align-items: center; flex: 1; }

.search-input {
    flex: 1;
    max-width: 360px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    background: var(--card);
    outline: none;
    color: var(--text);
    transition: border-color .25s, box-shadow .25s;
}
.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(143,185,184,.15);
}

.toolbar-right { display: flex; gap: 10px; align-items: center; }

/* ── 按钮 ─────────────────────────────────────────── */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .25s ease;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(143,185,184,.35);
}

.btn-ghost {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all .25s ease;
}
.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

/* ── 卡片 ─────────────────────────────────────────── */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    overflow-x: auto;
}

/* ── 表格 ─────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .3px;
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--border);
}

tbody tr {
    transition: background .2s ease;
}
tbody tr:hover { background: #FAFAF8; }

tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

.empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 52px 0;
    font-size: 14px;
}

.count-row {
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

/* ── 操作按钮 ─────────────────────────────────────────── */
.ops { white-space: nowrap; }

.btn-edit {
    display: inline-block;
    color: var(--primary-dark);
    background: #EDF6F5;
    border: none;
    padding: 5px 13px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    margin-right: 6px;
    transition: all .2s ease;
}
.btn-edit:hover { background: var(--secondary); }

.btn-del {
    display: inline-block;
    color: #b07070;
    background: #FDF4F4;
    border: none;
    padding: 5px 13px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s ease;
}
.btn-del:hover { background: #F5E0E0; color: #b07070; }

/* ── 登录页 ─────────────────────────────────────────── */
body.auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.auth-card {
    width: 360px;
    max-width: 92vw;
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow-hover);
    padding: 40px 36px;
}

.auth-brand {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 24px;
    letter-spacing: -.3px;
}

.auth-card h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -.5px;
}

.auth-card .desc {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.form-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 11px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color .25s, box-shadow .25s;
    margin-bottom: 16px;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(143,185,184,.12);
    background: #fff;
}

.auth-card .btn-primary { width: 100%; margin-top: 8px; padding: 13px; font-size: 15px; }

/* ── 弹窗 ─────────────────────────────────────────── */
.modal {
    position: fixed; inset: 0;
    background: rgba(30,30,30,.35);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 50;
    backdrop-filter: blur(3px);
}
.modal.open { display: flex; }

.modal-box {
    width: 480px;
    max-width: 100%;
    background: var(--card);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.12);
    padding: 28px 30px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px;
}
.modal-head h2 { font-size: 17px; font-weight: 600; color: var(--text); }
.btn-x {
    background: none; border: none; font-size: 26px; color: var(--muted);
    cursor: pointer; line-height: 1; padding: 0 4px;
    transition: color .2s;
}
.btn-x:hover { color: var(--text); }

.field-group { margin-bottom: 14px; }

.field-group label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 7px;
    font-weight: 500;
}
.req { color: #c08080; }

.field-group input,
.field-group select,
.field-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color .25s, box-shadow .25s;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(143,185,184,.12);
    background: #fff;
}

.row2 { display: flex; gap: 14px; }
.row2 > div { flex: 1; }

.check-row { margin: 16px 0 6px; }
.check-row label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--text); cursor: pointer;
}

.btn-full { width: 100%; margin-top: 20px; }

/* ── 导入弹窗 ─────────────────────────────────────────── */
.import-tip {
    background: #F0F7F7;
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 18px;
}
.import-tip b { color: var(--primary-dark); }
.import-tip ul { padding-left: 18px; margin: 6px 0; }

.file-upload { margin-bottom: 14px; }
.file-upload input[type="file"] { display: none; }
.file-label {
    display: block;
    padding: 28px 20px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    transition: all .25s ease;
}
.file-label:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
    background: #F5FAFA;
}
#fileText { pointer-events: none; }

/* ── 字段管理页 ─────────────────────────────────────────── */
.tip-box {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
    padding: 14px 16px;
    background: #F5FAFA;
    border-radius: var(--radius-sm);
    line-height: 1.8;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--secondary);
    color: var(--primary-dark);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ── 响应式 ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .topbar { padding: 14px 20px; }
    .container { padding: 28px 20px 60px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-right { justify-content: flex-end; }
    .search-input { max-width: 100%; }
    .row2 { flex-direction: column; gap: 0; }
    .card { padding: 20px 18px; }
}
