/* ============================================
   领券小助手后台样式
   ============================================ */
:root {
    --primary: #f04a30;
    --primary-dark: #cf3318;
    --orange: #ff9a3d;
    --text-1: #1d2129;
    --text-2: #4e5969;
    --text-3: #86909c;
    --border: #e5e6eb;
    --bg: #f6f6f8;
    --warm-bg: #fff6f4;
    --warm-border: #ffd9d0;
    --success: #0a7c25;
    --danger: #cb2634;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text-1);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:active { opacity: .8; }

/* ========== 顶部导航 ========== */
.topbar {
    background: #fff;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1440px;
    margin: 0 auto;
    height: 60px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: flex; align-items: center; color: var(--text-1); }
.brand-logo { font-size: 26px; margin-right: 8px; }
.brand-name { font-size: 18px; font-weight: 700; }
.brand-sub {
    font-size: 12px; color: var(--text-3);
    margin-left: 10px; padding: 2px 8px;
    background: var(--warm-bg); border: 1px solid var(--warm-border);
    border-radius: 999px;
}
.nav { display: flex; align-items: center; gap: 8px; }
.nav-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 999px;
    color: var(--text-2); font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: #f2f3f5; }
.nav-item.active { background: var(--warm-bg); color: var(--primary); font-weight: 700; }
.nav-logout { color: var(--text-3); }

/* ========== 布局 ========== */
.main { max-width: 1440px; margin: 0 auto; padding: 24px 24px 48px; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.page-title { font-size: 22px; font-weight: 700; }
.page-actions { display: flex; gap: 12px; align-items: center; }
.footer {
    text-align: center; color: #b0b5bd; font-size: 12px;
    padding: 24px 0 32px;
}

/* ========== 卡片 ========== */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 16px; font-weight: 700;
    padding-bottom: 14px; margin-bottom: 16px;
    border-bottom: 2px solid #f2f3f5;
    display: flex; align-items: center; justify-content: space-between;
}

/* ========== 提示 ========== */
.alert {
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    border: 2px solid transparent;
}
.alert-success { background: #eaf8ee; color: var(--success); border-color: #b7e7c4; }
.alert-error { background: #ffecec; color: var(--danger); border-color: #ffc9c9; }
.alert-info { background: #eef4ff; color: #1456cc; border-color: #c2d8ff; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 22px;
    border-radius: 999px; border: 1px solid transparent;
    font-size: 14px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    text-decoration: none;
}
.btn:active { opacity: .85; }
.btn-primary { background: linear-gradient(135deg, var(--orange), var(--primary)); color: #fff; }
.btn-default { background: #fff; color: var(--text-2); border-color: var(--border); }
.btn-danger { background: #fff; color: var(--danger); border-color: #ffc9c9; }
.btn-sm { height: 30px; padding: 0 14px; font-size: 12px; }

/* ========== 表格 ========== */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
    padding: 14px 16px; text-align: left;
    border-bottom: 1px solid #f2f3f5;
    vertical-align: middle;
}
table.data th {
    background: #fafbfc; color: var(--text-2);
    font-size: 13px; font-weight: 700; white-space: nowrap;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fffaf9; }

/* 领券列表：固定列宽，防止「跳转目标」长链接撑开其他列 */
table.data-coupons { table-layout: fixed; }
table.data-coupons td { overflow: hidden; }
table.data-coupons .link-text { max-width: 100%; }
/* 分类 / 数字 / 状态等窄列：内容横排不折行、居中 */
table.data-coupons .col-nowrap { white-space: nowrap; text-align: center; }
table.data-coupons th.col-nowrap { text-align: center; }
/* 操作列按钮组不做溢出裁切，避免小屏幕下按钮被截断 */
table.data-coupons .col-actions { overflow: visible; }

.col-actions { white-space: nowrap; text-align: right; }
.col-actions .btn { margin-left: 6px; }
/* 领券列表操作列按钮较多，收紧横向内边距保证 4 个按钮完整显示 */
table.data-coupons .col-actions .btn-sm { padding-left: 11px; padding-right: 11px; }

.platform-cell { display: flex; align-items: center; gap: 10px; }
.platform-icon {
    width: 36px; height: 36px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0; background: var(--warm-bg);
}
.platform-name { font-weight: 700; color: var(--text-1); }
.platform-sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 400; }
.link-text {
    display: inline-block; max-width: 260px;
    color: var(--text-3); font-size: 12px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    vertical-align: middle;
}
.clicks { font-weight: 700; color: var(--primary); }

/* 跳转目标（小程序 AppID / 页面路径）长文本截断 */
.jump-target { max-width: 100%; min-width: 0; }

/* 领取项页：父条目信息卡片 */
.parent-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; margin-bottom: 14px;
}
.parent-card .platform-icon { width: 42px; height: 42px; font-size: 22px; }
.parent-meta { min-width: 0; }
.parent-name { font-weight: 700; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.jump-target .jump-line {
    display: block; max-width: 100%;
    font-size: 12px; color: var(--text-3); font-weight: 400;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jump-target .jump-appid { color: var(--text-2); margin-top: 4px; }

.badge {
    display: inline-block; padding: 3px 12px;
    border-radius: 999px; font-size: 12px; font-weight: 600;
    white-space: nowrap;
}
.badge-on { background: #eaf8ee; color: var(--success); border: 1px solid #b7e7c4; }
.badge-off { background: #f2f3f5; color: var(--text-3); border: 1px solid var(--border); }

/* ========== 筛选条 ========== */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-item {
    padding: 7px 18px; border-radius: 999px;
    background: #fff; border: 2px solid var(--border);
    color: var(--text-2); font-size: 13px; font-weight: 500;
}
.filter-item.active {
    background: linear-gradient(135deg, var(--orange), var(--primary));
    border-color: transparent; color: #fff; font-weight: 700;
}

/* ========== 表单 ========== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.form-item { display: flex; flex-direction: column; }
.form-item.full { grid-column: 1 / -1; }
.form-item label {
    font-size: 13px; font-weight: 700; color: var(--text-2);
    margin-bottom: 8px;
}
.form-item label .required { color: var(--danger); margin-left: 2px; }
.form-item .hint { font-size: 12px; color: var(--text-3); font-weight: 400; margin-top: 6px; }
.input, select.input, textarea.input {
    width: 100%; height: 40px; padding: 0 14px;
    border: 2px solid var(--border); border-radius: 10px;
    font-size: 14px; color: var(--text-1);
    background: #fff; outline: none;
    font-family: inherit;
}
textarea.input { height: auto; padding: 10px 14px; resize: vertical; }
.input:focus { border-color: var(--primary); }
.form-actions {
    display: flex; gap: 12px; margin-top: 24px;
    padding-top: 20px; border-top: 2px solid #f2f3f5;
}
.color-preview { display: flex; align-items: center; gap: 10px; }
.color-dot { width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--border); }
.color-preview .input { flex: 1; }

/* ========== 统计 ========== */
.stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    margin-bottom: 20px;
}
.stat-box {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px 24px;
}
.stat-box .num { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-box .lbl { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.stat-box.accent { background: linear-gradient(135deg, #fff3ee, #fff); border-color: var(--warm-border); }

/* ========== 登录页 ========== */
.login-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #ffe3c8, #fff1e8);
    padding: 20px;
}
.login-card {
    width: 100%; max-width: 400px;
    background: #fff; border-radius: 16px;
    padding: 36px 32px;
    box-shadow: 0 8px 32px rgba(240, 74, 48, .15);
}
.login-logo { text-align: center; font-size: 52px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; margin: 14px 0 6px; }
.login-sub { text-align: center; font-size: 12px; color: var(--text-3); margin-bottom: 26px; }
.login-form .form-item { margin-bottom: 18px; }
.login-form .btn-primary { width: 100%; height: 46px; font-size: 16px; margin-top: 6px; }
.login-error {
    background: #ffecec; border: 2px solid #ffc9c9; color: var(--danger);
    border-radius: 10px; padding: 12px 16px; font-size: 13px;
    margin-bottom: 18px; text-align: center;
}

/* ========== 响应式 ========== */
@media (max-width: 760px) {
    .topbar-inner { flex-direction: column; height: auto; padding: 10px 16px; gap: 8px; }
    .main { padding: 16px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
    .nav-item { padding: 6px 12px; font-size: 13px; }
    .link-text { max-width: 120px; }
}
