*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1a5f3f;
    --primary-hover: #144d33;
    --primary-light: #e8f5ee;
    --danger: #c0392b;
    --danger-light: #fdecea;
    --success: #1a5f3f;
    --success-light: #e8f5ee;
    --warning: #b7791f;
    --warning-light: #fef9e7;
    --text: #1a1a1a;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f9fafb;
    --white: #ffffff;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
header {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow);
}
.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: .875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.header-logo {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.01em;
    text-decoration: none;
    color: inherit;
}
.header-logo span { opacity: .7; font-weight: 400; }
nav a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: .875rem;
    padding: .25rem .625rem;
    border-radius: 4px;
    transition: background .15s;
}
nav a:hover { background: rgba(255,255,255,.15); color: var(--white); }
.link-button {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,.85);
    font-size: .875rem;
    padding: .25rem .625rem;
    border-radius: 4px;
    transition: background .15s;
}
.link-button:hover { background: rgba(255,255,255,.15); color: var(--white); }

/* ── Main ── */
main {
    max-width: 900px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
    flex: 1;
}

/* ── Messages ── */
.messages { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .5rem; }
.message {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.message-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid #f5c6c2; }
.message-success { background: var(--success-light); color: var(--success); border: 1px solid #a7d7b8; }
.message-info    { background: var(--warning-light); color: var(--warning); border: 1px solid #f5dfa3; }

/* ── Cards ── */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1rem;
}
.card-body { padding: 1.25rem; }

/* ── Page heading ── */
h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }
h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: .75rem; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.125rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    line-height: 1.4;
}
.btn-primary   { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn:disabled  { opacity: .45; cursor: not-allowed; }

/* ── Form elements ── */
label { display: block; font-size: .875rem; font-weight: 400; margin-bottom: .375rem; }
input[type="text"], input[type="tel"], input[type="password"] {
    width: 100%;
    padding: .625rem .875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="tel"]:focus, input[type="password"]:focus,
input[type="email"]:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,95,63,.15);
}
input[type="email"], select, textarea {
    width: 100%;
    padding: .625rem .875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
    background: var(--white);
}
textarea { resize: vertical; min-height: 80px; }
.field-error { color: #c0392b; font-size: .8rem; margin-top: .25rem; }

/* ── Table ── */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; padding: .625rem .875rem; font-size: .8rem; font-weight: 600;
     text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
     background: var(--bg); border-bottom: 1px solid var(--border); }
