/* ========== 基础 ========== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f4f6fa;
    color: #222;
    font-size: 15px;
    padding-bottom: 40px;
}
a { color: inherit; text-decoration: none; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 18px; border: none; border-radius: 8px;
    font-size: 15px; cursor: pointer; background: #e8ecf3; color: #333;
    transition: all .15s; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg,#4f8cff,#3a6fe0); color: #fff; }
.btn-ghost { background: transparent; color: #666; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-called {
    background: linear-gradient(135deg,#22c55e,#16a34a);
    color: #fff; font-weight: 600; padding: 12px 18px;
    box-shadow: 0 4px 12px rgba(34,197,94,.3);
}
.btn-called:hover { filter: brightness(1.05); }

/* ========== 登录 ========== */
.login-body {
    background: linear-gradient(135deg,#667eea,#764ba2);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-card {
    background: #fff; border-radius: 16px; padding: 36px 32px;
    width: 100%; max-width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.login-card h2 { text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: #999; margin-bottom: 24px; font-size: 14px; }
.login-card label { display: block; margin: 14px 0 6px; font-size: 14px; color: #555; }
.login-card input {
    width: 100%; padding: 12px 14px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 15px; outline: none;
}
.login-card input:focus { border-color: #4f8cff; }
.login-card .btn-primary { margin-top: 24px; padding: 12px; font-size: 16px; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; }

/* ========== 顶栏 ========== */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.logo { font-size: 18px; font-weight: 700; color: #333; }
.hello { color: #666; font-size: 14px; margin-right: 8px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ========== 统计条 ========== */
.stats-bar {
    display: flex; gap: 10px; padding: 14px 16px;
}
.stat {
    flex: 1; background: #fff; border-radius: 12px;
    padding: 14px 8px; text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.stat-num { font-size: 24px; font-weight: 700; color: #3a6fe0; }
.stat-label { font-size: 12px; color: #999; margin-top: 4px; }
.stat:nth-child(1) .stat-num { color: #22c55e; }
.stat:nth-child(2) .stat-num { color: #f59e0b; }
.stat:nth-child(3) .stat-num { color: #8b5cf6; }

/* ========== 筛选 ========== */
.filter-bar {
    display: flex; gap: 8px; padding: 0 16px 12px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.chip {
    flex-shrink: 0; padding: 7px 14px; border-radius: 20px;
    background: #fff; border: 1px solid #e5e7eb; color: #555;
    font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip-active { background: #3a6fe0; color: #fff; border-color: #3a6fe0; }
.chip-refresh { margin-left: auto; }

/* ========== 电话卡片 ========== */
.phone-list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.phone-card {
    background: #fff; border-radius: 12px; padding: 14px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity:0; transform: translateY(8px);} to {opacity:1; transform:none;} }
.card-done { opacity: 0; transform: translateX(60px); transition: all .3s; }
.card-main { flex: 1; min-width: 0; }
.phone-num { font-size: 22px; font-weight: 700; letter-spacing: .5px; margin-bottom: 6px; }
.tel-link { color: #1f2937; }
.tel-link:active { color: #3a6fe0; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: #666; }
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 12px; font-weight: 600;
}
.tag-public { background: #fef3c7; color: #b45309; }
.tag-private { background: #ede9fe; color: #6d28d9; }
.platform { color: #3a6fe0; background: #eff6ff; padding: 2px 8px; border-radius: 4px; }
.cust-name { color: #555; }
.area { color: #999; }
.remark {
    margin-top: 6px; font-size: 13px; color: #777;
    background: #f9fafb; padding: 6px 10px; border-radius: 6px;
    overflow: hidden; text-overflow: ellipsis;
}

/* ========== 空状态 ========== */
.empty-tip { text-align: center; padding: 60px 20px; color: #999; }
.empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-tip p { margin-bottom: 20px; }
.loading { text-align: center; padding: 20px; color: #999; }

/* ========== 弹窗 ========== */
.modal-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
}
.modal {
    background: #fff; border-radius: 14px; padding: 22px;
    width: 100%; max-width: 360px;
}
.modal h3 { margin-bottom: 6px; }
.modal-phone { font-size: 20px; font-weight: 700; color: #3a6fe0; margin-bottom: 14px; }
.modal label { font-size: 13px; color: #666; display: block; margin-bottom: 8px; }
.modal textarea {
    width: 100%; min-height: 60px; padding: 10px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 14px; resize: vertical; outline: none;
    font-family: inherit;
}
.modal textarea:focus { border-color: #4f8cff; }
.quick-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag-btn {
    padding: 5px 12px; border-radius: 16px; border: 1px solid #e5e7eb;
    background: #f9fafb; font-size: 13px; cursor: pointer; color: #555;
}
.tag-active { background: #3a6fe0; color: #fff; border-color: #3a6fe0; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ========== Toast ========== */
.toast {
    position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,.8); color: #fff; padding: 10px 20px;
    border-radius: 24px; font-size: 14px; z-index: 200;
    opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast-ok { background: rgba(34,197,94,.95); }
.toast-err { background: rgba(239,68,68,.95); }

/* ========== 后台通用 ========== */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar {
    width: 200px; background: #1f2937; color: #cbd5e1;
    padding: 20px 0; flex-shrink: 0;
}
.sidebar h2 { color: #fff; font-size: 16px; padding: 0 20px 20px; border-bottom: 1px solid #374151; }
.sidebar a {
    display: block; padding: 12px 20px; color: #cbd5e1;
    font-size: 14px; border-left: 3px solid transparent;
}
.sidebar a:hover, .sidebar a.active {
    background: #111827; color: #fff; border-left-color: #4f8cff;
}
.admin-main { flex: 1; padding: 24px; background: #f4f6fa; overflow-x: auto; }
.admin-main h1 { font-size: 20px; margin-bottom: 20px; }
.card-white {
    background: #fff; border-radius: 10px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 16px;
}
table.data-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
}
table.data-table th, table.data-table td {
    padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee;
}
table.data-table th { background: #f9fafb; color: #555; font-weight: 600; }
table.data-table tr:hover td { background: #f9fafb; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; font-size: 14px; color: #555; }
.form-row input, .form-row select, .form-row textarea {
    width: 100%; max-width: 400px; padding: 9px 12px;
    border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none;
}
.form-row input:focus, .form-row select:focus { border-color: #4f8cff; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 14px; margin-bottom: 20px; }
.admin-stat { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.admin-stat .n { font-size: 28px; font-weight: 700; color: #3a6fe0; }
.admin-stat .l { font-size: 13px; color: #999; margin-top: 4px; }
.badge { padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-red { background: #fee2e2; color: #991b1b; }
.text-muted { color: #999; font-size: 13px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
