/*
 * Augustine's global theme and navigation, loaded on every page.
 * Colours and fonts follow STYLE_GUIDE_AUGUSTINE.md.
 */
:root {
    /* Parchment: sepia ink, earthy accents instead of one bright colour per section */
    --aug-bg: #f1e6cc;
    --aug-bg-secondary: #e8d9b5;
    --aug-amber: #b8620f;
    --aug-amber-dark: #8a4b12;
    --aug-amber-light: #efd7a4;
    --aug-text: #4a3a28;
    --aug-taupe: #8a6a42;
    --aug-muted: #8f7856;
    --aug-border: #dcc79c;
    --aug-line: rgba(138, 106, 66, 0.35);

    --aug-receipt: #6f7d3c;   /* olive */
    --aug-recipe: #b8862b;    /* ochre */
    --aug-manual: #5e7d72;    /* sage */
    --aug-shopping: #a3392b;  /* sealing wax */
    --aug-voice: #8b5cf6;     /* the voice button stays violet: the main button */
    --aug-journal: #8a6a42;
    --aug-warning: #a3392b;
    --aug-wax: #a3392b;
    --aug-olive: #6f7d3c;

    --aug-bookmarks-height: 4.25rem;
    --aug-desk: #e3d3ae;
    --aug-paper: #f3e6c8;
    --aug-card: #faf1db;      /* light parchment, instead of white */
    --aug-margin: rgba(138, 106, 66, 0.35);
    --aug-touch: 2.75rem;

    /* The paper: fine grain, soft stains and darker edges (drawn by SVG, no image to load) */
    --aug-paper-texture:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.3 0 0 0 0 0.15 0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.4 0 0 0 0 0.2 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E"),
        radial-gradient(ellipse at center, rgba(255, 250, 235, 0.35) 0%, rgba(255, 250, 235, 0) 60%, rgba(140, 100, 50, 0.16) 100%);
}

/* ─── Page basics ─── */
body {
    background: linear-gradient(135deg, var(--aug-bg) 0%, var(--aug-bg-secondary) 100%);
    background-attachment: fixed;
    color: var(--aug-text);
    font-family: 'Nunito', sans-serif;
    line-height: 1.7;
}

.site-main {
    padding: 1.5rem 1rem 3rem;
}

.page {
    max-width: 900px;
    margin: 0 auto;
}

.page-narrow {
    max-width: 480px;
}

.page-head {
    margin-bottom: 2rem;
}

.page-title {
    font-family: 'Lora', serif;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--aug-amber);
}

.page-subtitle {
    margin-top: 0.25rem;
    color: var(--aug-muted);
    font-style: italic;
}

.section-heading {
    margin-bottom: 0.75rem;
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--aug-amber);
}

.back-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--aug-touch);
    color: var(--aug-taupe);
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: var(--aug-amber-dark);
}

.handwritten {
    font-family: 'Caveat', cursive;
}

.muted {
    color: var(--aug-muted);
    font-style: italic;
    font-size: 0.95rem;
}

.ink-link {
    display: inline-block;
    padding: 0.6rem 0;
    color: var(--aug-amber);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease-out;
}

.ink-link:hover {
    color: var(--aug-amber-dark);
    text-decoration: underline;
    text-decoration-style: wavy;
    text-underline-offset: 4px;
}

/* ─── Cards ─── */
.card {
    padding: 1.5rem;
    background: var(--aug-card);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card + .card {
    margin-top: 1rem;
}

.card-accent {
    border-left: 4px solid var(--accent, var(--aug-amber));
}

.card-title {
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--aug-text);
}

.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.card-grid > .card + .card {
    margin-top: 0;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: var(--aug-touch);
    padding: 0 1.4rem;
    border: 2px solid transparent;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background 0.2s ease-out, color 0.2s ease-out;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn[hidden] {
    display: none;
}

.btn-primary {
    background: var(--aug-amber);
    color: white;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
}

.btn-primary:hover {
    background: var(--aug-amber-dark);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

.btn-secondary {
    background: var(--aug-card);
    border-color: var(--aug-amber);
    color: var(--aug-amber);
}

.btn-secondary:hover {
    background: var(--aug-bg);
}

.btn-quiet {
    background: transparent;
    color: var(--aug-taupe);
    padding: 0 0.75rem;
}

.btn-quiet:hover {
    background: var(--aug-bg-secondary);
    transform: none;
}

.btn-danger {
    background: rgba(163, 57, 43, 0.1);
    color: var(--aug-warning);
}

.btn-danger:hover {
    background: rgba(163, 57, 43, 0.18);
}

.btn-small {
    min-height: 2.25rem;
    padding: 0 0.9rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

/* ─── Forms (Symfony's default form markup inside .form) ─── */
.form > div,
.form .field {
    margin-bottom: 1.25rem;
}

.form label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--aug-taupe);
    font-weight: 600;
    font-size: 0.95rem;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="search"],
.form input[type="password"],
.form input[type="number"],
.form input[type="date"],
.form input[type="datetime-local"],
.form select,
.form textarea {
    display: block;
    width: 100%;
    min-height: var(--aug-touch);
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--aug-border);
    border-radius: 12px;
    background: var(--aug-card);
    color: var(--aug-text);
    font: inherit;
    transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
    outline: none;
    border-color: var(--aug-amber);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.form textarea {
    resize: vertical;
}

/* Checkbox: input and label side by side */
.form .checkbox-row,
.form div:has(> input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.form input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--aug-amber);
}

.form div:has(> input[type="checkbox"]) label {
    margin: 0;
    font-weight: 400;
    color: var(--aug-text);
}

/* Datetime widgets rendered as several selects */
.form div:has(> select + select) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form div:has(> select + select) > select {
    width: auto;
}

.form ul {
    margin: 0.35rem 0 0;
    padding: 0;
    list-style: none;
    color: var(--aug-warning);
    font-size: 0.9rem;
}

