:root {
    --color-bg: #f2f8f4;
    --color-card: #ffffff;
    --color-border: #d9ece0;
    --color-primary: #16a34a;
    --color-primary-hover: #15803d;
    --color-primary-light: #dcfce7;
    --color-text: #1a2e22;
    --color-muted: #5f7a68;
    --color-danger: #dc2626;
    --shadow-sm: 0 1px 2px rgba(22, 100, 60, 0.06);
    --shadow-md: 0 4px 14px rgba(22, 100, 60, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-bg) 220px);
    color: var(--color-text);
    opacity: 0;
    transition: opacity 0.25s ease;
}

body.is-ready {
    opacity: 1;
}

.container {
    animation: rise-in 0.35s ease both;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.topbar {
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.topbar-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-primary-hover);
    text-decoration: none;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar nav a {
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.topbar nav a:hover {
    color: var(--color-primary-hover);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

h1 {
    margin: 0 0 1rem;
    font-size: 1.5rem;
    color: var(--color-text);
}

.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 480px;
    box-shadow: var(--shadow-sm);
}

.auth-card {
    margin: 3rem auto 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    background: var(--color-primary-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-primary-hover);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: var(--color-primary-light);
}

.table a {
    color: var(--color-primary-hover);
    font-weight: 600;
    text-decoration: none;
}

.table a:hover {
    text-decoration: underline;
}

.actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.actions form {
    margin: 0;
}

.empty {
    color: var(--color-muted);
}

label {
    display: block;
    margin: 1rem 0 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

label:first-of-type {
    margin-top: 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

textarea {
    resize: vertical;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

button,
.button,
.button-secondary {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

button[type="submit"],
.button {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

button[type="submit"]:hover,
.button:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.button-secondary {
    background: transparent;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
}

.button-secondary:hover {
    background: var(--color-primary-light);
    color: var(--color-primary-hover);
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-danger);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.alert {
    background: #fef2f2;
    color: var(--color-danger);
    border: 1px solid #fecaca;
    padding: 0.65rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.detail-card {
    max-width: none;
    margin-bottom: 2rem;
}

.detail-list {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0.6rem 1rem;
    margin: 0;
}

.detail-list dt {
    color: var(--color-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.detail-list dd {
    margin: 0;
}

h2 {
    font-size: 1.15rem;
    margin: 0 0 1rem;
    color: var(--color-text);
}

.mail-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mail-item {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease;
}

.mail-item:hover {
    box-shadow: var(--shadow-md);
}

.mail-item summary {
    cursor: pointer;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    list-style: none;
}

.mail-item summary::-webkit-details-marker {
    display: none;
}

.mail-item summary::before {
    content: "✉";
    color: var(--color-primary);
    margin-right: 0.5rem;
}

.mail-subject {
    font-weight: 600;
}

.mail-meta {
    color: var(--color-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.mail-body {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    white-space: pre-line;
    color: var(--color-text);
}

.mail-delete-form {
    margin-top: 0.5rem;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 40, 26, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 100;
}

.confirm-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.confirm-modal-box {
    background: var(--color-card);
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 360px;
    width: calc(100% - 2rem);
    box-shadow: var(--shadow-md);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.15s ease;
}

.confirm-modal.is-open .confirm-modal-box {
    transform: translateY(0) scale(1);
}

.confirm-modal-text {
    margin: 0 0 1.25rem;
    color: var(--color-text);
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.confirm-modal-confirm {
    background: var(--color-danger);
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.confirm-modal-confirm:hover {
    background: #b91c1c;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-offen {
    background: #fef3c7;
    color: #92400e;
}

.status-bestätigt {
    background: var(--color-primary-light);
    color: var(--color-primary-hover);
}

.status-storniert {
    background: #fee2e2;
    color: #991b1b;
}
