* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f0e8;
    color: #333;
    min-height: 100vh;
}

header {
    background: #e65100;
    color: #fff;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

nav {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.logo {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

main {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* Home */
.home {
    text-align: center;
    padding-top: 24px;
}

.home h1 {
    font-size: 28px;
    color: #e65100;
    margin-bottom: 4px;
}

.subtitle {
    color: #777;
    margin-bottom: 32px;
    font-size: 14px;
}

.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    display: block;
    text-decoration: none;
    color: #333;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.15s, box-shadow 0.15s;
}

.card:active {
    transform: scale(0.98);
}

.card-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.card h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.card p {
    color: #666;
    font-size: 14px;
}

.card-incoming {
    border-left: 4px solid #2e7d32;
}

.card-outgoing {
    border-left: 4px solid #e65100;
}

/* Capture Page */
.mode-banner {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 16px;
}

.mode-banner.incoming {
    background: #e8f5e9;
    color: #2e7d32;
}

.mode-banner.outgoing {
    background: #fff3e0;
    color: #e65100;
}

.capture-area {
    text-align: center;
}

.upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px;
    border: 2px dashed #ccc;
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.upload-btn:active {
    border-color: #e65100;
}

.upload-icon {
    font-size: 40px;
}

.preview {
    margin-bottom: 16px;
}

.preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    width: 100%;
    margin-top: 8px;
    transition: opacity 0.15s;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: #e65100;
    color: #fff;
}

.btn-primary:active:not(:disabled) {
    background: #bf360c;
}

.btn-secondary {
    background: #fff;
    color: #e65100;
    border: 2px solid #e65100;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: #e65100;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Review */
.shared-fields {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.field {
    flex: 1;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.field input, .field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.item-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: relative;
}

.item-card .item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.item-card .item-num {
    font-weight: 700;
    font-size: 13px;
    color: #e65100;
}

.item-card .remove-btn {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
}

.item-card .fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.item-card .fields-grid .full-width {
    grid-column: 1 / -1;
}

.item-card .fields-grid label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    margin-bottom: 2px;
}

.item-card .fields-grid input,
.item-card .fields-grid select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Success */
.success-msg {
    text-align: center;
    padding: 32px 0;
}

.success-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.success-msg h2 {
    margin-bottom: 20px;
    color: #2e7d32;
}

.success-msg .btn {
    margin-top: 12px;
}

/* Error */
.error-msg {
    text-align: center;
    padding: 32px 0;
    color: #d32f2f;
}

.error-msg p {
    margin-bottom: 16px;
    font-size: 14px;
}
