/* =========================================================
   STADTTAUBEN LEVERKUSEN CONTROL PANEL
   CODED BY LEVCORE
   © 2026
   ========================================================= */

/* -------------------------
   DESIGN TOKENS
------------------------- */

:root {
    --bg: #eefaf6;
    --bg-soft: #f8fffc;

    --surface: #ffffff;
    --surface-soft: #ecfbf6;
    --surface-green: #dff8f0;

    --text: #07342f;
    --text-soft: #23514b;
    --muted: #6e8a84;

    --primary: #13b897;
    --primary-dark: #087d6b;
    --primary-deep: #063d37;
    --accent: #b8f5e8;

    --danger: #b42318;
    --success: #0b8f62;
    --warning: #b7791f;

    --border: #d8eee8;
    --border-strong: #bce5db;

    --shadow: 0 24px 60px rgba(7, 52, 47, .10);
    --shadow-soft: 0 12px 34px rgba(7, 52, 47, .08);

    --radius-sm: 12px;
    --radius: 22px;
    --radius-lg: 30px;

    --sidebar-width: 290px;
    --topbar-height: 76px;

    --field-height: 52px;
}

/* -------------------------
   RESET / BASE
------------------------- */

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

html {
    width: 100%;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 0% 18%, rgba(19, 184, 151, .16), transparent 26%),
        radial-gradient(circle at 100% 20%, rgba(19, 184, 151, .14), transparent 28%),
        linear-gradient(180deg, #f8fffc 0%, #edf9f5 45%, #f8fffc 100%);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg {
    max-width: 100%;
    height: auto;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

hr {
    height: 0;
    margin: 18px 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* -------------------------
   LOGIN
------------------------- */

.login-page,
.cp-login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.cp-login-page {
    background:
        radial-gradient(circle at 15% 10%, rgba(19, 184, 151, .24), transparent 28%),
        radial-gradient(circle at 85% 18%, rgba(184, 245, 232, .55), transparent 30%),
        radial-gradient(circle at 50% 100%, rgba(7, 52, 47, .10), transparent 38%),
        linear-gradient(135deg, #f8fffc 0%, #e9f8f3 100%);
}

.login-card,
.cp-login-card {
    width: 100%;
    max-width: 440px;
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow);
}

.login-card h1,
.cp-login-card h1 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: -.04em;
}

.login-card p,
.cp-login-card p {
    margin: 0 0 24px;
    color: var(--muted);
}

.cp-login-shell {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: 1.18fr .82fr;
    gap: 24px;
    align-items: stretch;
}

.cp-login-panel,
.cp-login-card {
    min-height: 620px;
}

.cp-login-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 34px;
    border-radius: 34px;
    color: #fff;
    background:
        radial-gradient(circle at 18% 12%, rgba(184, 245, 232, .28), transparent 28%),
        radial-gradient(circle at 80% 82%, rgba(19, 184, 151, .26), transparent 34%),
        linear-gradient(160deg, #07342f 0%, #052b27 100%);
    box-shadow: var(--shadow);
}

.cp-login-panel::after {
    content: "";
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 310px;
    height: 310px;
    border-radius: 50%;
    background: rgba(184, 245, 232, .12);
}

.cp-login-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}

.cp-login-logo {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: rgba(255, 255, 255, .10);
    backdrop-filter: blur(10px);
}

.cp-login-logo img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    display: block;
}

.cp-login-brand strong {
    display: block;
    font-size: 20px;
    line-height: 1.1;
}

.cp-login-brand span {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, .68);
    font-size: 14px;
}

.cp-login-copy {
    position: relative;
    z-index: 1;
    margin-top: auto;
    max-width: 620px;
}

.cp-login-kicker {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 14px;
    padding: 7px 11px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: #b8f5e8;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.cp-login-panel .cp-login-kicker {
    color: #07342f;
    background: rgba(184, 245, 232, .95);
}

.cp-login-copy h1 {
    max-width: 560px;
    margin: 0 0 16px;
    color: #fff;
    font-size: clamp(42px, 6vw, 70px);
    line-height: .92;
    letter-spacing: -.06em;
}

.cp-login-copy p {
    max-width: 560px;
    margin: 0;
    color: rgba(255, 255, 255, .76);
    font-size: 17px;
    line-height: 1.65;
}

.cp-login-features {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 34px;
}

.cp-login-features div {
    padding: 16px;
    border: 1px solid rgba(184, 245, 232, .18);
    border-radius: 20px;
    background: rgba(255, 255, 255, .07);
    backdrop-filter: blur(10px);
}

.cp-login-features strong {
    display: block;
    margin-bottom: 6px;
    color: #fff;
}

.cp-login-features span {
    display: block;
    color: rgba(255, 255, 255, .64);
    font-size: 13px;
    line-height: 1.45;
}

.cp-login-card {
    max-width: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 38px;
    border-radius: 34px;
}

.cp-login-card .btn {
    width: 100%;
}

.cp-login-security {
    margin-top: 24px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 13px;
    line-height: 1.5;
}

