﻿:root {
    --tg-blue: #0088cc;
    --tg-blue-2: #0b93d5;
    --bg: #ffffff;
    --text: #0b2330;
    --muted: #6b7b86;
    --container: 1100px;
    --radius: 8px;
    --gap: 16px;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    color: var(--text);
    background: linear-gradient(180deg, #f7fbfc 0%, #ffffff 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.header {
    background: linear-gradient(90deg,var(--tg-blue),var(--tg-blue-2));
    color: #fff;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(11,34,48,0.08);
    position: sticky;
    top: 0;
    z-index: 50;
}

    .header .wrap {
        max-width: var(--container);
        margin: 0 auto;
        display: flex;
        gap: var(--gap);
        align-items: center;
        justify-content: space-between;
    }

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

    .brand .logo {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: rgba(255,255,255,0.14);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 18px;
        box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
    }

    .brand .title {
        font-weight: 600;
        font-size: 18px
    }

.nav {
    display: flex;
    gap: 14px;
    align-items: center;
}

    .nav a {
        color: rgba(255,255,255,0.95);
        text-decoration: none;
        padding: 8px 10px;
        border-radius: 6px;
        font-weight: 500;
    }

        .nav a:hover {
            background: rgba(255,255,255,0.08)
        }

        .nav a.active {
            background: rgba(255,255,255,0.16)
        }

.container {
    max-width: var(--container);
    margin: 28px auto;
    padding: 0 20px;
}

.card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(11,34,48,0.06);
    padding: 20px;
}

h1 {
    margin: 0 0 8px;
    font-size: 28px
}

h2 {
    margin-top: 0;
    color: var(--tg-blue)
}

p {
    margin: 0 0 12px;
    color: var(--muted)
}

ul {
    margin: 0 0 12px 20px;
    color: var(--muted)
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
    gap: 16px;
}

.profile {
    display: flex;
    gap: 14px;
    align-items: center;
}

.avatar {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: linear-gradient(180deg,#0b93d5,#0088cc);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 28px;
}

.kv {
    color: var(--muted);
    font-size: 14px
}

.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px
}

label {
    font-weight: 600;
    margin-bottom: 6px
}

input[type="text"], input[type="password"], select, textarea {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e6eef3;
    font-size: 14px;
    background: #fbfdff;
}

.btn {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--tg-blue);
    color: #fff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

    .btn.ghost {
        background: transparent;
        border: 1px solid rgba(11,34,48,0.06);
        color: var(--text)
    }

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace;
    font-size: 13px;
    background: #fbfdff;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #eef7fb;
    color: #0b2330
}

.footer {
    margin-top: 36px;
    padding: 18px 20px;
    border-top: 1px solid rgba(11,34,48,0.04);
    background: transparent;
}

    .footer .wrap {
        max-width: var(--container);
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        gap: 12px;
        align-items: center;
        color: var(--muted);
        font-size: 14px;
    }

    .footer a {
        color: var(--tg-blue);
        text-decoration: none
    }

.error-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px
}

@media (max-width:780px) {
    .nav {
        display: none
    }

    .brand .title {
        font-size: 16px
    }

    .header .wrap {
        padding: 8px
    }

    .container {
        padding: 0 12px
    }
}

.card.login-card {
    margin: 48px auto 24px; 
    max-width: 520px; 
    padding: 28px; 
}

#loginMsg.error {
    color: #e53935; 
    font-weight: 600;
    margin-top: 12px;
}

#loginMsg {
    color: var(--muted);
    margin-top: 12px;
    font-size: 0.95rem;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 12px;
    align-items: start; 
}

.grid article.card {
    display: flex;
    flex-direction: column; 
}

.image-grid figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.image-grid .thumb-wrap {
    height: 260px; 
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fbfdff;
    border-radius: 10px;
    overflow: hidden;
    padding: 12px;
    box-shadow: 0 6px 14px rgba(11,34,48,0.04);
}

.image-grid img.thumb {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; 
    display: block;
}

.image-grid figcaption {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

@media (max-width: 780px) {
    .image-grid {
        gap: 10px;
    }

        .image-grid .thumb-wrap {
            height: 160px;
            padding: 8px;
        }
}

:root {
    --container: 1400px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
    margin-top: 12px;
    align-items: start;
}

.grid article.card {
    display: flex;
    flex-direction: column;
}

.image-grid .thumb-wrap {
    height: clamp(360px, 30vw, 760px); 
    padding: 10px; 
    display: flex;
    align-items: center; 
    justify-content: center;
    background: #fbfdff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 14px rgba(11,34,48,0.04);
}

.image-grid img.thumb {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: none; 
    object-fit: contain;
    display: block;
}

@media (min-width: 900px) {
    .image-grid figcaption {
        font-size: 14px;
    }
}

@media (max-width: 900px) {
    .image-grid .thumb-wrap {
        height: clamp(180px, 38vw, 320px);
        padding: 8px;
    }
}