/* Reset und Basis-Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --primary: #2154ff;
    --primary-strong: #1739b5;
    --accent: #19b37a;
    --danger: #d34c4c;
    --background: #eef2ff;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --surface-muted: #f5f7ff;
    --text: #0f172a;
    --text-muted: #5b6478;
    --border: rgba(15, 23, 42, 0.1);
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
    --shadow-strong: 0 24px 60px rgba(15, 23, 42, 0.18);
    --glow: rgba(33, 84, 255, 0.18);
    --header-bg: #2154ff;
    --page-bg: #eef2ff;
    --input-bg: rgba(255, 255, 255, 0.92);
    --input-border: rgba(15, 23, 42, 0.12);
    --input-focus: rgba(33, 84, 255, 0.28);
    --overlay: rgba(255, 255, 255, 0.42);
    --card-bg: rgba(255, 255, 255, 0.82);
    --card-hover: rgba(255, 255, 255, 0.96);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --primary: #7b9dff;
    --primary-strong: #9fb4ff;
    --accent: #43d39e;
    --danger: #f06b6b;
    --background: #07111f;
    --surface: #0c1426;
    --surface-strong: #0c1426;
    --surface-muted: #101b33;
    --text: #e7edf9;
    --text-muted: #a7b0c2;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
    --shadow-strong: 0 24px 70px rgba(0, 0, 0, 0.45);
    --glow: rgba(123, 157, 255, 0.18);
    --header-bg: #0c1426;
    --page-bg: #07111f;
    --input-bg: rgba(9, 15, 28, 0.94);
    --input-border: rgba(255, 255, 255, 0.08);
    --input-focus: rgba(123, 157, 255, 0.3);
    --overlay: rgba(8, 12, 20, 0.4);
    --card-bg: rgba(11, 19, 36, 0.82);
    --card-hover: rgba(14, 24, 45, 0.95);
}

html {
    min-height: 100%;
    background: var(--page-bg);
}

body {
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: transparent;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: none;
}

button,
input {
    font: inherit;
}

button {
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--surface);
}

.login-box {
    width: 100%;
    max-width: 460px;
    padding: 40px;
    border-radius: 28px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    display: block;
    width: min(240px, 100%);
    height: auto;
    margin: 0 auto;
}

.logo-shell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.login-logo-shell {
    width: min(320px, 100%);
    margin: 0 auto 20px;
    padding: 14px 18px;
}

.login-header h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    color: var(--text);
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#loginStep1,
#loginStepEnroll,
#loginStepVerify {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--input-border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus);
}

.form-group small {
    color: var(--text-muted);
    font-size: 12px;
}

.form-inline-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.form-inline-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 2;
}

.form-inline-item--small {
    flex: 1;
}

.btn-primary,
.btn-outline,
.btn-secondary,
.btn-menu,
.btn-theme-toggle,
.dropdown-item,
.tiles-modal-close,
.card-hide-btn {
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 13px 18px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 30px var(--glow);
}

.btn-primary:hover {
    box-shadow: 0 16px 36px rgba(33, 84, 255, 0.28);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(33, 84, 255, 0.35);
    padding: 11px 18px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-outline:hover {
    background: rgba(33, 84, 255, 0.08);
}

.error-message {
    background: rgba(211, 76, 76, 0.12);
    color: var(--danger);
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    text-align: center;
    border: 1px solid rgba(211, 76, 76, 0.2);
}

/* Dashboard */
.dashboard-container {
    min-height: 100vh;
    position: relative;
    z-index: 0;
}

.dashboard-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 28px;
    background: var(--header-bg);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow);
}

.header-content h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

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

.header-logo {
    display: block;
    width: 108px;
    height: auto;
    flex: 0 0 auto;
}

