﻿@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Montserrat:wght@500;600;700&display=swap');

:root {
    --bg: #f2f7f3;
    --surface: #ffffff;
    --surface-soft: #f7fbf8;
    --line: #dbe5dd;
    --text: #1f2b23;
    --muted: #5e7164;
    --hero-accent: #2f9d46;
    --blue: #2f9d46;
    --blue-strong: #247b36;
    --success: #1f8e3d;
    --danger: #d93025;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-sm: 10px;
    --shadow: 0 6px 24px rgba(23, 31, 42, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 10% 10%, #ffffff 0%, var(--bg) 45%, #e9f1eb 100%);
}

a { color: inherit; }

.topbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.topbar__inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand__dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hero-accent), #257636);
    box-shadow: 0 0 0 5px rgba(47, 157, 70, 0.18);
}

.brand__title {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
}

.brand__subtitle { margin: 0; color: var(--muted); font-size: 0.8rem; }

.topbar__user { display: flex; align-items: center; gap: 10px; }

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
}

.user__name { margin: 0; font-weight: 700; font-size: 0.92rem; }
.user__role { margin: 0; color: var(--muted); font-size: 0.8rem; }

.hero {
    max-width: 1240px;
    margin: 18px auto 0;
    padding: 0 20px;
}

.hero__inner {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #173a21 0%, #1f4a2c 65%, #245534 100%);
    color: #ffffff;
    padding: 34px 30px 38px;
    box-shadow: 0 16px 28px rgba(11, 18, 27, 0.2);
}

.hero__inner::after {
    content: '';
    position: absolute;
    right: -50px;
    top: -35px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(95, 214, 121, 0.42) 0%, rgba(95, 214, 121, 0) 70%);
}

.hero h1 {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.5rem, 2.3vw, 2.1rem);
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

.hero p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.97rem;
    position: relative;
    z-index: 1;
}

.tabs {
    max-width: 1240px;
    margin: 10px auto 0;
    padding: 0 20px;
}

.tabs__inner {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 8px;
    display: flex;
    gap: 6px;
}

.tab {
    text-decoration: none;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.92rem;
    padding: 12px 14px;
    border-bottom: 3px solid transparent;
}

