:root {
    --lila: #553984;
    --lila-dark: #402a63;
    --orange: #E28D4B;
    --gelb: #FFC76B;
    --bg: #f4f1f7;
    --card: #ffffff;
    --border: #e3ddec;
    --text: #2b2438;
    --muted: #786f8c;
    --success: #3a8a5f;
    --error: #c04444;
    --radius: 10px;
    --max-width: 1280px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--lila); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
    background: var(--lila);
    color: #fff;
}
.topbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.brand {
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gelb);
    display: inline-block;
}
.topnav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.topnav a {
    color: #f0ecf7;
    font-size: 14px;
}
.topnav a:hover { color: var(--gelb); text-decoration: none; }
.topnav-user {
    color: var(--gelb);
    font-size: 13px;
    font-weight: 600;
}
.btn-ghost {
    border: 1px solid rgba(255,255,255,0.4);
    padding: 6px 14px;
    border-radius: 6px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

/* Page */
.page-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.card h2, .card h3 {
    margin-top: 0;
    color: var(--lila-dark);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

/* Folder tiles */
.folder-tile {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: block;
    transition: box-shadow 0.15s, transform 0.15s;
}
.folder-tile:hover {
    box-shadow: 0 4px 16px rgba(85, 57, 132, 0.12);
    transform: translateY(-2px);
    text-decoration: none;
}
.folder-tile h3 {
    margin: 0 0 6px 0;
    color: var(--lila-dark);
}
.folder-tile .meta {
    color: var(--muted);
    font-size: 13px;
}

/* Buttons */
.btn {
    display: inline-block;
    background: var(--orange);
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.btn:hover { background: #cf7a38; text-decoration: none; color: #fff; }
.btn-primary { background: var(--lila); }
.btn-primary:hover { background: var(--lila-dark); }
.btn-secondary {
    background: transparent;
    color: var(--lila);
    border: 1px solid var(--lila);
}
.btn-secondary:hover { background: #f0ecf7; color: var(--lila); }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #a03636; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* Forms */
.form-group { margin-bottom: 18px; }
label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--lila-dark);
}
input[type=text], input[type=email], input[type=password], input[type=file], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--lila);
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkbox-row input { width: auto; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px; }

/* Flash messages */
.flash {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
}
.flash-success { background: #e5f4ea; color: var(--success); border: 1px solid #bfe3cb; }
.flash-error { background: #fbe9e9; color: var(--error); border: 1px solid #f0c4c4; }
.flash-info { background: #f0ecf7; color: var(--lila-dark); border: 1px solid var(--border); }

/* Login form container */
.auth-wrap {
    max-width: 420px;
    margin: 60px auto;
}
.auth-wrap .card { text-align: left; }
.auth-logo {
    text-align: center;
    margin-bottom: 24px;
    color: var(--lila);
    font-weight: 800;
    font-size: 20px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-yellow { background: #fff3dc; color: #9a6b12; }
.badge-purple { background: #f0ecf7; color: var(--lila-dark); }

/* Footer */
.sitefooter {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 24px;
}

/* File list */
.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.file-row:last-child { border-bottom: none; }
.file-name { font-weight: 600; color: var(--text); }
.file-meta { color: var(--muted); font-size: 13px; }

.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* Ordner-Ansicht: Kacheln/Liste-Umschalter */
.view-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}
.view-toggle button {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--lila-dark);
}
.view-toggle button.active {
    background: var(--lila);
    color: #fff;
    border-color: var(--lila);
}
.folder-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.folder-grid.list-view .folder-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    gap: 16px;
}
.folder-grid.list-view .folder-tile:hover {
    transform: none;
}
.folder-grid.list-view .folder-tile h3 {
    margin: 0;
    font-size: 15px;
}
.folder-grid.list-view .folder-tile .meta {
    white-space: nowrap;
}
.folder-grid.list-view .folder-tile .flex-between {
    flex: 1;
    margin-bottom: 0 !important;
}

/* Datei per Link aus dem Dashboard hervorheben */
.file-row:target { background:#fff3dc; border-radius:8px; box-shadow:0 0 0 2px #FFC76B; }