/* -------------------------
   APP LAYOUT
------------------------- */

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px;
    color: #fff;
    background:
        radial-gradient(circle at 20% 0%, rgba(19, 184, 151, .32), transparent 34%),
        linear-gradient(180deg, #07342f 0%, #052b27 100%);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin-bottom: 30px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    color: #07342f;
    font-weight: 900;
    letter-spacing: -.04em;
}

.brand-logo {
    overflow: hidden;
    background: transparent;
}

.brand-logo img {
    width: 74%;
    height: 74%;
    object-fit: contain;
    display: block;
}

.brand strong,
.brand span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand strong {
    font-size: 15px;
    line-height: 1.1;
}

.brand span {
    margin-top: 3px;
    color: rgba(255, 255, 255, .68);
    font-size: 13px;
}

/* -------------------------
   NAVIGATION
------------------------- */

.nav {
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-group-title {
    padding: 0 14px;
    color: rgba(255, 255, 255, .46);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.nav-group-links {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 14px;
    color: rgba(255, 255, 255, .78);
    font-size: 14px;
    font-weight: 750;
    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease,
        box-shadow .2s ease;
}

.nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    transform: translateX(2px);
}

.nav a.active {
    color: #07342f;
    background: #b8f5e8;
    box-shadow: 0 10px 24px rgba(184, 245, 232, .16);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
}

.sidebar-footer a {
    display: block;
    padding: 13px 14px;
    border-radius: 999px;
    color: #07342f;
    background: #fff;
    font-weight: 800;
    text-align: center;
}

/* -------------------------
   MAIN / TOPBAR / CONTENT
------------------------- */

.main {
    min-width: 0;
    overflow-x: hidden;
}

/* Layout-Schutz: verhindert horizontales Seitenscrolling durch breite Tabellen/Formulare. */
.main,
.content,
.cp-main {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 34px;
    border-bottom: 1px solid rgba(216, 238, 232, .8);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(18px);
}

.topbar strong {
    display: block;
    font-size: 19px;
    line-height: 1.1;
    letter-spacing: -.03em;
}

.topbar span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.menu-toggle {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    color: var(--text);
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 8px 22px rgba(7, 52, 47, .08);
    font-size: 0;
    line-height: 1;
}

.menu-toggle::before {
    content: "☰";
    font-size: 22px;
    line-height: 1;
    transform: translateY(-1px);
}

.content,
.cp-main {
    width: min(1180px, 100%);
    min-width: 0;
    overflow-x: hidden;
    margin: 0 auto;
    padding: 34px;
}

/* -------------------------
   PAGE HEADER
------------------------- */

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 26px;
}

.page-header h1 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: clamp(32px, 4vw, 42px);
    line-height: .98;
    letter-spacing: -.06em;
}

.page-header p {
    max-width: 720px;
    margin: 0;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.6;
}

.page-actions,
.form-actions,
.section-header,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.page-actions,
.section-header,
.actions {
    align-items: center;
}

.form-actions {
    align-items: flex-start;
    margin-top: 22px;
}

.section-header {
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0 0 6px;
}

.section-header p {
    margin: 0;
    color: var(--muted);
}

/* -------------------------
   CARDS
------------------------- */

.card {
    position: relative;
    margin-bottom: 24px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .90);
    box-shadow: var(--shadow-soft);
}

.card h1,
.card h2,
.card h3 {
    margin-top: 0;
    color: var(--text);
    letter-spacing: -.045em;
}

.card h1 {
    margin-bottom: 14px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: .98;
}

.card h2 {
    margin-bottom: 18px;
    font-size: clamp(23px, 3vw, 32px);
    line-height: 1.05;
}

.card h3 {
    margin-bottom: 10px;
    font-size: 20px;
    line-height: 1.15;
}

.card p {
    color: var(--text-soft);
    line-height: 1.65;
}

/* -------------------------
   GRID / STATS
------------------------- */

.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 24px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat,
.stat-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 100% 0%, rgba(19, 184, 151, .10), transparent 34%),
        rgba(255, 255, 255, .92);
    box-shadow: var(--shadow-soft);
}

.stat span,
.stat-card span {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.stat strong,
.stat-card strong {
    display: block;
    font-size: 34px;
    line-height: 1;
    letter-spacing: -.05em;
}

/* -------------------------
   FORMS
------------------------- */

.form-card {
    padding: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.form-row,
.form-group {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: start;
}

.form-row.full,
.form-group-full {
    grid-column: 1 / -1;
}

label {
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    outline: none;
    color: var(--text);
    background: #fff;
    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
    height: var(--field-height);
    min-height: var(--field-height);
    max-height: var(--field-height);
    padding: 0 14px;
    line-height: normal;
}

select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--primary-dark) 50%),
        linear-gradient(135deg, var(--primary-dark) 50%, transparent 50%);
    background-position:
        calc(100% - 22px) 50%,
        calc(100% - 16px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"] {
    min-width: 0;
    max-width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

/* Fix für iPhone Safari: Datumsfelder werden sonst gern breiter als die Spalte */
input[type="date"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value,
input[type="month"]::-webkit-date-and-time-value {
    min-width: 0;
    width: 100%;
    text-align: left;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
    margin-left: 0;
    padding-left: 6px;
}

textarea {
    min-height: 130px;
    padding: 13px 14px;
    resize: vertical;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 5px rgba(19, 184, 151, .13);
}

#monthly_fee,
#voluntary_fee {
    height: var(--field-height) !important;
    min-height: var(--field-height) !important;
    max-height: var(--field-height) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: normal !important;
    align-self: start;
}

/* -------------------------
   BUTTONS
------------------------- */

.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 14px 28px rgba(19, 184, 151, .22);
    transition:
        transform .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(19, 184, 151, .28);
}