.header-logo-shell {
    padding: 10px 14px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.subtitle {
    font-size: 13px;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.btn-theme-toggle,
.btn-menu {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: white;
    background: rgba(255, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
}

.header-profile-icon {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.header-profile-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 130px;
    font-size: 14px;
    font-weight: 500;
    min-width: 0;
    flex-shrink: 1;
}

.menu-chevron {
    font-size: 12px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.8;
}

.btn-theme-toggle {
    order: 1;
    min-width: 110px;
    justify-content: center;
    box-shadow: none;
}

.btn-theme-toggle .theme-icon {
    font-size: 15px;
    line-height: 1;
}

.btn-theme-toggle:hover,
.btn-menu:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-theme-toggle.is-dark {
    box-shadow: none;
}

.menu-wrapper {
    position: relative;
    order: 2;
    min-width: 0;
    flex-shrink: 1;
}

.btn-menu {
    padding: 8px 12px;
    max-width: 220px;
    min-width: 0;
    flex-shrink: 1;
    gap: 6px;
    overflow: hidden;
}

.btn-menu.active {
    background: rgba(255, 255, 255, 0.22);
}

.dashboard-main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px;
}

.edit-mode-bar {
    display: none;
    justify-content: center;
    padding: 20px 0 8px;
}

.edit-mode-bar .btn-primary {
    padding: 12px 36px;
    font-size: 15px;
    border-radius: 999px;
    box-shadow: var(--shadow);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 22px;
    margin-top: 12px;
}

.service-card {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    padding: 28px;
    background: var(--header-bg);
    border: 1px solid color-mix(in srgb, var(--header-bg) 78%, white);
    box-shadow: var(--shadow);
    cursor: pointer;
    color: white;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.service-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.service-card:hover {
    transform: translateY(-4px);
    background: var(--header-bg);
    box-shadow: var(--shadow-strong);
    border-color: rgba(255, 255, 255, 0.35);
}

.service-card.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(40%);
}

.service-card.disabled:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.service-card.disabled .service-name {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}

.service-icon {
    position: relative;
    display: block;
    width: max-content;
    margin: 0 auto 20px;
    font-size: 48px;
    line-height: 1;
}

.service-name {
    position: relative;
    z-index: 1;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    text-align: center;
}

.service-description {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    line-height: 1.55;
    text-align: center;
}

.service-card.disabled::after {
    content: attr(data-disabled-message);
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.70);
    color: white;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}

/* Modals */
.tiles-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--overlay);
}

.tiles-modal-content {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-strong);
    overflow: hidden;
}

.tiles-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid var(--border);
}

.tiles-modal-header h2 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.tiles-modal-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.tiles-modal-close:hover {
    background: rgba(33, 84, 255, 0.12);
    color: var(--primary);
}

/* Tiles Modal */
.tiles-modal-content {
    max-width: 560px;
}

.tiles-modal-body {
    padding: 18px 22px;
}

.tiles-modal-hint {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 14px;
}


.tiles-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
}

.absence-modal-content {
    max-width: 760px;
}

.absence-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

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

.absence-form select,
.absence-form textarea {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--input-border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text);
    resize: vertical;
}

.absence-form select:focus,
.absence-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus);
}

.absence-status {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    border: 1px solid transparent;
}

.absence-status.is-success {
    background: rgba(25, 179, 122, 0.12);
    color: #137a53;
    border-color: rgba(25, 179, 122, 0.22);
}

.absence-status.is-error {
    background: rgba(211, 76, 76, 0.12);
    color: var(--danger);
    border-color: rgba(211, 76, 76, 0.2);
}

.absence-modal-footer {
    padding: 0;
    border-top: none;
}

.attachment-add-btn {
    align-self: flex-start;
}

.attachment-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-muted);
    font-size: 14px;
}

.attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.attachment-remove {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(211, 76, 76, 0.12);
    color: var(--danger);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.attachment-remove:hover {
    background: rgba(211, 76, 76, 0.22);
}

.form-hint {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-muted);
}

.form-required-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -10px;
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 230px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-strong);
    z-index: 500;
}

