.plan {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.day {
    min-height: 130px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.day.today {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.day.unplanned {
    background: var(--surface-soft);
    border-style: dashed;
}

.day h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.today-badge {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    font-size: 10px;
    letter-spacing: 0.04em;
}

.day-empty {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.meal {
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.meal:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.meal-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.meal-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.meal-title a {
    color: inherit;
    text-decoration-color: var(--accent);
}

.meal {
    cursor: grab;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    border-radius: 8px;
}

.meal:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.meal-grip {
    flex: none;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.55;
}

.meal:hover .meal-grip {
    opacity: 1;
}

.meal.dragging {
    opacity: 0.35;
}

.meal-ghost {
    position: fixed;
    z-index: 1000;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--accent);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgb(34 42 36 / 18%);
    pointer-events: none;
    cursor: grabbing;
    transform: rotate(-1.5deg);
}

.day.drop-only {
    display: none;
}

.plan.is-dragging .day.drop-only {
    display: block;
}

.plan.is-dragging .day {
    transition: border-color 0.15s, background-color 0.15s;
}

.day.drop-target {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.meal-remove {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.meal-remove:hover {
    color: var(--ink);
}

.meal-remove:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}


/* Koch-Verlauf (Pop-up): eine Zeile pro Gericht, Einzeleinträge beim Aufklappen */
.history-search {
    width: 100%;
    margin-top: 18px;
}

.history-list {
    display: grid;
    margin-top: 10px;
    border-top: 1px solid var(--line);
}

.history-group {
    border-bottom: 1px solid var(--line);
}

.history-group summary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 2px;
    list-style: none;
    cursor: pointer;
}

.history-group summary::-webkit-details-marker {
    display: none;
}

.history-group summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

.history-name {
    min-width: 0;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-meta {
    flex: none;
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
}

.history-group[open] .history-name {
    color: var(--accent);
}

.history-body {
    display: grid;
    gap: 10px;
    padding: 0 2px 12px;
}

.history-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.history-fields input,
.history-fields select {
    width: 100%;
    min-width: 0;
    padding: 7px 10px;
    font-size: 13px;
}

.history-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.history-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px 2px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--accent-soft);
    font-size: 12px;
}

.history-chip button {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.history-chip button:hover {
    color: var(--ink);
}

.history-more {
    justify-self: start;
    margin-top: 10px;
}

/* Abfrage „Was habt ihr gekocht?“ beim Start einer neuen Woche */
.week-list {
    display: grid;
    gap: 6px;
}

.week-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
}

.week-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.week-item .hint {
    margin: 0;
    font-size: 12px;
}

@media (max-width: 560px) {
    .history-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Wochen im Voraus (Bedienung wie im Haushalt) */
.plan-week-nav {
    display: flex;
    gap: 6px;
}

.meal-shift {
    display: inline-flex;
    flex: none;
    gap: 2px;
}

.meal-shift button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font: inherit;
    cursor: pointer;
}

.meal-shift button:hover {
    border-color: var(--accent);
    color: var(--ink);
}

.meal-shift button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}