.btn.primary,
.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.btn.secondary,
.btn-secondary {
    color: var(--primary-dark);
    background: var(--surface-soft);
    border: 1px solid var(--border-strong);
    box-shadow: none;
}

.btn.danger,
.btn-danger {
    color: #fff;
    background: var(--danger);
}

/* -------------------------
   ALERTS / HELPERS
------------------------- */

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    font-weight: 700;
}

.alert.error,
.alert-error {
    color: var(--danger);
    background: #fff1f0;
    border-color: #ffd1cc;
}

.alert.success,
.alert-success {
    color: var(--success);
    background: #e9fbf1;
    border-color: #c7f0d8;
}

.muted {
    color: var(--muted) !important;
}

.small {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.text-content {
    color: var(--text-soft);
    line-height: 1.7;
}

.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--text);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 900;
}

.status-badge {
    padding: 7px 11px;
    color: var(--primary-dark);
    border: 1px solid var(--border-strong);
    letter-spacing: .02em;
}

.badge.green {
    color: var(--success);
    background: #e6fbf1;
}

.badge.red {
    color: var(--danger);
    background: #fff1f0;
}

.badge.gold,
.badge.yellow {
    color: var(--warning);
    background: #fff7df;
}

/* -------------------------
   pagination
------------------------- */

/*.pagination{
    display:flex;
    gap:8px;
    margin-top:24px;
    justify-content:center;
    flex-wrap:wrap;
}*/

.pagination{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:12px;
    margin-top:20px;
    flex-wrap:wrap;
}

.pagination-info{
    font-weight:600;
    color:var(--text-muted);
}


.pagination .btn{
    width:auto;
    min-width:44px;
    flex:0 0 auto;
}


/* -------------------------
   TABLES
------------------------- */

.table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.table-wrap::-webkit-scrollbar {
    height: 8px;
}

.table-wrap::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(7, 52, 47, .18);
}

table,
.table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    min-width: 0;
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

th {
    color: var(--primary-dark);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    white-space: normal;
}

td {
    color: var(--text);
}

td strong {
    color: var(--text);
}

tr:last-child td {
    border-bottom: 0;
}

.table-wrap th:nth-child(1),
.table-wrap td:nth-child(1) {
    width: 22%;
}

.table-wrap th:nth-child(2),
.table-wrap td:nth-child(2) {
    width: 11%;
}

.table-wrap th:nth-child(3),
.table-wrap td:nth-child(3) {
    width: 13%;
}

.table-wrap th:nth-child(4),
.table-wrap td:nth-child(4) {
    width: 17%;
}

.table-wrap th:nth-child(5),
.table-wrap td:nth-child(5) {
    width: 14%;
}

.table-wrap th:nth-child(6),
.table-wrap td:nth-child(6) {
    width: 13%;
    white-space: nowrap;
}

.table-wrap th:nth-child(7),
.table-wrap td:nth-child(7) {
    width: 10%;
    min-width: 92px;
    text-align: right;
    white-space: nowrap;
}

.table-wrap td:last-child .btn,
.table-wrap td:last-child a.btn {
    min-height: 38px;
    padding: 10px 14px;
    font-size: 13px;
}


.table-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 12px;
}

.table-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

.table-actions a:hover {
    border-color: var(--primary);
    background: #ffffff;
}

/* -------------------------
   DETAIL / TAUBENAKTEN
------------------------- */

.case-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 24px;
}

.case-overview-grid .card {
    margin-bottom: 0;
}

.case-overview-grid .card:nth-child(3) {
    grid-column: 1 / -1;
}

.detail-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding: 0 0 12px;
    border-bottom: 1px solid rgba(216, 238, 232, .75);
}

.detail-list div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.detail-list dd {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 750;
    line-height: 1.45;
}

.detail-list.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.detail-list.compact div {
    display: block;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
}

.detail-list.compact dt {
    margin-bottom: 5px;
}

/* -------------------------
   TIMELINE / TAUBENAKTEN-VERLAUF
------------------------- */

.timeline {
    position: relative;
    display: grid;
    gap: 16px;
}

.timeline-item {
    position: relative;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        radial-gradient(circle at 100% 0%, rgba(19, 184, 151, .08), transparent 32%),
        #fff;
    box-shadow: 0 10px 28px rgba(7, 52, 47, .06);
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.timeline-item h3 {
    margin: 0 0 10px;
    font-size: 22px;
}

.case-timeline {
    position: relative;
    display: grid;
    gap: 18px;
}

.case-timeline::before {
    content: "";
    position: absolute;
    left: 23px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--border-strong), rgba(19, 184, 151, .08));
}

.case-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.case-timeline-marker {
    position: relative;
    z-index: 1;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, var(--surface-soft));
    box-shadow: 0 12px 26px rgba(7, 52, 47, .09);
    font-size: 20px;
}

