:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --ink: #000000;
    --muted: #6b7280;
    --line: #d7e3f4;
    --sidebar: #000000;
    --sidebar-soft: rgba(0, 102, 255, .14);
    --brand: #0066ff;
    --accent: #0066ff;
    --gold: #0066ff;
    --gold-soft: #e8f1ff;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --radius: 8px;
    --shadow: 0 16px 40px rgba(0, 0, 0, .09);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
    background:
        radial-gradient(circle at 88% 0%, rgba(0, 102, 255, .22), transparent 30%),
        linear-gradient(180deg, #000000 0%, #0a0f1a 52%, #000000 100%);
    color: #f2f6ff;
    min-height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    border-right: 1px solid rgba(0, 102, 255,.18);
    display: flex;
    flex-direction: column;
}

.sidebar-head {
    padding: 22px;
    border-bottom: 1px solid rgba(0, 102, 255,.16);
}

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

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: linear-gradient(135deg, #4d94ff, var(--gold));
    font-weight: 800;
}

.brand-logo {
    width: auto;
    height: 44px;
    max-width: 148px;
    border-radius: 0;
    object-fit: contain;
    flex: 0 0 auto;
    border: 0;
    box-shadow: none;
}

.brand-row strong { display: block; color: #fff; font-size: 16px; }
.brand-row span { display: block; color: rgba(255,255,255,.68); font-size: 12px; margin-top: 2px; }

.nav-list { padding: 14px 12px 12px; flex: 1; }
.nav-group { margin-bottom: 4px; }

.nav-link {
    width: 100%;
    border: 0;
    color: rgba(255,255,255,.76);
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 10px;
    border-radius: 7px;
    text-align: left;
}

.nav-link:hover, .nav-link.active, .nav-group.is-open > .nav-link {
    color: var(--gold);
    background: var(--sidebar-soft);
    box-shadow: inset 0 0 0 1px rgba(0, 102, 255,.18);
}

.nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: rgba(0, 102, 255,.16);
    color: var(--gold);
    flex: 0 0 28px;
    box-shadow: inset 0 0 0 1px rgba(0, 102, 255,.12);
}

.nav-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon,
.nav-group.is-open > .nav-link .nav-icon {
    background: rgba(0, 102, 255,.24);
    color: #8ec0ff;
    box-shadow: inset 0 0 0 1px rgba(0, 102, 255,.28);
}

.chevron { margin-left: auto; transition: transform .2s ease; }
.nav-group.is-open .chevron { transform: rotate(90deg); }

.sub-nav {
    display: none;
    margin: 4px 0 8px 38px;
    padding-left: 14px;
    border-left: 1px solid rgba(0, 102, 255,.2);
}

.nav-group.is-open .sub-nav { display: grid; gap: 2px; }

.sub-nav a {
    color: rgba(255,255,255,.64);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
}

.sub-nav a:hover, .sub-nav a.active {
    background: rgba(0, 102, 255,.14);
    color: var(--gold);
}

.sidebar-foot {
    padding: 12px;
    border-top: 1px solid rgba(0, 102, 255,.16);
    margin-top: auto;
}

.logout-btn {
    cursor: pointer;
    font: inherit;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 8, .52);
    z-index: 19;
}

.sidebar-backdrop[hidden] {
    display: none;
}

body.sidebar-open {
    overflow: hidden;
}

.main-shell { min-width: 0; }

.topbar {
    height: 72px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(245, 247, 250, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
}

.menu-btn { display: none; }

.search-box {
    flex: 1;
    max-width: 520px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    color: var(--muted);
    font-size: 13px;
}

.search-box input {
    border: 0;
    outline: 0;
    width: 100%;
    color: var(--ink);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    font-weight: 700;
}

.profile-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px 6px 6px;
}

.profile-chip > span {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--gold);
    color: #ffffff;
    font-weight: 800;
    font-size: 12px;
}

.profile-chip strong, .profile-chip small { display: block; }
.profile-chip strong { font-size: 13px; }
.profile-chip small { color: var(--muted); font-size: 11px; }

.profile-menu {
    position: relative;
}

.profile-menu-toggle {
    cursor: pointer;
}

.profile-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
    padding: 6px;
    display: none;
    z-index: 30;
}

.profile-dropdown.is-open {
    display: grid;
    gap: 2px;
}

