/* ── stup.rsyo.de portal styles ─────────────────────────────────────────────
   Single file, no external deps. Conservative palette, readable everywhere.
   ─────────────────────────────────────────────────────────────────────────── */

:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #dbeafe;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --warning: #d97706;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
    --radius: 10px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 120ms, border-color 120ms, transform 60ms;
    user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn .icon { font-size: 14px; }

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

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 20%, #2563eb15 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, #16a34a15 0%, transparent 40%),
        var(--bg);
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 32px;
}
.login-header { text-align: center; margin-bottom: 24px; }
.login-header h1 { font-size: 20px; margin: 12px 0 4px; }
.login-header .subtitle { color: var(--text-muted); font-size: 13px; margin: 0; }

.logo-mark {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: #fff;
    border-radius: 14px;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
}
.logo-mark.small { width: 36px; height: 36px; font-size: 13px; border-radius: 10px; }

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="password"] {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--surface);
    transition: border-color 120ms, box-shadow 120ms;
}
.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.field .hint { font-size: 12px; color: var(--text-faint); margin: 6px 0 0; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.toggle-pw {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    color: var(--text-muted);
}

.btn-primary[type="submit"] { width: 100%; padding: 12px; font-size: 14px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 14px; text-decoration: none; }

/* ── DSGVO consent checkbox + privacy page ───────────────────────────── */
.consent-field { margin: 4px 0 16px; }
.consent {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-muted);
    cursor: pointer;
}
.consent input[type="checkbox"] { margin-top: 2px; flex: 0 0 auto; }
.consent a, .login-footer a { color: var(--primary); }

.privacy-card { max-width: 720px; text-align: left; }
.privacy-content h2 { font-size: 15px; margin: 20px 0 6px; }
.privacy-content h3 { font-size: 13.5px; margin: 14px 0 4px; }
.privacy-content p, .privacy-content li { font-size: 13px; line-height: 1.55; color: var(--text-muted); }
.privacy-content ul { margin: 6px 0 6px 18px; padding: 0; }
.privacy-content code { font-size: 12px; }
.privacy-back { margin-top: 22px; }

/* ── rsyocto logo + site footer ───────────────────────────────────────── */
/* Logo: original file is 400×120. Displayed at up to 90% of the original
   (max-height 108px) and never wider than the surrounding frame — on the
   420px login card it fills the full inner width (356px ≈ 89%). */
.logo-img {
    display: block;
    margin: 0 auto;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 108px;
}
.topbar .logo-img { max-height: 26px; margin: 0; }
.site-footer {
    display: flex;
    justify-content: center;
    padding: 20px 16px 16px;
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-wrap: nowrap;
    overflow: hidden;
}
.site-footer .footer-links {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary); text-decoration: underline; }
.site-footer .footer-copy { margin: 0; }

/* Logout button — rsyocto brand orange (#f36b2a) */
.btn-logout {
    display: inline-flex;
    align-items: center;
    background: #f36b2a;
    color: #fff;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}
.btn-logout:hover { background: #d34c0d; color: #fff; }

.login-footer {
    margin: 20px 0 0;
    font-size: 12px;
    color: var(--text-faint);
    text-align: center;
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error {
    background: var(--danger-soft);
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-icon {
    flex: 0 0 22px;
    height: 22px;
    width: 22px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
}

/* ── Portal layout ──────────────────────────────────────────────────────── */
.portal-page { background: var(--bg); }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-title { font-weight: 600; font-size: 15px; }
.brand-sub { color: var(--text-muted); font-size: 12px; }
.topbar-right .link-muted { color: var(--text-muted); font-size: 13px; }
.topbar-right .link-muted:hover { color: var(--danger); }

.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    padding: 20px 24px;
    align-items: start;
}
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
}

.sidebar {
    display: grid;
    gap: 10px;
    position: sticky;
    top: 20px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 20px; font-weight: 600; margin-top: 2px; }
.stat-card.hint-card .stat-sub { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

/* ── Content area ───────────────────────────────────────────────────────── */
.content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13px; }
.crumb { color: var(--text-muted); }
.crumb a { color: var(--text-muted); }
.crumb a:hover { color: var(--primary); }
.crumb-sep { color: var(--text-faint); }
.crumb.current { color: var(--text); font-weight: 500; }

.content-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Dropzone ───────────────────────────────────────────────────────────── */
.dropzone {
    margin: 16px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    transition: border-color 120ms, background-color 120ms;
    cursor: pointer;
}
.dropzone:focus { outline: none; border-color: var(--primary); }
.dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-dark);
}
.dz-icon { font-size: 30px; }
.dz-title { font-weight: 600; margin-top: 6px; color: var(--text); }
.dz-sub { font-size: 12px; margin-top: 2px; }

/* ── Upload queue ───────────────────────────────────────────────────────── */
.upload-queue {
    margin: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.upload-queue-item {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.upload-queue-item:last-child { border-bottom: none; }
.upload-queue-item .uq-icon { font-size: 16px; }
.upload-queue-item .uq-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-queue-item .uq-status { color: var(--text-muted); font-size: 12px; }
.upload-queue-item .uq-bar {
    grid-column: 2 / 3;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.upload-queue-item .uq-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 120ms;
}
.upload-queue-item.state-done .uq-bar-fill { background: var(--success); }
.upload-queue-item.state-error .uq-bar-fill { background: var(--danger); }
.upload-queue-item.state-error .uq-status { color: var(--danger); }

/* ── File table ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.file-table { width: 100%; border-collapse: collapse; }
.file-table th, .file-table td {
    text-align: left;
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.file-table th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.file-table tbody tr:hover { background: var(--surface-2); }
.file-table tr.empty-row td {
    text-align: center;
    color: var(--text-faint);
    padding: 32px;
}
.col-size { width: 100px; text-align: right; }
.col-modified { width: 160px; color: var(--text-muted); }
.col-actions { width: 80px; text-align: right; }
.file-row .name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.file-icon {
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 20px;
    font-size: 16px;
}
.file-name { color: var(--text); }
.file-row.is-dir .file-name { font-weight: 500; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.danger:hover { color: var(--danger); }

/* ── Dialogs ────────────────────────────────────────────────────────────── */
dialog.dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: calc(100% - 32px);
    color: var(--text);
}
dialog.dialog::backdrop {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
}
dialog.dialog form { padding: 20px; }
dialog.dialog h3 { margin: 0 0 12px; font-size: 16px; }
dialog.dialog label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }
dialog.dialog input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
}
dialog.dialog input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    max-width: 360px;
}
.toast {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 13px;
    animation: toast-in 160ms ease-out;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
