/* ============================================================
   线索收集系统 · 全站样式
   设计基调：深蓝灰侧边栏 + 浅灰内容区 + 蓝色主色
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------
   登录页
   ------------------------------------------------------------ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, rgba(37, 99, 235, .14), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(6, 182, 212, .12), transparent 45%),
        #eef2f7;
}

.auth-card {
    display: flex;
    width: 100%;
    max-width: 880px;
    min-height: 500px;
    background: var(--card);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.auth-brand {
    flex: 0 0 340px;
    padding: 44px 36px;
    color: #e2e8f0;
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.auth-brand::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -80px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, .45), transparent 70%);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
}

.brand-mark .logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--primary);
    display: grid;
    place-items: center;
    font-size: 17px;
    color: #fff;
    flex: 0 0 auto;
}

.auth-brand h1 {
    margin: 40px 0 12px;
    font-size: 26px;
    line-height: 1.35;
    font-weight: 600;
    color: #fff;
}

.auth-brand p {
    margin: 0;
    color: #94a3b8;
    font-size: 13.5px;
}

.brand-points {
    list-style: none;
    margin: 32px 0 0;
    padding: 0;
    font-size: 13px;
    color: #cbd5e1;
}

.brand-points li {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 14px;
}

.brand-points .dot {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 50%;
    background: rgba(37, 99, 235, .22);
    color: #93c5fd;
    font-size: 11px;
    display: grid;
    place-items: center;
}

.auth-brand .brand-footer {
    margin-top: auto;
    font-size: 12px;
    color: #64748b;
    position: relative;
    z-index: 1;
}

.auth-form {
    flex: 1 1 auto;
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
}

.auth-form .sub {
    margin: 0 0 28px;
    color: var(--text-muted);
    font-size: 13.5px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

/* 通用表单控件：放在 .field 里或单独使用都可以 */
.control {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    font-family: inherit;
}

.control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.control::placeholder {
    color: var(--text-faint);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 18px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.btn-primary {
    color: #fff;
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.btn-block {
    width: 100%;
    height: 44px;
    font-size: 15px;
}

.btn-ghost {
    color: #374151;
    background: #fff;
    border-color: var(--border);
}

.btn-ghost:hover {
    background: #f9fafb;
    text-decoration: none;
}

.btn-danger {
    color: #fff;
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    text-decoration: none;
}

.auth-hint {
    margin-top: 22px;
    padding: 12px 14px;
    font-size: 12.5px;
    color: #4b5563;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    line-height: 1.7;
}

.auth-hint code {
    padding: 1px 5px;
    font-size: 12px;
    background: #eef2f7;
    border-radius: 4px;
    color: #1d4ed8;
}

/* ------------------------------------------------------------
   提示条
   ------------------------------------------------------------ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 11px 14px;
    margin-bottom: 18px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    line-height: 1.6;
}

.alert-danger {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.alert-success {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.alert-warning {
    color: #b45309;
    background: #fffbeb;
    border-color: #fde68a;
}

.alert-info {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.alert code {
    padding: 1px 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: inherit;
    background: rgba(255, 255, 255, .7);
    border-radius: 4px;
}

/* ------------------------------------------------------------
   后台框架
   ------------------------------------------------------------ */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    flex: 0 0 220px;
    width: 220px;
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 60px;
    padding: 0 18px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex: 0 0 auto;
}

.sidebar-brand .logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary);
    display: grid;
    place-items: center;
    font-size: 14px;
    flex: 0 0 auto;
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 14px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 12px;
    margin-bottom: 4px;
    font-size: 13.5px;
    color: #cbd5e1;
    border-radius: var(--radius-sm);
    transition: background-color .15s, color .15s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

.nav-item .icon {
    width: 16px;
    text-align: center;
    flex: 0 0 auto;
    opacity: .9;
}

.sidebar-user {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #475569;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 600;
    flex: 0 0 auto;
}

.sidebar-user .meta {
    min-width: 0;
}

.sidebar-user .meta .name {
    font-size: 13px;
    color: #f1f5f9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user .meta .role {
    font-size: 11.5px;
    color: #94a3b8;
}

.main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 24px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.content {
    flex: 1 1 auto;
    padding: 24px;
}