.dropdown-item {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.dropdown-item:hover {
    background: rgba(33, 84, 255, 0.08);
    color: var(--primary);
}

.dropdown-item.active {
    background: rgba(33, 84, 255, 0.12);
    color: var(--primary);
}

.dropdown-color-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.color-palette-compact {
    gap: 7px;
}

.color-swatch {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    background: var(--swatch-color);
    box-shadow: 0 0 0 1px var(--border), 0 6px 14px rgba(15, 23, 42, 0.12);
    cursor: pointer;
}

.color-swatch:hover,
.color-swatch.is-selected {
    outline: 3px solid color-mix(in srgb, var(--swatch-color) 35%, transparent);
    transform: translateY(-1px);
}

.dropdown-mini-btn {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.dropdown-mini-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.dropdown-danger {
    color: var(--danger);
}

.dropdown-danger:hover {
    background: rgba(211, 76, 76, 0.1);
    color: var(--danger);
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

/* Edit Mode */
.services-grid.edit-mode {
    outline: 2px dashed rgba(33, 84, 255, 0.34);
    outline-offset: 8px;
    border-radius: 24px;
}

.services-grid.edit-mode .service-card {
    cursor: grab;
}

.services-grid.edit-mode .service-card:active {
    cursor: grabbing;
}

.services-grid.edit-mode .service-card[data-locked="true"] {
    cursor: default;
}

.card-edit-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    z-index: 10;
}

.card-hide-btn,
.card-lock-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card-hide-btn {
    border: none;
    background: var(--danger);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(211, 76, 76, 0.25);
}

.card-hide-btn:hover {
    background: #b93d3d;
}

.card-lock-icon {
    background: rgba(255, 255, 255, 0.16);
    color: var(--text);
    font-size: 14px;
}

/* Drag & Drop */
.service-card.dragging {
    opacity: 0.45;
    transform: scale(0.98);
    box-shadow: none;
}

.service-card.drag-over {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 900px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 18px 24px;
    }

    .header-brand {
        width: 100%;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .login-box {
        padding: 28px 20px;
        border-radius: 22px;
    }

    .login-logo {
        width: min(220px, 100%);
    }

    .login-logo-shell {
        width: min(280px, 100%);
        padding: 12px 14px;
    }

    .dashboard-main {
        padding: 18px;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

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

    .tiles-modal-header,
    .tiles-modal-body,
    .tiles-modal-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .tiles-modal-footer {
        flex-direction: column-reverse;
    }

    .tiles-modal-footer .btn-primary,
    .tiles-modal-footer .btn-outline {
        width: 100%;
    }

    .header-profile-name {
        display: none;
    }

    .btn-menu {
        padding: 8px 10px;
    }

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

    .btn-theme-toggle {
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .login-container {
        padding: 16px;
    }

    .dashboard-header {
        padding: 16px;
    }

    .header-actions {
        gap: 8px;
    }

    .btn-theme-toggle .theme-label {
        display: none;
    }

    .btn-theme-toggle {
        width: 42px;
        padding: 0;
        justify-content: center;
    }

    .header-logo {
        width: 96px;
    }

    .header-logo-shell {
        padding: 8px 12px;
    }

}

/* ─── Admin-Port-Login ───────────────────────────────────────────────────────── */

#adminLoginForm {
    align-items: center;
}

#adminLoginForm .form-group,
#adminLoginForm button {
    width: 100%;
}

#adminLoginForm button[type="submit"] {
    margin-top: 10px;
}

/* ── TOTP Enrollment / Verify Steps ─────────────────────────────────────── */

.totp-step-header {
    text-align: center;
    margin-bottom: 20px;
}

.totp-step-icon {
    font-size: 36px;
    line-height: 1;
    margin-bottom: 10px;
}

.totp-step-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text);
}