td { padding: .75rem .875rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Badge ── */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-green   { background: var(--primary-light); color: var(--primary); }
.badge-gray    { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-red     { background: var(--danger-light); color: var(--danger); }

/* ── Footer ── */
footer {
    text-align: center;
    padding: 1.25rem 1.5rem;
    font-size: .8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* ── Utilities ── */
.text-muted { color: var(--text-muted); font-size: .875rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.gap-2 { gap: .5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ── Details / Chevron (bestellung_uebersicht) ── */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.chevron { transition: transform .2s; display: inline-block; color: var(--text-muted); font-size: .75rem; }
details[open] > form > .woche-body .chevron,
details[open] > summary .chevron { transform: rotate(180deg); }

/* ── Save toast (bestellung_uebersicht) ── */
#save-toast {
    position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
    padding: .5rem 1.25rem; border-radius: 6px; font-size: .9rem; font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,.12); z-index: 9999;
    opacity: 0; transition: opacity .2s; pointer-events: none;
}
#save-toast.show { opacity: 1; }
#save-toast.ok    { background: var(--success-light); color: var(--success); border: 1px solid #a7d7b8; }
#save-toast.error { background: var(--danger-light);  color: var(--danger);  border: 1px solid #f5c6c2; }

/* ── Menu grid (verwaltung_menus_bearbeiten) ── */
.menu-grid-wrap { overflow-x: auto; }
.menu-grid { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 700px; }
.menu-grid th {
    text-align: left; padding: .625rem .875rem;
    font-size: .8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.menu-grid td { padding: .5rem .625rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.menu-grid tr:last-child td { border-bottom: none; }
.menu-grid .day-cell { white-space: nowrap; font-weight: 500; padding-top: .75rem; color: var(--text); min-width: 110px; }
.menu-grid textarea {
    width: 100%; padding: .5rem .7rem;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: .95rem; font-family: inherit; line-height: 1.4;
    resize: none; min-height: 68px; overflow: hidden;
    outline: none; transition: border-color .15s, box-shadow .15s;
    background: var(--white);
}
.menu-grid textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,95,63,.15);
}
.kat-header { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.week-nav { display: flex; gap: .375rem; flex-wrap: wrap; }
.week-btn {
    padding: .35rem .8rem; border-radius: 6px; border: 1px solid var(--border);
    background: var(--white); font-size: .8rem; cursor: pointer;
    text-decoration: none; color: var(--text); transition: background .15s;
}
.week-btn:hover { background: var(--bg); }
.week-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.toolbar { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.5rem; }
.toolbar-group { display: flex; flex-direction: column; gap: .25rem; }
.toolbar-group label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.toolbar-group select { padding: .4rem .7rem; width: auto; }

/* ── Margin utilities ── */
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ── Page header (title + action row) ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1.5rem;
}

/* ── Links ── */
.back-link { color: var(--primary); text-decoration: none; font-size: .875rem; }
.link-primary { color: var(--primary); text-decoration: none; }
.link-danger { color: var(--danger); text-decoration: none; }
.table-link { color: var(--primary); text-decoration: none; font-size: .8rem; }
.table-link-danger { color: var(--danger); text-decoration: none; font-size: .8rem; }

/* ── Button variants ── */
.btn-sm { font-size: .875rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #a93226; }

/* ── Form ── */
.form-inline { display: inline; }
.form-group { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.label-optional { font-weight: 400; color: var(--text-muted); }

/* ── Text utilities ── */
.text-sm { font-size: .875rem; }

/* ── Card variants ── */
.card-header-flex { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem 1.5rem; font-size: .9rem; }

/* ── Bestellung overview ── */
.woche-list { display: flex; flex-direction: column; gap: .75rem; }
.woche-summary { cursor: pointer; padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-weight: 600; }
.woche-summary-meta { display: flex; align-items: center; gap: .625rem; }
.woche-body { padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; border-top: 1px solid var(--border); }
.radio-group { display: flex; flex-direction: column; gap: .5rem; }
.radio-label { display: flex; align-items: flex-start; gap: .625rem; cursor: pointer; margin-bottom: 0; }
.radio-label-center { display: flex; align-items: center; gap: .625rem; cursor: pointer; margin-bottom: 0; }
.radio-input { margin-top: auto; margin-bottom: auto; }

/* ── Menu option (bestellung_bearbeiten) ── */
.menu-option-list { display: flex; flex-direction: column; gap: .625rem; margin-bottom: 1.5rem; }
.menu-option-label { display: flex; align-items: center; gap: .75rem; cursor: pointer; padding: .625rem .875rem; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 0; }

/* ── Storno ── */
.storno-table { margin-bottom: 1.5rem; }
.storno-label { color: var(--text-muted); padding: .25rem .5rem .25rem 0; font-size: .875rem; }
.confirm-form { display: flex; gap: .75rem; }

/* ── Sync label (verwaltung_menus_bearbeiten) ── */
.sync-label-wrap { margin-top: .3rem; font-weight: 400; font-size: .75rem; text-transform: none; letter-spacing: 0; color: var(--text-muted); }
.sync-label { display: flex; align-items: center; gap: .3rem; cursor: pointer; margin: 0; }
.sync-label input[type="checkbox"] { margin: 0; }

/* ── Table cell ── */
.cell-actions { white-space: nowrap; }
