:root {
    --primary: #2f6b4f;
    --primary-dark: #16352a;
    --bg: #f4f6f4;
    --card: #ffffff;
    --border: #dde4de;
    --text: #22291f;
    --muted: #6b7268;
    --danger: #c0392b;
    --success: #1e8e3e;
    --warning: #b8860b;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.wrap-narrow { max-width: 640px; margin: 0 auto; padding: 40px 20px; }

h1, h2, h3 { font-weight: 600; margin: 0 0 16px; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.topbar {
    background: var(--primary-dark);
    color: #fff;
    padding: 0 20px;
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; padding: 0; height: 56px; max-width: 1100px; }
.topbar a { color: #fff; }
.topbar .brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.topbar .brand img { height: 40px; width: auto; border-radius: 6px; background: #fff; padding: 3px 8px; }
.topbar .navwrap { max-width: 1100px; margin: 0 auto; display:flex; align-items:center; justify-content:space-between; height:56px; }

.mainnav { display: flex; align-items: center; height: 56px; }
.mainnav > a, .mainnav .navgroup > summary {
    margin-left: 18px;
    font-size: 14px;
    opacity: .92;
    color: #fff;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
}
.mainnav > a:hover, .mainnav .navgroup > summary:hover { opacity: 1; text-decoration: underline; }
.mainnav > a.active, .mainnav .navgroup > summary.active { opacity: 1; font-weight: 600; border-bottom-color: #fff; text-decoration: none; }

.navgroup { position: relative; display: inline-block; }
.navgroup > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.navgroup > summary::-webkit-details-marker { display: none; }
.navgroup > summary::after { content: "▾"; font-size: 9px; opacity: .8; }
.navgroup[open] > summary { opacity: 1; }
.navgroup-content {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0,0,0,.18);
    min-width: 210px;
    padding: 6px;
    z-index: 50;
}
.navgroup-content a {
    display: block;
    padding: 9px 12px;
    border-radius: 5px;
    color: var(--text);
    font-size: 14px;
    opacity: 1;
}
.navgroup-content a:hover { background: #f0f2f5; text-decoration: none; }
.navgroup-content a.active { background: #e8edf5; color: var(--primary-dark); font-weight: 600; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafbfc; }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f0f2f5; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }

label { display: block; font-size: 13.5px; font-weight: 600; margin: 14px 0 5px; color: #40465a; }
label.inline { display: inline; font-weight: 500; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14.5px;
    font-family: inherit;
    background: #fff;
}
textarea { resize: vertical; }
input[type=checkbox] { width: 16px; height: 16px; vertical-align: middle; margin-right: 6px; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
legend { font-weight: 600; padding: 0 6px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #e8edf5; color: var(--primary-dark); }
.badge.gruen { background: #e3f6e8; color: var(--success); }
.badge.gelb { background: #fdf3d9; color: var(--warning); }
.badge.rot { background: #fbe6e3; color: var(--danger); }
.badge.grau { background: #eceff2; color: var(--muted); }

.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: #e3f6e8; color: #166b34; }
.flash.error { background: #fbe6e3; color: #96291d; }
.flash.info { background: #e8edf5; color: var(--primary-dark); }
.flash.warning { background: #fdf3d9; color: #8a6100; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat .num { font-size: 28px; font-weight: 700; color: var(--primary-dark); }
.stat .label { color: var(--muted); font-size: 13px; margin-top: 2px; }

.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.mt0 { margin-top: 0; }
.actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

.day-cell { border: 1px solid var(--border); min-height: 90px; padding: 6px; vertical-align: top; border-radius: 4px; }
.day-cell.full { background: #fdf3d9; }
.day-cell.today { border-color: var(--primary); border-width: 2px; }
.day-num { font-weight: 700; font-size: 13px; }
.day-count { font-size: 11.5px; color: var(--muted); }
.order-chip { display: block; font-size: 11.5px; background: #eef2f8; border-radius: 4px; padding: 2px 5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-chip.express { background: #fdf3d9; }
.order-chip.continued { background: transparent; border: 1px dashed #b7c2d0; color: var(--text); }
.order-chip.continued.express { border-color: #e0c46a; }

.table-scroll { overflow-x: auto; }
.cell-lines { display: flex; flex-direction: column; gap: 3px; }
.cell-lines .sub { color: var(--muted); font-size: 12.5px; }
.cell-lines .badge { align-self: flex-start; }

/* Kompaktes Aktionsmenü für Tabellenzeilen (z.B. Bearbeiten/Aktivieren) - per <details> ohne JS */
.rowmenu { position: relative; display: inline-block; }
.rowmenu > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: var(--muted);
}
.rowmenu > summary::-webkit-details-marker { display: none; }
.rowmenu > summary::marker { content: ""; }
.rowmenu > summary:hover { background: #f0f2f5; color: var(--text); }
.rowmenu[open] > summary { background: #f0f2f5; color: var(--text); }
.rowmenu-content {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
    min-width: 170px;
    padding: 6px;
    z-index: 30;
}
.rowmenu-content a, .rowmenu-content button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 5px;
    background: none;
    border: none;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
}
.rowmenu-content a:hover, .rowmenu-content button:hover { background: #f0f2f5; text-decoration: none; }
.rowmenu-content form { margin: 0; }

.login-box { max-width: 380px; margin: 80px auto; }

.notice-box { background: #fff8e1; border: 1px solid #f0d98c; border-radius: 6px; padding: 12px 14px; font-size: 13.5px; margin: 10px 0; }
