:root {
    --ink: #17202a;
    --muted: #6c7685;
    --line: #dce7f5;
    --brand: #1d6fd6;
    --soft: #f3f8ff;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--soft);
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 236px;
    padding: 28px 18px;
    color: #dbeafe;
    background: #0b2d55;
}

.sidebar strong {
    display: block;
    margin-bottom: 28px;
    color: #ffffff;
    font-size: 20px;
}

.sidebar a {
    display: block;
    margin-bottom: 8px;
    padding: 12px 14px;
    border-radius: 8px;
    color: #d7e7ff;
}

.sidebar a.active,
.sidebar a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.logout-form {
    margin: 18px 0 0;
}

.logout-form button {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #d7e7ff;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.logout-form button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.admin-main {
    margin-left: 236px;
    padding: 32px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.admin-header span {
    color: var(--brand);
    font-weight: 700;
}

.admin-header h1 {
    margin: 6px 0 0;
    font-size: 32px;
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    background: var(--brand);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.admin-btn.small {
    min-height: 36px;
    padding: 0 14px;
}

.admin-btn.ghost {
    min-height: 36px;
    color: var(--brand);
    background: #eef6ff;
}

.admin-btn.danger {
    min-height: 36px;
    background: #dc2626;
}

.login-body {
    min-height: 100vh;
    background:
            radial-gradient(circle at 20% 15%, rgba(29, 111, 214, 0.18), transparent 34%),
            linear-gradient(135deg, #f4f9ff 0%, #e4f1ff 100%);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-card {
    width: min(460px, 100%);
    padding: 38px;
    border: 1px solid #cfe0f3;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 28px 70px rgba(23, 74, 132, 0.16);
}

.login-brand {
    margin-bottom: 28px;
}

.login-brand span {
    color: var(--brand);
    font-weight: 800;
}

.login-brand strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

.login-brand p {
    margin: 10px 0 0;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-form label {
    display: grid;
    gap: 8px;
    color: #334155;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid #cfe0f3;
    border-radius: 8px;
    font: inherit;
    outline: none;
}

.login-form input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(29, 111, 214, 0.12);
}

.login-error {
    padding: 11px 13px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    background: #fff1f2;
}

.login-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 2px;
}

.login-back {
    display: block;
    margin-top: 18px;
    color: var(--brand);
    text-align: center;
    font-weight: 700;
}

.registration-thumb {
    width: 96px;
    height: 72px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
}

.admin-notice {
    margin-bottom: 18px;
    padding: 13px 16px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #0f3f7a;
    background: #eff6ff;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.summary-grid article,
.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.summary-grid article {
    padding: 20px;
}

.summary-grid span {
    color: var(--muted);
}

.summary-grid strong {
    display: block;
    margin-top: 8px;
    color: var(--brand);
    font-size: 30px;
}

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

.content-stack {
    display: grid;
    gap: 18px;
}

.panel {
    overflow: hidden;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.panel-title h2 {
    margin: 0;
    font-size: 20px;
}

.panel-title span {
    color: var(--muted);
    font-size: 14px;
}

.panel-title-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.panel-title-actions form,
table form {
    margin: 0;
}

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

.message-table form {
    margin: 0;
}

.message-question {
    max-width: 520px;
    line-height: 1.7;
    word-break: break-word;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 700;
    background: #fbfcfd;
}

.admin-list {
    margin: 0;
    padding: 8px 20px 18px;
    list-style: none;
}

.admin-list li {
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

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

.create-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: #fbfdff;
}

.edit-list {
    display: grid;
}

.edit-row {
    display: grid;
    gap: 10px;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
}

.edit-row:last-child {
    border-bottom: 0;
}

.banner-row {
    grid-template-columns: 92px 1.1fr 1.6fr 120px 160px 86px 76px 260px;
}

.course-row {
    grid-template-columns: 92px 1fr 1.4fr 120px 150px 90px 90px 110px 110px 76px 76px 260px;
}

.teacher-row {
    grid-template-columns: 70px 1fr 1fr 1.7fr 160px 86px 76px 260px;
}

.news-row {
    grid-template-columns: 92px 1fr 1.3fr 110px 1.5fr 160px 92px 86px 76px 260px;
}

.image-create-form[action="/admin/content/news"] {
    grid-template-columns: 1fr 1.3fr 110px 1.6fr 160px 86px 120px;
}

.case-row {
    grid-template-columns: 108px 0.8fr 1fr 1.2fr 1.5fr 160px 86px 76px 260px;
}

.env-photo-row {
    grid-template-columns: 92px 150px 1.3fr 160px 86px 76px 260px;
}

.case-create-form {
    grid-template-columns: 0.8fr 1fr 1.3fr 1.6fr 160px 86px 120px;
}

.course-create-form {
    grid-template-columns: 1fr 1.4fr 120px 160px 100px 100px 110px 110px 86px 120px;
}

.env-photo-create-form {
    grid-template-columns: 160px 1.3fr 180px 86px 120px;
}

.thumb-box {
    display: grid;
    place-items: center;
    width: 86px;
    height: 56px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #f8fbff;
    font-size: 12px;
}

.thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 8px;
    color: #1d6fd6;
    background: #eef6ff;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.avatar-thumb {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.case-thumb {
    width: 100px;
    height: 70px;
}

input,
textarea,
select {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #ffffff;
    font: inherit;
    outline: none;
}

textarea {
    min-height: 72px;
    padding-top: 10px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(29, 111, 214, 0.12);
}

.sort-input {
    min-width: 76px;
}

.check-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.check-label input {
    width: 16px;
    min-height: 16px;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.chat-admin-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
}

.session-list {
    display: grid;
}

.session-item {
    display: grid;
    gap: 6px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.session-item.active,
.session-item:hover {
    background: #eef6ff;
}

.session-item strong {
    color: var(--brand);
    font-size: 13px;
}

.session-item span {
    color: var(--ink);
}

.session-item.empty {
    color: var(--muted);
}

.admin-chat-box {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 420px;
    max-height: 560px;
    overflow-y: auto;
    padding: 18px;
    background: #f8fbff;
}

.admin-chat-message {
    display: grid;
    gap: 5px;
    max-width: 72%;
}

.admin-chat-message.admin {
    justify-self: end;
}

.admin-chat-message span,
.admin-chat-message small {
    color: var(--muted);
    font-size: 13px;
}

.admin-chat-message.admin span,
.admin-chat-message.admin small {
    text-align: right;
}

.admin-chat-message p {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 63, 122, 0.08);
}

.admin-chat-message.admin p {
    color: #ffffff;
    background: var(--brand);
}

.empty-chat {
    color: var(--muted);
}

.admin-reply-form {
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--line);
}

.admin-reply-form textarea {
    min-height: 72px;
    padding-top: 10px;
    resize: vertical;
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
        display: flex;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
    }

    .sidebar strong {
        margin: 0 14px 0 0;
        white-space: nowrap;
    }

    .sidebar a {
        margin: 0;
        white-space: nowrap;
    }

    .admin-main {
        margin-left: 0;
        padding: 22px 16px;
    }

    .summary-grid,
    .admin-grid,
    .chat-admin-layout,
    .admin-reply-form,
    .create-form,
    .edit-row {
        grid-template-columns: 1fr;
    }

    .row-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }
}