.totp-step-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.totp-enroll-qr {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

.totp-enroll-qr img {
    width: 200px;
    height: 200px;
    border-radius: 10px;
    border: 3px solid var(--border);
    background: #fff;
    display: block;
}

.totp-secret-details {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.totp-secret-details summary {
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.totp-secret-code {
    display: block;
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
    letter-spacing: 0.05em;
    color: var(--text);
}

.totp-verify-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.totp-verify-actions .btn-outline {
    flex: 0 0 auto;
}

.totp-verify-actions .btn-primary {
    flex: 1;
}

.admin-login-badge {
    display: block;
    width: fit-content;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 20px;
    margin: 0 auto 8px;
}

.admin-login-hint {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 8px;
}

.admin-2fa-choice {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.admin-2fa-choice-btn {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    font-size: 15px;
}

/* ─── Admin-Panel Modal ──────────────────────────────────────────────────────── */

.admin-modal-content {
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.admin-modal-body {
    overflow-y: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
}

.admin-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.01em;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-services-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-service-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.admin-service-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-service-icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.admin-service-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.admin-service-meta strong,
.admin-service-meta em,
.admin-service-meta small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-service-meta em {
    color: var(--text-muted);
    font-size: 11px;
    font-style: normal;
}

.admin-service-meta small {
    color: var(--text-muted);
    font-size: 12px;
}

.admin-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    display: block;
    margin-bottom: 6px;
}

.admin-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.admin-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.admin-optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

.admin-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.admin-radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.admin-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}

.admin-radio-label input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
}

.admin-select {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--input-border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    appearance: auto;
}

.admin-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus);
}

.admin-server-grid {
    grid-template-columns: 1fr 120px;
}

.admin-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
}

.admin-test-btn {
    min-width: 160px;
}

.ldap-basedn-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.ldap-basedn-row input {
    flex: 1;
    padding: 10px 13px;
    border: 1px solid var(--input-border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 14px;
}

.ldap-basedn-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus);
}

.ldap-basedn-remove {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 6px 10px;
    transition: color 0.15s, border-color 0.15s;
}

.ldap-basedn-remove:hover {
    color: #e05c5c;
    border-color: #e05c5c;
}

.ldap-basedn-add-btn {
    margin-top: 4px;
    font-size: 13px;
    padding: 7px 16px;
}

.admin-test-result {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.admin-test-result.is-success {
    background: rgba(25, 179, 122, 0.12);
    color: #137a53;
    border-color: rgba(25, 179, 122, 0.22);
}

.admin-test-result.is-error {
    background: rgba(211, 76, 76, 0.12);
    color: var(--danger);
    border-color: rgba(211, 76, 76, 0.2);
}

.testuser-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.testuser-list:empty,
.testuser-list.is-empty {
    display: none;
}

.testuser-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    font-size: 14px;
}

.testuser-row:last-child {
    border-bottom: none;
}

.testuser-row:first-child {
    background: var(--surface-muted);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 16px;
}

.locked-tile-row:first-child {
    background: var(--surface);
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    padding: 11px 16px;
}

.testuser-name {
    font-weight: 600;
    color: var(--text);
}

.testuser-pw {
    font-family: monospace;
    color: var(--text-muted);
    font-size: 13px;
}

.testuser-delete {
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.testuser-delete:hover {
    background: rgba(211, 76, 76, 0.08);
    border-color: rgba(211, 76, 76, 0.25);
}

.testuser-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ─── Admin-Port-Modus: Admin-Panel als Seiteninhalt ────────────────────────── */

body.admin-port-mode .dashboard-container {
    min-height: auto;
}

body.admin-port-mode #adminModal {
    position: static;
    background: none;
    padding: 0;
    display: block !important;
    overflow-y: visible;
    align-items: unset;
    justify-content: unset;
    z-index: auto;
    inset: auto;
}

body.admin-port-mode #adminModal .tiles-modal-content {
    max-width: 800px;
    width: 100%;
    margin: 12px auto 24px;
    border-radius: var(--radius);
    max-height: none;
    box-shadow: var(--shadow-lg);
    height: auto;
}

body.admin-port-mode #adminModal .tiles-modal-body {
    max-height: none;
    overflow-y: visible;
    height: auto;
}

@media (max-width: 768px) {
    .admin-modal-content {
        max-width: 100%;
        max-height: 95vh;
    }

    .admin-server-grid {
        grid-template-columns: 1fr;
    }

    .admin-form-actions {
        flex-direction: column-reverse;
    }

    .admin-form-actions .btn-primary,
    .admin-form-actions .btn-outline {
        width: 100%;
    }

    .testuser-row {
        grid-template-columns: 1fr auto;
    }

    .testuser-pw {
        display: none;
    }
}
