/* QuiPrendQuoi — base mobile-first */

:root {
    --color-bg: #f6f7f9;
    --color-card: #ffffff;
    --color-text: #1a1d23;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-primary: #0d6e6e;
    --color-primary-dark: #0a5757;
    --color-danger: #b91c1c;
    --color-success: #16a34a;
    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 16px;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 96px;
}

header.app-header {
    background: var(--color-primary);
    color: #fff;
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}
header.app-header .inner {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
header.app-header h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
header.app-header a, header.app-header button.link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    background: none;
    border: none;
    padding: 6px 8px;
    cursor: pointer;
}
header.app-header a:hover, header.app-header button.link:hover {
    text-decoration: underline;
}

h1, h2, h3 { margin: 0 0 12px; }
h2 { font-size: 18px; margin-top: 20px; }
h3 { font-size: 15px; color: var(--color-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

p { margin: 0 0 12px; }

.card {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.muted { color: var(--color-muted); font-size: 14px; }
.error { color: var(--color-danger); font-size: 14px; margin-top: 8px; }
.success { color: var(--color-success); font-size: 14px; margin-top: 8px; }

label {
    display: block;
    font-size: 14px;
    color: var(--color-muted);
    margin-bottom: 6px;
}

input[type="text"], input[type="password"], select, textarea {
    width: 100%;
    padding: 12px;
    font: inherit;
    color: inherit;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    min-height: 44px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 110, 0.15);
}

button, .btn {
    font: inherit;
    cursor: pointer;
    border: none;
    background: var(--color-primary);
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    min-height: 44px;
    font-weight: 600;
    transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--color-primary-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary {
    background: #fff;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}
button.secondary:hover { background: #f3f4f6; }

button.danger { background: var(--color-danger); }
button.danger:hover { background: #991b1b; }

button.icon {
    background: none;
    color: var(--color-muted);
    padding: 8px;
    min-height: 36px;
    min-width: 36px;
    border-radius: 6px;
}
button.icon:hover { background: #f3f4f6; color: var(--color-text); }
button.icon.danger { color: var(--color-danger); }
button.icon.danger:hover { background: #fef2f2; }

.row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.row.spread { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }

.form-row { margin-bottom: 14px; }

.fab {
    position: fixed;
    right: max(20px, calc((100vw - 640px)/2 + 20px));
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 20;
    border: none;
    cursor: pointer;
}
.fab:hover { background: var(--color-primary-dark); }

/* Items list — single line layout */
.item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--color-card);
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}
.item.assigned { border-left: 4px solid var(--color-success); padding-left: 8px; }

.item .label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item .qty {
    flex: 0 0 auto;
    max-width: 90px;
    font-size: 13px;
    color: var(--color-muted);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item select {
    flex: 0 0 auto;
    width: auto;
    max-width: 110px;
    padding: 6px 22px 6px 8px;
    font-size: 14px;
    min-height: 36px;
    text-overflow: ellipsis;
}

.item .editable {
    cursor: pointer;
    padding: 3px 5px;
    margin: -3px -5px;
    border-radius: 6px;
}
.item .editable:hover { background: #f3f4f6; }
.item .editable.empty { color: var(--color-muted); font-style: italic; }

.item input.inline-edit {
    padding: 3px 5px;
    margin: -3px -5px;
    min-height: 28px;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    background: #fff;
    border: 1px solid var(--color-primary);
    border-radius: 6px;
}
.item input.inline-edit.label-edit {
    flex: 1 1 auto;
    min-width: 0;
}
.item input.inline-edit.qty-edit {
    flex: 0 0 auto;
    max-width: 90px;
    font-size: 13px;
    text-align: right;
}

/* Add row — toujours présente en bas, pas de FAB ni modal */
.item.add-row {
    background: #fff;
    box-shadow: none;
    border: 1px dashed var(--color-border);
    padding-left: 12px;
}
.item.add-row input {
    border: none;
    background: transparent;
    padding: 6px 4px;
    min-height: 36px;
    font: inherit;
    outline: none;
}
.item.add-row input:focus { background: #f9fafb; border-radius: 4px; }
.item.add-row .new-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
}
.item.add-row .new-qty {
    flex: 0 0 auto;
    max-width: 90px;
    font-size: 13px;
    text-align: right;
    color: var(--color-muted);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 30;
    padding: 16px;
}
.modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 16px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}
.modal h2 { margin-top: 0; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Token boxes (admin) */
.token-box {
    background: #f3f4f6;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px;
    font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
    font-size: 13px;
    word-break: break-all;
}

@media (min-width: 640px) {
    .modal-backdrop { align-items: center; }
}

/* Récap — vue compacte par participant */
.recap-group {
    margin-bottom: 18px;
}
.recap-group h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: none;
    letter-spacing: 0;
    margin: 0 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}
.recap-group.unassigned h3 { color: var(--color-muted); }
.recap-group ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.recap-group li {
    font-size: 15px;
    padding: 3px 0;
    line-height: 1.35;
}
.recap-group li .qty {
    color: var(--color-muted);
    font-size: 13px;
    margin-left: 4px;
}
.recap-empty {
    color: var(--color-muted);
    font-style: italic;
    font-size: 14px;
    padding: 3px 0;
}

/* Hidden helper */
.hidden { display: none !important; }