.profile-dropdown a,
.profile-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: var(--ink);
    padding: 10px 12px;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover {
    background: #f8fafc;
}

.content {
    padding: 28px;
    display: grid;
    gap: 22px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.eyebrow {
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.page-head h1, .card-title h2 {
    margin: 5px 0 6px;
    font-size: 30px;
    line-height: 1.15;
    letter-spacing: 0;
}

.page-head p, .login-copy p, .role-card p {
    margin: 0;
    color: var(--muted);
}

.head-actions { display: flex; gap: 10px; }

.primary-btn, .ghost-btn, .danger-btn {
    min-height: 40px;
    border-radius: 8px;
    padding: 0 15px;
    border: 1px solid transparent;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn {
    background: var(--gold);
    color: #ffffff;
    border-color: rgba(0, 102, 255, .76);
}

.primary-btn:hover {
    background: #0052cc;
    color: #ffffff;
}

.ghost-btn {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
}

.danger-btn {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.compact { min-height: 34px; padding: 0 12px; font-size: 13px; }
.full { width: 100%; }
.link-btn { text-decoration: none; }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.metric-card, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.metric-card:after {
    content: "";
    position: absolute;
    inset: auto 18px 0 auto;
    width: 62px;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background: currentColor;
}

.metric-card span, .metric-card small {
    display: block;
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin: 8px 0 4px;
    font-size: 28px;
}

.metric-card.blue { color: var(--brand); }
.metric-card.green { color: var(--green); }
.metric-card.amber { color: var(--amber); }
.metric-card.red { color: var(--red); }

.dashboard-grid, .form-grid, .settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr);
    gap: 16px;
}

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

.compact-section {
    margin-bottom: 18px;
}

.panel { padding: 18px; min-width: 0; }
.panel.wide { min-height: 330px; }

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

.panel-head h2 {
    margin: 3px 0 0;
    font-size: 18px;
}

.bar-chart {
    height: 230px;
    display: flex;
    align-items: end;
    gap: 12px;
    padding-top: 20px;
}

.bar-chart span {
    flex: 1;
    min-width: 22px;
    border-radius: 7px 7px 0 0;
    background: linear-gradient(180deg, var(--gold), #000000);
}

.timeline { display: grid; gap: 14px; }
.timeline div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
}
.timeline strong, .timeline span { display: block; }
.timeline span { color: var(--muted); margin-top: 3px; }

.data-list { display: grid; gap: 10px; }
.data-list div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.data-list small { color: var(--muted); }
.data-list em { font-style: normal; font-size: 12px; color: var(--brand); font-weight: 800; }

.course-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}
.course-dot.blue { background: var(--brand); }
.course-dot.green { background: var(--green); }
.course-dot.amber { background: var(--amber); }
.course-dot.red { background: var(--red); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    font-size: 14px;
}
th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td small {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
}
.badge.success { background: #dcfce7; color: #166534; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.muted { background: #eef2f7; color: #475569; }
.table-action { width: 32px; height: 32px; }

.mock-thumb {
    width: 54px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--line);
    background: #f8fafc;
}

.mock-thumb.placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 11px;
}

.preview-image {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.admin-form, .stack-form, .settings-list {
    display: grid;
    gap: 14px;
}

.detail-list {
    display: grid;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.detail-list > div {
    display: grid;
    grid-template-columns: minmax(130px, 170px) minmax(0, 1fr);
    gap: 12px 16px;
    align-items: start;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.detail-list > div:last-child {
    border-bottom: 0;
}

.detail-list > div strong {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    font-weight: 700;
}

.detail-list > div span {
    color: var(--ink);
    word-break: break-word;
}

label span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 11px 12px;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 102, 255,.22);
}

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

.toggle-line, .check-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toggle-line input, .check-line input { width: auto; }
.check-line { justify-content: flex-start; }
.check-line span { margin: 0; }

.role-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.role-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--gold-soft);
    color: var(--brand);
    font-weight: 800;
}

.role-card h2 { margin: 14px 0 8px; font-size: 18px; }
.permission-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.permission-tags span {
    border: 1px solid var(--line);
    background: var(--gold-soft);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        radial-gradient(circle at 18% 12%, rgba(0, 102, 255, .18), transparent 34%),
        linear-gradient(135deg, rgba(0, 0, 0, .08), rgba(0, 102, 255, .12)),
        #f5f7fa;
}