.form .help-text {
    color: var(--aug-muted);
    font-size: 0.9rem;
}

/* ─── Alerts (flash messages) ─── */
.alert {
    margin-bottom: 1rem;
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    border-left: 4px solid var(--alert-color);
    background: var(--aug-card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.alert-success { --alert-color: var(--aug-receipt); }
.alert-error { --alert-color: var(--aug-warning); }
.alert-warning { --alert-color: var(--aug-amber); }
.alert-info { --alert-color: var(--aug-manual); }

.flashes {
    max-width: 900px;
    margin: 0 auto;
}

/* ─── Tables (administration) ─── */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th {
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--aug-border);
    color: var(--aug-taupe);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--aug-border);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: var(--aug-bg);
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ─── Small pieces ─── */
.badge {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background: var(--aug-bg-secondary);
    color: var(--aug-taupe);
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-alert {
    background: rgba(163, 57, 43, 0.12);
    color: var(--aug-wax);
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--aug-taupe);
}

.empty-state-actions {
    justify-content: center;
}

.empty-state-icon {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.5rem 0;
}

.pagination-status {
    color: var(--aug-muted);
    font-size: 0.9rem;
}

.stat-number {
    font-family: 'Lora', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--aug-text);
}

/* ─── Directory (cupboards, shopping list): items sorted by section ─── */
.directory-section {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

.directory-heading {
    margin-bottom: 0.25rem;
    padding-bottom: 0.15rem;
    border-bottom: 2px solid var(--aug-amber-light);
    font-family: 'Lora', serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--aug-taupe);
}

.directory-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.directory-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding-top: 0.35rem;
}

.directory-name {
    color: var(--aug-text);
    text-decoration: none;
}

.directory-name:hover {
    color: var(--aug-amber-dark);
    text-decoration: underline;
    text-decoration-style: wavy;
    text-underline-offset: 4px;
}

.directory-quantity {
    min-width: 1.5rem;
    text-align: right;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--aug-amber);
}

.directory-quantity.is-low {
    color: var(--aug-shopping);
}

/* Out of stock: still in the cupboards, shown on demand */
.directory-item.is-out .directory-name,
.directory-item.is-out .directory-quantity:not(.is-low) {
    color: var(--aug-taupe);
}

/* ─── "Modifier" mode in the cupboards (stock-edit controller) ─── */
.inventory-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem 1rem;
}

.stock-edit-status:empty {
    display: none;
}

.stock-edit-status {
    color: var(--aug-warning);
}

.directory-badge[hidden],
.stock-step,
.stock-remove {
    display: none;
}

.directory.is-editing .directory-item {
    align-items: center;
}

/* The buttons need the room: no dotted leader nor badge (the gauge and the colour say it), the name takes what is left */
.directory.is-editing .directory-badge {
    display: none;
}

.directory.is-editing .leader {
    display: none;
}

.directory.is-editing .directory-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.directory-badge {
    flex-shrink: 0;
    white-space: nowrap;
}

.directory.is-editing .stock-step,
.directory.is-editing .stock-remove,
.stock-card .stock-step {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: var(--aug-touch);
    height: var(--aug-touch);
    padding: 0;
    border: 0;
    border-radius: 50%;
    font: inherit;
    cursor: pointer;
    touch-action: manipulation; /* no double-tap zoom when tapping + quickly */
}

/* − and +: little parchment tiles, embossed, brown ink */
.directory.is-editing .stock-step,
.stock-card .stock-step {
    border: 1px solid rgba(138, 106, 66, 0.45);
    border-radius: 10px;
    background: linear-gradient(180deg, #f7ecd2 0%, #e6d2a6 100%);
    box-shadow: inset 0 1px 0 rgba(255, 252, 240, 0.8), 0 1px 2px rgba(74, 52, 20, 0.25);
    color: #6b4a24;
    font-family: 'Lora', serif;
    font-size: 1.35rem;
    font-weight: 600;
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
}

.directory.is-editing .stock-step:active,
.stock-card .stock-step:active {
    transform: translateY(1px);
    background: linear-gradient(180deg, #e6d2a6 0%, #dcc594 100%);
    box-shadow: inset 0 2px 3px rgba(74, 52, 20, 0.25);
}

.directory.is-editing .stock-remove {
    background: none;
    font-size: 1.1rem;
    filter: sepia(0.6) saturate(0.6);
    opacity: 0.8;
}

/* On the article card, the − / + are always there */
.stock-stepper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stock-stepper .stat-number {
    min-width: 2rem;
    text-align: center;
}

.stock-card [data-hint][hidden] {
    display: none;
}

.directory.is-editing .directory-quantity {
    min-width: 2rem;
    text-align: center;
}

/* On/off switch (a link that reloads the page with the option) */
.toggle {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--aug-touch);
    color: var(--aug-taupe);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.toggle-track {
    position: relative;
    width: 2.25rem;
    height: 1.3rem;
    border-radius: 999px;
    background: var(--aug-border);
    transition: background 0.2s ease-out;
}

.toggle-thumb {
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--aug-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease-out;
}

.toggle.is-on {
    color: var(--aug-text);
}

.toggle.is-on .toggle-track {
    background: var(--aug-manual);
}

.toggle.is-on .toggle-thumb {
    transform: translateX(0.95rem);
}

@media (min-width: 900px) {
    .directory {
        columns: 2;
        column-gap: 3rem;
    }
}

.details {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    margin: 0 0 1rem;
}

.details dt {
    color: var(--aug-taupe);
    font-size: 0.85rem;
    font-weight: 600;
}

.details dd {
    margin: 0;
    font-size: 1.1rem;
}

.details dd.stat-number {
    font-size: 2rem;
    line-height: 1.2;
}

/* ─── Shopping list ─── */
.shopping-head,
.inventory-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

/* ─── Plain list (label … action) ─── */
.plain-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plain-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 1rem;
    border-bottom: 1px solid var(--aug-border);
}

.plain-item:last-child {
    border-bottom: none;
}

/* ─── File drop zone (Symfony UX Dropzone; its own CSS is disabled) ─── */
.dropzone-container {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 8rem;
    margin-bottom: 0.5rem;
    padding: 1.25rem;
    border: 2px dashed var(--aug-amber-light);
    border-radius: 12px;
    background: var(--aug-bg);
    transition: border-color 0.2s ease-out, background 0.2s ease-out;
}

.dropzone-container:hover,
.dropzone-container:focus-within {
    border-color: var(--aug-amber);
    background: var(--aug-card);
}

.dropzone-input {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-placeholder {
    flex-grow: 1;
    text-align: center;
    color: var(--aug-taupe);
    font-weight: 600;
}

.dropzone-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
}

.dropzone-preview-image {
    flex: none;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 8px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.dropzone-preview-filename {
    overflow-wrap: anywhere;
}

.dropzone-preview-button {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    z-index: 2;
    min-width: var(--aug-touch);
    min-height: var(--aug-touch);
    border: none;
    background: none;
    color: var(--aug-taupe);
    font-size: 1.4rem;
    cursor: pointer;
}

.dropzone-preview-button::before {
    content: '×';
}

/* ─── Receipt check ─── */
.receipt-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--aug-border);
}

