/* ===== 全局重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: #1890ff; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ===== 布局 ===== */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    padding-bottom: 60px;
}

/* ===== Flash消息 ===== */
.flash-container { padding: 12px 0; }
.flash {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}
.flash-error { background: #fff2f0; border: 1px solid #ffccc7; color: #cf1322; }
.flash-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }

/* ===== 品牌头部 ===== */
.brand-header {
    background: linear-gradient(135deg, #1890ff, #096dd9);
    color: #fff;
    padding: 20px 16px;
    text-align: center;
    margin: 0 -16px 20px;
}
.brand-header h1 { font-size: 20px; font-weight: 600; }
.brand-header p { font-size: 13px; opacity: 0.85; margin-top: 4px; }

/* ===== 登录页 ===== */
.login-page { max-width: 420px; margin: 40px auto; }
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 32px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.login-card h2 { text-align: center; margin-bottom: 24px; font-size: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; color: #666; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.1);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    text-align: center;
    transition: all 0.2s;
}
.btn-primary { background: #1890ff; color: #fff; }
.btn-primary:hover { background: #40a9ff; }
.btn-primary:active { background: #096dd9; }
.btn-primary:disabled { background: #b3d8ff; cursor: not-allowed; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #ff7875; }
.btn-success { background: #52c41a; color: #fff; }
.btn-warning { background: #faad14; color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid #d9d9d9;
    color: #666;
}
.btn-outline:hover { border-color: #1890ff; color: #1890ff; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ===== 填报页面 ===== */
.fill-header {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.fill-header .company-name { font-size: 18px; font-weight: 600; }
.fill-header .deadline-info { font-size: 13px; color: #888; margin-top: 6px; }
.fill-header .deadline-warning {
    color: #fa541c;
    font-weight: 600;
}

.community-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.community-card .card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.status-unreported { background: #f0f0f0; color: #888; }
.status-yes { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.status-no { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }

.choice-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.choice-item {
    flex: 1;
    padding: 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}
.choice-item.active-yes { border-color: #52c41a; background: #f6ffed; color: #389e0d; }
.choice-item.active-no { border-color: #ff4d4f; background: #fff2f0; color: #cf1322; }
.choice-item:active { transform: scale(0.98); }

.reason-box { margin-bottom: 12px; }
.reason-box textarea { width: 100%; }

/* 照片上传区 */
.photo-section { margin-top: 8px; }
.photo-section .section-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}
.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-trigger {
    aspect-ratio: 1;
    border: 2px dashed #d9d9d9;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    cursor: pointer;
    transition: border-color 0.2s;
    font-size: 12px;
}
.upload-trigger:active { border-color: #1890ff; }
.upload-trigger .icon { font-size: 24px; margin-bottom: 4px; }

.submit-row { display: flex; gap: 8px; margin-top: 12px; }

/* ===== 管理端 ===== */
.admin-nav {
    background: #001529;
    margin: 0 -16px 20px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
}
.admin-nav a {
    color: rgba(255,255,255,0.65);
    padding: 14px 16px;
    font-size: 14px;
    white-space: nowrap;
    transition: color 0.2s;
}
.admin-nav a:hover, .admin-nav a.active { color: #fff; }
.admin-nav .nav-spacer { flex: 1; }

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1890ff;
}
.stat-card .stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}
.stat-card.highlight .stat-value { color: #52c41a; }
.stat-card.warn .stat-value { color: #fa541c; }

/* 表格 */
.table-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow-x: auto;
}
.table-card h3 { font-size: 16px; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}
th { color: #888; font-weight: 500; background: #fafafa; }
tr:hover td { background: #fafafa; }

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 { margin-bottom: 16px; }
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* 图片预览弹窗 */
.photo-viewer {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.photo-viewer.active { display: flex; }
.photo-viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.photo-viewer .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    font-size: 20px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* 响应式 */
@media (max-width: 768px) {
    .app-container { padding: 0 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card .stat-value { font-size: 22px; }
    table { font-size: 13px; }
    th, td { padding: 6px 8px; }
    .admin-nav a { padding: 12px 10px; font-size: 13px; }
    .choice-group { flex-direction: column; }
    .modal { padding: 16px; }
}

@media (max-width: 480px) {
    .brand-header h1 { font-size: 17px; }
    .brand-header p { font-size: 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px 8px; }
    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-label { font-size: 11px; }
    .toolbar { flex-direction: column; }
    .toolbar .btn { width: 100%; }
}