.login-shell {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(17,24,39,.16);
}

.login-panel {
    padding: 42px;
    background:
        radial-gradient(circle at 88% 10%, rgba(0, 102, 255, .28), transparent 28%),
        linear-gradient(145deg, #000000 0%, #0a0f1a 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 560px;
}

.login-copy h1 {
    max-width: 560px;
    margin: 10px 0 12px;
    font-size: 42px;
    line-height: 1.08;
    letter-spacing: 0;
}

.login-copy p { color: rgba(255,255,255,.72); max-width: 450px; }

.login-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.login-stats div {
    border: 1px solid rgba(0, 102, 255,.22);
    border-radius: 8px;
    padding: 14px;
    background: rgba(0, 102, 255,.08);
}
.login-stats strong, .login-stats span { display: block; }
.login-stats strong { font-size: 22px; }
.login-stats span { color: rgba(255,255,255,.7); font-size: 12px; margin-top: 3px; }

.login-card {
    padding: 42px;
    display: grid;
    align-content: center;
}

.card-title { margin-bottom: 20px; }
.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1180px) {
    .metric-grid, .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid, .split-grid, .form-grid, .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        z-index: 20;
        inset: 0 auto 0 0;
        width: 286px;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.is-visible { transform: translateX(0); }
    .menu-btn { display: inline-grid; }
    .topbar { padding: 0 16px; }
    .detail-list > div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .profile-chip div, .search-box span { display: none; }
    .content { padding: 18px; }
    .page-head { display: grid; }
    .login-shell { grid-template-columns: 1fr; }
    .login-panel { min-height: auto; gap: 34px; }
}

@media (max-width: 620px) {
    .metric-grid, .role-grid, .two-col, .login-stats { grid-template-columns: 1fr; }
    .head-actions { width: 100%; }
    .head-actions button { flex: 1; }
    .page-head h1, .card-title h2 { font-size: 25px; }
    .login-copy h1 { font-size: 31px; }
    .login-panel, .login-card { padding: 28px; }
    .data-list div { grid-template-columns: auto 1fr; }
    .data-list em { grid-column: 2; }
}

.upload-card {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fbff;
    overflow: hidden;
}

.upload-preview {
    min-height: 172px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: var(--muted);
    text-align: center;
    padding: 22px;
}

.upload-preview.compact {
    min-height: 120px;
}

.upload-preview strong {
    display: block;
    color: var(--ink);
}

.upload-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 12px;
}

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

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

.permission-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
    padding: 14px;
}

.permission-box h3 {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--ink);
}

.check-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
}

.check-chip input { width: auto; }

.difficulty-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.difficulty-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px;
    background: #fff;
    font-weight: 800;
}

.difficulty-pill input { width: auto; }
.difficulty-pill.easy { color: var(--green); }
.difficulty-pill.medium { color: var(--amber); }
.difficulty-pill.hard { color: var(--red); }

.preview-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
    overflow: hidden;
}

.preview-art {
    min-height: 130px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 85% 15%, rgba(0, 102, 255, .34), transparent 28%),
        linear-gradient(135deg, #000000, #0a1a3a 72%, var(--gold));
    color: #ffffff;
    font-weight: 900;
}