/* ------------------------------------------------------------
   卡片 / 通用块
   ------------------------------------------------------------ */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.card + .card {
    margin-top: 18px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat .label {
    font-size: 13px;
    color: var(--text-muted);
}

.stat .value {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -.5px;
}

.stat .foot {
    font-size: 12px;
    color: var(--text-faint);
}

.muted {
    color: var(--text-muted);
}

.small {
    font-size: 12.5px;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}

.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    font-size: 12px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
}

.badge-primary { background: var(--primary-light); color: #1d4ed8; }
.badge-success { background: #ecfdf5; color: #047857; }
.badge-danger  { background: #fef2f2; color: #b91c1c; }
.badge-warning { background: #fffbeb; color: #b45309; }

.empty {
    padding: 48px 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13.5px;
}

/* ------------------------------------------------------------
   表格
   ------------------------------------------------------------ */

.table-wrap {
    overflow-x: auto;
    margin: 0 -20px -20px;
    padding: 0 20px 4px;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.data thead th {
    padding: 11px 12px;
    text-align: left;
    font-weight: 500;
    font-size: 12.5px;
    color: var(--text-muted);
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data thead th:first-child {
    border-top-left-radius: var(--radius-sm);
}

table.data thead th:last-child {
    border-top-right-radius: var(--radius-sm);
}

table.data tbody td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data tbody tr:hover {
    background: #fcfdff;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

table.data .actions a {
    margin-right: 10px;
    font-size: 13px;
}

/* 列多的表格给一个固定布局：列宽按表头声明分配，
   长文本用省略号截断，避免备注这类列被挤成竖排 */
table.data.data-wide {
    min-width: 990px;
    table-layout: fixed;
}

table.data.data-wide th,
table.data.data-wide td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

textarea.control {
    height: auto;
    min-height: 84px;
    padding: 10px 13px;
    line-height: 1.6;
    resize: vertical;
}

.control-auto {
    width: auto;
}

.control-date {
    width: 150px;
    flex: 0 0 auto;
}

.req {
    color: var(--danger);
    font-weight: 600;
}

.hint {
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-muted);
}

.hint code,
.tips code {
    padding: 1px 5px;
    font-size: 12px;
    color: #1d4ed8;
    background: #eef2f7;
    border-radius: 4px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.checkline,
.field label.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    font-size: 13.5px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}

.checkline input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ------------------------------------------------------------
   列表页工具栏 / 分页 / 行内按钮
   ------------------------------------------------------------ */

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.toolbar-wrap {
    flex-wrap: wrap;
}

.toolbar .control {
    width: auto;
    min-width: 130px;
}

.toolbar .control-auto {
    min-width: 200px;
}

.toolbar .spacer {
    flex: 1 1 auto;
}

.link-btn {
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
}

.link-btn:hover {
    text-decoration: underline;
}

.link-danger {
    color: var(--danger);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.pager-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.page-btn:hover {
    background: #f9fafb;
    text-decoration: none;
}

.page-btn.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

/* ------------------------------------------------------------
   代码块 / 说明列表
   ------------------------------------------------------------ */

.code-block {
    margin-bottom: 14px;
    background: #0f172a;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.code-label {
    padding: 7px 12px;
    font-size: 12px;
    color: #94a3b8;
    background: rgba(255, 255, 255, .05);
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.code-block pre {
    margin: 0;
    padding: 12px 14px;
    font-size: 12.5px;
    line-height: 1.7;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-all;
}

.tips {
    margin: 16px 0 0;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-muted);
}

.tips li + li {
    margin-top: 4px;
}

/* ------------------------------------------------------------
   用户授权：网站勾选列表
   ------------------------------------------------------------ */

.site-check-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
}

.site-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}

.site-check:hover {
    background: var(--primary-light);
    border-color: #bfdbfe;
}

.site-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--primary);
    cursor: pointer;
}

.site-check-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.site-check-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-check-domains {
    font-size: 11.5px;
    color: var(--text-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-check.is-disabled {
    opacity: .6;
}

/* ------------------------------------------------------------
   小屏适配
   ------------------------------------------------------------ */

@media (max-width: 1080px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .auth-card { flex-direction: column; min-height: 0; }
    .auth-brand { flex: 0 0 auto; padding: 28px; }
    .auth-brand h1 { margin: 20px 0 8px; font-size: 21px; }
    .brand-points { display: none; }
    .auth-form { padding: 32px 26px 36px; }

    .sidebar { position: fixed; left: -220px; transition: left .2s; z-index: 20; }
    .sidebar.open { left: 0; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
}