.receipt-item:last-of-type {
    border-bottom: none;
}

.receipt-item-name {
    flex: 1 1 12rem;
}

.stepper {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.stepper-button {
    width: var(--aug-touch);
    height: var(--aug-touch);
    border: 1px solid var(--aug-amber-light);
    border-radius: 50%;
    background: var(--aug-bg);
    color: var(--aug-amber-dark);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease-out;
}

.stepper-button:hover {
    background: var(--aug-amber-light);
}

.stepper-input {
    width: 3.5rem;
    min-height: var(--aug-touch);
    border: 1px solid var(--aug-border);
    border-radius: 10px;
    text-align: center;
    font: inherit;
    font-weight: 600;
}

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

.dev-details {
    margin-bottom: 1rem;
}

.dev-details pre {
    overflow-x: auto;
    font-size: 0.8rem;
}

/* ─── Augustine's sticky note ─── */
.sticky-note {
    position: relative;
    margin: 1rem 0.25rem 0 0.5rem;
    padding: 1rem 1.25rem 0.5rem;
    background: #f6e2a4; /* a yellowed note */
    transform: rotate(-1.2deg);
    box-shadow: 0 6px 14px rgba(120, 80, 10, 0.12);
    line-height: 1.6;
}

/* Washi tape */
.sticky-note::before {
    content: '';
    position: absolute;
    top: -0.7rem;
    left: 50%;
    width: 5.5rem;
    height: 1.4rem;
    transform: translateX(-50%) rotate(2deg);
    background: rgba(217, 119, 6, 0.28);
}

.sticky-note .handwritten {
    font-size: 1.6rem;
    color: #5b4a2e;
}

.signature {
    text-align: right;
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    color: var(--aug-taupe);
}

/* ─── Recipes ─── */
.recipe > * + * {
    margin-top: 1.5rem;
}

.recipe-title {
    font-family: 'Lora', serif;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--aug-text);
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.recipe-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.recipe-steps li {
    position: relative;
    padding: 0 0 1rem 2.75rem;
    counter-increment: step;
}

.recipe-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--aug-amber-light);
    color: var(--aug-amber-dark);
    font-family: 'Lora', serif;
    font-weight: 600;
}

/* Name ........ value */
.leader-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.leader-list li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.leader {
    flex: 1;
    border-bottom: 2px dotted var(--aug-line);
    transform: translateY(-0.3rem);
}

/* ─── Administration ─── */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0 1rem;
}

.filter-form > div {
    flex: 1 1 12rem;
}

.filter-form > div:last-child {
    flex: none;
}

.admin-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

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

.inline-form {
    display: inline;
}

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

/* ─── Long text (legal page) ─── */
.prose section + section {
    margin-top: 2rem;
}

.prose h2 {
    margin-bottom: 0.5rem;
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--aug-amber);
}

.prose h3 {
    margin-top: 1rem;
    font-weight: 700;
    color: var(--aug-taupe);
}

.prose ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.prose a {
    color: var(--aug-amber);
    font-weight: 600;
}

.prose a:hover {
    color: var(--aug-amber-dark);
}

/* ─── Footer ─── */
.site-footer {
    padding: 1.5rem 1rem 2rem;
    text-align: center;
    color: var(--aug-muted);
    font-size: 0.9rem;
}

.site-footer a {
    color: var(--aug-taupe);
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--aug-amber-dark);
}

@media print {
    .site-header,
    .bookmarks,
    .site-footer,
    .stock-step,
    .stock-remove,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }
}

/* ─── Top bar ─── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(241, 230, 204, 0.94);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--aug-border);
    padding-top: env(safe-area-inset-top);
    font-family: 'Nunito', sans-serif;
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    min-height: 3.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--aug-amber);
    color: white;
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 1.15rem;
}

.brand-subtitle {
    color: var(--aug-taupe);
    font-weight: 600;
}

.brand-name {
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 1.35rem;
    color: var(--aug-text);
}

/* ─── Beta: badge next to the name, ribbon in the corner of the site ─── */
.beta-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--aug-voice);
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Hangs under the (sticky) header, in the window's corner */
.beta-ribbon {
    position: absolute;
    top: 100%;
    right: 0;
    width: 7rem;
    height: 7rem;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

.beta-ribbon span {
    position: absolute;
    top: 1.45rem;
    right: -2.6rem;
    width: 10rem;
    padding: 0.3rem 0;
    transform: rotate(45deg);
    background: var(--aug-voice);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-align: center;
    text-transform: uppercase;
}

@media print {
    .beta-ribbon {
        display: none;
    }
}

.accent-amber { --accent: var(--aug-amber); }
.accent-manual { --accent: var(--aug-manual); }
.accent-shopping { --accent: var(--aug-shopping); }
.accent-receipt { --accent: var(--aug-receipt); }
.accent-recipe { --accent: var(--aug-recipe); }
.accent-voice { --accent: var(--aug-voice); }
.accent-journal { --accent: var(--aug-journal); }

/* ─── User menu ─── */
.user-menu {
    position: relative;
    margin-left: auto;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--aug-touch);
    padding: 0 0.4rem;
    border-radius: 999px;
    color: var(--aug-taupe);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    transition: background 0.2s ease-out;
}

