:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --ink: #1c2233;
    --muted: #5d667d;
    --line: #e1e5ef;
    --accent: #5b4bdb;
    --accent-ink: #ffffff;
    --soft: #eeeafd;
    --danger: #c62828;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 0.9rem 1rem;
}

.app-logo {
    color: var(--ink);
    font-weight: 800;
    font-size: 1.15rem;
    text-decoration: none;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.app-nav a {
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.app-nav a.is-active {
    color: var(--accent);
}

.app-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.25rem;
}

h1 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
}

.lead {
    margin: 0 0 1rem;
    color: var(--muted);
}

label {
    display: block;
    margin: 1rem 0 0.35rem;
    font-weight: 600;
}

textarea {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    resize: vertical;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.photo-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin: 0;
    padding: 1rem;
    min-height: 140px;
    border: 2px dashed var(--accent);
    border-radius: 14px;
    background: var(--soft);
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
}

.photo-preview {
    max-width: 100%;
    max-height: 320px;
    border-radius: 10px;
}

.photo-hint.is-small {
    font-size: 0.9rem;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    margin-top: 1rem;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

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

.btn-block {
    display: block;
    width: 100%;
}

.btn-small {
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.status {
    margin: 1rem 0 0;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    background: var(--soft);
    color: var(--accent);
    font-weight: 600;
}

.status.is-error {
    background: #fdeaea;
    color: var(--danger);
}

.result {
    margin-top: 1.5rem;
}

.result-block {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.result-head h2 {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.result-object {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
}

.result-meta {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.result-title {
    margin: 0;
    font-weight: 700;
}

.result-text {
    margin: 0;
    white-space: pre-wrap;
}

.result-usage {
    margin: 1rem 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
}

.price-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.price-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.7rem 0.3rem;
    border-radius: 10px;
    background: var(--bg);
    text-align: center;
}

.price-cell strong {
    font-size: 1.2rem;
}

.price-cell span {
    font-size: 0.75rem;
    color: var(--muted);
}

.price-cell.is-main {
    background: var(--soft);
    color: var(--accent);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chip {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--soft);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
}

.todo {
    margin: 0;
    padding-left: 1.2rem;
}

.result-edit {
    display: block;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    line-height: 1.5;
    resize: none;
    overflow: hidden;
}

.result-edit:hover {
    border-color: var(--line);
}

.result-edit:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--card);
}

.quota {
    display: inline-block;
    margin: 0 0 1rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: var(--soft);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
}

.auth-card {
    max-width: 420px;
    margin: 1rem auto;
}

.auth-form > div,
.auth-form .field {
    margin-bottom: 0.9rem;
}

.auth-form label {
    margin: 0 0 0.35rem;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-form ul {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
    color: var(--danger);
    font-size: 0.85rem;
}

.flash {
    margin: 0 0 1rem;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    font-weight: 600;
}

.flash-error {
    background: #fdeaea;
    color: var(--danger);
}

.check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    font-weight: 500;
}

.auth-switch {
    margin: 1rem 0 0;
    text-align: center;
    color: var(--muted);
}

.auth-switch a,
.back a {
    color: var(--accent);
    font-weight: 600;
}

.back {
    margin: 0 0 0.5rem;
}

.history {
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.history li + li {
    margin-top: 0.6rem;
}

.history li {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.history-delete {
    display: flex;
}

.btn-delete {
    padding: 0 0.8rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    font-size: 1.1rem;
    cursor: pointer;
}

.btn-delete:hover {
    border-color: var(--danger);
}

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.delete-form {
    margin-top: 1.5rem;
}

.history-item {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
}

.history-item:hover {
    border-color: var(--accent);
}

.history-main,
.history-side {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.history-title {
    color: var(--muted);
    font-size: 0.9rem;
}

.history-side {
    flex-shrink: 0;
    align-items: flex-end;
    font-size: 0.8rem;
    color: var(--muted);
}

.history-side strong {
    color: var(--accent);
    font-size: 1rem;
}

/* Œil du mot de passe */

.password-field {
    position: relative;
    display: block;
}

.auth-form .password-field input.password-input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 48px;
    border: 0;
    background: transparent;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

/* Bandeau d'installation (PWA) */

.install-banner {
    background: var(--soft);
    border-bottom: 1px solid var(--line);
}

.install-row {
    max-width: 760px;
    margin: 0 auto;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.install-icon {
    font-size: 1.6rem;
}

.install-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    font-size: 0.85rem;
    color: var(--muted);
}

.install-text strong {
    font-size: 0.95rem;
    color: var(--ink);
}

.install-btn {
    margin-top: 0;
    padding: 8px 14px;
}

.install-close {
    border: 0;
    background: transparent;
    padding: 8px;
    font-size: 1.1rem;
    color: var(--muted);
    cursor: pointer;
}

.install-help {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px 10px;
    font-size: 0.9rem;
}

.offline {
    text-align: center;
}