.tab.is-active,
.tab:hover { color: var(--blue); border-bottom-color: var(--blue); }

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 16px 20px 46px;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.layout--single { grid-template-columns: minmax(0, 1fr); }
.layout__main, .layout__side { min-width: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.card--accent { background: linear-gradient(130deg, #f5fcf6 0%, #ecf8ef 65%, #e7f6ea 100%); border-color: #d2ead8; }
.card--success { background: linear-gradient(130deg, #f6fff7 0%, #ebfaee 100%); border-color: #ccecd2; }
.compact { padding: 16px; }

.card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.card h2, .card h3, .card h4 { margin: 0; font-family: 'Montserrat', sans-serif; line-height: 1.25; }

.kicker {
    margin: 0 0 6px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hero-accent);
    font-weight: 800;
}

.muted { color: var(--muted); margin: 0; }
.small { font-size: 0.84rem; }

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #ecf8ef;
    color: #246f35;
    border: 1px solid #d0ead7;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    white-space: nowrap;
}

.badge--success { background: #e6f6ea; color: #1f8e3d; border-color: #cfead6; }

.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 14px;
}

.invite-block {
    margin-top: 12px;
}

.btn {
    appearance: none;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: var(--blue);
    color: #fff;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    box-shadow: 0 8px 14px rgba(47, 157, 70, 0.27);
}

.btn:hover { transform: translateY(-1px); background: var(--blue-strong); }
.btn--ghost { background: transparent; color: var(--blue); border: 1px solid #cde9d4; box-shadow: none; }
.btn--ghost:hover { background: #f2faf4; }
.btn--ghost-dark { background: #edf3ee; color: #2e4635; border: 1px solid #d5e2d7; box-shadow: none; }
.btn--ghost-dark:hover { background: #e4ece6; }
.btn--dark { background: #333333; box-shadow: 0 8px 14px rgba(20, 20, 20, 0.24); }
.btn--dark:hover { background: #262626; }
.btn--success { background: var(--success); box-shadow: 0 8px 14px rgba(31, 142, 61, 0.28); }
.btn--success:hover { background: #1a7b35; }
.btn--danger { background: #fff; color: var(--danger); border: 1px solid #f2c8c5; box-shadow: none; }
.btn--danger:hover { background: #fff4f3; }

.stream-post__header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.cover {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: 14px;
    margin: 10px 0 14px;
    border: 1px solid var(--line);
}

.content-body { color: #273442; line-height: 1.68; }
.content-body p:first-child { margin-top: 0; }

.topic-list { display: flex; flex-direction: column; gap: 12px; }

.topic-item,
.task-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topic-item__actions,
.task-item__right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.task-item--empty { justify-content: flex-start; }

.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.person-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eef2f5;
}

.person-row:last-child { border-bottom: none; }

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid #edf2f5;
}

.stat:last-child { border-bottom: none; }

.progress-item { border-top: 1px solid #edf2f5; padding-top: 10px; margin-top: 10px; }
.progress-item:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }

.center-wrap {
    min-height: 55vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.form-card { margin-bottom: 0; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 600;
}

.form-field span { color: #324154; }

.form-field input,
.form-field select,
.form-field textarea,
.input {
    width: 100%;
    border: 1px solid #d2dae3;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

.form-field textarea { resize: vertical; min-height: 130px; }

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.input:focus {
    outline: none;
    border-color: #71c382;
    box-shadow: 0 0 0 4px rgba(47, 157, 70, 0.16);
}

.full { grid-column: 1 / -1; }

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 0.92rem;
}

.inline-check input { width: 18px; height: 18px; }
.compact-check { margin-top: 28px; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.question-builder {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: 14px;
}

.question-row {
    display: grid;
    grid-template-columns: 1fr 120px auto;
    gap: 12px;
    align-items: start;
}

.question-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: 14px;
}

.photo-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    background: var(--surface-soft);
}

.photo-editor {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: var(--surface-soft);
}

.photo-editor__viewport {
    width: 100%;
    height: 300px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px dashed #bed1c2;
    background: #e8efe9;
    position: relative;
    cursor: grab;
    touch-action: none;
}

.photo-editor__viewport.is-dragging {
    cursor: grabbing;
}

.photo-editor__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    transform: scale(1);
    transform-origin: center;
    user-select: none;
    pointer-events: none;
}

.photo-editor__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    color: #557264;
    font-size: 0.9rem;
}

.photo-editor__toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.topic-cover-frame {
    width: 100%;
    height: 320px;
    border-radius: 14px;
    overflow: hidden;
    margin: 10px 0 14px;
    border: 1px solid var(--line);
    background: #e8efe9;
}

.topic-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--focus-x, 50%) var(--focus-y, 50%);
    transform: scale(calc(var(--zoom, 100) / 100));
    transform-origin: center;
}

.topic-gallery {
    margin-top: 18px;
}

.topic-tests {
    margin-top: 18px;
}

.topic-tests h3 {
    margin: 0 0 10px;
}

.topic-test-item + .topic-test-item {
    margin-top: 10px;
}

.gallery-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.gallery-item {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #fff;
}

.gallery-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.gallery-item--button {
    padding: 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.gallery-widget {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    overflow: hidden;
}

.gallery-widget img {
    width: 100%;
    display: block;
    max-height: 520px;
    object-fit: contain;
    background: #eef4ef;
}

.gallery-widget__caption {
    padding: 10px 12px;
    border-top: 1px solid var(--line);
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px 12px;
    margin-top: 10px;
}

.role-form {
    margin: 0;
    display: inline-block;
}

.option-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 10px 0;
}

.option-row input { margin-top: 2px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }

.table th,
.table td {
    text-align: left;
    border-bottom: 1px solid #e8edf2;
    padding: 12px;
    vertical-align: top;
}

.table th {
    color: #4d5c6b;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-bottom: 14px;
}

.alert--error { background: #ffeded; border: 1px solid #f4cbcb; color: #8a1f1f; }

.auth-page {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(150deg, #153220 0%, #1f472d 50%, #255637 100%);
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-wrap { width: 100%; max-width: 520px; }

.auth-card {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #d9e2eb;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(9, 12, 17, 0.3);
    padding: 34px;
}

.auth-card h1 {
    margin: 0 0 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.7rem;
}

.auth-btn { width: 100%; margin-top: 18px; padding: 12px 14px; font-size: 0.95rem; }
.auth-form { margin-top: 14px; }
.auth-consent {
    display: flex;
    align-items: flex-start;
    margin-top: 10px;
}

.text-link {
    color: var(--blue-strong);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.text-link:hover {
    color: #1d642c;
}

.policy-page {
    display: block;
    min-height: 100vh;
    padding: 26px 20px 36px;
}

.policy-wrap {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}

.policy-card + .policy-card {
    margin-top: 16px;
}

.policy-card h2 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-family: 'Montserrat', sans-serif;
}

.policy-card p {
    margin: 0 0 12px;
    line-height: 1.6;
}

.policy-actions {
    margin-top: 14px;
}

body.modal-open {
    overflow: hidden;
}

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
}

.gallery-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 18, 14, 0.72);
    border: none;
    width: 100%;
    cursor: pointer;
}

.gallery-modal__content {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 1200px);
    max-height: 90vh;
    margin: 4vh auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.gallery-modal__content img {
    width: 100%;
    height: auto;
    max-height: 90vh;
    display: block;
    background: #0f1512;
}

.gallery-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}

code {
    background: #f0f4f8;
    border: 1px solid #dbe5ef;
    color: #345;
    border-radius: 8px;
    padding: 2px 6px;
    word-break: break-all;
}

@media (max-width: 1024px) {
    .layout { grid-template-columns: 1fr; }
    .layout__side { order: -1; }
}

@media (max-width: 760px) {
    .topbar__inner { flex-wrap: wrap; }
    .hero__inner { padding: 28px 22px 32px; }

    .tabs__inner { overflow-x: auto; }

    .form-grid,
    .people-grid,
    .question-row { grid-template-columns: 1fr; }

    .topic-item,
    .task-item,
    .card__head,
    .stream-post__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .topic-item__actions,
    .task-item__right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .btn { width: 100%; }
    .topbar__user .btn { width: auto; }
}
