/* VolsProject — лёгкая система контролов */
:root {
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --ink: #1c1848;
    --muted: #6b6b86;
    --bg: #f3f2fb;
    --surface: #ffffff;
    --line: #e4e3f0;
    --line-strong: #cfcde3;
    --accent: #4f46e5;
    --accent-soft: #eef2ff;
    --danger: #dc2626;
    --warn-bg: #fff7ed;
    --warn-ink: #9a3412;
    --warn-line: #fed7aa;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-pill: 999px;
    --control-h: 44px;
    --control-h-sm: 40px;
    --shadow: 0 1px 2px rgba(28, 24, 72, 0.05), 0 10px 28px rgba(28, 24, 72, 0.07);
    --focus: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--ink);
}

a { color: var(--accent); }

img { max-width: 100%; }

/* ——— Контролы ——— */
label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.field { margin-bottom: 16px; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
input[type="url"],
select,
textarea {
    display: block;
    width: 100%;
    min-height: var(--control-h);
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f7f7fc;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea { min-height: 96px; resize: vertical; }

select {
    appearance: none;
    padding-right: 36px;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"),
        linear-gradient(#f7f7fc, #f7f7fc);
    background-repeat: no-repeat, repeat;
    background-position: right 12px center, 0 0;
    cursor: pointer;
}

input:hover,
select:hover,
textarea:hover {
    background-color: var(--surface);
    border-color: var(--line-strong);
}

select:hover {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"),
        linear-gradient(#ffffff, #ffffff);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background-color: var(--surface);
    border-color: var(--accent);
    box-shadow: var(--focus);
}

select:focus {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"),
        linear-gradient(#ffffff, #ffffff);
}

input::placeholder,
textarea::placeholder { color: #9a9ab3; }

input:disabled,
select:disabled,
textarea:disabled,
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

input:-webkit-autofill {
    -webkit-text-fill-color: var(--ink);
    box-shadow: 0 0 0 1000px #f7f7fc inset;
    transition: background-color 9999s ease-out;
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
    border-color: #f0abab;
    background: #fff8f8;
}

.field-error {
    margin-top: 6px;
    font-size: 13px;
    color: var(--danger);
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--control-h);
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn:hover,
button:hover {
    background: #e0e7ff;
}

.btn:focus-visible,
button:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.btn:active,
button:active { transform: translateY(1px); }

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: #4338ca;
    color: #fff;
}

.btn-ghost,
.btn-logout {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.btn-ghost:hover,
.btn-logout:hover {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-block { width: 100%; }

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
    color: #fff;
}

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

.field-check label {
    margin: 0;
    font-weight: 500;
    color: var(--ink);
}

.field-hint {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.link-danger { color: var(--danger); }

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* компактные контролы шапки — одна высота */
.bar-control,
.toolbar .btn,
.toolbar button,
.toolbar .menu-select-btn {
    box-sizing: border-box;
    height: var(--control-h-sm);
    min-height: var(--control-h-sm);
    padding: 0 16px;
    font-size: 13px;
    line-height: 1;
}

.toolbar .btn-logout {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
}

.toolbar .btn-logout:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--surface);
}

/* свой выпадающий список: нативный <select> в Windows не красится */
.menu-select {
    position: relative;
}

.menu-select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 240px;
    width: auto;
    padding: 0 14px 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.menu-select-btn::after {
    content: "";
    width: 16px;
    height: 16px;
    flex: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.menu-select-btn:hover {
    border-color: var(--line-strong);
    background: var(--surface);
}

.menu-select-btn:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus);
}

.menu-select-list {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 50;
    min-width: max(100%, 280px);
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.menu-select.is-open .menu-select-list { display: block; }

.menu-select-list [data-value] {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    height: var(--control-h-sm);
    min-height: var(--control-h-sm);
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.menu-select-list [data-value]:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.menu-select-list [data-value][aria-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

/* ——— Каркас ——— */
.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.top-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-toggle {
    box-sizing: border-box;
    width: var(--control-h-sm);
    height: var(--control-h-sm);
    min-height: var(--control-h-sm);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
}

.sidebar-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--surface);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand img { width: 36px; height: 36px; }

.who {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    font-size: 14px;
    color: var(--muted);
}

.who strong { color: var(--ink); font-weight: 600; }

.role {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
}

.role-preview {
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-preview label {
    margin: 0;
    white-space: nowrap;
}

.preview-banner {
    background: var(--warn-bg);
    color: var(--warn-ink);
    border-bottom: 1px solid var(--warn-line);
    padding: 8px 24px;
    font-size: 13px;
    text-align: center;
}

.shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 58px);
}

.sidebar {
    width: 252px;
    flex: none;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 16px 12px 32px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar a {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
}

.sidebar a:hover { background: #f7f7fc; }

.sidebar a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.nav-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.nav-group-toggle:hover { background: #f7f7fc; }

.nav-group-toggle::after {
    content: "";
    width: 16px;
    height: 16px;
    flex: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") center / 16px no-repeat;
    transition: transform 0.15s ease;
}

.nav-group.is-open .nav-group-toggle::after { transform: rotate(-180deg); }

.nav-group-items {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 0 0 4px;
}

.nav-group.is-open .nav-group-items { display: flex; }

.nav-group-items a { padding-left: 20px; }

.card-pad { padding: 16px 16px 0; }

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.file-list li:last-child { border-bottom: 0; }

.inline-form { display: inline; }

.stack-gap { margin-bottom: 16px; }

.lesson-body {
    line-height: 1.65;
    font-size: 16px;
    overflow: auto;
}

.lesson-body > :first-child { margin-top: 0; }
.lesson-body > :last-child { margin-bottom: 0; }

.lesson-body h2 {
    font-size: 22px;
    margin: 1.4em 0 0.5em;
    letter-spacing: -0.02em;
}

.lesson-body h3 {
    font-size: 18px;
    margin: 1.2em 0 0.4em;
}

.lesson-body p,
.lesson-body ul,
.lesson-body ol { margin: 0 0 0.9em; }

.lesson-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.lesson-body figure { margin: 1em 0; }

.lesson-body figure.image { display: table; }

.lesson-body .text-left { text-align: left; }
.lesson-body .text-center { text-align: center; }
.lesson-body .text-right { text-align: right; }
.lesson-body .text-justify { text-align: justify; }
.lesson-body .image-style-align-left { float: left; margin: 0 1em 1em 0; }
.lesson-body .image-style-align-right { float: right; margin: 0 0 1em 1em; }
.lesson-body .image-style-align-center,
.lesson-body .image-style-block {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.lesson-body iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: 0;
    border-radius: 12px;
    background: #111;
}

.lesson-body figure.media,
.lesson-body .media-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 1em 0;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
}

.lesson-body figure.media iframe,
.lesson-body .media-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    border-radius: 0;
}

.lesson-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 14px;
}

.lesson-body th,
.lesson-body td {
    border: 1px solid var(--line);
    padding: 8px 10px;
}

.lesson-body pre {
    overflow: auto;
    padding: 12px 14px;
    background: #f7f7fc;
    border-radius: 10px;
}

.lesson-body blockquote {
    margin: 0 0 1em;
    padding: 0 0 0 14px;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}

.ck-editor-container { width: 100%; }
.ck-editor-container .word-count { display: none; }
.ck.ck-editor { width: 100%; }
.ck.ck-toolbar {
    border-color: var(--line) !important;
    background: #f7f7fc !important;
    border-radius: 12px 12px 0 0 !important;
}
.ck.ck-content {
    min-height: 280px;
    border-color: var(--line) !important;
    border-radius: 0 0 12px 12px !important;
    color: var(--ink);
    font: inherit;
}
.ck.ck-content .media-embed,
.ck.ck-content figure.media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
}
.ck.ck-content .media-embed iframe,
.ck.ck-content figure.media iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.comment-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
}

.comment {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.comment:last-child { border-bottom: 0; }

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--muted);
}

.comment-meta strong { color: var(--ink); }
.comment p { margin: 0; white-space: pre-wrap; }

.video-current { margin: 0 0 16px; }

input[type="file"] {
    width: 100%;
    padding: 10px 0;
    border: 0;
    background: transparent;
    min-height: 0;
}

html.sidebar-collapsed .sidebar {
    width: 0;
    padding: 0;
    border-right-width: 0;
    overflow: hidden;
}

html.sidebar-collapsed .sidebar nav { display: none; }

main.app {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 28px 32px 48px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.page-header .lede { margin-bottom: 20px; }

.card-title {
    margin: 0 0 16px;
    font-size: 16px;
}

.form-card { max-width: 520px; margin-bottom: 20px; }
.form-card-wide { max-width: 960px; }
.lesson-video {
    display: block;
    width: 100%;
    max-height: min(68vh, 680px);
    border-radius: 12px;
    background: #111;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.toolbar-row {
    display: flex;
    gap: 10px;
    margin: 0 0 16px;
    max-width: 560px;
}

.toolbar-row input[type="search"] { flex: 1; }

.table-card { padding: 0; overflow: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.data-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.data-table tr:last-child td { border-bottom: 0; }

.col-actions {
    text-align: right;
    white-space: nowrap;
}

.col-actions a { margin-left: 12px; }

.pager {
    display: flex;
    gap: 16px;
    margin-top: 16px;
    font-size: 14px;
}

h1 {
    margin: 0 0 8px;
    font-size: 28px;
    letter-spacing: -0.03em;
    font-weight: 700;
}

.lede {
    color: var(--muted);
    margin: 0 0 24px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}

.empty-title { font-weight: 600; margin: 0 0 6px; }
.empty-hint { margin: 0; color: var(--muted); font-size: 14px; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--ink);
}

.alert-error,
.form-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

/* ——— Вход ——— */
body.login {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 20% -10%, #a5b4fc 0%, transparent 50%),
        radial-gradient(900px 500px at 110% 110%, #818cf8 0%, transparent 46%),
        linear-gradient(180deg, #eef2ff 0%, #f3f2fb 100%);
}

.login-card {
    width: min(100% - 32px, 420px);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    padding: 36px 32px 28px;
    box-shadow: var(--shadow);
}

.login-card .logo {
    display: block;
    width: 88px;
    height: 88px;
    margin: 0 auto 12px;
}

.login-card h1 {
    text-align: center;
    margin: 0 0 24px;
    font-size: 28px;
}

.login-card .brand-foot {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 20px;
}

@media (max-width: 960px) {
    .who {
        width: 100%;
        justify-content: flex-start;
    }
    .role-preview {
        flex: 1 1 220px;
        min-width: 0;
    }
    .menu-select {
        flex: 1;
        min-width: 0;
    }
    .menu-select-btn {
        min-width: 0;
        width: 100%;
    }
    .menu-select-list {
        left: 0;
        right: 0;
        min-width: 0;
    }
    .page-header { flex-wrap: wrap; }
}

@media (max-width: 720px) {
    .top { padding: 10px 16px; }
    .role-preview label { display: none; }
    .shell { flex-direction: column; min-height: 0; }
    .sidebar {
        width: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 10px 12px;
    }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    main.app { padding: 20px 16px 40px; }
    html.sidebar-collapsed .sidebar {
        display: none;
    }
    .login-card { padding: 28px 20px 22px; }
    .form-card { max-width: none; }
    .toolbar-row { max-width: none; }
}
