* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    background: #f2f4f7;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.5;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: inherit;
    outline: none;
}

.hidden {
    display: none !important;
}

/* ========== 顶部状态栏 ========== */
#app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.2);
}

.user-info {
    font-weight: 500;
    font-size: 15px;
}

.header-right {
    display: flex;
    gap: 12px;
}

.btn-link {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s;
}

.btn-link:active {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== 页面切换 ========== */
.page {
    display: none;
    padding: 16px;
    padding-bottom: 40px;
}

.page.active {
    display: block;
}

/* ========== 登录页 ========== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 16px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 600;
    color: #1677ff;
    margin-bottom: 6px;
}

.subtitle {
    color: #6b7280;
    font-size: 13px;
}

.login-form {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.form-item {
    margin-bottom: 16px;
}

.form-item label {
    display: block;
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    transition: all 0.2s;
}

.form-input:focus {
    border-color: #1677ff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.textarea {
    resize: none;
}

.avail-count {
    background: linear-gradient(135deg, #e6f4ff, #bae0ff);
    color: #1677ff;
    font-size: 18px;
    font-weight: 600;
    padding: 14px;
    border-radius: 10px;
    text-align: center;
}

.btn-primary {
    padding: 14px 24px;
    background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.3);
}

.btn-block {
    width: 100%;
    padding: 14px;
}

.btn-primary:disabled {
    background: #d1d5db;
    box-shadow: none;
    color: #fff;
}

.login-tip {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid #1677ff;
}

.login-tip p:first-child {
    font-weight: 600;
    color: #1677ff;
    margin-bottom: 8px;
}

.login-tip p {
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 4px;
}

/* ========== 页面标题 ========== */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title h2 {
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
}

.badge {
    background: #1677ff;
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 10px;
}

/* ========== 卡片列表 ========== */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.serial-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid #f0f0f0;
    position: relative;
    overflow: hidden;
}

.serial-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.serial-card.status-pending::before {
    background: #1677ff;
}

.serial-card.status-success::before {
    background: #22c55e;
}

.serial-card.status-fail::before {
    background: #ef4444;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.imei-badge {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 8px;
    letter-spacing: 1px;
    border: 1px dashed #d1d5db;
}

.status-tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 10px;
    font-weight: 500;
}

.status-tag.pending {
    background: #e6f4ff;
    color: #1677ff;
}

.status-tag.success {
    background: #dcfce7;
    color: #16a34a;
}

.status-tag.fail {
    background: #fee2e2;
    color: #dc2626;
}

.card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.field-label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 2px;
}

.field-value {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    word-break: break-all;
}

.field-value.deadline {
    color: #f59e0b;
}

.field-value.deadline.urgent {
    color: #ef4444;
    font-weight: 600;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}

.card-action {
    flex: 1;
}

.btn-claim {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #1677ff, #4096ff);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-claim:active {
    transform: scale(0.97);
}

.btn-claim:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.card-note {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
}

.fail-reason {
    background: #fef2f2;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #dc2626;
    margin-top: 10px;
    border-left: 3px solid #ef4444;
}

/* ========== 空状态 ========== */
.empty-box {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-box p {
    font-size: 15px;
    margin-bottom: 4px;
}

.empty-sub {
    font-size: 13px;
}

/* ========== 记录页统计 ========== */
.records-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.stat-item {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-num {
    font-size: 22px;
    font-weight: 700;
    color: #1677ff;
}

.stat-label {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

.stat-success .stat-num {
    color: #22c55e;
}

.stat-fail .stat-num {
    color: #ef4444;
}

/* ========== 弹窗 ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-body {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 480px;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    font-size: 20px;
    color: #9ca3af;
    padding: 4px 8px;
}

.modal-content {
    padding: 20px;
}

.modal-info {
    background: #f3f4f6;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
}

.modal-info .mi-row {
    display: flex;
    font-size: 13px;
    margin-bottom: 4px;
}

.modal-info .mi-row:last-child {
    margin-bottom: 0;
}

.modal-info .mi-label {
    color: #9ca3af;
    width: 70px;
    flex-shrink: 0;
}

.modal-info .mi-value {
    color: #1f2937;
    font-weight: 500;
    word-break: break-all;
}

.radio-group {
    display: flex;
    gap: 12px;
}

.radio-item {
    flex: 1;
}

.radio-item input[type="radio"] {
    display: none;
}

.radio-box {
    display: block;
    text-align: center;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
}

.radio-item input[type="radio"]:checked + .radio-box {
    border-color: #1677ff;
    background: #e6f4ff;
    color: #1677ff;
}

.radio-item.fail input[type="radio"]:checked + .radio-box {
    border-color: #ef4444;
    background: #fef2f2;
    color: #ef4444;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 200;
    max-width: 80%;
    text-align: center;
    animation: fadeIn 0.2s;
}

.toast.success {
    background: rgba(34, 197, 94, 0.95);
}

.toast.error {
    background: rgba(239, 68, 68, 0.95);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
