/* 手机版 H5 样式 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
    --primary: #e1251b;
    --primary-dark: #c1170f;
    --blue: #2563eb;
    --bg: #f4f5f7;
    --card: #ffffff;
    --text: #1f2329;
    --muted: #8a9099;
    --border: #e5e6eb;
    --green: #16a34a;
    --orange: #f59e0b;
}

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

.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }

/* 顶部品牌 */
.topbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 20px 16px 24px;
    border-radius: 0 0 18px 18px;
}
.topbar .brand { font-size: 18px; font-weight: 700; }
.topbar .sub { font-size: 13px; opacity: .85; margin-top: 4px; }
.topbar .user-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.topbar .user-name { font-size: 14px; background: rgba(255,255,255,.18); padding: 4px 12px; border-radius: 20px; }
.link-logout { color: #fff; font-size: 13px; opacity: .9; text-decoration: none; }

/* 卡片 */
.card {
    background: var(--card);
    border-radius: 14px;
    padding: 18px 16px;
    margin-top: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ''; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; }

/* 配额网格 */
.quota-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.quota-item { background: #f7f8fa; border-radius: 10px; padding: 12px 6px; }
.quota-item .num { font-size: 22px; font-weight: 700; }
.quota-item .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.num.red { color: var(--primary); }
.num.green { color: var(--green); }
.num.blue { color: var(--blue); }

/* 进度条 */
.progress { height: 8px; background: #f0f1f3; border-radius: 6px; overflow: hidden; margin-top: 14px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #ff6a3d); border-radius: 6px; transition: width .3s; }

/* 大按钮 */
.btn {
    display: block; width: 100%; border: none; border-radius: 12px;
    padding: 16px; font-size: 17px; font-weight: 700; cursor: pointer;
    color: #fff; transition: transform .05s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn-extract { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.btn-refill { background: linear-gradient(135deg, var(--blue), #1d4ed8); margin-top: 12px; }
.btn:disabled { background: #c9cdd4; color: #fff; cursor: not-allowed; }
.btn-ghost { background: #f0f1f3; color: var(--text); margin-top: 10px; font-size: 14px; font-weight: 600; padding: 12px; }

/* 状态提示条 */
.notice { border-radius: 10px; padding: 12px; font-size: 13px; margin-bottom: 14px; }
.notice.warn { background: #fff7e8; color: #b45309; border: 1px solid #fde4b8; }
.notice.info { background: #eef4ff; color: #1d4ed8; border: 1px solid #cdddff; }
.notice.ok { background: #edf9ef; color: #15803d; border: 1px solid #c6ecd0; }
.notice b { font-weight: 700; }

/* 在途明细 */
.flight-list { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.flight-list table { width: 100%; border-collapse: collapse; font-size: 13px; }
.flight-list th, .flight-list td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.flight-list th { background: #f7f8fa; position: sticky; top: 0; color: var(--muted); font-weight: 600; }
.flight-list td.link-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-group .input {
    width: 100%; border: 1px solid var(--border); border-radius: 10px;
    padding: 13px 14px; font-size: 15px; outline: none; background: #fafbfc;
}
.form-group .input:focus { border-color: var(--primary); background: #fff; }
.form-foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }
.form-foot a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* 认证页 */
.auth-wrap { max-width: 420px; margin: 40px auto; padding: 0 16px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .logo { width: 60px; height: 60px; border-radius: 16px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; font-weight: 800; }
.auth-logo h1 { font-size: 20px; margin-top: 12px; }
.auth-logo p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.auth-card { background: var(--card); border-radius: 16px; padding: 22px 18px; box-shadow: 0 4px 18px rgba(0,0,0,.05); }

/* 兜底粘贴区 */
.fallback-box { margin-top: 12px; display: none; }
.fallback-box textarea { width: 100%; min-height: 120px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 13px; outline: none; resize: vertical; }

/* Toast */
.toast {
    position: fixed; left: 50%; top: 40%; transform: translate(-50%,-50%);
    background: rgba(0,0,0,.82); color: #fff; padding: 12px 20px; border-radius: 10px;
    font-size: 14px; max-width: 80%; z-index: 999; text-align: center;
    opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.ok { background: rgba(22,163,74,.92); }
.toast.err { background: rgba(225,37,27,.95); }

.hidden { display: none !important; }

/* 角色徽章 */
.role-badge {
    display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
    border-radius: 20px; background: #eef0f3; color: #646a73; margin-left: 6px;
}
.role-badge.agent { background: rgba(37,99,235,.12); color: var(--blue); }

/* 工作台代理入口 */
.agent-entry {
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
    border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; text-decoration: none;
}
.agent-entry-title { font-size: 16px; font-weight: 700; }
.agent-entry-sub { font-size: 12px; opacity: .88; margin-top: 3px; }
.agent-entry-arrow { font-size: 28px; line-height: 1; opacity: .9; }

/* 邀请盒 */
.invite-code { font-size: 24px; font-weight: 800; letter-spacing: 3px; color: var(--blue); }
.invite-url {
    font-size: 12px; color: var(--muted); word-break: break-all; margin-top: 8px;
    background: #f7f8fa; border-radius: 8px; padding: 8px 10px;
}

/* 下级成员卡片 */
.member-card {
    border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px;
}
.member-head { display: flex; align-items: center; flex-wrap: wrap; }
.member-name { font-weight: 700; font-size: 15px; }
.member-status { font-size: 11px; padding: 2px 8px; border-radius: 20px; margin-left: 6px; }
.member-status.st-0 { background: #fff4e0; color: #b45309; }
.member-status.st-1 { background: #e6f7ec; color: #15803d; }
.member-status.st-2 { background: #fde8e6; color: #b91c1c; }
.member-quota { font-size: 12px; color: #646a73; margin: 8px 0; }
.member-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.member-actions .btn-sm { width: 100%; flex: 1 1 auto; }
.member-line { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.member-line label { font-size: 12px; color: var(--muted); }
.member-line .field-row { display: flex; gap: 8px; }
.member-line .field-row input {
    flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px;
    font-size: 14px; outline: none; min-width: 0;
}
.member-line .field-row .btn-sm { flex: 0 0 auto; }
.btn-make.full { width: 100%; margin-top: 10px; }
.btn-del-member { background: #fff; color: #c0392b; border: 1px solid #e6b0a8; }
.btn-del-member.full { width: 100%; margin-top: 8px; }
.btn-revoke { background: #fdf0ef; color: #c0392b; border: 1px solid #f6c9c4; }
.btn-revoke.full { width: 100%; margin-top: 10px; }
.btn-sm { padding: 7px 12px !important; font-size: 13px !important; flex: 0 0 auto; }
.btn-make {
    margin-top: 8px; background: #f0f3ff; color: var(--blue); border: 1px solid #d6e0ff;
}

.flight-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-release { background: #fff3e0; color: #b45309; border: 1px solid #f0c48a; }
.flight-head > span { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flight-head .btn-release { flex: 0 0 auto; white-space: nowrap; }
.flight-head .btn-release { flex: 0 0 auto; width: auto !important; white-space: nowrap; }
.member-line .field-row .btn-sm { flex: 0 0 auto; width: auto !important; }
.member-line .field-row input { min-width: 0; }

/* 下级卡片：输入框固定宽度、按钮占右边，避免 .btn 的 width:100% 把输入框压成一条缝 */
.member-line .field-row {
    display: grid !important;
    grid-template-columns: 104px 1fr;
    gap: 8px;
    align-items: stretch;
}
.member-line .field-row input {
    width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
}
.member-line .field-row .btn-sm {
    width: 100% !important;
    margin: 0 !important;
    flex: none !important;
    display: block;
    padding: 10px 12px !important;
    border-radius: 10px;
}
.topbar .user-actions { display: flex; align-items: center; gap: 12px; }
