:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1e222b;
    --border: #2a2f3a;
    --text: #e8eaed;
    --muted: #8b93a1;
    --accent: #5b8def;
    --accent-hover: #4a7bdc;
    --danger: #e5555a;
    --danger-hover: #cf4348;
    --success: #3fb972;
    --radius: 10px;
}

* { box-sizing: border-box; }

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

.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

header h1 {
    margin: 0 0 4px;
    font-size: 28px;
    letter-spacing: -0.02em;
}

header .sub {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 14px;
}

.header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.logout-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}
.whoami {
    color: var(--muted);
    font-size: 13px;
}

.wrap-narrow {
    max-width: 380px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.field small { color: var(--muted); font-weight: 400; }
.field input[type="text"] {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}
.login-form input {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}
.login-form .btn { align-self: stretch; }

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.flash-success { background: rgba(63,185,114,0.12); border: 1px solid rgba(63,185,114,0.35); color: #7fd9a4; }
.flash-error { background: rgba(229,85,90,0.12); border: 1px solid rgba(229,85,90,0.35); color: #f19a9d; }

.upload-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 36px;
}

#upload-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: rgba(91,141,239,0.06);
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dz-text strong { display: block; font-size: 15px; }
.dz-text small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; }
.dz-filename { color: var(--accent); font-size: 13px; min-height: 16px; }

.btn {
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn-primary { background: var(--accent); color: #fff; align-self: flex-start; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}
.section-header h2 { margin: 0; font-size: 18px; }
.count { color: var(--muted); font-size: 13px; }

.empty { color: var(--muted); font-size: 14px; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.thumb {
    aspect-ratio: 4 / 3;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.thumb img, .thumb video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }

.name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.details { font-size: 12px; color: var(--muted); }

.url-row {
    display: flex;
    gap: 6px;
}
.url-input {
    flex: 1;
    min-width: 0;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
}

.delete-form {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}
