* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: #f4f5f7;
    color: #1c1e21;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #1c1e21;
    color: #fff;
}
.topbar a { color: #9ecbff; }
.brand { font-weight: 600; }
.container {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 480px;
}
.card.wide { max-width: none; }
form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
input[type="text"], input[type="password"] {
    padding: 0.6rem;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    font-size: 1rem;
}
input[type="file"] { padding: 0.4rem 0; }
button {
    padding: 0.7rem;
    border: none;
    border-radius: 6px;
    background: #1877f2;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}
button:hover { background: #145dc4; }
form.inline { display: inline; margin: 0; }
button.danger { background: #d0021b; padding: 0.4rem 0.8rem; font-size: 0.85rem; }
button.danger:hover { background: #a50116; }
.error { color: #d0021b; }
.success { color: #1a7f37; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: 0.6rem; border-bottom: 1px solid #e4e6eb; }

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}
.gallery-item {
    background: #fafafa;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.gallery-item img,
.gallery-item video.thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    background: #000;
    display: block;
}
.thumb-fallback {
    display: none;
    height: 140px;
    border-radius: 6px;
    background: #eee;
    color: #606770;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.8rem;
    word-break: break-word;
}
.gallery-item .meta {
    font-size: 0.8rem;
    color: #606770;
}
.gallery-item .meta .filename {
    font-weight: 600;
    color: #1c1e21;
    word-break: break-word;
}
.gallery-item .actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}
