* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 8px 0 16px;
    border-bottom: 1px solid #333;
    margin-bottom: 16px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

header .logo {
    height: 36px;
    width: auto;
}

header h1 {
    font-size: 1.5rem;
    color: #4a90d9;
    text-align: center;
}

.status {
    font-size: 0.875rem;
    padding: 4px 12px;
    background: #333;
    border-radius: 12px;
    color: #aaa;
}

.view {
    display: none;
    flex: 1;
    flex-direction: column;
}

.view.active {
    display: flex;
}

/* Scanner */
#reader {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

#reader video {
    border-radius: 12px;
}

.hint {
    text-align: center;
    margin-top: 16px;
    color: #888;
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: #252547;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: #4a90d9;
}

.card.success {
    border: 2px solid #4caf50;
}

.card.success h2 {
    color: #4caf50;
}

.card.error {
    border: 2px solid #f44336;
}

.card.error h2 {
    color: #f44336;
}

.field {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.field:last-child {
    border-bottom: none;
}

.field label {
    color: #888;
}

.field.total {
    font-size: 1.25rem;
    font-weight: bold;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 2px solid #4a90d9;
    border-bottom: none;
}

.receipt-id {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    padding: 16px;
    margin-bottom: 16px;
    background: #1a1a2e;
    border-radius: 8px;
    color: #4caf50;
    font-family: monospace;
}

/* Buttons */
.actions {
    margin-top: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4a90d9;
    color: white;
}

.btn-primary:hover {
    background: #3a7fc8;
}

.btn-secondary {
    background: #333;
    color: #ccc;
}

.btn-secondary:hover {
    background: #444;
}

/* Settings */
.settings {
    margin-top: auto;
    padding: 16px 0;
    border-top: 1px solid #333;
}

.settings label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 4px;
}

.settings input {
    width: 100%;
    padding: 8px 12px;
    background: #252547;
    border: 1px solid #333;
    border-radius: 8px;
    color: #ccc;
    font-size: 0.875rem;
}

.settings input:focus {
    outline: none;
    border-color: #4a90d9;
}

/* Loading */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-height: 600px) {
    .card {
        padding: 12px;
    }
    .field {
        padding: 6px 0;
    }
    .btn {
        padding: 12px;
    }
}