.user-menu-toggle::-webkit-details-marker {
    display: none;
}

.user-menu-toggle:hover,
.user-menu[open] .user-menu-toggle {
    background: var(--aug-bg-secondary);
}

.user-initial {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--aug-amber-light);
    color: var(--aug-amber-dark);
    font-family: 'Lora', serif;
}

.user-name {
    display: none;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    min-width: 14rem;
    padding: 0.5rem;
    background: var(--aug-card);
    border: 1px solid var(--aug-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(74, 52, 20, 0.12);
    animation: aug-menu-in 0.2s ease-out;
}

@keyframes aug-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-menu-family,
.user-menu-heading {
    margin: 0;
    padding: 0.5rem 0.75rem 0.25rem;
    font-family: 'Lora', serif;
    font-weight: 600;
    color: var(--aug-amber);
}

.user-menu-heading {
    margin-top: 0.25rem;
    border-top: 1px solid var(--aug-border);
    padding-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--aug-taupe);
}

.user-menu-link {
    display: flex;
    align-items: center;
    min-height: var(--aug-touch);
    padding: 0 0.75rem;
    border-radius: 8px;
    color: var(--aug-text);
    text-decoration: none;
    transition: background 0.2s ease-out;
}

.user-menu-link:hover {
    background: var(--aug-bg);
}

.user-menu-logout {
    margin-top: 0.25rem;
    border-top: 1px solid var(--aug-border);
    border-radius: 0 0 8px 8px;
    color: var(--aug-taupe);
}

.login-link {
    margin-left: auto;
    display: flex;
    align-items: center;
    min-height: var(--aug-touch);
    padding: 0 1rem;
    border-radius: 12px;
    background: var(--aug-amber);
    color: white;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease-out;
}

.login-link:hover {
    background: var(--aug-amber-dark);
}

/* ════════════════════════════════════════════
   THE NOTEBOOK FRAME
   ════════════════════════════════════════════ */

/* The desk the notebook lies on */
body.notebook-desk,
body.cover-desk {
    background: radial-gradient(circle at 20% 0%, #efe3c6 0%, var(--aug-desk) 70%);
    background-attachment: fixed;
}

.notebook {
    --page-width: 46rem;
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    max-width: var(--page-width);
    margin: 0 auto 2rem;
    /* Own stacking context so the bookmarks can tuck behind the pages.
       No filter/transform here: it would trap the phone's fixed bookmarks inside the notebook. */
    isolation: isolate;
}

.notebook-spread { --page-width: 1100px; }
.notebook-directory { --page-width: 56rem; }
.notebook-card { --page-width: 34rem; }

/* A sheet of paper with the red margin line */
.notebook-page {
    position: relative;
    min-width: 0;
    padding: 1.5rem 1rem 2rem 1.75rem;
    background: var(--aug-paper);
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(74, 52, 20, 0.12);
    line-height: 1.6;
}

.notebook-page::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0.85rem;
    width: 2px;
    background: var(--aug-margin);
}

/* Open notebook: the two pages stack on phones */
.notebook-spread .notebook-page:first-child {
    border-radius: 12px 12px 0 0;
}

.notebook-spread .notebook-page:nth-child(2) {
    border-radius: 0 0 12px 12px;
    border-top: 1px dashed var(--aug-border);
}

/* Index card: a white bristol card with a red header rule */
.notebook-card .notebook-page {
    background: var(--aug-paper-texture), var(--aug-card);
}

.notebook-card .notebook-page::before {
    display: none;
}

.notebook-card .page-head {
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--aug-margin);
}

/* Inside a page, cards become light sections of the sheet */
.notebook-page .card {
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
}

.notebook-page .card + .card,
.notebook-page .card + section,
.notebook-page section + .card {
    margin-top: 2rem;
}

.notebook-page .card-accent {
    border-left: none; /* the red margin is already there */
}

/* ─── Bookmarks: phones (bottom of the screen) ─── */
.bookmarks {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    gap: 0.25rem;
    height: calc(var(--aug-bookmarks-height) + env(safe-area-inset-bottom));
    padding: 0 0.4rem env(safe-area-inset-bottom);
    background: linear-gradient(to top, var(--aug-desk) 60%, rgba(239, 231, 216, 0));
}

.bookmark {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    height: 3.4rem;
    border-radius: 10px 10px 0 0;
    background: var(--accent);
    color: white;
    font-family: 'Lora', serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 -2px 6px rgba(74, 52, 20, 0.12);
    transition: height 0.2s ease-out, transform 0.2s ease-out;
}

.bookmark-icon {
    font-size: 1.15rem;
    line-height: 1;
}

/* The open section: the bookmark is the colour of the paper and rises into the page */
.bookmark.is-active {
    height: 4rem;
    background: var(--aug-paper);
    color: var(--aug-text);
    box-shadow: 0 -3px 8px rgba(74, 52, 20, 0.15), inset 0 4px 0 var(--accent);
}

body.has-bookmarks {
    padding-bottom: calc(var(--aug-bookmarks-height) + env(safe-area-inset-bottom));
}

/* Six bookmarks on the smallest phones */
@media (max-width: 360px) {
    .bookmarks {
        gap: 0.15rem;
        padding: 0 0.25rem env(safe-area-inset-bottom);
    }

    .bookmark {
        font-size: 0.66rem;
    }
}

