:root {
    --bg-page: #ffffff;
    --bg-card: #f8f9fa;
    --border-subtle: #e5e7eb;
    --border-header: #212529;
    --text-primary: #212529;
    --text-secondary: #4b5563;
    --text-muted: #6c757d;
    --link-blue: #0d6efd;
    --link-blue-hover: #0a58ca;
    --btn-primary: #0d6efd;
    --btn-primary-hover: #0b5ed7;
    --radius-card: 10px;
    --radius-btn: 8px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.front-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 24px 48px;
}

/* 页头 */
.front-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.front-title {
    margin: 0;
    font-size: 32px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* 顶部可配置链接 + 下载按钮卡片 */
.action-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-link-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.top-link-row[hidden] {
    display: none;
}

.top-config-link {
    color: var(--link-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: 16px;
    line-height: 1.5;
    word-break: break-all;
    transition: color 0.15s ease;
}

.top-config-link:hover {
    color: var(--link-blue-hover);
}

.download-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--btn-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
    box-shadow: 0 1px 2px rgba(13, 110, 253, 0.18);
}

.btn-download:hover {
    background-color: var(--btn-primary-hover);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.24);
}

.btn-download:active {
    transform: translateY(1px);
}

.btn-download.is-disabled {
    background-color: #9ca3af;
    box-shadow: none;
    cursor: not-allowed;
}

.download-meta {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.download-meta-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background-color: #e9ecef;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

/* 短信表格卡片（1:1 贴合参考图风格） */
.table-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 32px 36px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sms-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 720px;
    color: var(--text-primary);
}

.sms-table thead th {
    padding: 10px 8px 12px;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    border-bottom: 1.5px solid var(--border-header);
    vertical-align: middle;
    white-space: nowrap;
}

.sms-table tbody td {
    padding: 14px 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    word-break: break-word;
}

.sms-table tbody tr:last-child td {
    border-bottom: none;
}

.sms-table tbody tr {
    transition: background-color 0.14s ease;
}

.sms-table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

/* 列宽比例优化，宽屏下内容列更舒展 */
.col-no { width: 9%; }
.col-time { width: 12%; }
.col-com { width: 7%; }
.col-sender { width: 17%; }
.col-receiver { width: 14%; }
.col-content { width: 41%; }

.cell-time {
    white-space: normal;
    font-variant-numeric: tabular-nums;
}

.cell-time-date {
    display: block;
}

.cell-time-clock {
    display: block;
}

.cell-mono {
    font-variant-numeric: tabular-nums;
}

/* 阶段三：传送带级联入场动画 */
@keyframes rowConveyorIn {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.992);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sms-row-enter {
    opacity: 0;
    animation: rowConveyorIn 0.36s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
    animation-delay: calc(var(--stagger-index, 0) * 45ms);
}

/* 阶段一：高保真流光骨架屏 */
.skeleton-bar {
    display: inline-block;
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(90deg, #e9ecef 25%, #f3f4f6 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.3s ease-in-out infinite;
}

.skeleton-bar.w-sm { width: 48px; }
.skeleton-bar.w-md { width: 96px; }
.skeleton-bar.w-lg { width: 140px; }
.skeleton-bar.w-full { width: 100%; }

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Toast 轻提示 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #1f2937;
    color: #ffffff;
    font-size: 13px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.16);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-item.toast-success { background: #0f766e; }
.toast-item.toast-error { background: #dc2626; }
.toast-icon { display: inline-flex; align-items: center; }

/* 移动端适配 */
@media (max-width: 768px) {
    .front-container {
        padding: 16px 12px 32px;
    }

    .front-title {
        font-size: 24px;
    }

    .action-card {
        padding: 14px 16px;
    }

    .table-card {
        padding: 16px 12px;
    }

    .sms-table {
        min-width: 640px;
    }

    .sms-table thead th,
    .sms-table tbody td {
        padding: 10px 6px;
        font-size: 13px;
    }
}
