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

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #f4f5fb 0%, #eef2ff 100%);
    color: #0f172a;
    font-size: 16px;
}

a {
    color: inherit;
}

/* HEADER + NAV */

.tp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: #0f172a;
    color: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 20;
}

.tp-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-logo {
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    font-size: 16px;
}
.tp-logo span {
    font-weight: 400;
    opacity: .85;
}

.tp-nav-toggle {
    display: none;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,.8);
    background: #020617;
    color: #e5e7eb;
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
}

.tp-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tp-nav-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.tp-nav-links a {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 999px;
    transition: background .15s ease, color .15s ease;
}
.tp-nav-links a:hover {
    background: rgba(249, 250, 251, 0.12);
    color: #ffffff;
}

.tp-tenant-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tp-tenant-switcher form {
    margin: 0;
}

.tp-tenant-select {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.9);
    padding: 6px 12px;
    font-size: 13px;
    background: #111827;
    color: #e5e7eb;
}

/* MAIN LAYOUT */

.tp-main {
    padding: 24px 16px 40px;
    margin: 0 auto;
    width: 100%;
}

/* CARDS */

.tp-cards {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.tp-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .12);
    flex: 1 1 260px;
}
.tp-card h2 {
    margin: 0 0 6px;
    font-size: 18px;
}
.tp-card p {
    margin: 0;
    color: #4b5563;
    font-size: 15px;
}

/* BOX SECTION */

.tp-section-card {
    margin-top: 24px;
    background: #ffffff;
    border-radius: 16px;
    padding: 18px 20px 22px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .10);
}
.tp-section-card h1 {
    margin: 0 0 10px;
    font-size: 22px;
}
.tp-section-card h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

/* FORM */

.tp-form-inner h2 {
    margin-top: 20px;
    font-size: 18px;
}

.tp-form-inner label {
    display: block;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 500;
}

.tp-form-inner input[type="file"],
.tp-form-inner select,
.tp-form-inner input[type="text"],
.tp-form-inner input[type="number"],
.tp-form-inner input[type="password"],
.tp-form-inner textarea {
    margin-top: 6px;
    font-size: 15px;
    width: 100%;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.tp-form-inner textarea {
    min-height: 90px;
    resize: vertical;
}

.tp-form-inner input:focus,
.tp-form-inner select:focus,
.tp-form-inner textarea:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79,70,229,.45);
    background: #ffffff;
}

/* BUTTONS */

.tp-primary-btn {
    display: inline-block;
    margin-top: 18px;
    padding: 10px 20px;
    border-radius: 999px;
    border: none;
    font-size: 15px;
    cursor: pointer;
    background: #4f46e5;
    color: #f9fafb;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(79,70,229,.4);
    transition: transform .1s ease, box-shadow .1s ease, background .1s ease;
}
.tp-primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(79,70,229,.5);
    background: #4338ca;
}
.tp-primary-btn:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(79,70,229,.4);
}

.tp-expand-btn {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    padding: 2px 10px;
    cursor: pointer;
    font-size: 13px;
    margin-right: 6px;
}
.tp-expand-btn:hover {
    background: #f3f4f6;
}

/* Kleine Action-Buttons (Edit / Delete) */

.tp-action-btn {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    padding: 2px 10px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 6px;
    text-decoration: none;
    display: inline-block;
}
.tp-action-btn:hover {
    background: #f3f4f6;
}
.tp-action-btn--danger {
    border-color: #fecaca;
    color: #b91c1c;
}
.tp-action-btn--danger:hover {
    background: #fef2f2;
}

/* ALERT */

.tp-alert {
    margin-bottom: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 14px;
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* TABLES */

.tp-table-wrapper {
    margin-top: 12px;
    width: 100%;
    overflow-x: auto;
}

.tp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 680px;
}
.tp-table th,
.tp-table td {
    padding: 10px 0px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}
.tp-table th {
    background: #f3f4f6;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
}
.tp-table tr:hover td {
    background: #f9fafb;
}

/* CHECKBOX */

.tp-checkbox {
    width: 16px;
    height: 16px;
}

/* MODAL */

.tp-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 40;
}
.tp-modal {
    background: #ffffff;
    border-radius: 18px;
    max-width: 720px;
    width: 100%;
    box-shadow: 0 22px 45px rgba(15,23,42,.45);
    padding: 20px 22px 22px;
}
.tp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.tp-modal-title {
    font-size: 18px;
    font-weight: 600;
}
.tp-modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: #6b7280;
}

/* Modal form layout */

.tp-modal-form label {
    display: block;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 500;
}

.tp-modal-form input[type="file"],
.tp-modal-form input[type="text"],
.tp-modal-form input[type="number"],
.tp-modal-form select,
.tp-modal-form textarea {
    margin-top: 6px;
    font-size: 15px;
    width: 100%;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.tp-modal-form textarea {
    min-height: 90px;
    resize: vertical;
}

.tp-modal-form input:focus,
.tp-modal-form select:focus,
.tp-modal-form textarea:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79,70,229,.45);
    background: #ffffff;
}

.tp-modal-form button {
    margin-top: 18px;
}

/* Two-column grid for modal forms on desktop */

@media (min-width: 768px) {
    .tp-modal-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px 16px;
    }
    .tp-modal-grid-2 label {
        margin-top: 0;
    }
}

/* RESPONSIVE NAV */

@media (max-width: 768px) {
    .tp-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .tp-nav-toggle {
        display: inline-block;
    }

    .tp-nav {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .tp-nav-links {
        flex-direction: column;
        width: 100%;
        display: none;
    }

    .tp-nav.tp-nav-open .tp-nav-links {
        display: flex;
    }

    .tp-nav-links a {
        width: 100%;
        padding: 8px 6px;
    }

    .tp-main {
        padding: 18px 10px 30px;
    }

    .tp-table {
        min-width: 0;
        font-size: 12px;
    }
}


/* letzte Spalte in Tabellen rechtsbündig */
.tp-table th:last-child,
.tp-table td:last-child {
    text-align: right;
}


/* Zugangscode-Eingabefelder (Login-PIN) */
.tp-code-input {
    width: 64px;
    height: 64px;
    font-size: 28px;
    text-align: center;
    border-radius: 20px;
    border: 2px solid #d1d5db;
    outline: none;
    background: #f9fafb;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.tp-code-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(129,140,248,.25);
    background: #ffffff;
}
@media (max-width: 480px) {
    .tp-code-input {
        width: 56px;
        height: 56px;
        font-size: 24px;
        border-radius: 16px;
    }
}


/* Spezieller Layer für Zugangscode-Login mit Blur */
.tp-modal-backdrop--lock {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(15,23,42,0.65);
}


/* Mandanten-Badge */
.tp-tenant-pill {
    display: inline-block;
    margin: 4px 0 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    background: #f9fafb;
    color: #4b5563;
}

/* 2-Spalten Layout in Settings */
.tp-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 16px;
}
.tp-form-grid label {
    margin-top: 12px;
}


/* Sekundärer Button (z.B. Info) */
.tp-secondary-btn {
    display: inline-block;
    margin-top: 0;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.9);
    background: #f9fafb;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tp-secondary-btn:hover {
    background: #e5e7eb;
    border-color: rgba(148,163,184,1);
    box-shadow: 0 4px 12px rgba(15,23,42,.08);
}
.tp-secondary-btn:active {
    box-shadow: none;
    transform: translateY(1px);
}
