:root {
    --navy: #14213d;
    --navy-light: #1f3158;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --background: #f1f5f9;
    --card: #ffffff;
    --text: #10213d;
    --muted: #64748b;
    --border: #dbe3ee;
    --green: #16a34a;
    --red: #dc2626;
    --orange: #d97706;
    --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
}

a {
    color: var(--blue);
}

button,
input {
    font: inherit;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.28), transparent 32%),
        linear-gradient(145deg, #0b1731, #1e3a69);
}

.login-shell {
    width: 100%;
    max-width: 460px;
}

.login-card {
    padding: 38px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.login-brand,
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-brand h1,
.login-brand p,
.login-heading h2,
.login-heading p {
    margin: 0;
}

.login-brand p,
.login-heading p {
    color: var(--muted);
}

.brand-symbol {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 16px;
    color: white;
    background: linear-gradient(135deg, var(--blue), #60a5fa);
    font-weight: 800;
    letter-spacing: -1px;
}

.brand-symbol-small {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 13px;
}

.login-heading {
    margin: 34px 0 24px;
}

.login-heading h2 {
    margin-bottom: 7px;
    font-size: 28px;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    margin-top: 8px;
    font-weight: 650;
}

.login-form input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    background: white;
    outline: none;
}

.login-form input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.login-footer {
    margin-top: 28px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.button-primary {
    color: white;
    background: var(--blue);
}

.button-primary:hover {
    background: var(--blue-dark);
}

.button-secondary {
    color: var(--text);
    background: #e7edf6;
}

.button-danger {
    color: white;
    background: var(--red);
}

.button-wide {
    width: 100%;
    margin-top: 14px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 12px max(22px, calc((100vw - 1240px) / 2));
    color: white;
    background: var(--navy);
}

.topbar-brand {
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 800;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-actions form {
    margin: 0;
}

.current-user {
    color: #cbd5e1;
}

.page {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    padding: 38px 0 54px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.hero h1 {
    margin: 4px 0 8px;
    font-size: clamp(30px, 5vw, 46px);
}

.hero p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--blue) !important;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 220px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.service-card,
.table-card,
.empty-state {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.service-card {
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.service-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.service-icon {
    display: inline-grid;
    place-items: center;
    min-width: 54px;
    height: 42px;
    padding: 0 10px;
    border-radius: 11px;
    color: white;
    background: linear-gradient(135deg, var(--blue), #60a5fa);
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 0.04em;
}

.service-card h2 {
    margin: 22px 0 8px;
}

.service-card p {
    min-height: 48px;
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.service-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 22px 0 14px;
}

.service-details div {
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
}

.service-details dt {
    color: var(--muted);
    font-size: 12px;
}

.service-details dd {
    margin: 4px 0 0;
    font-weight: 750;
}

.service-checked {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 750;
}

.status-online {
    color: #166534;
    background: #dcfce7;
}

.status-offline {
    color: #991b1b;
    background: #fee2e2;
}

.status-unknown {
    color: #92400e;
    background: #fef3c7;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.status-online {
    background: var(--green);
}

.status-dot.status-offline {
    background: var(--red);
}

.status-dot.status-unknown {
    background: var(--orange);
}

.alert {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 10px;
}

.alert-error {
    color: #991b1b;
    background: #fee2e2;
}

.alert-success {
    color: #166534;
    background: #dcfce7;
}

.admin-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.table-card {
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    background: #f8fafc;
    font-size: 12px;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.empty-state {
    padding: 48px;
    color: var(--muted);
    text-align: center;
}

.site-footer {
    padding: 24px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

@media (max-width: 760px) {
    .topbar,
    .hero {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    .summary-card {
        min-width: 0;
    }

    .login-card {
        padding: 26px;
    }
}


.form-card {
    margin-bottom: 24px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.form-card h2 {
    margin-top: 0;
}

.admin-form {
    display: grid;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.field {
    display: grid;
    gap: 7px;
}

.field-wide {
    grid-column: 1 / -1;
}

.field label {
    font-weight: 700;
}

.field input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
}

.field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.checkbox-row,
.form-actions,
.action-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 7px;
}

.action-row form {
    margin: 0;
}

.button-small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.admin-toolbar {
    gap: 12px;
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .field-wide {
        grid-column: auto;
    }
}

.field select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    background: white;
    outline: none;
}

.service-selection {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.service-selection legend {
    padding: 0 8px;
    font-weight: 750;
}

.service-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.service-checkboxes label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

/* Altes TK-Portal-Design mit neuer Portaltechnik */

.legacy-portal {
    background: #f4f7fb;
}

.legacy-header {
    color: white;
    background: #22304a;
    box-shadow: 0 5px 20px rgba(15, 23, 42, 0.16);
}

.legacy-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1400px, calc(100% - 40px));
    min-height: 116px;
    margin: 0 auto;
    gap: 24px;
}

.legacy-title {
    display: flex;
    align-items: center;
    gap: 18px;
}

.legacy-title h1,
.legacy-title p {
    margin: 0;
}

.legacy-title h1 {
    font-size: clamp(25px, 4vw, 38px);
}

.legacy-title p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
    color: #86efac;
    font-weight: 750;
}

.legacy-rocket {
    font-size: 42px;
}

.portal-online-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.legacy-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.legacy-actions form {
    margin: 0;
}

.legacy-user {
    color: #dbeafe;
}

.button-light {
    color: #14213d;
    background: #f8fafc;
}

.legacy-container {
    width: min(1400px, calc(100% - 40px));
    margin: 0 auto;
    padding: 30px 0 50px;
}

.legacy-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.legacy-welcome h2 {
    margin: 4px 0 7px;
    font-size: clamp(28px, 4vw, 40px);
}

.legacy-welcome p {
    margin: 0;
    color: var(--muted);
}

.legacy-summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
    box-shadow: var(--shadow);
}

.legacy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 20px;
}

.legacy-card {
    display: flex;
    flex-direction: column;
    min-height: 300px;
    padding: 25px;
    border: 1px solid rgba(219, 227, 238, 0.86);
    border-radius: 18px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition:
        transform 160ms ease,
        box-shadow 160ms ease;
}

.legacy-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.legacy-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.legacy-card-icon {
    display: inline-grid;
    place-items: center;
    min-width: 54px;
    height: 42px;
    padding: 0 10px;
    border-radius: 11px;
    color: white;
    background: linear-gradient(135deg, #22304a, #3b82f6);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0.04em;
}

.legacy-card h3 {
    margin: 22px 0 8px;
    font-size: 24px;
}

.legacy-description {
    min-height: 48px;
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.legacy-version {
    margin: 10px 0 0;
    font-weight: 750;
}

.legacy-technical {
    display: flex;
    flex-wrap: wrap;
    gap: 9px 16px;
    margin-top: auto;
    padding-top: 20px;
    color: var(--muted);
    font-size: 13px;
}

.legacy-card > .button {
    align-self: flex-start;
    margin-top: 14px;
}

.legacy-planned-note {
    margin-top: auto;
    padding-top: 22px;
    color: var(--muted);
    font-size: 14px;
}

.system-information {
    display: grid;
    gap: 13px;
    margin: 18px 0 0;
}

.system-information div {
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
}

.system-information dt {
    color: var(--muted);
    font-size: 12px;
}

.system-information dd {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    font-weight: 720;
}

.legacy-footer {
    display: grid;
    gap: 7px;
    padding: 30px;
    color: #64748b;
    text-align: center;
    font-size: 13px;
}

@media (max-width: 820px) {
    .legacy-header-inner,
    .legacy-welcome {
        align-items: stretch;
        flex-direction: column;
    }

    .legacy-header-inner {
        padding: 22px 0;
    }

    .legacy-summary {
        width: 100%;
    }
}

.sortable-header {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.sortable-header:hover {
    color: var(--blue);
}

.sort-arrow {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    border-radius: 6px;
    color: var(--blue);
    background: #e8efff;
    font-size: 12px;
    font-weight: 900;
}

.login-indicator {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    margin-top: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
}

.login-yes {
    color: #92400e;
    background: #fef3c7;
}

.login-no {
    color: #166534;
    background: #dcfce7;
}

.login-unknown {
    color: #475569;
    background: #e2e8f0;
}

.update-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.update-details {
    display: grid;
    gap: 12px;
    margin: 20px 0;
}

.update-details div {
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
}

.update-details dt {
    color: var(--muted);
    font-size: 12px;
}

.update-details dd {
    margin: 5px 0 0;
    overflow-wrap: anywhere;
    font-weight: 750;
}

.update-state {
    margin-top: 20px;
    padding: 16px;
    border-radius: 11px;
    font-weight: 750;
}

.update-state-neutral {
    color: #475569;
    background: #e2e8f0;
}

.update-state-current {
    color: #166534;
    background: #dcfce7;
}

.update-state-available {
    color: #92400e;
    background: #fef3c7;
}

.update-manifest {
    margin-top: 22px;
    padding: 24px;
}

.hash-value {
    font-family: Consolas, monospace;
    font-size: 12px;
}

.update-log {
    max-width: 700px;
    max-height: 320px;
    margin-top: 12px;
    padding: 14px;
    overflow: auto;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.table-scroll {
    overflow-x: auto;
}

details summary {
    margin-top: 8px;
    cursor: pointer;
    color: #2563eb;
}
