* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: 70px;
}

#app {
    max-width: 430px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 10px;
}

.header {
    text-align: center;
    padding: 20px 0;
    color: white;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none;
}

.stock-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    margin-bottom: 20px;
}

.stock-icon {
    font-size: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stock-info {
    flex: 1;
}

.stock-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stock-value {
    font-size: 42px;
    font-weight: 700;
    color: #333;
}

.stock-value .unit {
    font-size: 18px;
    font-weight: 400;
    color: #999;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.quick-btn {
    background: white;
    border: none;
    border-radius: 16px;
    padding: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.quick-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.record-section {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.record-section h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
}

.clear-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.clear-section h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.clear-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.clear-btn {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f5f5f5;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:active {
    transform: scale(0.98);
    background: #e8e8e8;
}

.clear-btn.danger {
    background: #fff0f0;
    border-color: #ffcdd9;
    color: #e53935;
}

.clear-btn.danger:active {
    background: #ffcdd9;
}

.record-list {
    max-height: 300px;
    overflow-y: auto;
}

.record-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.record-item:last-child {
    border-bottom: none;
}

.record-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
}

.record-icon.in {
    background: #e6f7ff;
}

.record-icon.out {
    background: #fff2e6;
}

.record-info {
    flex: 1;
}

.record-info .amount {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.record-info .note {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.record-time {
    font-size: 12px;
    color: #999;
}

.empty-tip {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

.form-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.form-card h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.stock-tip {
    text-align: center;
    padding: 12px;
    background: #fff7e6;
    border-radius: 10px;
    color: #fa8c16;
    font-size: 14px;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.input-group input[type="text"],
.input-group input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.number-input {
    display: flex;
    align-items: center;
    gap: 15px;
}

.number-input button {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 12px;
    background: #f5f5f5;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.number-input button:active {
    background: #e8e8e8;
}

.number-input input {
    flex: 1;
    text-align: center;
    font-size: 28px;
    font-weight: 600;
}

.confirm-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.confirm-btn:active {
    transform: scale(0.98);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.print-btn {
    width: 100%;
    padding: 16px;
    border: 2px solid #667eea;
    border-radius: 12px;
    background: white;
    color: #667eea;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.print-btn:active {
    background: #667eea;
    color: white;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 12px;
    background: #f9f9f9;
}

.history-item.inbound {
    border-left: 4px solid #52c41a;
}

.history-item.outbound {
    border-left: 4px solid #ff6b6b;
}

.history-item .title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.history-item .detail {
    font-size: 13px;
    color: #666;
}

.history-item .time {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    border-radius: 20px 20px 0 0;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 12px;
}

.tab-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.tab-item.active .tab-label {
    color: white;
}

.tab-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

.tab-label {
    font-size: 11px;
    color: #999;
}

.print-area {
    display: none;
}

@media print {
    body * {
        visibility: hidden;
    }
    
    .print-area,
    .print-area * {
        visibility: visible;
    }
    
    .print-area {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        padding: 10px;
    }
    
    .receipt {
        background: white;
        padding: 20px;
        border: 1px dashed #ccc;
    }
    
    .receipt-header {
        text-align: center;
        border-bottom: 1px dashed #ccc;
        padding-bottom: 15px;
        margin-bottom: 15px;
    }
    
    .receipt-header h3 {
        font-size: 18px;
        margin-bottom: 5px;
    }
    
    .receipt-body {
        margin-bottom: 20px;
    }
    
    .receipt-row {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px dotted #eee;
        font-size: 14px;
    }
    
    .receipt-footer {
        text-align: center;
        padding-top: 15px;
        border-top: 1px dashed #ccc;
    }
    
    .receipt-footer p {
        margin: 5px 0;
        font-size: 12px;
    }
    
    .company {
        font-size: 10px !important;
        color: #999;
        margin-top: 10px !important;
    }
}

/* 自定义渐变提示框 */
.custom-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.custom-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.custom-toast.error {
    background: rgba(255, 77, 79, 0.9);
}

.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.confirm-dialog.hidden {
    display: none;
}

.confirm-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin: 20px;
    max-width: 320px;
    width: 100%;
}

.confirm-message {
    font-size: 16px;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
}

.confirm-cancel,
.confirm-ok {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    border: none;
}

.confirm-cancel {
    background: #f0f0f0;
    color: #666;
}

.confirm-ok {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}



.settings-section {
    margin-top: 10px;
}

.settings-section h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.settings-tip {
    font-size: 13px;
    color: #999;
    margin-bottom: 15px;
}

.settings-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.settings-btn-item {
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #f8f8f8;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn-item:active {
    transform: scale(0.98);
    background: #eee;
}

.settings-btn-item.danger {
    background: #fff0f0;
    border-color: #ffcdd9;
    color: #e53935;
}

.settings-btn-item.danger:active {
    background: #ffcdd9;
}

.clear-section,
.clear-buttons,
.clear-btn {
    display: none;
}