.case-timeline-card {
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        radial-gradient(circle at 100% 0%, rgba(19, 184, 151, .07), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 255, 252, .88));
    box-shadow: 0 12px 32px rgba(7, 52, 47, .07);
}

.case-timeline-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.case-timeline-date {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
}

.case-timeline-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 22px;
    line-height: 1.15;
    letter-spacing: -.035em;
}

.timeline-edit-btn {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 10px 14px;
    font-size: 13px;
}

.case-timeline-text {
    margin-top: 12px;
    color: var(--text-soft);
    line-height: 1.7;
}

.timeline-info-box {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(236, 251, 246, .72);
}

.timeline-info-title {
    margin-bottom: 12px;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.timeline-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 16px 0 0;
}

.timeline-info-box .timeline-info-grid {
    margin-top: 0;
}

.timeline-info-grid div {
    min-width: 0;
    padding: 14px;
    border: 1px solid rgba(188, 229, 219, .85);
    border-radius: 18px;
    background: rgba(255, 255, 255, .78);
}

.timeline-info-grid dt {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.timeline-info-grid dd {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.45;
    overflow-wrap: anywhere;
}


.medication-period-pill {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin: 0 0 14px;
    padding: 8px 13px;
    border: 1px solid rgba(19, 184, 151, .28);
    border-radius: 999px;
    color: var(--primary-dark);
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 8px 18px rgba(7, 52, 47, .05);
}

.medication-period-pill span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.medication-period-pill strong {
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 950;
    line-height: 1.2;
}

.medication-info {
    border-color: rgba(19, 184, 151, .28);
    background:
        radial-gradient(circle at 100% 0%, rgba(19, 184, 151, .10), transparent 34%),
        rgba(236, 251, 246, .82);
}

.vitals-grid div {
    background: var(--surface-soft);
}

.timeline-warning {
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(183, 121, 31, .28);
    border-left: 5px solid var(--warning);
    border-radius: 16px;
    color: #7a4d0b;
    background: #fff8e8;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.5;
}

.case-timeline-footer {
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.timeline-type-medication .case-timeline-marker {
    background: linear-gradient(135deg, #ffffff, #e8fbf6);
}

.timeline-type-weight .case-timeline-marker {
    background: linear-gradient(135deg, #ffffff, #eef7ff);
}

.timeline-type-vet .case-timeline-marker,
.timeline-type-care .case-timeline-marker {
    background: linear-gradient(135deg, #ffffff, #fff7df);
}

@media (max-width: 720px) {
    .case-timeline::before {
        display: none;
    }

    .case-timeline-item {
        grid-template-columns: 1fr;
    }

    .case-timeline-marker {
        display: none;
    }

    .case-timeline-card {
        padding: 18px;
        border-radius: 22px;
    }

    .case-timeline-header {
        display: grid;
        gap: 12px;
    }

    .case-timeline-header h3 {
        font-size: 20px;
    }

    .timeline-edit-btn {
        width: 100%;
    }

    .timeline-info-grid {
        grid-template-columns: 1fr;
    }

    .medication-period-pill {
        width: 100%;
        justify-content: space-between;
        border-radius: 16px;
    }
}


/* -------------------------
   DOCUMENTATION MODULE
------------------------- */

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-actions .btn {
    width: auto;
    min-height: 40px;
    padding: 10px 14px;
    font-size: 13px;
}

.checkbox-label {
    min-height: var(--field-height);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 0;
    accent-color: var(--primary);
}

.alert-danger {
    color: var(--danger);
    background: #fff1f0;
    border-color: #ffd1cc;
}

.documentation-summary {
    display: grid;
    gap: 12px;
}

.documentation-summary-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
}

/* -------------------------
   IMAGE GALLERY / UPLOAD / LIGHTBOX
------------------------- */

.image-gallery,
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.image-card,
.image-preview-item {
    overflow: hidden;
    border: 1px solid rgba(19, 184, 151, .22);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(7, 52, 47, .08);
}

.image-card-button,
.image-preview-button {
    width: 100%;
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.image-card-button:focus-visible,
.image-preview-button:focus-visible,
.upload-dropzone:focus-visible {
    outline: 3px solid rgba(19, 184, 151, .35);
    outline-offset: 4px;
}

.image-card img,
.image-preview-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: block;
    object-fit: cover;
    background: var(--surface-soft);
}

.image-card-content,
.image-preview-caption {
    padding: 10px 11px 12px;
}

.image-card-content strong,
.image-preview-caption strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: .84rem;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.image-card-content span,
.image-preview-caption span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.35;
}

.image-upload-card {
    overflow: hidden;
}

.upload-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.upload-dropzone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 170px;
    padding: 26px;
    border: 2px dashed rgba(19, 184, 151, .42);
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(19, 184, 151, .11), transparent 36%),
        linear-gradient(180deg, #ffffff 0%, #f7fcfb 100%);
    cursor: pointer;
    transition:
        border-color .22s ease,
        background .22s ease,
        box-shadow .22s ease,
        transform .22s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: rgba(19, 184, 151, .9);
    background:
        radial-gradient(circle at top left, rgba(19, 184, 151, .18), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #effaf7 100%);
    box-shadow: 0 16px 34px rgba(7, 52, 47, .08);
}

.upload-dropzone:active {
    transform: scale(.995);
}

.upload-dropzone-content {
    text-align: center;
    pointer-events: none;
}

.upload-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
    border-radius: 20px;
    color: #07342f;
    background: rgba(19, 184, 151, .16);
    font-size: 24px;
    font-weight: 900;
}

.upload-dropzone strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 1.02rem;
}

.upload-dropzone span {
    display: block;
    color: var(--muted);
    font-size: .92rem;
}

.upload-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.upload-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    color: #0b3c37;
    background: rgba(19, 184, 151, .12);
    font-size: .86rem;
    font-weight: 800;
}