.preview-body {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.admin-note {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef4ff;
    color: #1e40af;
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.image-chip-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.image-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.image-chip strong,
.image-chip span {
    display: block;
}

.image-chip strong {
    color: var(--ink);
    font-size: 13px;
}

.image-chip span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.image-chip button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: #fee2e2;
    color: #991b1b;
    cursor: pointer;
    font-size: 18px;
    font-weight: 900;
}

.repeat-block {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
    padding: 12px;
}

.repeat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.repeat-head h3 {
    margin: 2px 0 0;
    font-size: 16px;
}

.clone-line {
    display: grid;
    grid-template-columns: 1fr 38px 38px;
    gap: 8px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-list span {
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800;
}

.text-center { text-align: center; }

.question-import-actions {
    margin: 14px 0;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-row form {
    margin: 0;
}

.alert {
    border-radius: 8px;
    border: 1px solid var(--line);
    padding: 13px 15px;
    line-height: 1.5;
}

.alert.success {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #166534;
}

.alert.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert ul {
    margin: 8px 0 0 18px;
}

.alert a {
    color: var(--brand);
    font-weight: 800;
    text-decoration: underline;
}

nav[role="navigation"] {
    margin-top: 16px;
}

nav[role="navigation"] .flex {
    display: flex;
    gap: 8px;
    align-items: center;
}

nav[role="navigation"] a,
nav[role="navigation"] span {
    color: var(--muted);
}

@media (max-width: 620px) {
    .checkbox-grid, .difficulty-row, .image-chip-grid, .clone-line { grid-template-columns: 1fr; }
}

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

.guide-sidebar {
    position: sticky;
    top: 20px;
    padding: 18px;
}

.guide-sidebar-title {
    margin: 0 0 14px;
    font-size: 0.95rem;
}

.guide-step-nav {
    display: grid;
    gap: 8px;
}

.guide-step-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    transition: border-color 0.2s, background 0.2s;
}

.guide-step-link:hover,
.guide-step-link.is-active {
    border-color: var(--accent);
    background: #eef4ff;
}

.guide-step-num {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
    flex-shrink: 0;
}

.guide-sidebar-actions {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.guide-content {
    display: grid;
    gap: 16px;
}

.guide-step-card {
    scroll-margin-top: 90px;
}

.guide-step-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.guide-step-head h2 {
    margin: 0;
    font-size: 1.1rem;
    flex: 1;
}

.guide-step-use,
.guide-step-when,
.guide-list {
    margin: 0;
    line-height: 1.75;
    color: #4b5563;
}

.guide-step-when {
    margin-top: 8px;
}

.guide-list {
    padding-left: 1.25rem;
}

@media (max-width: 960px) {
    .guide-layout {
        grid-template-columns: 1fr;
    }

    .guide-sidebar {
        position: static;
    }
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.media-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.media-card-preview {
    position: relative;
    height: 140px;
    background: #f8fafc;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.media-card-preview img,
.media-card-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-type-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
}

.media-doc-thumb {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: #eef2ff;
    color: #312e81;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
}

.media-card-body {
    padding: 12px;
    display: grid;
    gap: 6px;
}

.media-card-body strong {
    font-size: 13px;
}

.media-card-body small {
    color: var(--muted);
    font-size: 11px;
}

.media-path {
    word-break: break-all;
}

.media-picker {
    display: grid;
    gap: 8px;
}

.media-picker-preview {
    min-height: 90px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    display: grid;
    place-items: center;
    padding: 10px;
    background: #f8fafc;
}

.media-picker-preview img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 8px;
}

.media-picker-empty {
    color: var(--muted);
    font-size: 12px;
}

.media-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.media-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 20px;
}

.media-modal-backdrop[hidden] {
    display: none !important;
}

body.media-modal-open {
    overflow: hidden;
}

.media-modal {
    width: min(960px, 100%);
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.media-modal-head,
.media-modal-toolbar,
.media-modal-foot {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.media-modal-foot {
    border-bottom: 0;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.media-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.media-modal-head h2 {
    margin: 4px 0 0;
    font-size: 1.1rem;
}

.media-modal-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
}

.media-modal-toolbar input {
    flex: 1;
}

.media-modal-grid {
    padding: 16px 18px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    align-content: start;
}

.media-modal-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 8px;
    cursor: pointer;
    text-align: left;
    display: grid;
    gap: 8px;
}

.media-modal-item:hover {
    border-color: var(--accent);
    background: #f8fbff;
}

.media-modal-item img,
.media-modal-item video {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
}

.media-modal-item span {
    font-size: 11px;
    color: var(--muted);
    word-break: break-word;
}

.upload-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.72);
    display: grid;
    place-items: center;
    padding: 20px;
}

.upload-loader-overlay[hidden] {
    display: none !important;
}

body.upload-loader-open {
    overflow: hidden;
}

.upload-loader-card {
    width: min(360px, 100%);
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
    display: grid;
    gap: 10px;
    justify-items: center;
}

.upload-loader-card strong {
    font-size: 1rem;
    color: var(--ink);
    word-break: break-word;
}

.upload-loader-card small {
    color: var(--muted);
    line-height: 1.5;
}

.upload-loader-spinner {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: 4px solid #dbeafe;
    border-top-color: var(--accent, #2563eb);
    animation: upload-spin 0.9s linear infinite;
}

@keyframes upload-spin {
    to { transform: rotate(360deg); }
}

