/* Дизайн-система портала курса.
   Палитра — брендовый зелёный i.moscow (#00ae46) + берёзовые тона.
   Шрифт — самохостинг Inter (латиница + кириллица). */

:root {
    /* Зелёные (из CSS-переменных i.moscow: Accent-Theme-*) */
    --brand: #00ae46;
    --brand-hover: #009340;
    --brand-active: #028135;
    --brand-soft: #ddf9e8;
    --brand-softer: #f0fbf4;
    --brand-glow: rgba(20, 208, 111, .25);

    /* Текст: тёмно-зелёные чернила вместо чёрного */
    --ink: #043f23;
    --ink-2: #2a5741;
    --muted: #6b7f74;

    /* Берёста: тёплый светлый фон и линии */
    --birch-bg: #fbfaf6;
    --birch-bg-2: #f2f6ee;
    --surface: #ffffff;
    --line: #e6e3d8;
    --line-soft: #f0eee6;

    --danger: #c0392b;
    --danger-bg: rgba(192, 57, 43, .07);
    --danger-line: rgba(192, 57, 43, .22);
    --warn: #b6791f;

    --radius: 14px;
    --radius-lg: 24px;
    --shadow-card: 0 22px 54px rgba(4, 63, 35, .10);
    --shadow-btn: 0 10px 22px rgba(0, 174, 70, .26);

    --font: Inter, "Segoe UI", Arial, sans-serif;
}

/* @font-face объявления — в static/css/fonts.css (подключается перед этим файлом). */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background: var(--birch-bg);
}

a { color: var(--brand-active); }

/* ======================================================================
   Страница входа
   ====================================================================== */

body.auth {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background:
        radial-gradient(820px 420px at 88% -10%, rgba(20, 208, 111, .18), transparent 60%),
        radial-gradient(760px 420px at 6% 4%, rgba(0, 174, 70, .13), transparent 58%),
        radial-gradient(640px 420px at 50% 120%, rgba(0, 174, 70, .10), transparent 60%),
        linear-gradient(180deg, var(--birch-bg), var(--birch-bg-2));
}

.card {
    background: var(--surface);
    padding: 34px 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
    width: min(100% - 20px, 420px);
}

.card .head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}
.card .head-text { min-width: 0; }   /* даёт заголовку переноситься, не растягивая карточку */

.mark {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #14d461, var(--brand));
    box-shadow: 0 10px 22px var(--brand-glow);
}
.mark svg { width: 26px; height: 26px; }

.card h1 {
    font-size: 21px;
    margin: 0;
    letter-spacing: -.02em;
    line-height: 1.2;
    font-weight: 700;
}
.card .sub { color: var(--muted); font-size: 13.5px; margin: 3px 0 0; }

label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin: 16px 0 7px;
}

/* input:not([type]) — на случай, если у поля забыли указать type: без этого
   оно остаётся с браузерными размерами по умолчанию и выбивается из вёрстки. */
input[type="text"], input[type="password"], input[type="search"],
input[type="email"], input:not([type]), select {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    font-size: 15px;
    font-family: inherit;
    background: #fdfdfa;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s, background .15s;
    box-sizing: border-box;
    display: block;
}
input:focus, select:focus {
    outline: 0;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(0, 174, 70, .13);
    background: #fff;
}

/* Автозаполнение браузера красит поля в свой сиреневый — возвращаем нашу палитру.
   inset-тень вместо background: сам background Chrome перебить не даёт. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fdfdfa inset;
    -webkit-text-fill-color: var(--ink);
    caret-color: var(--ink);
    transition: background-color 6000s ease-in-out 0s;
}
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset, 0 0 0 4px rgba(0, 174, 70, .13);
}

button, .btn {
    font-family: inherit;
    cursor: pointer;
    border: 0;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-hover));
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .16s, box-shadow .16s, background .16s;
}

.card button[type="submit"] {
    width: 100%;
    margin-top: 24px;
    min-height: 52px;
    font-size: 16px;
    font-weight: 700;
    box-shadow: var(--shadow-btn);
}
.card button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(0, 174, 70, .36);
}
.card button[type="submit"]:active { transform: none; background: var(--brand-active); }

.hint, .err {
    margin: 18px 0 2px;
    padding: 11px 13px;
    border-radius: 11px;
    font-size: 13.5px;
    line-height: 1.5;
}
.hint {
    color: #0a6e4f;
    background: var(--brand-soft);
    border: 1px solid rgba(0, 174, 70, .22);
}
.err {
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid var(--danger-line);
    font-weight: 500;
}
.foot { margin-top: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ======================================================================
   Шапка портала
   ====================================================================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.topbar .logo {
    width: 30px; height: 30px; flex: 0 0 auto;
    border-radius: 9px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #14d461, var(--brand));
}
.topbar .logo svg { width: 17px; height: 17px; }

.greeting {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.greeting .name { color: var(--brand-active); }

.course-title {
    color: var(--muted);
    font-size: 13px;
    border-left: 1px solid var(--line);
    padding-left: 12px;
    margin-left: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar .spacer { flex: 1 1 auto; }

.btn-sm {
    height: 36px;
    padding: 0 14px;
    font-size: 13.5px;
    border-radius: 10px;
    white-space: nowrap;
}
.btn-sm:hover { background: var(--brand-hover); }

.btn-ghost {
    background: transparent;
    color: var(--ink-2);
    border: 1.5px solid var(--line);
}
.btn-ghost:hover { background: var(--birch-bg-2); color: var(--ink); border-color: #d9d5c6; }

/* ======================================================================
   Курс
   ====================================================================== */

