/* 鸡蛋批发管理系统 - 移动端样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f6fa;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    padding-bottom: 60px; /* 底部导航高度 */
}

a {
    text-decoration: none;
    color: inherit;
}

/* 顶部导航 */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.header-title {
    font-size: 17px;
    font-weight: 600;
}

.header-right {
    position: absolute;
    right: 15px;
    font-size: 13px;
}

/* 主内容区 */
.app-content {
    padding-top: 50px;
    min-height: 100vh;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    display: flex;
    border-top: 1px solid #e5e7eb;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 11px;
    transition: all 0.2s;
}

.nav-item.active {
    color: #f59e0b;
}

.nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.nav-text {
    font-size: 11px;
}

/* KPI卡片网格 */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.kpi-label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

.kpi-value.profit {
    color: #10b981;
}

.kpi-value.debt {
    color: #ef4444;
}

.kpi-sub {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* 区块 */
.section {
    margin: 12px;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.more-link {
    font-size: 12px;
    color: #f59e0b;
    font-weight: normal;
}

/* 快捷操作 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 5px;
    background: #fffbeb;
    border-radius: 10px;
    font-size: 12px;
    color: #92400e;
}

.quick-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

/* 卡片列表 */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-item {
    background: white;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #f3f4f6;
    cursor: pointer;
    transition: all 0.2s;
}

.card-item:active {
    background: #f9fafb;
}

.card-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.card-amount {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
}

.card-amount.debt {
    color: #ef4444;
}

.card-amount.profit {
    color: #10b981;
}

.card-sub {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.card-detail {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
}

.card-debt {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #fef3c7;
    font-size: 12px;
    color: #d97706;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-link {
    color: #f59e0b;
    font-weight: 600;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.status-paid {
    background: #d1fae5;
    color: #059669;
}

.status-unpaid {
    background: #fee2e2;
    color: #dc2626;
}

.status-partial {
    background: #fef3c7;
    color: #d97706;
}

/* 搜索栏 */
.search-bar {
    padding: 12px;
    background: white;
    display: flex;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    position: sticky;
    top: 50px;
    z-index: 50;
}

.search-form {
    flex: 1;
    display: flex;
    gap: 6px;
}

.search-form input,
.search-form select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}

.search-form input:focus,
.search-form select:focus {
    border-color: #f59e0b;
}

/* Tab栏 */
.tab-bar {
    display: flex;
    background: white;
    border-bottom: 1px solid #f3f4f6;
    position: sticky;
    top: 50px;
    z-index: 50;
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 12px;
    font-size: 14px;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-item.active {
    color: #f59e0b;
    border-bottom-color: #f59e0b;
    font-weight: 600;
}

/* 汇总栏 */
.summary-bar {
    display: flex;
    background: white;
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.summary-item {
    flex: 1;
    text-align: center;
}

.summary-label {
    font-size: 11px;
    color: #9ca3af;
    display: block;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.summary-value.profit {
    color: #10b981;
}

.summary-value.debt {
    color: #ef4444;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: #f59e0b;
    color: white;
}

.btn-primary:active {
    background: #d97706;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:active {
    background: #059669;
}

.btn-default {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-default:active {
    background: #e5e7eb;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

/* 表单 */
.form-container {
    padding: 15px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #f59e0b;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

.required {
    color: #ef4444;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* 计算预览 */
.calc-preview {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}

.preview-title {
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 8px;
}

.preview-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #78350f;
    padding: 4px 0;
}

.preview-row.highlight {
    font-weight: 600;
    font-size: 14px;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid #fde68a;
}

.preview-row .profit {
    color: #059669;
}

/* 库存提示 */
.inventory-tip {
    margin: 15px;
    padding: 12px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #065f46;
}

/* 欠款信息 */
.debt-info {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 16px;
}

.debt-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: #78350f;
}

.debt-row.highlight {
    font-weight: 600;
    font-size: 16px;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid #fde68a;
}

.debt-row .debt {
    color: #dc2626;
}

/* 欠款汇总 */
.debt-summary {
    display: flex;
    background: white;
    padding: 15px;
    border-bottom: 1px solid #f3f4f6;
}

.debt-summary-item {
    flex: 1;
    text-align: center;
}

.debt-summary-label {
    font-size: 12px;
    color: #9ca3af;
    display: block;
    margin-bottom: 4px;
}

.debt-summary-value {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.debt-summary-value.debt {
    color: #ef4444;
}

/* 客户信息卡 */
.customer-info-card {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    padding: 20px 15px;
    margin: 0;
}

.customer-info-card h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

.info-row {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 4px;
    display: flex;
    gap: 15px;
}

/* 操作栏 */
.action-bar {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: white;
    border-bottom: 1px solid #f3f4f6;
}

.action-bar .btn {
    flex: 1;
}

/* 进度条 */
.progress-bar {
    height: 6px;
    background: #f3f4f6;
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #f97316);
    border-radius: 3px;
    transition: width 0.3s;
}

/* 平均成本卡 */
.avg-cost-card {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 12px;
}

.avg-cost-label {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.avg-cost-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}

.avg-cost-tip {
    font-size: 11px;
    opacity: 0.8;
}

/* 个人中心 */
.profile-header {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    padding: 25px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.user-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-role {
    font-size: 13px;
    opacity: 0.9;
}

/* 汇总网格 */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.summary-grid .summary-item {
    text-align: center;
    padding: 15px;
    background: #f9fafb;
    border-radius: 10px;
}

.summary-num {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.summary-num.profit {
    color: #10b981;
}

.summary-num.debt {
    color: #ef4444;
}

.summary-grid .summary-label {
    font-size: 12px;
    color: #9ca3af;
}

/* 菜单列表 */
.menu-list {
    display: flex;
    flex-direction: column;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 12px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background: #f9fafb;
}

.menu-icon {
    font-size: 20px;
    margin-right: 12px;
}

.menu-text {
    flex: 1;
    font-size: 14px;
    color: #374151;
}

.menu-badge {
    font-size: 12px;
    color: #9ca3af;
    margin-right: 8px;
}

.menu-arrow {
    color: #d1d5db;
    font-size: 18px;
}

.menu-danger .menu-text {
    color: #ef4444;
}

/* 版本信息 */
.version-info {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #9ca3af;
}

/* 提示框 */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 13px;
}

.alert-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 14px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
}

.page-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
}

.page-info {
    font-size: 13px;
    color: #9ca3af;
}

/* 图表容器 */
.chart-container {
    width: 100%;
    overflow-x: auto;
}

.chart-container canvas {
    width: 100% !important;
}

/* 登录页 */
.login-page {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 30px 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 25px;
}

.login-header h1 {
    font-size: 22px;
    color: #1f2937;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: #9ca3af;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form .form-group label {
    font-size: 13px;
    color: #6b7280;
}

.login-tip {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: #9ca3af;
}

/* 销售详情页 */
.sale-detail-header {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
    padding: 20px 15px;
}

.amount-overview {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.overview-item {
    text-align: center;
    flex: 1;
}

.overview-label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.overview-value {
    font-size: 18px;
    font-weight: 700;
}

.overview-value.profit {
    color: #d1fae5;
}

.overview-value.debt {
    color: #fee2e2;
}

.payment-status-bar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px;
}

.status-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 12px;
    opacity: 0.9;
}

/* 信息列表 */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-label {
    font-size: 13px;
    color: #6b7280;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.info-value.profit {
    color: #10b981;
}

.info-value.debt {
    color: #ef4444;
}

/* 快捷金额 */
.quick-amounts {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.quick-amount-btn {
    flex: 1;
    padding: 6px;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-amount-btn:active {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

/* 还款方式选择 */
.payment-methods {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.method-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 5px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.method-item input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.method-item input[type="radio"]:checked + .method-icon + .method-text {
    color: #f59e0b;
}

.method-item:has(input[type="radio"]:checked) {
    border-color: #f59e0b;
    background: #fffbeb;
}

.method-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.method-text {
    font-size: 12px;
    color: #6b7280;
}

/* 角色标签 */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.role-admin {
    background: #fef3c7;
    color: #d97706;
}

.role-staff {
    background: #dbeafe;
    color: #2563eb;
}

/* 卡片操作按钮 */
.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

.action-btn {
    flex: 1;
    text-align: center;
    padding: 6px 10px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
}

.action-btn:active {
    background: #e5e7eb;
}

.action-btn.action-danger {
    background: #fee2e2;
    color: #dc2626;
}

.action-btn.action-success {
    background: #d1fae5;
    color: #059669;
}

/* 角色说明 */
.role-desc {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.role-desc-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.role-desc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.role-desc-list li {
    font-size: 12px;
    color: #6b7280;
    padding: 3px 0;
}

/* 四种角色标签 */
.role-badge.role-1 {
    background: #fef3c7;
    color: #d97706;
}

.role-badge.role-2 {
    background: #dbeafe;
    color: #2563eb;
}

.role-badge.role-3 {
    background: #d1fae5;
    color: #059669;
}

.role-badge.role-4 {
    background: #f3f4f6;
    color: #6b7280;
}

/* 配送相关 */
.filter-bar {
    background: white;
    padding: 12px 15px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.filter-form {
    flex: 1;
}

.filter-row {
    display: flex;
    gap: 8px;
}

.filter-row input,
.filter-row select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
}

/* 配送卡片 */
.delivery-card {
    position: relative;
    cursor: pointer;
}

.delivery-order {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}

.order-num {
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
}

.delivery-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

.action-primary {
    background: #dbeafe;
    color: #2563eb;
}

.action-success {
    background: #d1fae5;
    color: #059669;
}

/* 配送详情头部 */
.delivery-detail-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 20px 15px;
    text-align: center;
}

.delivery-detail-header .status-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 8px;
}

.delivery-time {
    font-size: 13px;
    opacity: 0.9;
}

.phone-link {
    color: #2563eb;
    text-decoration: none;
}

.remark-text {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
}

.delivery-actions-bottom {
    padding: 15px;
    position: sticky;
    bottom: 60px;
    background: #f9fafb;
}

/* 销售卡片配送信息 */
.card-delivery {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
    font-size: 12px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delivery-status {
    color: #f59e0b;
    font-weight: 500;
}

/* 表单行（两列） */
.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* 响应式适配 */
@media (min-width: 768px) {
    body {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .app-header,
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
}

.action-delete {
    background: #fee2e2;
    color: #dc2626;
    margin-left: auto;
}

.btn-danger {
    background: #ef4444 !important;
    color: white !important;
}

.action-bar {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: white;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
