* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1d23;
    color: #d8dde5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.topbar {
    background: #232830;
    border-bottom: 1px solid #3a3f48;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.brand strong {
    font-size: 1.5rem;
    color: #4a9eff;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.brand .tagline {
    color: #6b7280;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.nav a {
    color: #b0b8c4;
    text-decoration: none;
    margin-left: 0.5rem;
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.nav a:hover {
    background: #2c3138;
    color: #fff;
}

.content {
    flex: 1;
    padding: 2.5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.content h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: #fff;
    font-weight: 600;
}

.content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #4a9eff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.lead {
    color: #b0b8c4;
    margin-bottom: 2rem;
}

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

.card {
    background: #232830;
    border: 1px solid #3a3f48;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.ok  { background: #1e3a2e; color: #4ade80; }
.badge.err { background: #3a1e1e; color: #f87171; }

.small { font-size: 0.8rem; color: #6b7280; margin-top: 0.5rem; }

code { background: #1a1d23; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.9em; }

.bottombar {
    background: #232830;
    border-top: 1px solid #3a3f48;
    padding: 1rem 2rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
}

/* ============================================================
   Auth (Login)
============================================================ */

.auth-body {
    background: #1a1d23;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: #232830;
    border: 1px solid #3a3f48;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-brand strong {
    font-size: 1.75rem;
    color: #4a9eff;
    letter-spacing: -0.02em;
}

.auth-brand .tagline {
    display: block;
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.auth-card h2 {
    text-align: center;
    color: #fff;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-card label {
    font-size: 0.85rem;
    color: #b0b8c4;
    margin-bottom: -0.5rem;
}

.auth-card input[type="email"],
.auth-card input[type="password"] {
    background: #1a1d23;
    border: 1px solid #3a3f48;
    color: #e0e6ed;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.auth-card input:focus {
    outline: none;
    border-color: #4a9eff;
}

.auth-card button {
    background: #4a9eff;
    color: #fff;
    border: none;
    padding: 0.85rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.15s;
}

.auth-card button:hover {
    background: #2563eb;
}

.error-box {
    background: #3a1e1e;
    color: #fca5a5;
    border: 1px solid #7f1d1d;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ============================================================
   Topbar User-Menu
============================================================ */

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-left: auto;
}

.user-email {
    color: #b0b8c4;
    font-size: 0.85rem;
}

.logout-link {
    color: #b0b8c4;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #3a3f48;
    transition: background 0.15s, color 0.15s;
}

.logout-link:hover {
    background: #3a1e1e;
    color: #fca5a5;
    border-color: #7f1d1d;
}

/* ============================================================
   Dashboard Status-Elemente
============================================================ */

.stat-line {
    color: #d8dde5;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.stat-line strong {
    color: #fff;
    font-size: 1.1rem;
}

.bar {
    background: #1a1d23;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.bar-fill {
    background: #4a9eff;
    height: 100%;
    transition: width 0.3s;
}

.bar-fill.warn {
    background: #f59e0b;
}

.load-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.25rem;
}

.load-row > div {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    background: #1a1d23;
    border-radius: 6px;
}

.load-row strong {
    display: block;
    color: #fff;
    font-size: 1.25rem;
}

.load-row .small {
    display: block;
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.service-list {
    list-style: none;
    margin-top: 0.5rem;
}

.service-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #2c3138;
    font-size: 0.9rem;
}

.service-list li:last-child {
    border-bottom: none;
}

.badge.warn {
    background: #3a2e1e;
    color: #fbbf24;
}

/* ============================================================
   User-Menu: email als Link
============================================================ */

.user-email {
    color: #b0b8c4;
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.user-email:hover {
    background: #2c3138;
    color: #fff;
}

/* ============================================================
   Form-Card (Profile, kuenftig auch andere Formulare)
============================================================ */

.form-card {
    background: #232830;
    border: 1px solid #3a3f48;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    margin-top: 1rem;
}

.form-card h3 {
    margin-bottom: 1rem;
}

.form-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-card label {
    font-size: 0.85rem;
    color: #b0b8c4;
    margin-bottom: -0.5rem;
}

.form-card input[type="password"],
.form-card input[type="email"],
.form-card input[type="text"] {
    background: #1a1d23;
    border: 1px solid #3a3f48;
    color: #e0e6ed;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-card input:focus {
    outline: none;
    border-color: #4a9eff;
}

.form-card button {
    background: #4a9eff;
    color: #fff;
    border: none;
    padding: 0.85rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.15s;
}

.form-card button:hover {
    background: #2563eb;
}

.form-card .small {
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: -0.5rem;
}

.success-box {
    background: #1e3a2e;
    color: #86efac;
    border: 1px solid #14532d;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ============================================================
   Datentabellen, Buttons, Toolbar
============================================================ */

.toolbar {
    margin: 1.5rem 0 1rem;
    display: flex;
    gap: 0.75rem;
}

.btn-primary, .btn-small, .btn-danger, .btn-cancel {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #3a3f48;
    background: #2c3138;
    color: #d8dde5;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.btn-small {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: #4a9eff;
    color: #fff;
    border-color: #4a9eff;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-danger {
    background: #3a1e1e;
    color: #fca5a5;
    border-color: #7f1d1d;
}

.btn-danger:hover {
    background: #7f1d1d;
    color: #fff;
}

.btn-cancel {
    background: transparent;
    color: #9ca3af;
}

.btn-cancel:hover {
    color: #fff;
    background: #2c3138;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: #232830;
    border: 1px solid #3a3f48;
    border-radius: 8px;
    overflow: hidden;
}

.data-table thead {
    background: #1a1d23;
}

.data-table th {
    text-align: left;
    padding: 0.85rem 1rem;
    color: #9ca3af;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #3a3f48;
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #2c3138;
    vertical-align: top;
    font-size: 0.9rem;
}

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

.data-table tr:hover {
    background: #2c3138;
}

.data-table code {
    color: #4a9eff;
    background: #1a1d23;
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

.data-table .actions form {
    display: inline;
    margin: 0;
}

.err-text {
    color: #fca5a5;
}

.empty-state {
    background: #232830;
    border: 1px dashed #3a3f48;
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    color: #9ca3af;
    margin-top: 1rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #d8dde5;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.checkbox-row input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #4a9eff;
}

.form-card {
    max-width: 600px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    align-items: center;
}

/* ============================================================
   Form: select (MySQL-User grant_db)
============================================================ */

.form-card select {
    background: #1a1d23;
    border: 1px solid #3a3f48;
    color: #e0e6ed;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-card select:focus {
    outline: none;
    border-color: #4a9eff;
}
