:root {
    --bg: #f3f5f9;
    --card: #ffffff;
    --ink: #1c2331;
    --muted: #6b7688;
    --line: #dfe4ed;
    --brand: #1d6fd0;
    --brand-dark: #17579f;
    --danger: #c62828;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 6px 18px rgba(20, 30, 50, .06);
}

* { box-sizing: border-box; }

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

a { color: var(--brand); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--brand);
    color: #fff;
    padding: 10px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
}

.brand img { width: 34px; height: 34px; border-radius: 8px; }

.mainnav { display: flex; flex-wrap: wrap; gap: 4px; }

.mainnav a {
    color: #fff;
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.mainnav a:hover { background: rgba(255, 255, 255, .18); }
.mainnav a.logout { background: rgba(0, 0, 0, .18); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 18px; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}

h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.calendar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.calendar-head .month { font-size: 21px; font-weight: 700; }

.btn {
    display: inline-block;
    border: 0;
    background: var(--brand);
    color: #fff;
    padding: 9px 15px;
    border-radius: 9px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #e7ebf3; color: var(--ink); }
.btn.secondary:hover { background: #d8dfeb; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }

.grid-week, .grid-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.grid-week div {
    text-align: center;
    font-weight: 600;
    color: var(--muted);
    font-size: 13px;
    padding-bottom: 6px;
}

.day {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: #fbfcfe;
    border: 1px solid var(--line);
    border-radius: 10px;
    min-height: 108px;
    padding: 5px;
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.day.other { background: #f1f3f7; opacity: .65; }
.day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.day.weekend { background: #f7f8fc; }

/* Die ganze Zelle öffnet das Formular für diesen Tag */
.day-fill {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 0;
    padding: 5px 6px 0 0;
    text-decoration: none;
    border-radius: 10px;
}

.day-fill:hover { background: rgba(29, 111, 208, .07); }

.day .num {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-align: right;
    text-decoration: none;
}

.hint { margin: -6px 0 12px; font-size: 13px; color: var(--muted); }

.day.today .num { color: var(--brand); }

.ev {
    position: relative;
    z-index: 1;
    display: block;
    min-width: 0;
    max-width: 100%;
    font-size: 12px;
    line-height: 1.25;
    padding: 3px 6px;
    border-radius: 6px;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.ev .time { opacity: .85; font-weight: 500; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--muted);
}

.swatch {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid rgba(0, 0, 0, .18);
    display: inline-block;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 14px; }

input[type=text], input[type=password], input[type=email], input[type=date],
input[type=time], input[type=number], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
}

textarea { min-height: 90px; resize: vertical; }
input[type=color] { width: 60px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 18px; height: 18px; }

.msg { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.msg.error { background: #fdecea; color: #a3231b; }
.msg.success { background: #e7f6ec; color: #1c6b36; }
.msg.info { background: #e8f1fd; color: #1a4f8b; }

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

.weekdays { display: flex; flex-wrap: wrap; gap: 6px; }
.weekdays label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f4f9;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }

.list-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.list-item .bar { width: 8px; align-self: stretch; border-radius: 4px; min-height: 40px; }
.list-item .meta { color: var(--muted); font-size: 13px; }
.list-item .title { font-weight: 600; color: var(--ink); text-decoration: none; }
.list-item .title:hover { color: var(--brand); }

/* Monatsliste unter dem Kalender – nur auf schmalen Bildschirmen */
.month-list { display: none; margin-top: 20px; }
.month-list h2 { margin-top: 16px; font-size: 15px; }

@media (max-width: 720px) {
    .day { min-height: 62px; padding-top: 22px; }
    .day .num { font-size: 12px; }
    /* Termine werden auf dem Handy nur als Farbbalken angedeutet */
    .ev {
        font-size: 0;
        line-height: 0;
        height: 6px;
        padding: 0;
        margin-top: 3px;
        border-radius: 3px;
    }
    .ev .time { display: none; }
    .month-list { display: block; }
    .row2, .row3 { grid-template-columns: 1fr; }
    .wrap { padding: 12px; }
    .grid-days, .grid-week { gap: 4px; }
}