/* ─── Bookmarks, harmonised: parchment and leather tabs instead of one bright colour per section ─── */
.bookmark {
    background: linear-gradient(180deg, #d8bf8e 0%, #c6a46c 100%);
    color: #5a4026;
    box-shadow: 0 -2px 6px rgba(74, 52, 20, 0.14), inset 0 1px 0 rgba(255, 248, 230, 0.55), inset 0 0 0 1px rgba(110, 80, 40, 0.25);
}

.bookmark:nth-child(even) {
    background: linear-gradient(180deg, #ceb282 0%, #bb9861 100%);
}

/* Emojis toned down to the parchment */
.bookmark-icon {
    filter: sepia(0.55) saturate(0.75);
}

.bookmark.is-active {
    background: var(--aug-paper);
    color: #4a3a28;
    box-shadow: 0 -3px 8px rgba(74, 52, 20, 0.15), inset 0 3px 0 #a8875a;
}

.bookmark.is-active .bookmark-icon {
    filter: none;
}

/* ─── Parchment: every sheet of the notebook ─── */
.notebook-page {
    background: var(--aug-paper-texture), var(--aug-paper);
    box-shadow: inset 0 0 0 1px rgba(138, 106, 66, 0.25), inset 0 0 40px rgba(120, 85, 40, 0.18), 0 12px 24px rgba(74, 52, 20, 0.16);
}

/* A faint sepia double rule instead of the red margin line */
.notebook-page::before {
    width: 3px;
    background: none;
    border-left: 1px solid var(--aug-line);
    border-right: 1px solid var(--aug-line);
}

.directory-heading {
    border-bottom: 1px dashed var(--aug-line);
}

.directory-quantity {
    color: var(--aug-amber-dark);
}

/* Stock gauge (like a life bar): the stock against its reserve; the tick is the reserve */
.stock-gauge {
    --fill: 0%;
    position: relative;
    flex: none;
    align-self: center;
    width: 3.5rem;
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(138, 106, 66, 0.18);
    box-shadow: inset 0 1px 2px rgba(74, 52, 20, 0.25);
    overflow: hidden;
}

.stock-gauge::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--fill);
    border-radius: inherit;
    background: linear-gradient(180deg, #93a35a 0%, var(--aug-olive) 100%);
    transition: width 0.3s ease-out;
}

.stock-gauge.is-low::before {
    background: linear-gradient(180deg, #c95a45 0%, var(--aug-wax) 100%);
}

/* The reserve, at the middle of the gauge */
.stock-gauge::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: rgba(74, 52, 20, 0.45);
}

/* ─── Cupboards as an inventory: a grid of slots (view-toggle), not while editing ─── */
.directory-icon {
    display: none;
}

.view-switch {
    display: inline-flex;
    border: 1px solid rgba(138, 106, 66, 0.35);
    border-radius: 999px;
    overflow: hidden;
}

.view-switch button {
    min-height: 2.25rem;
    padding: 0 0.75rem;
    border: 0;
    background: none;
    color: var(--aug-taupe);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.view-switch button[aria-pressed="true"] {
    background: rgba(138, 106, 66, 0.18);
    color: var(--aug-text);
}

/* One grid for the whole inventory: the icons tell the categories apart */
.directory.is-grid:not(.is-editing) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.75rem, 1fr));
    gap: 0.6rem;
    columns: auto;
    padding-top: 0.25rem;
}

.directory.is-grid:not(.is-editing) .directory-section,
.directory.is-grid:not(.is-editing) .directory-list {
    display: contents;
}

.directory.is-grid:not(.is-editing) .directory-heading {
    display: none;
}

.directory.is-grid:not(.is-editing) .directory-item {
    position: relative;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3rem;
    min-height: 6.75rem;
    padding: 0.7rem 0.4rem 0.55rem;
    border-radius: 10px;
    background: rgba(255, 250, 235, 0.5);
    box-shadow: inset 0 0 0 1px rgba(138, 106, 66, 0.3), inset 0 2px 6px rgba(90, 60, 20, 0.12);
    text-align: center;
}

.directory.is-grid:not(.is-editing) .directory-item:has(.is-low) {
    box-shadow: inset 0 0 0 1.5px rgba(163, 57, 43, 0.55), inset 0 2px 6px rgba(90, 60, 20, 0.12);
}

.directory.is-grid:not(.is-editing) .directory-icon {
    display: block;
    font-size: 2rem;
    line-height: 1;
    filter: sepia(0.3) saturate(0.85);
}

.directory.is-grid:not(.is-editing) .directory-item.is-out .directory-icon {
    opacity: 0.45;
    filter: grayscale(1);
}

.directory.is-grid:not(.is-editing) .directory-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1.25;
}

.directory.is-grid:not(.is-editing) .directory-quantity {
    position: absolute;
    top: 0.3rem;
    right: 0.45rem;
    min-width: 0;
    font-size: 1.15rem;
}

.directory.is-grid:not(.is-editing) .leader,
.directory.is-grid:not(.is-editing) .directory-badge {
    display: none;
}

.directory.is-grid:not(.is-editing) .stock-gauge {
    width: 80%;
    margin-top: auto;
}

