:root {
    --primary: #111111;
    --primary-dark: #000000;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1c2733;
    --muted: #6b7785;
    --border: #e3e8ef;
    --danger: #c0392b;
    --success: #27ae60;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

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

header {
    background: var(--primary);
    color: white;
    padding: 24px 32px;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-logo {
    height: 130px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}

header h1 {
    margin: 0;
    font-size: 28px;
}

.subtitle {
    margin: 4px 0 0;
    opacity: 0.85;
    font-size: 14px;
}

.main-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.22);
}

.nav-link.active {
    background: white;
    color: var(--primary-dark);
}

main {
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ─────────── Karten ─────────── */
.card {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 16px;
    font-size: 20px;
    color: var(--primary-dark);
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.header-row h2 { margin: 0; }

/* ─────────── Formular ─────────── */
form .row {
    margin-bottom: 14px;
}

.row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.row.three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 14px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input, textarea, select {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: white;
    color: var(--text);
    transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    resize: vertical;
}

/* ─────────── Buttons ─────────── */
button {
    cursor: pointer;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.15s, transform 0.05s;
}

button:active { transform: translateY(1px); }

button.primary {
    background: var(--primary);
    color: white;
}
button.primary:hover { background: var(--primary-dark); }

button.secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}
button.secondary:hover { background: #e9eef5; }

button.danger {
    background: var(--danger);
    color: white;
}
button.danger:hover { background: #962c20; }

.actions {
    text-align: right;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─────────── Aufgabenliste ─────────── */
.task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.task-item:hover {
    border-color: var(--primary);
    transform: translateX(2px);
}

.task-item.done {
    opacity: 0.55;
}

.task-item.done .task-title {
    text-decoration: line-through;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.task-title {
    font-weight: 600;
    font-size: 15px;
}

.task-role {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.task-meta {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.empty {
    color: var(--muted);
    font-style: italic;
    margin: 0;
}

/* ─────────── Rollen-Gruppen (Heute) ─────────── */
.role-group {
    margin-bottom: 20px;
}

.role-group h3 {
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 6px;
    margin: 0 0 12px;
}

/* ─────────── Modal ─────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: 14px;
    padding: 32px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.modal h2 {
    margin: 0 0 16px;
    color: var(--primary-dark);
    padding-right: 32px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--muted);
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-meta {
    background: var(--bg);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}

.modal-meta strong {
    color: var(--muted);
    font-weight: 600;
    margin-right: 8px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section strong {
    display: block;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.modal-section p {
    margin: 0;
    white-space: pre-wrap;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ─────────── Wochenübersicht ─────────── */
.week-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.week-title {
    font-size: 18px;
    color: var(--primary-dark);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.week-today-link {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.week-today-link:hover { text-decoration: underline; }

.week-nav {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
}

.week-nav:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

.week-day {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.week-day.today {
    border-color: var(--primary);
    border-width: 2px;
    background: white;
}

.week-day-header {
    background: var(--primary);
    color: white;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.week-day.today .week-day-header {
    background: var(--primary-dark);
}

.weekday-name {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.weekday-date {
    font-size: 12px;
    opacity: 0.85;
}

.week-day-body {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.week-role-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.week-role-name {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
}

.week-task {
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: all 0.15s;
}

.week-task:hover {
    border-color: var(--primary);
    transform: translateX(1px);
}

.week-task.done {
    opacity: 0.5;
}

.week-task.done .week-task-title {
    text-decoration: line-through;
}

.week-task-time {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 11px;
}

.week-task-title {
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.week-empty {
    text-align: center;
    color: var(--muted);
    font-style: italic;
    margin: 8px 0;
    font-size: 12px;
}

@media (max-width: 1000px) {
    .week-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .week-day { min-height: auto; }
}

@media (max-width: 600px) {
    .row.two-col, .row.three-col { grid-template-columns: 1fr; }
    main { padding: 0 16px; }
    header { padding: 20px; }
    .week-grid { grid-template-columns: 1fr; }
    .header-content { justify-content: center; }
}

/* ─────────── User-Info & Logout im Header ─────────── */
.user-info {
    color: white;
    font-size: 14px;
    opacity: 0.85;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.nav-link.logout {
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.logout:hover {
    background: rgba(192, 57, 43, 0.7);
}

/* ─────────── Login-Seite ─────────── */
.login-body {
    background: var(--primary);
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.login-logo {
    height: 80px;
    width: auto;
    display: block;
    margin: 0 auto 24px;
}

.login-card h1 {
    margin: 0 0 24px;
    font-size: 24px;
    color: var(--primary-dark);
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.login-card label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.login-card input[type="text"],
.login-card input[type="password"] {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
}

.login-card label.remember {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-size: 14px;
    color: var(--muted);
}

.login-card label.remember input {
    margin: 0;
}

.login-card button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
}

.login-card button:hover {
    background: var(--primary-dark);
}

.login-error {
    background: #fdecea;
    color: var(--danger);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid #f5c6cb;
}
