/* Каркас панели, общий для /dashboard и /academy: боковое меню, шапка раздела,
   шторка на телефоне, плотность полей и кнопок внутри панели.
   Цвета — только токены тем (themes.css), поэтому работают все пять тем. */

.dash-page {
    --side: 264px;
    --hover: color-mix(in srgb, var(--text) 6%, transparent);
    --accent-soft: rgba(var(--accent-rgb), .12);
    --accent-line: rgba(var(--accent-rgb), .45);
    --card-pad: 22px;
    min-height: 100vh;
    background: var(--bg);
}
.dash-page .ico { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.skip-link { position: absolute; top: -100px; left: 16px; z-index: 100; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-fill); color: var(--on-accent); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }

/* ---------- Каркас ---------- */

.dash-shell { min-height: 100vh; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
.dash-sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 14px 14px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--surface);
    scrollbar-width: thin;
}
.dash-sidebar .brand { min-height: 40px; padding: 0 10px; }

.dash-nav { display: grid; gap: 2px; }
.dash-nav-group { margin: 18px 12px 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.dash-nav-group:first-child { margin-top: 4px; }
.dash-nav a {
    position: relative;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.dash-nav a[hidden] { display: none; }
.dash-nav a .ico { color: var(--muted); transition: color .15s ease; }
.dash-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-nav a:hover { background: var(--hover); color: var(--text); }
.dash-nav a:hover .ico { color: var(--text); }
/* Открытый раздел: подложка акцентом и полоса слева. */
.dash-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.dash-nav a[aria-current="page"] .ico { color: var(--accent-text); }
.dash-nav a[aria-current="page"]::before { position: absolute; top: 9px; bottom: 9px; left: -14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); content: ''; }
.dash-count { min-width: 22px; height: 20px; display: inline-grid; place-items: center; padding: 0 7px; border-radius: 10px; background: var(--accent-fill); color: var(--on-accent); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

.dash-side-foot { display: grid; gap: 4px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.dash-user { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 8px; }
.dash-user img { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; }
.dash-user span { flex: 1; min-width: 0; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.dash-user span:empty { display: none; }
.dash-back { min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 8px; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.dash-back:hover { background: var(--hover); color: var(--text); }
.dash-back .ico { width: 16px; height: 16px; }

.dash-icon-button {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.dash-icon-button:hover { border-color: var(--field-line); background: var(--hover); color: var(--text); }
#discord-logout:hover { border-color: color-mix(in srgb, var(--danger) 60%, var(--line)); color: var(--danger); }

.dash-scrim { display: none; }

.dash-body { min-width: 0; display: flex; flex-direction: column; }
.dash-top {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 36px;
    border-bottom: 1px solid var(--line);
    background: rgba(var(--bg-rgb), .86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.dash-menu { display: none; }
.dash-heading { min-width: 0; flex: 1; }
.dash-eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.dash-eyebrow:empty { display: none; }
.dash-top h1 { margin: 0; overflow: hidden; font: 700 21px/1.2 var(--display); text-overflow: ellipsis; white-space: nowrap; }
.dash-top-tools { display: flex; align-items: center; gap: 10px; }
.dash-top .theme-toggle { min-height: 40px; border-radius: 8px; }

.dash-main { width: 100%; max-width: 1280px; margin: 0; padding: 28px 36px 72px; }
.dash-main:focus { outline: none; }
.dash-lead { max-width: 72ch; margin: 0 0 20px; color: var(--text-2); font-size: 15px; line-height: 1.6; }
.dash-loading, .dash-empty { margin: 0; padding: 14px 0; color: var(--muted); font-size: 14.5px; }
.dash-error { display: grid; justify-items: start; gap: 12px; padding: var(--card-pad); border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.dash-error p { margin: 0; color: var(--text-2); }

.dash-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-text);
    font: 600 14px var(--body);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 5px;
    white-space: nowrap;
    cursor: pointer;
    transition: text-decoration-color .15s ease;
}
.dash-link:hover { text-decoration-color: currentColor; }

/* ---------- Плотность внутри панели ---------- */
/* На публичных страницах поля крупные; в рабочей панели их много на экране. */

.dash-page .field { gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
.dash-page .field input:not([type="color"]):not([type="file"]),
.dash-page .field textarea,
.dash-page .field select,
.dash-page .media-row input,
.dash-page .track-add > input,
.dash-page .staff-toolbar input[type="search"],
.dash-page .staff-toolbar select,
.dash-page .staff-dept-add select,
.dash-page .staff-dialog select { min-height: 46px; padding-top: 10px; padding-bottom: 10px; border-color: color-mix(in srgb, var(--field-line) 70%, var(--line)); background-color: color-mix(in srgb, var(--bg) 70%, var(--surface)); }
.dash-page .field textarea { min-height: 96px; }
.dash-page .field input:focus, .dash-page .field textarea:focus, .dash-page .field select:focus,
.dash-page .staff-toolbar input[type="search"]:focus, .dash-page .staff-toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.dash-page .button-primary { min-height: 46px; padding: 0 20px; border-radius: 8px; font-size: 14.5px; }
.dash-page .button-quiet { min-height: 40px; border-color: var(--line); border-radius: 8px; color: var(--text); }
.dash-page .button-quiet:hover { border-color: var(--field-line); background: var(--hover); }
.dash-page .media-upload { min-height: 46px; border-radius: 8px; }
.dash-page :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Узкие экраны: меню уезжает в шторку ---------- */

@media (max-width: 900px) {
    .dash-shell { display: block; }
    .dash-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(300px, 86vw);
        height: auto;
        transform: translateX(-102%);
        transition: transform .22s ease;
        box-shadow: 0 0 60px rgba(0, 0, 0, .5);
    }
    .nav-open .dash-sidebar { transform: none; }
    .dash-scrim { position: fixed; inset: 0; z-index: 39; display: block; background: rgba(0, 0, 0, .55); }
    .dash-scrim[hidden] { display: none; }
    .nav-open { overflow: hidden; }
    .dash-menu { display: inline-grid; }
    .dash-top { min-height: 64px; padding: 10px 16px; }
    .dash-top h1 { font-size: 18px; }
    .dash-eyebrow { font-size: 10px; }
    .dash-main { padding: 18px 16px 56px; }
    .dash-page { --card-pad: 18px; }
}

@media (max-width: 560px) {
    .dash-top .theme-toggle .theme-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dash-page *, .dash-page *::before, .dash-page *::after { transition: none !important; animation: none !important; }
}