/* ─── Wide screens: bookmarks on the right edge of the notebook ─── */
@media (min-width: 900px) {
    .notebook {
        padding-right: 2.75rem; /* room for the bookmarks */
        max-width: calc(var(--page-width) + 2.75rem);
    }

    .notebook-page {
        padding: 2rem 2rem 2.5rem 3rem;
        min-height: 36rem;
    }

    .notebook-page::before {
        left: 2rem;
    }

    .notebook-spread {
        grid-template-columns: 1fr 1fr;
    }

    .notebook-spread .notebook-page:first-child {
        border-radius: 12px 0 0 12px;
        box-shadow: inset -18px 0 24px -18px rgba(90, 60, 20, 0.25), 0 12px 24px rgba(74, 52, 20, 0.12); /* binding */
    }

    .notebook-spread .notebook-page:nth-child(2) {
        border-radius: 0 12px 12px 0;
        border-top: none;
        box-shadow: inset 18px 0 24px -18px rgba(90, 60, 20, 0.25), 0 12px 24px rgba(74, 52, 20, 0.12);
    }

    .notebook-card .notebook-page {
        min-height: 0;
        padding-left: 2rem;
    }

    .bookmarks {
        position: absolute;
        top: 3rem;
        right: 0;
        left: auto;
        bottom: auto;
        z-index: -1; /* tucked behind the pages */
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        height: auto;
        padding: 0;
        background: none;
    }

    .bookmark {
        flex: none;
        flex-direction: row;
        gap: 0;
        width: 2.75rem;
        height: auto;
        padding: 1rem 0;
        border-radius: 0 10px 10px 0;
        font-size: 0.85rem;
        writing-mode: vertical-rl;
        box-shadow: 2px 2px 6px rgba(74, 52, 20, 0.12);
    }

    .bookmark:hover {
        transform: translateX(3px);
    }

    .bookmark-icon {
        display: none;
    }

    .bookmark.is-active {
        width: 3.1rem;
        height: auto;
        margin-left: -0.35rem; /* joins the page */
        box-shadow: 2px 2px 6px rgba(74, 52, 20, 0.12), inset -3px 0 0 #a8875a;
    }

    body.has-bookmarks {
        padding-bottom: 0;
    }

    .user-name {
        display: inline;
        padding-right: 0.4rem;
    }

    .site-main {
        padding: 2rem 1.5rem 4rem;
    }
}

/* ════════════════════════════════════════════
   WRITING ON THE PAGE (lists, sections)
   ════════════════════════════════════════════ */
.section-title {
    margin-bottom: 0.25rem;
    font-family: 'Lora', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--aug-amber);
}

.notebook-section {
    margin-top: 2rem;
}

.notebook-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.notebook-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 2.25rem; /* rows with a link get their touch height from .ink-link */
}

/* Keep "· 15 articles lus" together when the line wraps on small screens */
.notebook-item .muted {
    white-space: nowrap;
}

.checkbox-item {
    justify-content: flex-start;
}

.checkbox-item::before {
    content: '';
    flex: none;
    align-self: center;
    width: 0.95rem;
    height: 0.95rem;
    border: 2px solid var(--aug-taupe);
    border-radius: 3px;
    transform: rotate(-3deg);
}

.checkbox-item .handwritten {
    font-size: 1.45rem;
}

/* Shopping list: a real checkbox behind a hand-drawn box, the whole line is the tap target */
.shopping-check {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--aug-touch);
    cursor: pointer;
}

.shopping-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.shopping-box {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid var(--aug-taupe);
    border-radius: 3px;
    transform: rotate(-3deg);
    color: var(--aug-shopping);
    font-weight: 700;
}

.shopping-name {
    font-size: 1.45rem;
}

.shopping-check input:checked ~ .shopping-box::after {
    content: '✓';
}

.shopping-check input:checked ~ .shopping-name {
    color: var(--aug-muted);
    text-decoration: line-through;
}

.shopping-check input:focus-visible ~ .shopping-box {
    outline: 2px solid var(--aug-amber);
    outline-offset: 2px;
}

/* "Modifier" on the list: no ticking, the − / + and 🗑 of the cupboards take the room */
.directory.is-editing .shopping-item {
    gap: 0.5rem;
}

.directory.is-editing .shopping-check {
    min-width: 0;
    pointer-events: none;
}

.directory.is-editing .shopping-box {
    display: none;
}

.directory.is-editing .shopping-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.directory.is-editing .shopping-item .quantity {
    flex-shrink: 0;
    margin-left: 0;
    min-width: 2.25rem;
    text-align: center;
}

.shopping-offline[hidden] {
    display: none;
}

/* "C'est rangé !" stays at hand above the bookmarks while scrolling the list */
.shopping-actions {
    position: sticky;
    bottom: calc(var(--aug-bookmarks-height) + env(safe-area-inset-bottom) + 0.5rem);
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    background: linear-gradient(transparent, var(--aug-paper) 30%);
}

@media (min-width: 900px) {
    .shopping-actions {
        bottom: 1rem;
    }
}

.quantity {
    margin-left: auto;
    font-family: 'Caveat', cursive;
    font-size: 1.35rem;
    color: var(--aug-shopping);
}

.empty-line {
    color: var(--aug-muted);
    font-style: italic;
}

.moves-day {
    margin-top: 0.75rem;
    font-family: 'Lora', serif;
    font-weight: 600;
    color: var(--aug-taupe);
    font-size: 0.95rem;
}

/* ─── The household's journal ─── */
.journal {
    margin: 0;
    padding: 0;
    list-style: none;
}

.journal-entry {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.35rem 0;
    line-height: 1.5;
}

.journal-icon {
    flex: none;
}

.journal-text {
    flex: 1;
    min-width: 0;
}

.journal-time {
    flex: none;
    font-size: 0.85rem;
}

.journal-link {
    padding: 0;
    white-space: normal;
}

/* ════════════════════════════════════════════
   HOLD TO TALK (always at hand on the notebook pages)
   ════════════════════════════════════════════ */
.voice {
    --level: 0;
    position: fixed;
    z-index: 60;
    right: 1rem;
    bottom: calc(var(--aug-bookmarks-height) + env(safe-area-inset-bottom) + 0.75rem);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
    pointer-events: none;
}

.voice > * {
    pointer-events: auto;
}

.voice-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    border: none;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #a78bfa 0%, var(--aug-voice) 55%, #6d28d9 100%);
    color: white;
    box-shadow: 0 0 0 4px var(--aug-paper), 0 8px 20px rgba(109, 40, 217, 0.35);
    cursor: pointer;
    touch-action: none;           /* no scroll while holding */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;  /* no "save image" menu on long press */
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background 0.2s ease-out;
}

