/*
 * Handgeschriebenes, schlankes Utility/Komponenten-CSS (kein Build-Tool noetig).
 * Bewusst statt Tailwind gewaehlt, damit auf dem all-inkl-Server kein Node/npm
 * verfuegbar sein muss -- diese Datei wird 1:1 hochgeladen und funktioniert direkt.
 */

:root {
    --color-bg: #f4f6f8;
    --color-surface: #ffffff;
    --color-border: #dde2e7;
    --color-text: #1f2933;
    --color-text-muted: #616e7c;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-danger: #dc2626;
    --color-danger-bg: #fee2e2;
    --color-success: #16a34a;
    --color-success-bg: #dcfce7;
    --color-warning: #d97706;
    --color-warning-bg: #fef3c7;
    --color-neutral-bg: #e5e7eb;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    margin: 0 0 0.5em;
    font-weight: 600;
}

/* Layout */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.app-header .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
}

.app-nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.app-nav a {
    color: var(--color-text-muted);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-weight: 500;
}

.app-nav a:hover, .app-nav a.active {
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
}

.app-main {
    flex: 1;
    padding: 1.5rem;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
}

/* Cards */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Grid helpers */

.grid {
    display: grid;
    gap: 1rem;
}

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

@media (max-width: 900px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
    .app-main { padding: 1rem; }
}

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Forms */

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

input, select, textarea {
    font: inherit;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row > * {
    flex: 1;
    min-width: 160px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    background: var(--color-neutral-bg);
    color: var(--color-text);
}

.btn:hover {
    filter: brightness(0.97);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

th {
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

tbody tr:hover {
    background: var(--color-bg);
}

.table-wrap {
    overflow-x: auto;
}

/* Badges / status pills */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--color-neutral-bg);
    color: var(--color-text);
    white-space: nowrap;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }

/* Alerts */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

/* Login page */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 360px;
}

/* Stat tiles (Dashboard) */

.stat-tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
}

.stat-tile .label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
}

.stat-tile .value {
    font-size: 1.6rem;
    font-weight: 700;
}

[x-cloak] { display: none !important; }

.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