.upload-empty-note {
    margin-top: 10px;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: auto;
    margin-top: 9px;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.checkline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    padding: 0;
    accent-color: var(--primary);
}

.image-card-content .checkline {
    padding: 8px 10px;
    border-radius: 13px;
    color: #7f1d1d;
    background: rgba(239, 68, 68, .09);
    font-size: .84rem;
    font-weight: 800;
}

.image-card-content .checkline input[type="checkbox"] {
    accent-color: #dc2626;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(7, 52, 47, .82);
    backdrop-filter: blur(10px);
}

.lightbox.open {
    display: grid;
}

.lightbox figure {
    width: min(1100px, 100%);
    margin: 0;
}

.lightbox img {
    max-width: 100%;
    max-height: 82vh;
    display: block;
    margin: 0 auto;
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
}

.lightbox figcaption {
    margin-top: 14px;
    color: #fff;
    text-align: center;
    font-weight: 700;
}

.lightbox-close {
    position: fixed;
    top: 22px;
    right: 22px;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    color: var(--text);
    background: #fff;
    font-size: 30px;
    line-height: 1;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .22);
    cursor: pointer;
}

/* -------------------------
   FINANCE
------------------------- */

.finance-list {
    display: grid;
    gap: 12px;
}

.finance-empty {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--muted);
    font-weight: 700;
}

.finance-item {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.finance-item summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 18px;
    cursor: pointer;
    list-style: none;
}

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

.finance-item summary::after {
    content: "Details öffnen";
    grid-column: 1 / -1;
    width: fit-content;
    padding: 7px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 900;
}

.finance-item[open] summary::after {
    content: "Details schließen";
}

.finance-main strong {
    display: block;
    font-size: 16px;
    line-height: 1.25;
}

.finance-main span,
.finance-main small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.finance-amount {
    display: grid;
    justify-items: end;
    gap: 8px;
    white-space: nowrap;
}

.finance-amount strong {
    font-size: 18px;
}

.finance-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 0 18px 18px;
}

.finance-details div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
}

.finance-details div.wide {
    grid-column: span 2;
}

.finance-details div.full {
    grid-column: 1 / -1;
    padding: 0;
    border: 0;
    background: transparent;
}

.finance-details span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.finance-details strong {
    display: block;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}


.finance-notes {
    margin-top: 6px;
    line-height: 1.5;
    white-space: normal;
}
/* -------------------------
   SEARCH / RESULT
------------------------- */

.searchbar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.searchbar input {
    max-width: 460px;
}

.result-box {
    margin-top: 20px;
    padding: 22px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 100% 0%, rgba(19, 184, 151, .12), transparent 34%),
        var(--surface-soft);
}

.result-box strong {
    display: block;
    margin-bottom: 8px;
    font-size: 28px;
    line-height: 1;
    letter-spacing: -.04em;
}

/* -------------------------
   PERMISSIONS
------------------------- */

.permission-list {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.permission-list small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

/* -------------------------
   MEDICATION
------------------------- */

.medication-list {
    display: grid;
    gap: 18px;
}

.medication-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow-soft);
}

