:root {
    color-scheme: light;
    font-family: "Inter", "Microsoft YaHei", sans-serif;
    --primary: #3f69b2;
    --primary-dark: #2e4d85;
    --surface: #ffffff;
    --surface-muted: #f4f7fb;
    --border: rgba(36, 55, 99, 0.12);
    --text: #1b2940;
    --text-muted: #60708a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: #eef2f8;
}

body,
button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

.dashboard-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: linear-gradient(180deg, #2f4c7f 0%, #3d5f96 100%);
    color: #fff;
    padding: 40px 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar h1,
.dashboard-header h2,
.module-card h3 {
    margin: 0;
}

.sidebar a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

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

.sidebar-nav a {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav a.is-active {
    background: rgba(255, 255, 255, 0.18);
}

.sidebar-compact {
    justify-content: space-between;
}

.dashboard-main {
    padding: 36px;
}

.dashboard-header p {
    color: var(--text-muted);
}

.stats-grid,
.module-grid,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.stats-grid {
    margin: 24px 0;
}

.top-panel-gap {
    margin-top: 24px;
}

.compact-grid {
    margin-bottom: 0;
}

.stat-card,
.module-card,
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 14px 36px rgba(21, 42, 84, 0.08);
}

.stat-card span {
    display: block;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-card strong {
    display: block;
    font-size: 22px;
    margin-bottom: 10px;
}

.stat-card-emphasis strong {
    margin-bottom: 0;
    font-size: 32px;
}

.dashboard-metric-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dashboard-metric-head h2 {
    margin: 0 0 8px;
}

.dashboard-metric-head p {
    margin: 0;
    color: var(--text-muted);
}

.dashboard-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.dashboard-metric-card {
    min-height: 156px;
    justify-content: center;
}

.dashboard-metric-card span {
    font-size: 15px;
}

.dashboard-metric-card strong {
    font-size: 38px;
}

.dashboard-metric-card.is-empty strong {
    color: var(--text-muted);
}

.stat-card p,
.detail-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.65;
}

.module-grid {
    margin-top: 24px;
}

.module-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.module-card p {
    margin: 10px 0 0;
    color: var(--text-muted);
    line-height: 1.65;
}

.module-link {
    display: inline-block;
    margin-top: 16px;
    font-weight: 700;
    color: var(--primary-dark);
}

.content-panel {
    margin-top: 24px;
}

.content-panel h2 {
    margin: 0 0 10px;
}

.content-panel > p {
    margin: 0 0 20px;
    color: var(--text-muted);
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(360px, 520px) 1fr;
    gap: 24px;
    align-items: start;
}

.wide-layout {
    grid-template-columns: 1fr 1fr;
}

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 14px 36px rgba(21, 42, 84, 0.08);
}

.panel-head {
    margin-bottom: 18px;
}

.panel-head h3 {
    margin: 0 0 8px;
}

.panel-head p {
    margin: 0;
    color: var(--text-muted);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

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

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.form-grid label span {
    font-weight: 600;
    color: var(--text);
}

.full-width {
    grid-column: 1 / -1;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.admin-form textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.form-actions button {
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #4a7bdf 0%, #3156a8 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 22px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.button-link.secondary {
    background: #edf3ff;
    color: var(--primary-dark);
}

.button-link.danger {
    background: #ffeff1;
    color: #b42338;
}

.button-link.ghost {
    background: rgba(36, 55, 99, 0.06);
    color: var(--text);
}

.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(36, 55, 99, 0.08);
    vertical-align: top;
}

.admin-table th {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #edf3ff;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
}

.status-chip.success {
    background: #eafaf0;
    color: #237a47;
}

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

.table-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    margin: 0;
}

.flash-banner {
    margin: 20px 0 0;
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 600;
}

.flash-banner.success {
    background: #eafaf0;
    color: #237a47;
}

.helper-text {
    color: var(--text-muted);
    line-height: 1.6;
}

.stack-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

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

.detail-card strong {
    display: block;
    margin-bottom: 8px;
}

.danger-zone {
    border: 1px solid rgba(180, 35, 56, 0.16);
    background: #fff7f8;
    border-radius: 18px;
    padding: 18px;
}

.danger-zone h3,
.danger-zone p {
    margin-top: 0;
}

.danger-zone p {
    color: var(--text-muted);
}

.selector-bar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.selector-bar h3 {
    margin: 0 0 8px;
}

.selector-bar p {
    margin: 0;
    color: var(--text-muted);
}

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

.info-banner h3 {
    margin-top: 0;
}

.list-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-stack-empty {
    min-height: 360px;
    justify-content: center;
}

.list-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
}

.list-row strong {
    display: block;
    margin-bottom: 6px;
}

.list-row p {
    margin: 0;
    color: var(--text-muted);
}

.list-row.is-active {
    border-color: rgba(63, 105, 178, 0.35);
    background: #f7faff;
}

.sync-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 28px 20px;
}

.sync-empty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: #edf3ff;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
}

.sync-empty-state h4 {
    margin: 0;
    font-size: 24px;
    line-height: 1.5;
}

.sync-empty-state > p {
    margin: 0;
    max-width: 620px;
    color: var(--text-muted);
    line-height: 1.8;
}

.sync-empty-guide {
    width: min(100%, 620px);
    padding: 20px 22px;
    border: 1px solid rgba(63, 105, 178, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f6ff 100%);
    text-align: left;
}

.sync-empty-guide strong {
    display: block;
    margin-bottom: 12px;
}

.sync-empty-guide ol {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
    line-height: 1.8;
}

.sync-empty-state-plain {
    align-items: flex-start;
    text-align: left;
    padding: 4px 0 0;
}

.group-entry-row {
    align-items: center;
}

.group-entry-link {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--primary-dark);
    font-size: 20px;
    font-weight: 800;
    text-decoration: none;
}

.inline-bot-link {
    color: var(--primary-dark);
    font-weight: 700;
    text-decoration: none;
}

.inline-bot-link:hover,
.group-entry-link:hover {
    text-decoration: underline;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.toggle-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f9fbff;
    color: var(--text);
}

.toggle-field input {
    width: auto;
    margin: 0;
}

.top-gap {
    margin-top: 20px;
}

.mono-text {
    font-family: "Consolas", "SFMono-Regular", monospace;
}

.sub-text {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 12px;
}

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

    .selector-bar,
    .form-layout,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .selector-bar,
    .list-row {
        flex-direction: column;
        align-items: stretch;
    }
}
