:root {
    --primary: #CC0000;
    --primary-dark: #990000;
    --background: #FAFAFA;
    --text: #212121;
    --muted: #777777;
    --border: #DDDDDD;
    --success: #2E7D32;
    --warning: #CC0000;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Roboto, "Segoe UI", Arial, sans-serif;
    background: var(--background);
    color: var(--text);
}

.app-bar {
    background: var(--primary);
    color: white;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-bar .back {
    cursor: pointer;
    font-size: 20px;
    user-select: none;
}

.screen {
    display: none;
    padding: 20px;
    max-width: 480px;
    margin: 0 auto;
    padding-bottom: 60px;
}

.screen.active { display: block; }

.logo {
    display: block;
    margin: 0 auto;
    height: 70px;
    cursor: pointer;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    background: white;
}

.field textarea {
    min-height: 90px;
    resize: vertical;
}

.counter {
    text-align: right;
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.checkbox-row input {
    margin-top: 3px;
}

.warning-text {
    color: var(--warning);
    font-style: italic;
    font-size: 13px;
    margin: 4px 0 16px 26px;
}

button, .btn {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 14px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-outline {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-small {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    margin: 0;
}

.error-msg {
    color: var(--warning);
    font-size: 12px;
    margin-top: 4px;
}

.hidden { display: none !important; }

.home-title {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin: 8px 0 24px;
}

.trade-in-block {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin-bottom: 16px;
}

/* Historique */
.history-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
}

.history-item .subject {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 4px;
}

.history-item .status-date {
    font-size: 13px;
}

.status-sent { color: var(--success); }
.status-pending { color: var(--warning); }

.empty-state {
    text-align: center;
    color: var(--muted);
    margin-top: 60px;
}

/* Scanner QR */
#qr-overlay {
    position: fixed;
    inset: 0;
    background: black;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

#qr-video {
    flex: 1;
    width: 100%;
    object-fit: cover;
}

#qr-overlay .qr-footer {
    padding: 16px;
    background: black;
}

#qr-overlay .qr-footer button {
    margin-bottom: 0;
}

/* Modale (dialogues) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-box {
    background: white;
    border-radius: 10px;
    padding: 22px;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-box h3 {
    margin-top: 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.modal-actions button {
    margin-bottom: 0;
}

.banner {
    background: #FFF3E0;
    border: 1px solid #FFB74D;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.banner button {
    width: auto;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
}