.medication-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.medication-kicker {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.medication-head h2 {
    margin: 0;
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.05;
    letter-spacing: -.04em;
}

.medication-head p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.medication-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.medication-details {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.medication-details div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
}

.medication-details span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.medication-details strong {
    display: block;
    color: var(--text);
    line-height: 1.4;
}

.medication-note {
    margin-top: 16px;
    padding: 16px;
    border-left: 5px solid var(--primary);
    border-radius: 16px;
    background: #f8fffd;
    color: var(--text-soft);
    line-height: 1.6;
}

.medication-actions {
    margin-top: 16px;
}

.medication-calculator {
    display: none;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.medication-calculator.open {
    display: block;
}

/* -------------------------
   RESPONSIVE
------------------------- */


@media (max-width: 1400px) {
    :root {
        --sidebar-width: 300px;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-width);
        max-width: 86vw;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: var(--shadow);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: inline-flex;
    }

    .content,
    .cp-main {
        width: min(1180px, 100%);
        padding: 30px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 1100px) {
    .content,
    .cp-main {
        padding: 26px;
    }
    .table-wrap th,
    .table-wrap td {
        padding: 14px 12px;
        font-size: 14px;
    }

    .table-wrap th {
        font-size: 11px;
        letter-spacing: .06em;
    }

    .table-wrap .status-badge,
    .table-wrap .badge {
        padding: 6px 9px;
        font-size: 11px;
    }


    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .case-overview-grid {
        grid-template-columns: 1fr;
    }

    .case-overview-grid .card:nth-child(3) {
        grid-column: auto;
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--sidebar-width);
        max-width: 86vw;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: var(--shadow);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: inline-flex;
    }

    .topbar {
        padding: 0 20px;
    }

    .content,
    .cp-main {
        padding: 22px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid-2,
    .grid-3,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .medication-head {
        display: grid;
    }

    .medication-badges {
        justify-content: flex-start;
    }

    .medication-details,
    .finance-details {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cp-login-shell {
        grid-template-columns: 1fr;
    }

    .cp-login-panel,
    .cp-login-card {
        min-height: auto;
    }

    .cp-login-panel {
        padding: 28px;
    }

    .cp-login-copy {
        margin-top: 80px;
    }

    .cp-login-features {
        grid-template-columns: 1fr;
    }
}


@media (max-width: 1420px) {
    /* Tablet / schmale Desktopbreiten: Tabellen werden zu Karten, damit keine Spalten gequetscht werden. */
    .table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .table-wrap table,
    .table-wrap .table {
        min-width: 0;
        max-width: 100%;
        table-layout: auto;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
    }

    tbody {
        display: grid;
        gap: 14px;
    }

    tr {
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: 22px;
        background: #fff;
        box-shadow: var(--shadow-soft);
    }

    th,
    td,
    .table-wrap th:nth-child(n),
    .table-wrap td:nth-child(n) {
        width: 100%;
    }

    td {
        display: grid;
        grid-template-columns: 190px minmax(0, 1fr);
        gap: 14px;
        align-items: center;
        padding: 11px 0;
        border-bottom: 1px solid var(--border);
        text-align: left;
        overflow-wrap: anywhere;
        word-break: normal;
        white-space: normal;
    }

    td:first-child {
        padding-top: 0;
    }

    td:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .06em;
    }

    td[colspan]::before {
        display: none;
    }

    td .btn {
        width: fit-content;
        min-width: 120px;
        margin-top: 0;
    }

    .table-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 680px) {
    :root {
        --field-height: 50px;
    }

    .login-card {
        padding: 26px;
        border-radius: 24px;
    }

    .content,
    .cp-main {
        padding: 16px;
    }

    .topbar {
        min-height: 68px;
    }

    .card {
        padding: 20px;
        border-radius: 24px;
    }

    .page-header h1 {
        font-size: 32px;
    }

    .grid-4,
    .medication-details,
    .finance-details {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .searchbar {
        display: grid;
    }

    .searchbar input {
        max-width: none;
    }

    .actions,
    .page-actions,
    .form-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .detail-list div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .detail-list.compact {
        grid-template-columns: 1fr;
    }

    /* Mobile Tabellen als Karten */
    .table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .table-wrap table,
    .table-wrap .table {
        min-width: 0;
        max-width: 100%;
        table-layout: auto;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
    }

    tbody {
        display: grid;
        gap: 14px;
    }

    tr {
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: 20px;
        background: #fff;
        box-shadow: var(--shadow-soft);
    }

    th,
    td,
    .table-wrap th:nth-child(n),
    .table-wrap td:nth-child(n) {
        width: 100%;
    }

    td {
        display: grid;
        grid-template-columns: 42% minmax(0, 1fr);
        gap: 14px;
        align-items: start;
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
        text-align: left;
        word-break: break-word;
        white-space: normal;
    }

    td:first-child {
        padding-top: 0;
    }

    td:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .06em;
    }

    td[colspan]::before {
        display: none;
    }

    td .btn {
        width: 100%;
        margin-top: 4px;
    }

    .quick-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .quick-actions .btn {
        width: 100%;
    }

    .table-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .table-actions a {
        justify-content: center;
        width: 100%;
    }

    .finance-item summary {
        grid-template-columns: 1fr;
    }

    .finance-amount {
        justify-items: start;
    }

    .finance-details div.wide {
        grid-column: auto;
    }

    .medication-card {
        padding: 18px;
        border-radius: 24px;
    }

    .medication-head h2 {
        font-size: 24px;
    }

    .medication-calculator {
        padding: 16px;
    }

    .upload-dropzone {
        min-height: 150px;
        padding: 20px;
    }

    .upload-dropzone strong {
        font-size: .98rem;
    }

    .image-preview-grid,
    .image-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* iPhone Safari: Formularfelder wirklich in Spalte halten */
    input,
    select,
    textarea {
        max-width: 100%;
    }

    input[type="date"],
    input[type="datetime-local"],
    input[type="time"],
    input[type="month"] {
        display: block;
        width: 100%;
        inline-size: 100%;
        min-inline-size: 0;
        max-inline-size: 100%;
        padding-right: 10px;
        font-size: 16px;
    }

    select {
        font-size: 16px;
    }
}

@media (max-width: 420px) {
    .sidebar {
        width: 86vw;
    }

    .topbar strong {
        font-size: 16px;
    }

    .topbar span {
        font-size: 12px;
    }

    .card h1 {
        font-size: 30px;
    }

    .stat strong,
    .stat-card strong {
        font-size: 30px;
    }

    .cp-login-page {
        padding: 14px;
    }

    .cp-login-panel {
        padding: 24px;
        border-radius: 26px;
    }

    .cp-login-card {
        padding: 26px;
        border-radius: 26px;
    }

    .cp-login-copy h1 {
        font-size: 40px;
    }

    td {
        grid-template-columns: 1fr;
        gap: 5px;
    }
}


/* =========================================================
   DOCUMENTATION MODULE IMPROVEMENTS
========================================================= */

.documentation-timeline {
    gap: 18px;
}

.documentation-item {
    overflow: hidden;
}

.documentation-item h3 {
    margin-top: 14px;
}

.documentation-item p {
    margin-bottom: 0;
}

.timeline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.timeline-actions .btn {
    width: auto;
    min-height: 40px;
    padding: 10px 14px;
    font-size: 13px;
}

.documentation-item .status-badge {
    margin-bottom: 10px;
}

@media (max-width: 1400px) {

    .documentation-timeline {
        gap: 16px;
    }

    .documentation-item {
        padding: 20px;
    }

    .timeline-item h3 {
        font-size: 20px;
    }
}

@media (max-width: 680px) {

    .timeline-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .timeline-actions .btn {
        width: 100%;
    }

    .documentation-item {
        padding: 18px;
        border-radius: 22px;
    }

    .timeline-item h3 {
        font-size: 18px;
    }
}


/* =========================================================
   MEMBERS LIST / ACCORDION
   ersetzt die breite Mitglieder-Tabelle
========================================================= */

.member-list {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.member-list-head,
.member-row {
    display: grid;
    grid-template-columns: 95px minmax(220px, 1fr) 110px 120px 150px;
    gap: 18px;
    align-items: center;
}

.member-list-head {
    padding: 14px 18px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.member-item {
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.member-item:last-child {
    border-bottom: 0;
}

.member-item summary {
    list-style: none;
    cursor: pointer;
    padding: 18px;
}

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

.member-item summary:hover {
    background: rgba(19, 184, 151, .035);
}

.member-row > span {
    min-width: 0;
}

.member-number {
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}

.member-name strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.member-name small,
.member-detail-box small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.member-fee {
    white-space: nowrap;
}

.member-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--primary-dark);
    background: var(--surface-soft);
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.member-toggle::after {
    content: "▾";
    margin-left: 8px;
    font-size: 12px;
}

.member-item[open] .member-toggle::after {
    content: "▴";
}

.member-details {
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fffc 100%);
}

.member-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.member-detail-box {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
}

.member-detail-box > span:first-child {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.member-detail-box strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.member-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.member-actions .btn {
    width: auto;
}

.member-empty {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--muted);
    font-weight: 700;
}

@media (max-width: 900px) {
    .member-list-head,
    .member-row {
        grid-template-columns: 80px minmax(170px, 1fr) 90px 90px 130px;
        gap: 10px;
    }

    .member-list-head {
        padding: 13px 14px;
        font-size: 11px;
        letter-spacing: .05em;
    }

    .member-item summary {
        padding: 14px;
    }

    .member-toggle {
        min-height: 36px;
        padding: 0 11px;
        font-size: 12px;
    }

    .member-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .member-list {
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .member-list-head {
        display: none;
    }

    .member-item {
        overflow: hidden;
        margin-bottom: 14px;
        border: 1px solid var(--border);
        border-radius: 22px;
        box-shadow: var(--shadow-soft);
    }

    .member-row {
        grid-template-columns: 1fr auto;
        gap: 10px 14px;
    }

    .member-name {
        grid-column: 1 / -1;
        order: -1;
    }

    .member-toggle {
        width: 100%;
    }

    .member-status,
    .member-fee,
    .member-toggle {
        align-self: center;
    }

    .member-detail-grid {
        grid-template-columns: 1fr;
    }

    .member-actions .btn {
        width: 100%;
    }
}

@media (max-width: 440px) {
    .member-row {
        grid-template-columns: 1fr;
    }
}


/* -------------------------
   MEDICATION PERIOD / HELP
------------------------- */

.type-medication-help {
    display: none;
    max-width: 760px;
    margin-top: 6px;
}

.medication-info .medication-period-pill {
    margin-bottom: 12px;
}

.medication-info .timeline-info-grid dt {
    overflow-wrap: anywhere;
}


/* =========================================================
   TABLE FIX / PFLEGESTELLEN & GENERISCHE TABELLEN
   Optisch bessere Desktop-Tabelle + saubere Mobile Cards
========================================================= */

/* Desktop: Tabellen dürfen bei Bedarf horizontal scrollen,
   statt Inhalte/Buttons abzuschneiden. */
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

/* Desktop-Grundlayout */
.table-wrap table,
.table-wrap .table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    table-layout: auto;
}

.table-wrap th,
.table-wrap td {
    padding: 16px 18px;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.table-wrap th {
    white-space: nowrap;
}

/* Generische Tabellenbreiten für 7 Spalten wie Pflegestellen */
.table-wrap th:nth-child(1),
.table-wrap td:nth-child(1) {
    width: 20%;
}

.table-wrap th:nth-child(2),
.table-wrap td:nth-child(2) {
    width: 16%;
}

.table-wrap th:nth-child(3),
.table-wrap td:nth-child(3) {
    width: 12%;
}

.table-wrap th:nth-child(4),
.table-wrap td:nth-child(4) {
    width: 18%;
}

.table-wrap th:nth-child(5),
.table-wrap td:nth-child(5) {
    width: 16%;
}

.table-wrap th:nth-child(6),
.table-wrap td:nth-child(6) {
    width: 9%;
    white-space: nowrap;
}

.table-wrap th:nth-child(7),
.table-wrap td:nth-child(7) {
    width: 9%;
    min-width: 130px;
    text-align: right;
    white-space: nowrap;
}

/* Button in Aktion-Spalte nicht abschneiden */
.table-wrap td:last-child .btn,
.table-wrap td:last-child a.btn {
    width: auto;
    min-width: 118px;
    min-height: 38px;
    padding: 10px 15px;
    font-size: 13px;
    white-space: nowrap;
}

/* Tablet: Kartenlayout früher, aber kompakter und sauber */
@media (max-width: 1180px) {
    .table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .table-wrap table,
    .table-wrap .table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap th,
    .table-wrap td,
    .table-wrap tr {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .table-wrap thead {
        display: none;
    }

    .table-wrap tbody {
        display: grid;
        gap: 14px;
    }

    .table-wrap tr {
        padding: 18px;
        border: 1px solid var(--border);
        border-radius: 24px;
        background:
            radial-gradient(circle at 100% 0%, rgba(19, 184, 151, .06), transparent 34%),
            #fff;
        box-shadow: var(--shadow-soft);
    }

    .table-wrap th:nth-child(n),
    .table-wrap td:nth-child(n) {
        width: 100%;
        min-width: 0;
        text-align: left;
        white-space: normal;
    }

    .table-wrap td {
        display: grid;
        grid-template-columns: 180px minmax(0, 1fr);
        gap: 16px;
        align-items: center;
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
        font-size: 15px;
        line-height: 1.45;
    }

    .table-wrap td:first-child {
        padding-top: 0;
    }

    .table-wrap td:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .table-wrap td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 950;
        text-transform: uppercase;
        letter-spacing: .07em;
    }

    .table-wrap td[colspan]::before {
        display: none;
    }

    .table-wrap td:last-child {
        align-items: center;
    }

    .table-wrap td:last-child .btn,
    .table-wrap td:last-child a.btn {
        justify-self: start;
        width: auto;
        min-width: 150px;
    }
}

/* Mobile: Einspaltige Karten, keine gequetschten Labels */
@media (max-width: 680px) {
    .content,
    .cp-main {
        padding: 14px;
    }

    .card {
        padding: 18px;
    }

    .table-wrap tbody {
        gap: 12px;
    }

    .table-wrap tr {
        padding: 16px;
        border-radius: 22px;
    }

    .table-wrap td {
        grid-template-columns: 1fr;
        gap: 5px;
        align-items: start;
        padding: 11px 0;
    }

    .table-wrap td::before {
        font-size: 11px;
        letter-spacing: .08em;
    }

    .table-wrap td strong {
        font-size: 16px;
    }

    .table-wrap .badge,
    .table-wrap .status-badge {
        margin-top: 2px;
    }

    .table-wrap td:last-child .btn,
    .table-wrap td:last-child a.btn {
        justify-self: stretch;
        width: 100%;
        min-width: 0;
        margin-top: 4px;
    }
}

/* Sehr kleine Displays */
@media (max-width: 420px) {
    .table-wrap tr {
        padding: 14px;
    }

    .table-wrap td {
        font-size: 14px;
    }
}


/* =========================================================
   FINANCE DONATION PANEL / SPENDERDATEN
========================================================= */

.donation-panel {
    display: grid;
    gap: 18px;
    padding: 22px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at 100% 0%, rgba(19, 184, 151, .10), transparent 32%),
        var(--surface-soft);
}

.donation-panel[hidden] {
    display: none !important;
}

.donation-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.donation-panel-head h2 {
    margin: 0 0 5px;
    font-size: 23px;
    line-height: 1.1;
    letter-spacing: -.035em;
}

.donation-panel-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.donation-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 7px 12px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: rgba(184, 245, 232, .85);
    font-size: 13px;
    font-weight: 950;
}

.donor-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.donor-mode-card {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 12px;
    align-items: flex-start;
    min-height: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, .82);
    cursor: pointer;
}

.donor-mode-card input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 2px 0 0;
    accent-color: var(--primary);
}

.donor-mode-card strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
}

.donor-mode-card small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.donor-existing {
    display: grid;
    gap: 8px;
}

.donor-existing[hidden],
.donor-new[hidden] {
    display: none !important;
}

.donor-new {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.donation-checkbox {
    width: fit-content;
    min-height: 44px;
    padding: 0 14px;
    background: #fff;
}

.donation-hint {
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 680px) {
    .donation-panel {
        padding: 18px;
        border-radius: 22px;
    }

    .donation-panel-head,
    .donor-mode-grid,
    .donor-new {
        grid-template-columns: 1fr;
    }

    .donation-panel-head {
        display: grid;
    }

    .donation-pill,
    .donation-checkbox {
        width: 100%;
        justify-content: center;
    }
}