.voice-button:hover {
    transform: translateY(-2px);
}

.voice-button:focus-visible {
    outline: 3px solid var(--aug-amber);
    outline-offset: 5px;
}

.voice-icon {
    position: relative;
    z-index: 1;
    width: 1.75rem;
    height: 1.75rem;
    fill: currentColor;
    stroke: currentColor;
    transition: opacity 0.2s ease-out;
}

/* Rings following the voice */
.voice-rings,
.voice-rings::before {
    position: absolute;
    inset: 0;
    border: 2px solid var(--aug-voice);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.voice-rings::before {
    content: '';
    inset: -2px;
}

.voice-spinner {
    position: absolute;
    width: 1.75rem;
    height: 1.75rem;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
}

.voice[data-state="starting"] .voice-button {
    transform: scale(1.06);
}

.voice[data-state="recording"] .voice-button {
    transform: scale(1.12);
    background: radial-gradient(circle at 35% 30%, #c4b5fd 0%, #7c3aed 55%, #5b21b6 100%);
    box-shadow: 0 0 0 4px var(--aug-paper), 0 10px 28px rgba(109, 40, 217, 0.5);
}

.voice[data-state="recording"] .voice-rings {
    opacity: 0.55;
    transform: scale(calc(1.18 + var(--level) * 0.7));
    transition: transform 0.08s linear;
}

.voice[data-state="recording"] .voice-rings::before {
    opacity: 0.6;
    transform: scale(calc(1.12 + var(--level) * 0.5));
}

.voice.is-cancelling .voice-button {
    background: #a8a29e;
    box-shadow: 0 0 0 4px var(--aug-paper), 0 6px 14px rgba(0, 0, 0, 0.2);
}

.voice.is-cancelling .voice-rings {
    opacity: 0;
}

.voice[data-state="sending"] .voice-icon {
    opacity: 0;
}

.voice[data-state="sending"] .voice-spinner {
    opacity: 1;
    animation: voice-spin 0.8s linear infinite;
}

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

/* Augustine's answer, on a piece of the notebook's paper */
.voice-bubble {
    max-width: min(19rem, calc(100vw - 2rem));
    padding: 0.7rem 1rem 0.8rem;
    border: 1px solid var(--aug-border);
    border-radius: 14px 14px 4px 14px;
    background: var(--aug-paper);
    box-shadow: 0 8px 20px rgba(74, 52, 20, 0.18);
    animation: voice-bubble-in 0.2s ease-out;
}

.voice-bubble[hidden] {
    display: none;
}

@keyframes voice-bubble-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.voice-status {
    font-family: 'Caveat', cursive;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--aug-voice);
}

.voice-detail {
    margin-top: 0.25rem;
    color: var(--aug-text);
    font-size: 0.95rem;
    line-height: 1.45;
}

.voice[data-state="done"] .voice-status {
    color: var(--aug-amber-dark);
}

.voice[data-state="error"] .voice-status {
    color: var(--aug-warning);
}

/* What was really noted, and what it means for the shopping list */
.voice-noted,
.voice-note {
    display: block;
}

.voice-noted {
    color: var(--aug-taupe);
    font-size: 0.9rem;
}

.voice-note {
    margin-top: 0.15rem;
    color: var(--aug-shopping);
    font-size: 0.9rem;
    font-weight: 600;
}

.voice-note::before {
    content: '🛒 ';
}

.voice-undo {
    display: block;
    margin-top: 0.4rem;
    min-height: var(--aug-touch);
    padding: 0 0.9rem;
    border: 1px solid var(--aug-border);
    border-radius: 999px;
    background: var(--aug-card);
    color: var(--aug-taupe);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.voice-undo:hover {
    border-color: var(--aug-voice);
    color: var(--aug-voice);
}

.voice-link {
    font-weight: 600;
}

/* "Votre avis" (feedback): opposite Augustine's button, smaller and quieter */
.voice-feedback {
    right: auto;
    left: 1rem;
    align-items: flex-start;
    gap: 0.3rem;
}

.voice-feedback .voice-button {
    width: 3.25rem;
    height: 3.25rem;
    background: var(--aug-paper);
    color: var(--aug-taupe);
    box-shadow: 0 0 0 1px var(--aug-border), 0 6px 14px rgba(74, 52, 20, 0.18);
}

.voice-feedback .voice-icon {
    width: 1.5rem;
    height: 1.5rem;
    fill: none;
}

.voice-feedback[data-state="recording"] .voice-button {
    background: radial-gradient(circle at 35% 30%, #fbbf24 0%, var(--aug-amber) 55%, var(--aug-amber-dark) 100%);
    color: white;
}

.voice-feedback .voice-rings,
.voice-feedback .voice-rings::before {
    border-color: var(--aug-amber);
}

.voice-feedback .voice-bubble {
    border-radius: 14px 14px 14px 4px;
}

.voice-feedback .voice-status {
    color: var(--aug-amber-dark);
}

.voice-feedback-label {
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--aug-paper);
    color: var(--aug-taupe);
    font-size: 0.7rem;
    font-weight: 700;
    pointer-events: none;
}

.voice-feedback[data-state] .voice-feedback-label {
    visibility: hidden;
}

/* Room for the button above the last lines of the page */
body.has-bookmarks .site-main {
    padding-bottom: 6rem;
}

@media (min-width: 900px) {
    .voice {
        right: 2rem;
        bottom: 2rem;
    }

    .voice-feedback {
        right: auto;
        left: 2rem;
    }

    .voice-button {
        width: 4.5rem;
        height: 4.5rem;
    }

    body.has-bookmarks .site-main {
        padding-bottom: 4rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .voice-button,
    .voice-rings,
    .voice-bubble {
        transition: none !important;
        animation: none !important;
    }
}

/* ════════════════════════════════════════════
   THE COVER (login, sign up)
   ════════════════════════════════════════════ */
.cover {
    position: relative;
    max-width: 26rem;
    margin: 1rem auto 2rem;
    padding: 2.5rem 1.5rem 2rem;
    border-radius: 6px 16px 16px 6px;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 6px),
        linear-gradient(135deg, #b45309 0%, #92400e 100%);
    box-shadow:
        inset 6px 0 0 rgba(0, 0, 0, 0.12), /* spine */
        0 18px 36px rgba(74, 52, 20, 0.25);
}

/* Elastic strap */
.cover-strap {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 2.25rem;
    width: 0.7rem;
    background: rgba(40, 20, 5, 0.45);
}

.cover-label {
    position: relative;
    margin: 0 auto 1.5rem;
    max-width: 17rem;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    background: var(--aug-paper-texture), var(--aug-paper);
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.cover-brand .brand-mark {
    margin: 0 auto 0.4rem;
}

.cover-title {
    font-family: 'Caveat', cursive;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--aug-amber-dark);
}

.cover-subtitle {
    margin-top: 0.25rem;
    color: var(--aug-taupe);
    font-style: italic;
    font-size: 0.95rem;
}

.cover-subtitle:empty {
    display: none;
}

.cover-content {
    position: relative;
    padding: 1.5rem 1.25rem;
    border-radius: 10px;
    background: var(--aug-paper-texture), var(--aug-paper);
}

.cover-footer {
    margin-top: 1rem;
    text-align: center;
}

.cover-intro {
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* "Mot de passe oublié ?" under the password field */
.forgot-password {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.9rem;
    text-align: right;
}

/* ════════════════════════════════════════════
   ADMINISTRATION (outside the notebook)
   ════════════════════════════════════════════ */
.admin-nav {
    border-bottom: 1px solid var(--aug-border);
    background: var(--aug-card);
}

.admin-nav-inner {
    display: flex;
    gap: 0.25rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0.5rem;
    overflow-x: auto;
}

.admin-nav-link {
    flex: none;
    display: flex;
    align-items: center;
    min-height: var(--aug-touch);
    padding: 0 0.75rem;
    border-bottom: 3px solid transparent;
    color: var(--aug-taupe);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.admin-nav-link:hover {
    color: var(--aug-amber-dark);
}

.admin-nav-link.is-active {
    border-bottom-color: var(--aug-amber);
    color: var(--aug-text);
}

.admin-nav-back {
    margin-left: auto;
    font-weight: 400;
}

/* ─── Statistics (AI consumption) ─── */
.page-wide {
    max-width: 1100px;
}

.kpis {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    margin-top: 1rem;
}

.kpi {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: var(--aug-card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.kpi-label {
    color: var(--aug-taupe);
    font-size: 0.85rem;
    font-weight: 600;
}

.kpi-value {
    font-family: 'Lora', serif;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.3;
}

.kpi-detail {
    color: var(--aug-muted);
    font-size: 0.85rem;
}

.kpis + .card,
.card + .kpis,
.breakdown,
.breakdown + .card {
    margin-top: 1rem;
}

.breakdown {
    display: grid;
    gap: 1rem;
}

.breakdown > .card + .card {
    margin-top: 0;
}

.table-note {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.results-heading {
    margin-top: 0.75rem;
    color: var(--aug-taupe);
    font-weight: 700;
}

.members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.members .badge {
    text-decoration: none;
}

.search-form {
    margin-bottom: 1rem;
}

@media (min-width: 900px) {
    .breakdown {
        grid-template-columns: 1fr 1fr;
    }
}

/* ─── The family (members, invitation links) ─── */
.family-member-name {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.family-member {
    min-height: var(--aug-touch);
}

.family-invitation {
    display: grid;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--aug-card);
    border-left: 4px solid var(--aug-amber);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.family-invitation-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 1rem;
}

.family-invitation-link {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--aug-border);
    border-radius: 8px;
    background: var(--aug-bg);
    color: var(--aug-taupe);
    font: inherit;
    font-size: 0.85rem;
}

.family-invitation-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.family-invitation-actions form {
    margin-left: auto;
}

.family-invite-form {
    max-width: 26rem;
}

/* Leaving or deleting: tucked away, behind a click */
.danger-zone {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--aug-border);
}

.danger-zone summary {
    min-height: var(--aug-touch);
    display: flex;
    align-items: center;
    color: var(--aug-taupe);
    cursor: pointer;
}

.danger-zone[open] summary {
    color: var(--aug-warning);
}

.danger-zone .form {
    max-width: 26rem;
}

/* Long labels ("Quitter le foyer et supprimer mon compte") wrap inside the button */
.danger-zone .btn {
    height: auto;
    min-height: var(--aug-touch);
    padding-block: 0.5rem;
    white-space: normal;
    line-height: 1.3;
}

/* ─── Administration: feedback tickets ─── */
.feedback-views {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feedback-view {
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--aug-border);
    border-radius: 999px;
    color: var(--aug-taupe);
    text-decoration: none;
}

.feedback-view.is-active {
    border-color: var(--aug-amber);
    background: var(--aug-amber-light);
    color: var(--aug-text);
    font-weight: 600;
}

.feedback-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.feedback-report {
    padding: 0.75rem 0;
    border-top: 1px solid var(--aug-border);
}

.feedback-report:first-child {
    border-top: 0;
}

.feedback-report-text {
    margin: 0 0 0.25rem;
    font-style: italic;
}

.feedback-report-device {
    font-size: 0.8rem;
}

/* ─── Installable app (PWA) ─── */
.user-menu-link[hidden],
[data-controller="install"][hidden] {
    display: none;
}

/* "Installer l'app" is a button on Android: same look as the menu links */
button.user-menu-link {
    width: 100%;
    border: 0;
    background: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.offline {
    text-align: center;
}

.offline-message {
    font-size: 1.6rem;
    color: var(--aug-amber-dark);
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .bookmark,
    .site-header * {
        transition: none !important;
        animation: none !important;
    }
}
