/* ============================================================
   全局样式 — 极兔快递品牌风格
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f5f6fa;
    min-height: 100vh;
    color: #333;
    line-height: 1.5;
}

.app-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================
   顶部导航 — 极兔橙色品牌栏
   ============================================================ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #ff2b6f 0%, #ff5c8a 100%);
    padding: 0 28px;
    height: 56px;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(255,43,111,0.3);
    margin-bottom: 16px;
}

.app-logo {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.header-btn.admin-entry {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
}
.header-btn.admin-entry:hover {
    background: rgba(255,255,255,0.35);
}

.header-btn.logout {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.2);
}
.header-btn.logout:hover {
    background: rgba(255,255,255,0.28);
    color: #fff;
}

.user-info {
    font-size: 13px;
    color: rgba(255,255,255,0.95);
    font-weight: 500;
    padding: 0 4px;
}

/* ============================================================
   Tab 导航
   ============================================================ */
.tab-nav {
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 14px 14px 0 0;
    padding: 0 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    border-bottom: 1px solid #eee;
}

.tab-btn {
    padding: 14px 22px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #888;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.tab-btn:hover { color: #555; }
.tab-btn.active {
    color: #ff2b6f;
    border-bottom-color: #ff2b6f;
    font-weight: 600;
}

/* ============================================================
   内容区
   ============================================================ */
.app-content {
    flex: 1;
    background: #fff;
    padding: 24px 28px;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 8px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   统计卡片 — 带顶部色条
   ============================================================ */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 16px 14px;
    text-align: center;
    border: 1px solid #f0f0f0;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: #d0d0d0;
}
.stat-card .stat-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: 4px;
    line-height: 1.2;
}
.stat-card.connected::before { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.stat-card.unconnected::before { background: linear-gradient(90deg, #e74c3c, #ff6b6b); }
.stat-card.rate::before { background: linear-gradient(90deg, #ff2b6f, #ff7aa3); }

/* ============================================================
   区块标题
   ============================================================ */
.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.section-title .icon { font-size: 16px; }

/* ============================================================
   表单组件
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}
.required { color: #e74c3c; }
.hint { font-size: 12px; color: #aaa; margin-top: 4px; display: block; }

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #fafbfc;
    color: #333;
}
.form-group input:focus,
.form-group select:focus {
    border-color: #ff2b6f;
    box-shadow: 0 0 0 3px rgba(255,43,111,0.1);
    background: #fff;
}
.form-group input:read-only {
    background: #f5f6f8;
    color: #666;
    cursor: default;
    border-color: #eaeaea;
}
.form-group input:read-only:focus {
    border-color: #eaeaea;
    box-shadow: none;
}

.input-group {
    display: flex;
    gap: 10px;
}
.input-group input[type="text"] { flex: 1; }

.form-row {
    display: flex;
    gap: 16px;
}
.form-group.half { flex: 1; }

/* ============================================================
   时间信息栏（常驻显示）
   ============================================================ */
.time-info-bar {
    background: #fef5f8;
    border: 1px solid #fcc8db;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}
.time-info-bar .form-group { margin-bottom: 0; }
.time-info-bar label {
    font-size: 12px;
    font-weight: 600;
    color: #993355;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.time-info-bar input {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    background: #fff;
    border-color: #f0c0d3;
}

/* ============================================================
   态度/接通选项
   ============================================================ */
.attitude-row {
    background: #f9fafb;
    border-radius: 12px;
    padding: 18px 20px 10px;
    margin-bottom: 16px;
    border: 1px solid #eef0f3;
}
.attitude-row > .form-group { margin-bottom: 8px; }
.attitude-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 4px;
}
.attitude-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 8px;
    transition: background 0.15s;
}
.attitude-item:hover:not(.disabled) { background: #fff0f5; }
.attitude-item.disabled { cursor: not-allowed; opacity: 0.45; }
.attitude-item input[type="radio"] { display: none; }
.attitude-label {
    padding: 8px 20px;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid #e0e0e0;
    transition: all 0.2s;
    user-select: none;
}
.attitude-item input[type="radio"]:checked + .attitude-label {
    border-color: #ff2b6f;
    background: #ffe0eb;
    box-shadow: 0 0 0 2px rgba(255,43,111,0.12);
}
.attitude-label.accept { color: #27ae60; }
.attitude-label.accept:hover { border-color: #27ae60; }
.attitude-label.reject { color: #e74c3c; }
.attitude-label.reject:hover { border-color: #e74c3c; }
.attitude-label.pending { color: #f39c12; }
.attitude-label.pending:hover { border-color: #f39c12; }
.attitude-item input[type="radio"]:checked + .attitude-label.accept {
    border-color: #27ae60; background: #e8f8ef;
}
.attitude-item input[type="radio"]:checked + .attitude-label.reject {
    border-color: #e74c3c; background: #fdeaea;
}
.attitude-item input[type="radio"]:checked + .attitude-label.pending {
    border-color: #f39c12; background: #fef9e7;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    padding: 9px 20px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    letter-spacing: 0.3px;
}
.btn-primary { background: #ff2b6f; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #e0245e; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,43,111,0.3); }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }

.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover:not(:disabled) { background: #1e8449; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(39,174,96,0.3); }
.btn-success:disabled { background: #a9c9b5; cursor: not-allowed; }

.btn-secondary { background: #f0f0f0; color: #555; }
.btn-secondary:hover:not(:disabled) { background: #e0e0e0; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c0392b; }

.submit-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}
.submit-group .btn {
    min-width: 140px;
    padding: 12px 28px;
    font-size: 15px;
}

/* ============================================================
   消息
   ============================================================ */
.message {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    display: none;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}
.message.success { display: block; background: #e8f8ef; color: #1e8449; border: 1px solid #c3e6cb; }
.message.error { display: block; background: #fdeaea; color: #922b21; border: 1px solid #f5b7b1; }

/* ============================================================
   记录列表
   ============================================================ */
.filter-bar {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 18px;
    border: 1px solid #eef0f3;
}
.filter-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 130px;
}
.filter-item label { font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.3px; }
.filter-item input { padding: 8px 12px; border: 1.5px solid #e0e0e0; border-radius: 8px; font-size: 13px; outline: none; background: #fff; }
.filter-item input:focus { border-color: #ff2b6f; }
.filter-item .btn { padding: 8px 18px; font-size: 13px; }

.record-item {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 10px;
    border: 1px solid #f0f0f0;
    transition: box-shadow 0.2s;
}
.record-item:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.record-item .record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f5f5f5;
}
.record-item .record-body {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
}
.record-item .record-body .tag {
    background: #f0f0f0;
    padding: 3px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
}
.record-item .record-body .tag.accept { background: #e8f8ef; color: #1e8449; }
.record-item .record-body .tag.reject { background: #fdeaea; color: #922b21; }
.record-item .record-body .tag.pending { background: #fef9e7; color: #7d6608; }
.record-item .record-body .tag.connected { background: #e8f8ef; color: #1e8449; }
.record-item .record-body .tag.unconnected { background: #fdeaea; color: #922b21; }

.retry-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.retry-section label { font-size: 12px; color: #888; }
.retry-section .btn-sm { padding: 4px 14px; font-size: 12px; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; }
.retry-section .btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   分页
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding-top: 14px;
}
.pagination .btn { padding: 7px 20px; font-size: 13px; }
.pagination .btn:disabled { opacity: 0.5; cursor: not-allowed; }
#pageInfo { font-size: 13px; color: #888; }

.loading { text-align: center; color: #bbb; padding: 40px 0; font-size: 14px; }
.empty { text-align: center; color: #bbb; padding: 40px 0; font-size: 14px; }

/* ============================================================
   排行榜
   ============================================================ */
.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.ranking-header h3 { font-size: 17px; color: #333; font-weight: 700; }
.ranking-filter { display: flex; align-items: center; gap: 10px; }
.ranking-filter label { font-size: 13px; color: #888; }
.ranking-filter select { padding: 7px 14px; border: 1.5px solid #e0e0e0; border-radius: 8px; font-size: 13px; outline: none; background: #fff; }
.ranking-filter select:focus { border-color: #ff2b6f; }

.ranking-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
}
.ranking-table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #eee;
}
.ranking-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
}
.ranking-table tr:last-child td { border-bottom: none; }
.ranking-table tr.my-rank {
    background: #fff0f5;
}
.ranking-table tr.my-rank td {
    font-weight: 600;
    color: #ff2b6f;
}
.ranking-table .rank-medal { font-size: 20px; }

/* ============================================================
   管理界面
   ============================================================ */
.admin-layout {
    display: flex;
    gap: 20px;
    min-height: 500px;
}

.admin-sidebar {
    width: 180px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 8px 0;
    border: 1px solid #eef0f3;
}
.admin-menu-btn {
    display: block;
    width: 100%;
    padding: 11px 18px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    margin-right: 4px;
}
.admin-menu-btn:hover { background: #eef0f3; color: #333; }
.admin-menu-btn.active {
    background: #ffe0eb;
    color: #ff2b6f;
    border-left-color: #ff2b6f;
    font-weight: 600;
}

.admin-content {
    flex: 1;
}
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
.admin-stat-card {
    background: #f9fafb;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    border: 1px solid #eef0f3;
}
.admin-stat-card span { display: block; font-size: 12px; color: #999; text-transform: uppercase; letter-spacing: 0.3px; }
.admin-stat-card strong { font-size: 24px; color: #333; margin-top: 2px; }

.admin-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.admin-filter input, .admin-filter select {
    padding: 8px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: #fff;
}
.admin-filter input:focus, .admin-filter select:focus {
    border-color: #ff2b6f;
}
.admin-filter .btn { padding: 8px 18px; font-size: 13px; }

.invite-generate {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px 18px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #eef0f3;
}
.invite-generate label { font-size: 13px; font-weight: 500; color: #555; }
.invite-generate input[type="number"] {
    width: 80px;
    padding: 8px 10px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
}
.invite-generate .btn { padding: 8px 20px; }

.export-form {
    max-width: 520px;
}
.export-form .form-group { margin-bottom: 12px; }
.export-form .form-group label { font-size: 13px; }
.export-form .btn { margin-top: 8px; }

/* 管理面板内分区标题 */
.admin-section {
    margin-bottom: 24px;
}
.admin-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}
.admin-section .section-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}
.admin-divider {
    border: none;
    border-top: 1px solid #eef0f3;
    margin: 24px 0;
}

/* ============================================================
   页脚
   ============================================================ */
.app-footer {
    text-align: center;
    font-size: 12px;
    color: #ccc;
    padding: 10px 0;
    letter-spacing: 0.3px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
    .app-container { padding: 10px; }
    .app-header { flex-wrap: wrap; gap: 8px; padding: 0 16px; height: 50px; }
    .app-logo { font-size: 15px; }
    .header-right { flex-wrap: wrap; }
    .tab-btn { padding: 10px 14px; font-size: 13px; }
    .app-content { padding: 16px; }
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; gap: 10px; }
    .filter-row { flex-direction: column; }
    .filter-item { min-width: 100%; }
    .input-group { flex-direction: column; }
    .submit-group { flex-direction: column; align-items: center; }
    .submit-group .btn { width: 100%; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; display: flex; flex-wrap: wrap; padding: 8px; }
    .admin-menu-btn { width: auto; padding: 8px 16px; border-left: none; border-bottom: 3px solid transparent; border-radius: 0; margin-right: 0; }
    .admin-menu-btn.active { border-bottom-color: #ff2b6f; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
    .ranking-table { font-size: 12px; }
    .ranking-table th, .ranking-table td { padding: 8px 10px; }
}

/* ============================================================
   自定义弹窗（替代原生 alert / confirm / prompt）
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(2px);
}
.modal-overlay.show { opacity: 1; }
.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 92%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(14px) scale(0.97);
    transition: transform 0.2s ease;
}
.modal-overlay.show .modal-box { transform: none; }
.modal-title {
    padding: 20px 22px 0;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}
.modal-body {
    padding: 12px 22px 4px;
    font-size: 14px;
    color: #666;
    line-height: 1.7;
    word-break: break-word;
}
.modal-footer {
    padding: 14px 22px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.modal-form .form-group { margin-bottom: 12px; }
.modal-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
}
.modal-form input,
.modal-form select {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.modal-form input:focus,
.modal-form select:focus { border-color: #ff2b6f; }
.modal-form input:disabled { background: #f5f5f5; color: #999; }