body.course-page { display: flex; flex-direction: column; overflow: hidden; }

.course-frame {
    flex: 1 1 auto;
    border: 0;
    width: 100%;
    display: block;
    background: #dcdee0;
}

.banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--line);
}
/* Без этого правила display:flex перебивает HTML-атрибут hidden
   и скрытые баннеры остаются на экране. */
.banner[hidden] { display: none; }
.banner.ok { background: var(--brand-soft); color: #0a6e4f; }
.banner.bad { background: var(--danger-bg); color: var(--danger); }
.banner .spacer { flex: 1 1 auto; }
.banner button { height: 32px; padding: 0 13px; font-size: 13px; border-radius: 9px; }

/* ======================================================================
   Админка
   ====================================================================== */

.page { padding: 22px 24px 48px; }

.page h1 {
    font-size: 22px;
    margin: 0 0 4px;
    letter-spacing: -.02em;
}
.page .lead { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }

.tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 16px;
    min-width: 132px;
}
.tile .n { font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.tile .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.accent .n { color: var(--brand); }
.tile.warn .n { color: var(--warn); }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}
.toolbar input[type="search"] { width: 280px; padding: 9px 13px; border-radius: 10px; font-size: 14px; }
.toolbar select { width: auto; padding: 9px 30px 9px 13px; border-radius: 10px; font-size: 14px; }
.toolbar .spacer { flex: 1 1 auto; }
.toolbar .count { color: var(--muted); font-size: 13px; }

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: auto;
    max-height: calc(100vh - 300px);
}

table.report {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 13px;
    white-space: nowrap;
}

table.report thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--birch-bg-2);
    border-bottom: 1px solid var(--line);
    padding: 9px 11px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--ink-2);
    cursor: pointer;
    user-select: none;
}
table.report thead th:hover { background: var(--brand-soft); }
table.report thead th .arrow { opacity: .35; margin-left: 4px; font-size: 10px; }
table.report thead th[aria-sort] .arrow { opacity: 1; color: var(--brand); }
table.report thead th.num, table.report td.num { text-align: right; }
table.report thead th.mid, table.report td.mid { text-align: center; }

table.report td {
    padding: 8px 11px;
    border-bottom: 1px solid var(--line-soft);
}
table.report tbody tr:hover td { background: var(--brand-softer); }
table.report tbody tr:last-child td { border-bottom: 0; }

td.fio { font-weight: 600; white-space: normal; min-width: 190px; }
td.dept, td.title-cell { white-space: normal; max-width: 190px; color: var(--ink-2); }
td.empty, .dash { color: #b9c2bc; }

.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.6;
}
.pill.passed { background: var(--brand-soft); color: #0a6e4f; }
.pill.failed { background: var(--danger-bg); color: var(--danger); }
.pill.progress { background: #fff4e0; color: var(--warn); }
.pill.none { background: #f1f0ea; color: var(--muted); }

.check { color: var(--brand); font-weight: 700; }

.bar {
    position: relative;
    width: 74px;
    height: 7px;
    border-radius: 999px;
    background: #eceae0;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}
.bar i {
    position: absolute;
    inset: 0 auto 0 0;
    background: linear-gradient(90deg, #14d461, var(--brand));
    border-radius: 999px;
}
.bar-label { font-size: 11.5px; color: var(--muted); margin-left: 7px; vertical-align: middle; }

.notice {
    padding: 11px 14px;
    border-radius: 11px;
    font-size: 13.5px;
    margin-bottom: 16px;
    background: #fff8e6;
    border: 1px solid #f0dfae;
    color: #7a5a12;
}

@media (max-width: 720px) {
    .course-title { display: none; }
    .toolbar input[type="search"] { width: 100%; }
    .page { padding: 16px 12px 40px; }
}
